We help IT Professionals succeed at work.
Get Started

Serial Comms

Upland asked
Last Modified: 2012-06-21
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.

Any ideas....?
Watch Question
This problem has been solved!
Unlock 1 Answer and 37 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE