Advanced 7-Segment Multiplexing
bsparky
Posts: 52
I am tring to understand the code for Experiment #29 from the Parallax web site.
index var nib
idxodd var index.bit0
for index=0to7
lookup index,[noparse][[/noparse]scan,3,brite,5,decode,$of,shutdn,1],d7219
shiftout datapin,clock,msbfirst,[noparse][[/noparse]d7219]
if(idxodd=no) then no_load
pulsout load,5
They show the NEXT command after the no_load label I believe it should be before it,but thats not my real question.
What exactly is happening with the statment IF(IDXODD=NO) THEN NO_LOAD isn't the idxodd looking at bit0 of the nib index and would this bit0 not change alternetly 0 & 1 as the index went through the count 0 to 7.
0000 for 0 count
0001 for 1 count
0010 for 2 count
0011 for 3 count
0100 for 4 count
0101 for 5 count and so on ?
Or am I looking at this all wrong must be any light on this.......... Thanks Bill
index var nib
idxodd var index.bit0
for index=0to7
lookup index,[noparse][[/noparse]scan,3,brite,5,decode,$of,shutdn,1],d7219
shiftout datapin,clock,msbfirst,[noparse][[/noparse]d7219]
if(idxodd=no) then no_load
pulsout load,5
They show the NEXT command after the no_load label I believe it should be before it,but thats not my real question.
What exactly is happening with the statment IF(IDXODD=NO) THEN NO_LOAD isn't the idxodd looking at bit0 of the nib index and would this bit0 not change alternetly 0 & 1 as the index went through the count 0 to 7.
0000 for 0 count
0001 for 1 count
0010 for 2 count
0011 for 3 count
0100 for 4 count
0101 for 5 count and so on ?
Or am I looking at this all wrong must be any light on this.......... Thanks Bill
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Another part in that same program has me a bit confused the variables DEPOSIT.bit0, DEPOSIT.bit1 a bit can only hold a 0 or 1 but you could have up to 9 pennys ? Thanks for clearing these question up for me. I a trying to make a scoreing display board.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
0000 0000 0000 0000 word hold value 65535
0000 0000 byte hold value 255
0000 nib hold value 15
0 bit hold value 1
So if you are looking bit0 of the var deposit you would be looking 0000 0000 which to my way of looking at it would be 0 or 1.
Thanks for the help.
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
The Main loop calls a subroutine called Get_Coins. Get_Coins will scan the coin inputs and return 1s in the variable called deposit for the coin button(s) pressed. For example, on a scan of Get_Coins the Penny and Nickel inputs could be pressed. The value returned in depost would be %00011.
Back up in the Main loop there is code like this:
The idea is that if a coin bit is set (1), then the value for that coin would be added. This program is a little subtle -- spend some time with it and it will make sense.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
In my program I want to scan a 16 keypad then storing the keys as a single var number and check each key for the enter key which will tell me my number is done, then send this out to the display. Each number entered will be subtracted from a total value entered first. Will see how I make out. Should be fun. Love these STAMPS.
I appreciate all your help.
We're pleased that our products are a pleasure and that our demos are helpful.· Have fun!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA