Serial Ports

Serial Ports are a common tool we use to communicate with devices at work. Usually, if a device has a serial interface, you can breath a sigh of relief that you are going to have success with communicating with it. There are still some things to watch out for though. Getting the baud rate, parity, data bits, and stop bits configured properly is critical. I helped a colleague at work today with just such a problem. He was trying to receive data in his .NET client from a bar code scanner that we had configured in the Descarte OmniServer OPC server. He would get the initial data change event when the OPC item was created, but nothing after that. I wrote the prototype he was basing it on, and I knew that it worked, as I had used the same barcode scanner in testing it. So we started poking around. First, we brought up HyperTerm and looked to see if we were getting any data. Sure enough, data was coming across. Then we went back to the OmniServer configuration to be sure that our topic was configured to use COM1, and that the device was using the right protocol, in this case an Intermek protocol. It was, but still, no data. So then I got to thinking, "I wonder if HyperTerm is using a different configuration". That was it! In HyperTerm, we were setup for 9600 baud 7-e-1 configuration. In OmniServer, we were looking at 9600 baud 8-n-1. Big difference! The barcode scanner was sending 7 data bits, but our OPC server was looking for 8 data bits. That's why it never sent a data change event. We got it reconfigured and it worked beautifully from there.

0 comments:

 
Jade Mason