Page 1 of 1
UART Serial Sending Numbers
Posted: Sun Jan 24, 2021 10:42 am
by jay_dee
I think I've caught myself out!
I'm sending Byte values from a PIC using UART, values 0-255, These are recieved by Flowcode App Dev.
But should I be using the sendChar, Send Number or Send String macros?
If I sendChar 0 ( which I accept is ASCII Null) I dont seem to get anything at the other end?
I could convert each number to a test string, but then I have to send 3 bytes to represent a character from a single byte.
Im sure I had this issue a few years back buyt I've forgottn the solution! Any ideas?

Re: UART Serial Sending Numbers
Posted: Sun Jan 24, 2021 4:37 pm
by medelec35
Hi,
You can use SendNumber or SendString
Both will work as the SendNumber automatically sends the numbers as an ASCII string.
Therefore you can send any number including 0
When you had the issue , you could have been trying to send Char before the sendNumber was added to the components?
Re: UART Serial Sending Numbers
Posted: Mon Jan 25, 2021 9:24 am
by jay_dee
Thanks Martin,
To Clarify.. if I want to send a number over UART, I can only send it as a text based string. Thus for 255 send multiple bytes "2" "5" "5".
In terms of bandwodith cost, Instead of a single byte of data I need to send three bytes of data?
I cannot reliably send lower vlaue bytes as these may be interpreted as command characters, since all recieved data is compared to an ASCII lookup table and the first 16 items are command characters.
Are both of these statments rougly correct? Thanks, John.
Re: UART Serial Sending Numbers
Posted: Mon Jan 25, 2021 11:37 am
by p.erasmus
jay_dee wrote: ↑Mon Jan 25, 2021 9:24 am
if I want to send a number over UART, I can only send it as a text based string. Thus for 255 send multiple bytes "2" "5" "5".
In terms of bandwodith cost, Instead of a single byte of data I need to send three bytes of data?
This is not totally true you can send numbers 0-255 as a byte and 0-65535 as 2 bytes however this depends more on the receiver than the sender as the receiver determines how it interprets the UART bytes received,
For example I send a Byte array of 20 bytes containing the number it self such as 1 or 555 (in this case 2 bytes) the receiver read this bate array and do the ASCII encoding and use the corresponding value so the actual processing power is done by the LABVIEW application not the small micro UART.
This all really depends on your receiver how it can and will interpret the bytes you send.
Sorry not to trying hijack the post just wanted to share a bit of my experience
Re: UART Serial Sending Numbers
Posted: Mon Jan 25, 2021 11:52 am
by jay_dee
All input appreciated. Great, yes that totally make sense.
The UART transmitter does not determine how the bytes are interpreted, the Reciving device does. If it handles everything as ASCII then I must bend to its will and send character values rather than pure byte values.
As a non coder ( mechanical/electrical background) even after years of FC... so much of the basics are still missing!
J.
Re: UART Serial Sending Numbers
Posted: Mon Jan 25, 2021 12:03 pm
by medelec35
Suppose you use the SendNumber 1234
What that will do is break the numbers in to four lots of bytes.
The first byte sent is 41. That is ASCII for 1
then 42, 43 and finally 44 is sent.
That would be the same if SendString "1234" is used
Again 41, 42, 43 & 44 is sent
p.erasmus wrote: ↑Mon Jan 25, 2021 11:37 am
Sorry not trying hijack the post just wanted to share a bit of my experience
Not at all!
It's the opposite.
You are posting very useful contributions, so thank you.
Re: UART Serial Sending Numbers
Posted: Mon Jan 25, 2021 12:15 pm
by p.erasmus
jay_dee wrote: ↑Mon Jan 25, 2021 11:52 am
All input appreciated.
medelec35 wrote: ↑Mon Jan 25, 2021 12:03 pm
Not at all!
It's the opposite.
You are posting very useful contributions, so thank you.
Thanks guys appreciate

I am also learning still from here in the forum
