Binary to Decimal Conversion
debonene
Posts: 19
Please can anyone tell me the command syntax to convert binary to decimal representation using the BS2 board.
Comments
There's an operator DIG used to provide a decimal digit of the decimal representation of a number.
There's what's called the DEC formatter used in a variety of I/O statements including SERIN, SEROUT, DEBUG, and DEBUGIN among others. The various formatters are also discussed in one of the appendices of the Manual..
edit: Mike! You did it again!...
Verification: I kept a Debug command after Line1 and Line2 and it gave me different answers. such as
result3= 3918( This is correct)
mVolts3= 0006(This is not correct)
CODE: .......
Line 1: result3 = result3 & value3
Line 2: mVolts3 = ((result3 *5000)/4095 )
You have to try harder than that. Give us something to work with: attach the full source code, with comments on each line where you think it should be decimal or binary and include what you are trying to do.
mVolts3 = result3 */ 313
or
mVolts3 = result3 ** 14484 + result3 ' more accurate
See */ and ** operators in the PBASIC reference materials.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com