Rob,
I tried to use your code with one letter and it did not work with Lazarus but I did tried Arduino Ide Serial Monitor and got it working with single letter. So I guess something wrong with my Lazarus. I am using synaser. Can someone tell me where I can get Terminal Emulator. Do I need a second computer to test Terminal Emulator with Lazarus?
Reid
1. i take it you are using Window 10 or similar? in which case it is not possible to have
both the
Arduino Ide Serial Monitor and your Lazarus program accessing the serial port at the same time - this is a limitation of Windows. so you would need to close the
Arduino Ide Serial Monitor before running your Lazarus program. this limitation applies to
any two Windows programs that may be trying to access the same serial port at once.
2. i would change the line
ser.Config(9600, 8, 'N', SB1, False, False); to instead use 2 stop bits, ie,
ser.Config(9600, 8, 'N', SB2, False, False);, although i'm not too sure if this will make much difference. unfortunately my knowledge of
Synaser is rather limited as i've never used it. i prefer to use lower-level routines that are OS specific myself, and do most of my work with Linux.
3. after calling
ser.Connect and
ser.Config you may wish to add lines to check
LastError and
LastErrorDesc to ensure that you are successfully opening and configuring the serial port - my guess is that
Synaser does
not quit your program upon encountering any errors. something like this will likely work:
ser.Connect('COM4');
if ser.LastError<>0 then ShowMessage('ser.Connect Error: '+ ser.LastErrorDesc);
ser.Config(9600, 8, 'N', SB2, False, False);
if ser.LastError<>0 then ShowMessage('ser.Config Error: '+ ser.LastErrorDesc);
let us know how you get along. i've been looking at the documentation here:
http://synapse.ararat.cz/doc/help/synaser.TBlockSerial.htmlalthough there may be far better documentation elsewhere. can anyone else reading this provide a pointer to some example code that shows how to use
Synaser?
cheers,
rob :-)