Serial Port Component For Lazarus House

Posted on
Lazarus Add OnLazarus Create Component

So far so good! For testing and see thing clears I send from Arduino secuently a 27 char string: ( instead of a string filled with 24 'values' ending with 'end') 'N888end' N: string with numbers 'Laabbbcccdddeeefffggghhhend' L: string with letters Now I can see if a diplayed string on my Lazarus form is from one and the same sended string or an mixed string from 2 sended string! After a while and lots of coding and 'adjustments' I got a stable displayed string. ( apearently I don't need a delimiter in Lazars, but I DO in mikropAscal Arduino when receving from RS232 ) Next thing I wanted to run the application for a long time and 'catch' wrong strings by just checking: first char is it an 'L' or an 'N'? If not: increment and display the errornumber on my form. As learned the first char in a string is placed at position 0 as in stringIN[0], but then I found out i had to check stringIN[1].

From Pdf To Music Xml. See, picture. Ok, not a big deal but what does it mean? Still, have to do troubleshouting etc, sometimes the application hangs soon, other times it runs longer. ( could it because of debug-mode instead of runnng it as a 'free' programm? ) By the way somehow I don't trust the timers, or maybe I have a programm-error/mistake. I also need some code if there's nog data OR time out, see *CODE 'cause it reads even when there is a time out OR no dataReady. I see several problems.

(1) The loop will fail to run if there are 27 or more characters in the comm buffer (2) The timeout value is never reset, so eventually your delay loop will only sleep for 1 mSec and then exit (3) I don't understand what you are trying to accomplish with the loop, delay, and reading the input while the buffer contains less than 27 characters. You might want to bypass the dataRead until the buffer has at least the 27 characters that make up the string.