LED Refresh rates
george miyagi
Posts: 48
I have an 8x8 array with columns hooked up to a Darlington Array to a 595. Everything seems to be working ok. But I am still getting a visible flicker, more like a bluriness.
If I add another 595, and hence add more code, the flicker worsens.
There's nothing wrong with the power of matrix. If I turn on all lights, it's fine. But when i multiplex, then the fuzziness occurs. This seems to tell me it's the refresh rate.
Is the Basic Stamp2 not fast enough, or could the problem lie elsewhere?
If I add another 595, and hence add more code, the flicker worsens.
There's nothing wrong with the power of matrix. If I turn on all lights, it's fine. But when i multiplex, then the fuzziness occurs. This seems to tell me it's the refresh rate.
Is the Basic Stamp2 not fast enough, or could the problem lie elsewhere?
clk CON 0 ser CON 1 latch CON 2 x VAR BYTE counter VAR BYTE rows VAR BYTE cols VAR BYTE clk2 CON 3 ser2 CON 4 latch2 CON 5 LOW latch LOW latch2 counter=128 rows = %00011111 'horiz off Main: FOR x = 0 TO 8 counter = counter >> 1 IF counter=0 THEN counter=128 rows =255-counter GOSUB Send_Cmd NEXT GOTO Main Send_Cmd: SHIFTOUT ser, clk, MSBFIRST, [noparse][[/noparse]rows\8] PULSOUT latch, 1 RETURN
Comments
Post Edited (Paul Baker) : 6/17/2005 2:07:11 PM GMT
I think you might be able to optimize your code a bit.· Give this a try:
' {$STAMP BS2}
' {$PBASIC 2.5
Clock·········· PIN···· 0
Dout··········· PIN···· 1
Latch·········· PIN···· 2
Latch2········· PIN···· 3
idx············ VAR···· Nib
counter········ VAR···· Byte
rows··········· VAR···· Byte
cols··········· VAR···· Byte
Setup:
· LOW Latch
Main:
· FOR idx = 7 TO 0
··· counter = 1 << idx
··· rows = ~counter
··· SHIFTOUT Dout, Clock, MSBFIRST, [noparse][[/noparse]rows]
··· PULSOUT Latch, 1
· NEXT
· GOTO Main
I think this will do what your code is presently doing, albiet a bit more elegantly (I'm taking advantage of PBASIC to a greater degree than you are).· Your code seems to indicate that you're going to have another 595.· You don't need a full second set of pins, you can share the Data and Clock lines -- just use a separate Latch line for the second 595.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Paul Baker) : 6/17/2005 4:13:20 PM GMT
· SHIFTOUT Dout, Clock, MSBFIRST, [noparse][[/noparse]rowData, colData]
Using this, the connections would be: Stamp --> Col595 --> Row595.· I know the the MAX7219 is a bit pricey vis-a-vis the 595, but that would sure make this project a bunch easier and eliminate any speed issues related to the BS2.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 6/17/2005 4:23:05 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perform initializations such as initial pin states.
Initialize the 164 by clocking in eight 1s (place 1 on Data and pulse Next_Row 8 times)
Main_Loop
Loop 8 times (n){
Serial shift nth·row's data into (column) 595 (Col_Clk is clock pin, Data is data pin)
If first row, set Data low else set Data high.
Pulse Next_Row
}
Repeat Main_Loop
End Algorithm
This circuit takes advantage of the 595's latch to signal when the row shift occurs. Whenever the data in the internal register of the 595 is latched to the outputs, the value on the Data line is shifted into the 164 at the same time. Since the row and column are updated simultaneously, a column is always lit meaning no "dead time". So this circuit exhibits the same benefit as the daisy chain method, but updates the row almost as a side effect.
If SHIFTOUT always leaves the data pin in the same state,·only test·for when Data needs to be the other state (ie if SHIFTOUT leaves Data=0, do: IF n>0 THEN Data=1), this should save a few cycles.
EDIT: You should get the same 74' family for the 164 as the 595 you already have (if you have a 74HC595, get a 74HC164). This will make the propagation delay as close as possible between the 595 and the 164. Propagation delay is the amount of time it takes for an output to reflect a change in input, each 74' family has different delays and you want the outputs of the 164 and 595 to change at the same time as much as possible.
Post Edited (Paul Baker) : 6/17/2005 10:03:27 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The schematic I'm using is the one from StampWorks3 modified slightly
The reason I'm not using the 7219s is that I need to build 5 screens of 32x16, meaning I would need 40!!!! Along with 5 basic stamps and all the LEDs etc. this is some serious outlay for my exhibition...
Anyway, I'll try do some shopping today and see if I can get my hands on a couple of 164s and try that method out too.
<addendum - John's code works fine when the whole matrix is to be lit, but I seem to run into the same problem when addressing individual lights>
Post Edited (george miyagi) : 6/18/2005 11:31:11 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
that's what i feared.
so your advice:
using BS2: if i use the 7219 would this have enough speed for what i'm trying to do, taking into a/c that i need to build a matrix of 32x16
using the SX: would this work with the 595s, or would I still have to use 7219s.
After having forked out ¥20 000 (yes, your products are super-expensive in Japan), I need to do some serious research and thinking about this project. - though i'm sure i'll find a use for the BS2, and have learnt a lot from it, and it's nice to know i wasn't going crazy this last week.
Anyway, i digress. I'm on major time constraints to get this working. So do you suggest i go the SX way or 7219 way. The reason i went with the 595 were they were much easier to get my hands on and of course their price as compared to the 7219s.
thanks again for everybody's amazing help so far
regards
george
If you're looking to create a dynamic display then I would suggest the SX route -- you can (using my other project as a guide) create a custom display controller using an SX48.· Does your 32x16 display mean 32 rows or 32 columns?· If it's 32 columns, then you could use a couple 74x154 decoders and five I/O lines to select the column for display, then use two ports for the 16 row LEDs that would be lit.· SX/B on the SX48/52 allows large arrays, so you could create a 64 byte array that is the display buffer.· The "foreground" code would simply select a column, then put the LED data onto the LEDs.
Now, none of this is particularly easy, but it can be done.· Desho?
Gomen nasai about the high prices in or Parallax products Japan (it happens in Europe, too)·... exporting goods between countries always seems to benefit the tax and tarrif collecting agencies on both sides.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Where are you in Japan? I usually travel to Japan at least twice a year. I might be able to pick up some product for you here locally and deliver it to you in·Japan at U.S. prices. (Without being thrown in jail?)
よろしですか
もし ほしい です プラーベト エメル 下さい
ケン
·P.S. Upon closer reading of your post I noticed you need the parts soon, but I will not be in Japan until the fall.
Post Edited (KenM) : 6/18/2005 4:21:15 PM GMT
i'm gonna try out the 7219 route and see where that gets me. SX is no go for me as I'm on a Mac.
and thanks Ken for the offer, though time is against me at the moment.
regards
g