Uart Rx Byte to Variable

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: Uart Rx Byte to Variable

Post by Ferla »

StringIp = "" // Deleted
StringIP[index]='\0' // added as per your suggestion

inserting your project on top of the Ass_IP macro, assigning an input string = "12.34.56.78" when I try to display on the display what happens inside the cycle x = 4 cycles, on the display appears 002540 to display it I used macro component PrintNumber ip[ X] ,
I also used ip[1],ip[2] ecc..
Ferla

mnf
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Uart Rx Byte to Variable

Post by mnf »

Hi Ferla,

Hope you are a little further forward now.... Please post your code again with the changes - in the previous version you just output ip[0] (at the end of Ass_IP..

Have you tried adding a bit more debug to UART (it's a bit less trouble than trying to work out cursor position etc for LCD - if you output lots!)

Martin

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: Uart Rx Byte to Variable

Post by Ferla »

Hi Martin
I did a lot of tests and I came to a conclusion. The problem is in the loop icon. I do not know why but it can not do this
( StringIP >='0' AND StringIP <='9' ). I found a solution and it works great. Maybe you can improve, if you have any suggestions I appreciate.
Ferla
Attachments
UDP_RX_TX_OK_16F1937_ipCange9.fcfx
(47.45 KiB) Downloaded 184 times

mnf
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Uart Rx Byte to Variable

Post by mnf »

( StringIP >='0' AND StringIP <='9' )
Is indeed wrong - you are trying to compare a string to a single character...

You need:

StringIP[index] >= '0'

Where index is the current index of the character to process.

Martin

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: Uart Rx Byte to Variable

Post by Ferla »

If I remember correctly I tried but it does not work. As soon as I come back, I'll let you know
Thanks
ferla

Ferla
Flowcode v5 User
Posts: 126
Joined: Sun Jan 06, 2013 8:58 pm
Location: Italy
Been thanked: 19 times
Contact:

Re: Uart Rx Byte to Variable

Post by Ferla »

Martin does not work, does not advance in reading the string, always stays in the ip [x] hooked to position 0. The StringIP [index]
it is read but not progressing, the calculation is crossed over

Post Reply