Page 1 of 1

Convertin from decimal to Characters

Posted: Thu Sep 12, 2019 2:35 pm
by jollybv
Hi Guys

I am saving a string in I2C memory eg Hello World now when I read it back I get the decimal number for it 72(H) 101(e) 108(l) 108(l) 111(0) 32(space) 87(W) 111(o) 114(r) 108(l) 100(d) how do I convert that back into a string of characters? If anyone knows of an exsample it would be much appreciated.

I have tried looking at the example Ben did (NumberConversion) but I can't figure out what it does as I can't step through it
NumberConversions.fcfx
(14.72 KiB) Downloaded 266 times

Re: Convertin from decimal to Characters

Posted: Thu Sep 12, 2019 3:39 pm
by mnf
When you print out the read back characters you are 'printing' or displaying them as numbers (they are the ASCII representation of the desired string). Post your code and we'll be able to change if needed...

Martin

Re: Convertin from decimal to Characters

Posted: Thu Sep 12, 2019 4:52 pm
by jollybv
Hi

Thanks for the reply what in trying to do is read back the memory and then change it to Characters so I can use it in an SMS message string. If I read back each byte then convert to string it will send a string of numbers, not letters. I have made an example of what I'm trying to do
Decimal To Ascii.fcfx
(12.99 KiB) Downloaded 257 times

Re: Convertin from decimal to Characters

Posted: Thu Sep 12, 2019 9:02 pm
by mnf
Try:
Decimal To Ascii.fcfx
(12.48 KiB) Downloaded 300 times

Re: Convertin from decimal to Characters

Posted: Fri Sep 13, 2019 4:52 am
by jollybv
Hi

Thanks for that works perfectly, took a whole day of trying and still could not see how simple it was thanks again. :D