Hello Atomsky
Atomsky>>I need to represent a 3 digit decimal number spanning
from 000-777 (e.g. 023) like a 9-bit binary word consisting
of 3 x 3 bytes (e.g. %000-010-011). Is there an easy way
of converting this using PBP math? Thanks in advance.<<
Yes, there is a way...
First you use the "Dig" command... this will "Dig out each individual number...
Number var byte
DigNumber var byte
counter var byte
BinNumber var byte
For counter=2 to 0 step -1
DigNumber=Number Dig counter '(I don't have the book in front
of me, so syntax may be wrong)
' Now DigNumber is the first number you want.
' We now take that Dignumber and turn it into Binary
'I am not sure if this will work...you will have to see, but i saw this
'littel shortcut...it may not take a "assigned" value
'If you are ambitious, use a case statement and use up code <g>
'case DigNumber=1 BinNumber = DCD 1
'case DigNumber=2 BinNumber = DCD 2
'etc... <g>.
BinNumber = DCD DigNumber
LCDout BinNumber
Next counter
This is untested code, and I am not very diversed with PBP compiler commands. I have not learned all the syntex of the language yet...I am am *sure* there are probably easier ways to do such things... or a more "Proper" way.
Dwayne
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Bookmarks