Prob'ly a dumb question
kq6f
Posts: 5
This seems pretty trivial but I haven't figured out how to do it.
I want to take a byte (value = 0 to 255), convert it to three decimal digits, then parse each digit into a byte.
Example:··byte1 value = 127
············· digit 1 = 1
············· digit 2 = 2
············· digit 3 = 7
·············· byte2 value = 1
·············· byte3 value = 2
·············· byte 4 value = 7
Can anybody help, please?
·
I want to take a byte (value = 0 to 255), convert it to three decimal digits, then parse each digit into a byte.
Example:··byte1 value = 127
············· digit 1 = 1
············· digit 2 = 2
············· digit 3 = 7
·············· byte2 value = 1
·············· byte3 value = 2
·············· byte 4 value = 7
Can anybody help, please?
·
Comments
byte3 = byte1 / 10 // 10
byte4 = byte1 // 10
/ is integer division
// is modulo
Thanks a million, MikeK..
kq6f
byte1 - 127
byte2 = byte1 DIG 2 ' 1
byte3 = byte1 DIG 1 ' 2
byte4 = byte1 DIG 0 ' 7
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Rod Brink, kq6f
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Equipped with his 5 senses, man explores the world around and calls his adventure science
·
-Edwin Hubble
·
Mike only
You need a straight through cable, not a "null modem" cable to program any of the PBASIC Stamps. There is no reason why you can't make your own programming cable using the instructions found in the PBASIC Programming and Reference Manual. That manual can be found on the Parallax web site in the Downloads Section.
Regards.
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Mike only