RS232 Correct way of reading data from usart

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
Tom Stefanou
Posts: 32
Joined: Thu Nov 15, 2012 7:21 am
Has thanked: 7 times
Been thanked: 7 times
Contact:

RS232 Correct way of reading data from usart

Post by Tom Stefanou »

Hello again guys....
I am reading data from the serial port and display them to an lcd module.
What is the proper way of reading everything from the serial port buffer?
I have searched the forum and only thing i could find was a topic from flowcode 3 where BenJ had updated the ecxample of rs232 to use an interrrupt.
To be honest i could not find that implemented in flowcode 3 or 5 examples.
So i know i am missing a lot of characters compared to the ones i should receive.
How am i supposed to do the reading from the serial port?
Thank you for your time!

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: RS232 Correct way of reading data from usart

Post by Enamul »

If you use RXINT, every time receive any character in the buffer interrupt will trigger and you can read that character. PIC can easily be involved in doing other stuffs. That's is much reliable than just wait and read if PIC is doing something else in the loop as well. I can post example code if you want for RXINT. BTW, which PIC you are using..bcz there are some problem in RXINT in couple of PIC and Ben posted a fix for that but I don't think you have noticed that.
Enamul
University of Nottingham
enamul4mm@gmail.com

Tom Stefanou
Posts: 32
Joined: Thu Nov 15, 2012 7:21 am
Has thanked: 7 times
Been thanked: 7 times
Contact:

Re: RS232 Correct way of reading data from usart

Post by Tom Stefanou »

Hey Enamul,
I am using 16F877.
Yes an example would be very good i think.
Actually i want when i receive from serial the
"Would you like to activate duplex? [yes/no] :"
to light a led.
But i always am able to read some of it...

Post Reply