BCD nibble out on 4 pins
Archiver
Posts: 46,084
Hi,
Forgive me I'm pretty new to basic stamps. I have my stamp connected
to a 7 seg display driver as part of a counting program. Four of the
stamps outputs connect into the 7 seg display driver. I'd like an
easier way to send the display a digit rather than sending LOW 0,
HIGH 1, LOW 2, LOW 4 for a 2 in this example. My question is how can
I send out a binary value to four pins without individualy setting
each of the four pins for each number I send to the display.
Thanks in advance
Tim
Forgive me I'm pretty new to basic stamps. I have my stamp connected
to a 7 seg display driver as part of a counting program. Four of the
stamps outputs connect into the 7 seg display driver. I'd like an
easier way to send the display a digit rather than sending LOW 0,
HIGH 1, LOW 2, LOW 4 for a 2 in this example. My question is how can
I send out a binary value to four pins without individualy setting
each of the four pins for each number I send to the display.
Thanks in advance
Tim
Comments
You can write to all the pins at once using a variable. All you have to do
is mask off the pins you don't want to change.
Original Message
> Forgive me I'm pretty new to basic stamps. I have my stamp connected
> to a 7 seg display driver as part of a counting program. Four of the
> stamps outputs connect into the 7 seg display driver. I'd like an
> easier way to send the display a digit rather than sending LOW 0,
> HIGH 1, LOW 2, LOW 4 for a 2 in this example. My question is how can
> I send out a binary value to four pins without individualy setting
> each of the four pins for each number I send to the display.
>Forgive me I'm pretty new to basic stamps. I have my stamp connected
>to a 7 seg display driver as part of a counting program. Four of the
>stamps outputs connect into the 7 seg display driver. I'd like an
>easier way to send the display a digit rather than sending LOW 0,
>HIGH 1, LOW 2, LOW 4 for a 2 in this example. My question is how can
>I send out a binary value to four pins without individualy setting
>each of the four pins for each number I send to the display.
>Thanks in advance
>Tim
outA = %0010 ' set the low nibble=2
You also have to set those pins to be outputs early in your program:
dirA = %1111 ' make P0--P3 outputs
at once with OutA. Pins 4 - 7 with OutB, 8 - 11 with OutC and, finally 12 -
15 with OutD. Before you can do this, though, you need to set the
appropriate bits in Dirs. Let's assume you're using pins 0 - 3:
cntr VAR Nib
Init:
DirA = %1111 ' make pins 0 - 3 outputs
Main:
FOR cntr = 0 TO 9
OutA = cntr
PAUSE 1000
NEXT
GOTO Main
If you're using a BS1...
SYMBOL cntr = B0
Init:
Dirs = %00001111
Main:
FOR cntr = 0 TO 9
Pins = cntr
PAUSE 1000
NEXT
GOTO Main
Hope this helps.
-- Jon Williams
-- Applications Engineer, Parallax
In a message dated 9/5/01 11:02:36 PM Central Daylight Time,
timevex@o... writes:
> Forgive me I'm pretty new to basic stamps. I have my stamp connected
> to a 7 seg display driver as part of a counting program. Four of the
> stamps outputs connect into the 7 seg display driver. I'd like an
> easier way to send the display a digit rather than sending LOW 0,
> HIGH 1, LOW 2, LOW 4 for a 2 in this example. My question is how can
> I send out a binary value to four pins without individualy setting
>
[noparse][[/noparse]Non-text portions of this message have been removed]