USB Serial Write Problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

USB Serial Write Problem

Post by Gypo »

Hi

I have plugged a GPS unit to a PIC 18F4550 and was hoping (for now) to get the raw GPS data into the PIC and them send it out on a USB serial connection.
This is research into what other things / data strings I can manipulate from the GPS unit, Hence the reason for not using the GPS component.

I put together a simple Flowcode prog to read the data as a string from the GPS over the RS232 RxD pin RC7
I then send that same string out of the USB serial connection to terminal without any alteration.

Everything seems to work excep that I am getting odd characters being added to the string sent to terminal via the USB serial connection.
As I say Added because all the other data is there but there are odd characters in the string at odd places.

I have the same RS232 data going directly into one of the PCs RS232 ports too and so can compare them both at run time. The one going directly to the RS232 port is OK, no additions.

If I send this through a PL-2303 chip to a USB port there is no corruption so my guess there is something I am doing wrong with the string declaration or the parameters required in the components property settings.

I have declared the string variable as GPS_Read[100]

Parameters for the RS232 reading into the string
nTimeout(BYTE) , NumBytes(BYTE) = 10, 100
Return Valuse = GPS_Read[100]

I have attached a screen dump and logs from the 2 terminal screens (both terminal windows were setup the same (except for the port number))


Many Thanks
Attachments
GPS Display Difference.txt
Log of the 2 terminal inputs
(3.52 KiB) Downloaded 264 times
Corrupt USB Serial.JPG
Screen dump of added chars in terminal
(209.71 KiB) Downloaded 705 times
The only real simulation isn't ...
Gypo

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB Serial Write Problem

Post by Benj »

Hello,

It looks like you are sending the 255 (no incoming byte detected) to the PC. You need a if statement to detect if the RS232 GPS byte was 255. If it was then do not send the byte onto the PC. Hopefully this will solve your problem.

Gypo
Posts: 52
Joined: Thu Apr 29, 2010 11:12 am
Has thanked: 5 times
Been thanked: 3 times

Re: USB Serial Write Problem

Post by Gypo »

Benj

Yep it was as you said, put a filter to check for it and bingo,

Thanks
The only real simulation isn't ...
Gypo

Post Reply