Hi.
I need something like serout [dec2 var_name] or lcdout dec var_name;
but send the result to a string.
I suppose these functions are available in the compiler; nobody knows how to call them ?
Thanks
Hi.
I need something like serout [dec2 var_name] or lcdout dec var_name;
but send the result to a string.
I suppose these functions are available in the compiler; nobody knows how to call them ?
Thanks
Look at SEROUT2 in the manual. This tells how to send in BIN, HEX, DEC, or STR.
Dave
Always wear safety glasses while programming.
Hi,
How about:
/Henrik Olsson.Code:Serout......[#var_name] LCDOUT $FE,1,[#var_name]
Perhaps i badly explained.
I do not use serout or lcdout; i need a 16 bit binary to decimal conversion; i have to send a variable value to the Nokia 3310 display.
I now realized that DIG may be useful.
Regards
Hmm.. you are looking for an equivalent like the c function sprintf.
You are right, the DIG command is ideal to build the string. It may be more optimised if you hand code in asm
Jerson
tenthousands = value / 10000
value = value - ( tenthousands * 10000 )
thousands = value / 1000
value = value - ( thousands * 1000 )
hundreds = value / 100
value = value - ( hundreds * 100 )
tens = value / 10
value = value - ( tens * 10 )
ones = value
string(4) = tenthousands + 48
string(3) = thousands + 48
string(2) = hundreds + 48
string(1) = tens + 48
string(0) = ones + 48
First chunk of code will get the decimal values for the place holder for that digit.
Second chunk of code will change that into an ASCII representation of that number.
Then you can just serout (or SPI or I2C or whatever) that 'string' out whatever port you need to...
Theoretically anyways...
Bookmarks