Read RS232

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Read RS232

Post by Desdewit »

Hi Guys

What would be the best way (Array or String) to read 8 packets of 14 bytes coming in every 10sec via rs232 :?:
I want to keep the data in bytes so some of it can be changed and send back out after a few seconds.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Read RS232

Post by Enamul »

Hi,
I think it's better to use RXINT for RS232 read. As this helps you to keep your controller busy in doing other stuffs but can read RS232 data meanwhile..which you can put in a pre-defined array of your data length. You can initialize array index to count how many bytes you have received to be confirm that you have received 8*14. At the end of all byte reception you can simply re-initialize index which will enable you for another reception.

I am attaching here two code using RXINT as a start..
Attachments
RS232_4580_rcv.fcf
(12 KiB) Downloaded 280 times
RS232_4580.fcf
(11.5 KiB) Downloaded 253 times
Enamul
University of Nottingham
enamul4mm@gmail.com

Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Re: Read RS232

Post by Desdewit »

Hi Enamul

Thanks for the reply, the RXInt is working realy well with one byte at a time but when I receive a string of 14 bytes at once and try to read one byte from the string like Data[4] the lcd display nothing.
Sending one character at a time like ascii "A" prints on the lcd but sending "AA" leaves the lcd blank

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Read RS232

Post by Enamul »

That's why I told you not to use string read rather use char read..but use an index variable to mark string byte number. If you are not quite clear I can post something for you..
Enamul
University of Nottingham
enamul4mm@gmail.com

Desdewit
Posts: 130
Joined: Sat Feb 26, 2011 4:26 am
Location: South Africa
Has thanked: 25 times
Been thanked: 11 times
Contact:

Re: Read RS232

Post by Desdewit »

Hi Enamul

At last I got it to work with RXint.
Thanks for the support. :lol:

Post Reply