Shop OBEX P1 Docs P2 Docs Learn Events
HELP needed for a new guy. — Parallax Forums

HELP needed for a new guy.

ArchiverArchiver Posts: 46,084
edited 2003-07-01 21:38 in General Discussion
I am new to pbasic but am making good progress. Here is my problem. I
have managed to get my program to display a VAR I cal ANGLE. When I
used the DEBUG command, I get the desired Decimal number displayed in
the debug terminal in the range of 0 to 9999. However, I want to
display this number on a bank of 4 TIL311 displays. TIL311's latch
and decode and display a nible of hex data. I have the TIL311's in
groups of 2 and connected to P0 - P7. So, lets say my program's
function results in ANGLE being egual to 1234. How do I output "34"
to digits 0 and 1 and "12" to digits 2 and 3? To output "34" to
digits 0 and 1, I would have to write 00110100. Do I have to convert
from HEX to BCD?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-07-01 21:38
    x var byte
    angle var word
    angle=1234
    x.nib0 = angle dig 0
    x.nib1 = angle dig 1
    ' puts %00110100 in x
    ' see the dig operator in the Stamp manual

    >I am new to pbasic but am making good progress. Here is my problem. I
    >have managed to get my program to display a VAR I cal ANGLE. When I
    >used the DEBUG command, I get the desired Decimal number displayed in
    >the debug terminal in the range of 0 to 9999. However, I want to
    >display this number on a bank of 4 TIL311 displays. TIL311's latch
    >and decode and display a nible of hex data. I have the TIL311's in
    >groups of 2 and connected to P0 - P7. So, lets say my program's
    >function results in ANGLE being egual to 1234. How do I output "34"
    >to digits 0 and 1 and "12" to digits 2 and 3? To output "34" to
    >digits 0 and 1, I would have to write 00110100. Do I have to convert
    >from HEX to BCD?
Sign In or Register to comment.