Uart!

For general Flowcode discussion that does not belong in the other sections.
Post Reply
jgu1
Posts: 777
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 670 times
Been thanked: 174 times

Uart!

Post by jgu1 »

Hi!

I was making a program with tx and rx, Uart.

In this att. program when I use this in FC9 the display is filling the display up with strange sign, run all the time. I try yo make the same examble in FC8 it work and waiting, when data is comming in it´s ok?

What am I doing wrong please?

Br Jorgen
Attachments
Same FC8.fcfx
(10.34 KiB) Downloaded 96 times
RS232_ExampleRX2 Fc9.fcfx
(13.05 KiB) Downloaded 107 times

medelec35
Matrix Staff
Posts: 1920
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 622 times
Been thanked: 645 times

Re: Uart!

Post by medelec35 »

Hi Jorgen.
I have not looked into the reason, but try

Code: Select all

If: in > 0
Martin

jgu1
Posts: 777
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 670 times
Been thanked: 174 times

Re: Uart!

Post by jgu1 »

Thank you Martin. I test your suggest later today. But the strange it work as it should in FC8.

You hear :D

Br Jorgen

mnfisher
Valued Contributor
Posts: 1462
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 136 times
Been thanked: 713 times

Re: Uart!

Post by mnfisher »

Hi Jorgen, another suggestion is to print in as a number instead of using PrintAscii (note that only characters >= 32 (ascii for space) will show on the display.

An interrupt to receive input would have less chances of 'missing' input.

Martin

medelec35
Matrix Staff
Posts: 1920
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 622 times
Been thanked: 645 times

Re: Uart!

Post by medelec35 »

Hi Jorgen.
I have looked into this now.
The reason is that within RS232 properties there is an option to select Return of 8bits or 16bits.
If 16bits then the valid numbers are 0 to 255, therefore 256 is returned for no data.
With the variable

Code: Select all

 in
set as a byte type, it can't go up to 256, therefore it's rolled over to 0
If you change Return to 8 bits, then 255 will be returned for no data.
Therefore you can revert back to

Code: Select all

If: in < 255
Martin

jgu1
Posts: 777
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 670 times
Been thanked: 174 times

Re: Uart!

Post by jgu1 »

Hi Martin!

Well spottet :D I change to 8 bit and Print number, now nothing happend before I receive data and now it work perfect.
why had I not seen it you are brilliant :D Concerning the interrupt, I know this will be better. This was my first test in a project for IR remote control.

Yes, you will say, " IR remote control and RS232" make no sense :lol: Do you know these: https://www.ebay.com/itm/303292076882?h ... SwR91dhX9T
Work perfect an very easy to use the data which coming out and can be used.

Thank´s again again again Martin & Martin

Br Jorgen

medelec35
Matrix Staff
Posts: 1920
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 622 times
Been thanked: 645 times

Re: Uart!

Post by medelec35 »

That's brillant!
I'm glad you are all sorted.
jgu1 wrote:
Mon Feb 28, 2022 3:58 pm
Yes, you will say, " IR remote control and RS232" make no sense
No, not at all.
I have used UART in transceivers and wireless remotes, which allows pairing.
Martin

Post Reply