Shifting to shift registers
george miyagi
Posts: 48
Hi
i'm using the Max7219, well actaully 6 of them. But for the life of me, I can't work out how to shift more than 8x8 bits to them at once. How would i shift out a larger graphic to them?
i'm using the Max7219, well actaully 6 of them. But for the life of me, I can't work out how to shift more than 8x8 bits to them at once. How would i shift out a larger graphic to them?
Comments
· SHIFTOUT Dpin, Cpin, MSBFIRST, [noparse][[/noparse]data1, data2, data3, data4, data5, data6, data7, data8]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
however, I'm receiving the values via SERIN, and this is where is gets confusing....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
forgive the messy code, just trying to get it to work.
Q: Do you have control over the transmitting end?· If yes, just use one sync character and send a single byte (the value) for each position instead of the eight-byte binary string (this will speed up comms significantly).· Then you can do this:
· SERIN ProgPin, Baud, [noparse][[/noparse]WAIT ("*"), STR d7219\6]
(Note: You should NOT hardcode baud values -- put them into a constant.· Trust me on this.)· If you're sending the data as binary strings to avoid a conflict with the sync character, change to HEX2 format and do it like this:
· SERIN ProgPin, Baud, [noparse][[/noparse]WAIT ("*"), HEX2 d7219(0), HEX2 d7219(1), HEX2 d7219(2),··· ' <
························HEX2 d7219(3), HEX2 d7219(4), HEX2 d7219(5)]
That eliminates six bytes per item.· I've also put the 7219 data into an array to simplify other processes.
In your second program, this section of code:
· FOR char = 0 TO 4
·· ·LOOKUP 0, [noparse][[/noparse]Char_0,Char_1,Char_2,Char_3,Char_4,Char_5], eeAddr1
·· ·LOOKUP 1, [noparse][[/noparse]Char_0,Char_1,Char_2,Char_3,Char_4,Char_5], eeAddr2
·· ·LOOKUP 2, [noparse][[/noparse]Char_0,Char_1,Char_2,Char_3,Char_4,Char_5], eeAddr3
·· ·LOOKUP 3, [noparse][[/noparse]Char_0,Char_1,Char_2,Char_3,Char_4,Char_5], eeAddr4
·· ·LOOKUP 4, [noparse][[/noparse]Char_0,Char_1,Char_2,Char_3,Char_4,Char_5], eeAddr5
·· ·LOOKUP 5, [noparse][[/noparse]Char_0,Char_1,Char_2,Char_3,Char_4,Char_5], eeAddr6
·· ·GOSUB ShowChar
··· PAUSE 1000
· NEXT
... is a big waste of space since you're always using a fixed index for LOOKUP.· Is that what you meant to do?· And if your EE defintiions are of a fixed size and place in order, you can simply calculate an offset address.· This line of code will take the value in "theChar" and calculate the address for it:
· eeAddr = Char_0 + (theChar * 9)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
yes, i do have control over the transmitting end. perhaps it would've been helpful to explain what i'm doing. i am using Processing, ie. semi-Java, taking an image, converting it to binary to represent the black and white (on and off) states. That's why I'm using binary on both sides. So I'm only ever sending 1's and 0's. I will probably convert these to decimal later on, but at moment just trying to get it working.
so i've modified the code slightly, but it's still not working. Should i be sending all 64 bits of one 8x8 matrix, or should it be done as it is now, row for row?
Post Edited (george miyagi) : 7/3/2005 6:54:30 PM GMT