Problem speed RS232 in RX

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

Moderator: Benj

xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Been thanked: 7 times
Contact:

Problem speed RS232 in RX

Postby xelites » Wed Oct 24, 2018 6:39 pm

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.64 KiB) Downloaded 56 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8825
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3718 times
Contact:

Re: Problem speed RS232 in RX

Postby medelec35 » Wed Oct 24, 2018 7:57 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Been thanked: 7 times
Contact:

Re: Problem speed RS232 in RX

Postby xelites » Wed Oct 24, 2018 9:09 pm

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: 8825
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2561 times
Been thanked: 3718 times
Contact:

Re: Problem speed RS232 in RX

Postby medelec35 » Wed Oct 24, 2018 9:45 pm

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

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Been thanked: 7 times
Contact:

Re: Problem speed RS232 in RX

Postby xelites » Thu Oct 25, 2018 10:44 am

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: 14793
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4755 times
Been thanked: 4360 times
Contact:

Re: Problem speed RS232 in RX

Postby Benj » Fri Oct 26, 2018 11:51 am

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.
These users thanked the author Benj for the post:
medelec35 (Fri Oct 26, 2018 12:50 pm)
Rating: 5%
 

xelites
Posts: 44
Joined: Thu Nov 06, 2014 9:47 am
Been thanked: 7 times
Contact:

Re: Problem speed RS232 in RX

Postby xelites » Sat Nov 03, 2018 3:43 pm

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