Shop
OBEX
P1 Docs
P2 Docs
Learn
Events
Bs2p output data format — Parallax Forums
toggle menu
Categories
Discussions
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Sign In
·
Register
×
Home
›
Learn with BlocklyProp
Bs2p output data format
robert hilton
Posts:
3
2006-09-06 21:15
edited 2006-09-06 22:24
in
Learn with BlocklyProp
Bs2p outputs data in ascii format. How can i convert it into decimal format? Could any one help me out?
Comments
allanlane5
Posts:
3,815
2006-09-06 21:28
edited 2006-09-06 21:28
Sure. Define your terms.
For example, we have the value, 1000, which is the hex value $03E8. So, that's two bytes. The high-byte, $03, and the lowbyte, $E8.
Now, if you put that out as an ascii string (SEROUT 16, 16486, [noparse][[/noparse]DEC Value]), you're going to see "1000" (4 bytes).
If you put that out as binary (SEROUT 16, 16468, [noparse][[/noparse]Value.HighByte, Value.LowByte]) you'll see the two bytes.
To convert to decimal -- if recieving with a C++ program on the PC -- I believe its an option in 'fscanf()'.
So, what language are you using?
And when you say "Decimal Format", what do you mean?
Chris Savage
Parallax Engineering
Posts:
14,406
2006-09-06 22:24
edited 2006-09-06 22:24
This is a duplicate message.
·
Please refer to the original at the following link.
http://forums.parallax.com/showthread.php?p=604292
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Sign In
or
Register
to comment.
Comments
For example, we have the value, 1000, which is the hex value $03E8. So, that's two bytes. The high-byte, $03, and the lowbyte, $E8.
Now, if you put that out as an ascii string (SEROUT 16, 16486, [noparse][[/noparse]DEC Value]), you're going to see "1000" (4 bytes).
If you put that out as binary (SEROUT 16, 16468, [noparse][[/noparse]Value.HighByte, Value.LowByte]) you'll see the two bytes.
To convert to decimal -- if recieving with a C++ program on the PC -- I believe its an option in 'fscanf()'.
So, what language are you using?
And when you say "Decimal Format", what do you mean?
http://forums.parallax.com/showthread.php?p=604292
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com