USB Serial - Receiving '&hFF' in Flowcode 4
Posted: Tue Apr 12, 2011 9:02 pm
Hi
I have build some industrial devices over the past years, and they all made use of PIC 16F876, with standard RS232 comms to the PC software running at 19200 baud. The software was created in Visual Basic 3 & 5. Devices are used in the plant, and are connected to a laptop PC. The sofware comms is relatively simple, with the following data formats:
Synch Byte (&hFF), followed by a command byte, and several data bytes depending on the command.
With the new laptops, serial ports are no longer available, and in the new designs, I want to make use of the USB Serial function in Flowcode to get rid of the USB to Serial cable. The circuit design is very easy to convert from RS232 to USB (removing the MAX232 chip, solder on 3 USB wires, and replace the 16F with 18F2550).
Setting up the USB Serial port was no problem, and the USB Serial is working correct. However, my biggest problem is the fact that I am unable to determine between a received &hFF data, and no data received. I had a look at changing the Synch Byte in the VB code, but this will solve only the Synch side of the comms. Some of the data sent to the devices can include &hFF as well.
I have no problems sending &h00 to &hFF from the USB to the PC.
Is there a method to be able to determine if the USB Serial return value of &hFF was due to data received, or no data received?
Thanks in advance.
I have build some industrial devices over the past years, and they all made use of PIC 16F876, with standard RS232 comms to the PC software running at 19200 baud. The software was created in Visual Basic 3 & 5. Devices are used in the plant, and are connected to a laptop PC. The sofware comms is relatively simple, with the following data formats:
Synch Byte (&hFF), followed by a command byte, and several data bytes depending on the command.
With the new laptops, serial ports are no longer available, and in the new designs, I want to make use of the USB Serial function in Flowcode to get rid of the USB to Serial cable. The circuit design is very easy to convert from RS232 to USB (removing the MAX232 chip, solder on 3 USB wires, and replace the 16F with 18F2550).
Setting up the USB Serial port was no problem, and the USB Serial is working correct. However, my biggest problem is the fact that I am unable to determine between a received &hFF data, and no data received. I had a look at changing the Synch Byte in the VB code, but this will solve only the Synch side of the comms. Some of the data sent to the devices can include &hFF as well.
I have no problems sending &h00 to &hFF from the USB to the PC.
Is there a method to be able to determine if the USB Serial return value of &hFF was due to data received, or no data received?
Thanks in advance.