Page 1 of 1

Uart!

Posted: Sun Feb 27, 2022 2:21 pm
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

Re: Uart!

Posted: Sun Feb 27, 2022 9:10 pm
by medelec35
Hi Jorgen.
I have not looked into the reason, but try

Code: Select all

If: in > 0

Re: Uart!

Posted: Mon Feb 28, 2022 5:27 am
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

Re: Uart!

Posted: Mon Feb 28, 2022 7:17 am
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

Re: Uart!

Posted: Mon Feb 28, 2022 7:35 am
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

Re: Uart!

Posted: Mon Feb 28, 2022 3:58 pm
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

Re: Uart!

Posted: Mon Feb 28, 2022 8:41 pm
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.