A binary programing question...
I have created a·scrolling LED·display that uses two 74LS154 (4 x 16 decoder chips).· The hardware works fine.· The problem is with the binary addressing of the four output pins to the demultiplexor.· I can manually set the lines (P1 to P4)·to address the proper output lines on the decoder, but·I'd rather not do that.·I'd rather let the program increment the binary number and set the output pins (P1 to P4) accordingly, but I'm not proficient enough with my programming skills to do this.· Is there a way to·let the program send a binary·number to the four output lines (P1 to P4) so that each of the four lines contains one bit of the four bit number and then the progam will incement the number and reset the pins for the new number?· If I've totally confused you, let me know and I'll try to explain it better.
Thanks,
David···
Thanks,
David···
Comments
Ed
Thanks,
David
idx VAR Nib
idx=1
DIRA = %1111··· 'Set pins 0 to 3 as outputs
main:
OUTA = idx····· 'Switch each output high in turn as you loop through "main"
idx=idx <<1···· 'Bit shift left......see Pbasic Syntax Guide/Pbasic Operators
IF idx=0 THEN
idx=1·········· 'Reload idx with one after output high on pin3
ENDIF
PAUSE 750··· 'Pause between outputs
GOTO main
NOTE: as it is it uses Pins 0 through 3 not 1 through 4 as you described, is that a problem?
Jeff T.
David
I think this is what you are after.· This will produce a binary output on P1 through P4.
Edit:
If you intended for the binary output to be on pins 0 to 3 instead, then the code below should help you get started
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 11/8/2006 7:40:59 PM GMT
I'll try these suggestions and see how they work.· I had designated pin 0 (through an inverter) to be my chip select·0(low)=first 74LS154, and 1(high)=second 74LS154 chip.· The beauty of bread boards is that by moving a couple of wires, I could use pins 0 to 3 or 1 to 4 or just about any thing else.·
Once again, thank you all!
David
take care
Jeff T.