Problem speed RS232 in RX

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Contact:

Problem speed RS232 in RX

Post by xelites »

Good evening all pipol, I have a problem with the attached program. Can you understand or bend what happens? I have to receive the following command from the serial line &Y10 or &Y20 etc. &Y I put them as char to define the address while the other two are as string and I need to read the data to be converted into voltage etc. Everything works but I only read &Y1 or &Y2 all the second byte of the string are lost I think for the various conversion delays! if I send the 0 on the serial link and dial the command. Is there any quick routine to do what I need?
Thanks, I'm waiting :roll:
Attachments
test.fcfx
(188.63 KiB) Downloaded 63 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8897
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Problem speed RS232 in RX

Post by medelec35 »

Hi xelites,
Is there a specific reason for not using UART RX interrupt?
They are way better than timer interrupts or tight loops.
Martin

xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Contact:

Re: Problem speed RS232 in RX

Post by xelites »

Thanks Modelec, do you have any small examples to see how to use it in the right way? thanks again good night

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8897
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: Problem speed RS232 in RX

Post by medelec35 »

There will be numerous examples.
Latest example that also works with simulation can be found here
Note the RX interrupt is the only interrupt that currently does not simulate.
You will of course need to modify flowchart for your requirement.
After modification, if still not working then I will see if I can help you further.
Martin

xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Contact:

Re: Problem speed RS232 in RX

Post by xelites »

hello, I tried but nothing to do ... even simplifying the instructions I receive the first two characters ascii & Y every now and then the string data that comes together &Y99, if I send &Y wait and then send the string data 99 then it works fine but I have to divide the controls and this complicates my life on the WMI HMI display that does not have so many possibilities ... if you have any idea I try.
Thank you

User avatar
Benj
Matrix Staff
Posts: 14854
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Problem speed RS232 in RX

Post by Benj »

Hello,

If you are doing a lot of processing in the rxinterrupt macro then this could be why you are missing data.

I would suggest you use the RXinterrupt to add the incoming byte to a circular buffer and then process the buffer as part of your main loop. This leaves the interrupt free to fire and keep receiving bytes as they come in.

There are some examples here, specifically example 2.3 should be applicable.
https://www.matrixtsl.com/wiki/index.ph ... f2ad670a8a

If you're still having problems then please post your latest Flowchart so we can see what you're doing and what might be going wrong.

xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Contact:

Re: Problem speed RS232 in RX

Post by xelites »

Ok thx Benj now i try .. if i have the problem write you

Post Reply