I have in the last few days been forced to learn about serial comms for a project (99% of which is regular database/accounting stuff). I am currently struggling with this last 1%
I have this 'gizmo' which is basically a card reader with an LCD screen and a 9-pin RS485 conection, which plugs into a PC via a 3-core cable and a 485/232 convertor.
I was given a DOS program with the gizmo which does the comms job just fine - so I know the hardware is OK.
The gizmo accepts strings of ascii characters to perform certain tasks - these strings begin STX [Chr(2)] and end with ETX [chr(3)]. The gizmo has a diagnostic mode in which you can see bytes received on the LCD followed by the bytes it sends back in inverse video.
My problem is that I can send bytes to the gizmo, I see them displayed on its LCD display, I then see its response on the LCD display, but cannot read them with my program.
Until a few days ago I couldn't even write to the gizmo - but I discovered (thanks to E-E) that I needed to have DTRenable and RTSenable both set to True. I am now wondering if there is something else I need to be aware of to enable reading.
The essence of the code is:
msc1.PortOpen = True
msc1.Output = TX$
I see TX$ displayed on the gizmo and the response sent back to the PC - but the OnComm never fires. I can also poll for msc1.InBufferCount > 0 but it never happens.
I have tried all combinations of DTRenable and RTSenable both before and after the Output = TX$ without success - although comEvDSR fires the OnComm when that is toggled.
I have also tried all handshaking methods. There is clearly something I am not aware of as I know it works just fine with the DOS program I am supposed to be converting.