Page 1 of 1

sending a variable

Posted: Sat Jan 01, 2011 1:33 pm
by wiresalot
Hello,

Im using an rc time program on my BS2 changing it with a POT. The value changes and shows numbers, The pink recieves it, But displays odd charcters and not the number i need it to be a number. How can I make it be a number only?


Code: Select all

nbvar           VAR     Byte            ' PINK Data Variable


' -----[ Program Code ]----------------------------------------------------



DO
 HIGH 10
 PAUSE 1
 RCTIME 10, 1, nbvar
 DEBUG HOME, "time= ", DEC5 nbvar

SEROUT TX, Baud, ["!NB0W20:", nbvar, CLS]
LOOP
Thanks

wiresalot

Re: sending a variable

Posted: Sat Jan 01, 2011 2:58 pm
by thomastaranowski
You'll need to convert your raw number stored in nbval to ascii text for display (http://www.manpagez.com/man/7/ascii/). In C you'd use printf, itoa, or stringstream. No idea what you got going with basic, but I'm sure there's an equivalent.

Re: sending a variable

Posted: Sat Jan 01, 2011 3:12 pm
by wiresalot
Thanks for the reply.

Well basically im trying to use a thermistor for temperature reading, have a potentiometer conected now, until I get a thermistor. just trying to get the code to work.

"nbval" what is that :)
I didnt see it in Variable table.

Thanks for your reply.

wiresalot

Re: sending a variable

Posted: Sun Jan 02, 2011 7:47 am
by wiresalot
I figuered it out I had to add DEC5.

Code: Select all

nbvar           VAR     Byte            ' PINK Data Variable


' -----[ Program Code ]----------------------------------------------------



DO
HIGH 10
PAUSE 1
RCTIME 10, 1, nbvar
DEBUG HOME, "time= ", DEC5 nbvar

SEROUT TX, Baud, ["!NB0W20:", DEC5 nbvar, CLS]
LOOP
Thank you thomastaranowski

wiresalot