Max 6969 Led Driver
DigitalRedline
Posts: 5
Hey guys,
I'm trying to program a max 6969 16 output LED driver to use for a digital tachometer project. I obtained two max 6969's from maxim as free component samples. After reading the manual, I am still confused as how to write the proper code. I'm fairly sure that I wired the chip properly. Here's a copy of my code as is, could someone please check it for accuracy? Or does someone understand how the chip works? Additionally, I received two max 7219's (which are rather highly documented) that I also don't fully understand how to use. BTW I am programming on a BS2SX.
Thanks!
I'm trying to program a max 6969 16 output LED driver to use for a digital tachometer project. I obtained two max 6969's from maxim as free component samples. After reading the manual, I am still confused as how to write the proper code. I'm fairly sure that I wired the chip properly. Here's a copy of my code as is, could someone please check it for accuracy? Or does someone understand how the chip works? Additionally, I received two max 7219's (which are rather highly documented) that I also don't fully understand how to use. BTW I am programming on a BS2SX.
' {$STAMP BS2sx} ' {$PBASIC 2.5} DIN CON 15 Clk CON 14 LE CON 13 OE CON 12 index VAR NIB value VAR WORD idx VAR NIB counts VAR NIB one CON %1111111111111110 two CON %1111111111111100 three CON %1111111111111000 four CON %1111111111110000 five CON %1111111111100000 six CON %1111111111000000 seven CON %1111111110000000 eight CON %1111111100000000 nine CON %1111111000000000 ten CON %1111110000000000 eleven CON %1111100000000000 twelve CON %1111000000000000 thirteen CON %1110000000000000 fourteen CON %1100000000000000 fifteen CON %1000000000000000 sixteen CON %0000000000000000 main: 'LOW OE FOR counts = 0 TO 7 DEBUG DEC counts, CR, DEC idx, CR LOW LE PAUSE 1000 HIGH LE PAUSE 500 LOOKUP idx, [noparse][[/noparse]one,two,three,four,five,six,seven,eight], value idx=idx+1 SHIFTOUT DIN,CLK,MSBFIRST,[noparse][[/noparse]value] 'DEBUG DEC value, CR LOW LE PAUSE 1000 IF counts = 7 THEN GOTO restart NEXT restart: idx=0 counts=0 GOTO main
Thanks!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Look at the changes I made This should get you started I'm at work so I cant test this out but let me know what happens.
I updated the code I realized while driving home I goofed on it...this should work...let me know what it does.
'·{$STAMP·BS2sx}
'·{$PBASIC·2.5}
DIN·CON·15
Clk·CON·14
LE·CON·13
OE·CON·12
idx·VAR·NIB
value·VAR·WORD
idx·VAR NIB
counts·VAR·NIB
one······ CON·· %1111111111111110
two······ CON·· %1111111111111100
three···· CON·· %1111111111111000
four······ CON·· %1111111111110000
five······· CON·· %1111111111100000
six········ CON·· %1111111111000000
seven···· CON ·%1111111110000000
eight····· CON· %1111111100000000
nine······ CON· %1111111000000000
ten······· CON· %1111110000000000
eleven· · CON· %1111100000000000
twelve··· CON· %1111000000000000
thirteen· ·CON ·%1110000000000000
fourteen· CON ·%1100000000000000
fifteen··· CON· %1000000000000000
sixteen·· CON· %0000000000000000
main:
LOW OE· or just ground the pin on the IC I would just ground the pin
FOR·idx =·0·TO·7···········································································
DEBUG·DEC·counts,·CR,·DEC·index,·CR
HIGH·LE························································································'This allows the chip to receive data
PAUSE·50
LOOKUP·idx,·[noparse][[/noparse]one,two,three,four,five,six,seven,eight],·value
idx= index + 1
SHIFTOUT·DIN,CLK,MSBFIRST,[noparse]/noparse]value[color=red]\16[/color·········································· 'This shifts out data ALL 16 bits THE DEFAULT for the BS2 is only 8 bits
'DEBUG·DEC·value,·CR
LOW·LE·······················································································'This latches the data into the outputs of the·chip·and lights the LEDs
PAUSE·1000 CHANGE pause 1000 to PAUSE 50
idx= idx + 1················································································ 'This will move from "one to two to three·and so on"
IF·counts·=·7·THEN·GOTO·restart
NEXT
restart:
idx=0
counts=0
GOTO·main
Post Edited (LEDboy) : 1/23/2010 1:49:23 AM GMT
| use for a digital tachometer. I am programming on a Parallax
| BASIC stamp and have a few questions regarding proper
| interfacing. First off: when do I send the Load Enable pulse?
| Do I set it high, shift out the data MSBfirst, then set LE Low?
| Or is it LOW, SHIFT, HIGH? Next, I have tied OE to ground via a
| 10K resistor as I read that this sets it low (as to not interfere
| with the normal operation of the chip. Is this a good idea?
| Lastly, Can I send my data as a 16 bit binary number with 0
| corresponding to an LED on and 1 corresponding with an LED off?
| I tried this and it seemed that the LED's all turned on
| irregardless of my numbers. I would expect a string such as
| %1111111111111100 to turn on LED's on port 0 and 1, but that
| didn't happen."
I submitted that email to customer service and they sent me this reply:
| When the LE is HIGH the LATCH is transparent, meaning any data on
| shift register is transfered to the LATCH. When LE is LOW the
| contents of the LATCH don't change (even if the shift register
| contents are changing, the output latch contents won't change).
|
| 1. "When do I sent the Load Enable pulse" : The LE enable pulse
| should be sent after the 16 bits are clocked in to the shift
| register. If you look at figure 2; the LE pulse is given after
| the 16 bits are clocked in at DIN. So you can give a LE low
| (while the 16 bits are being clocked in at DIN) then a LE pulse
| once the 16 bits are clocked in.
|
| 2. "OE tied to ground via a 10k resistor)" : The MAX6969 will
| follow the voltage at the OE pin to enable/disable the outputs.
| And if the voltage at OE is less than (0.3*V+) it will treat the
| OE as a LOW voltage (page 2). In typical applications the OE
| signal is generated by the micro-processor & are pulled LOW or
| HIGH. If you want to OE to be constantly be at GND; just tie it
| to GND directly.
|
| 3. Regarding your last question, you are right, a bit 0 will
| correspond to LED on and bit 1 will correspond to LED off.
|
| If all LED's are ON regardless of the numbers; that means the
| timing may not be right. The output latch is not getting the
| intended 16-bits you are clocking in.
|
| Regards,
| Maxim applications
I have tied the OE pin to ground via a 10K. LEDboy: Is there any way I can eliminate the pause 50 after HIGH LE and before the lookup table, because I originally intended the lookup table to serve as my pause. Also, I noticed that the MAXIM customer service rep mentioned something about the timing, is this why the pause 1000 should be changed to a pause 50?
Thanks!
' {$PBASIC 2.5}
DIN CON 15
Clk CON 14
LE CON 13
LEd_Wait CON 1
DATA_VAR CON %1111111111111110
DO
HIGH LE
PAUSE LED_Wait
SHIFTOUT DIN, Clk, MSBFIRST, [noparse][[/noparse]DATA_VAR\16]
PAUSE LED_Wait
LOW LE
LOOP
There is a piece of test code. I am a bit confused by timing, and I don't seem to be able to turn just one LED on. It seems like a POV device, I just have to keep pulsing one LED to make it "appear" on, but from what I've seen from the manual, that shouldn't be the case. Eliminating the pauses (or making them like 5ms) seems to be the best solution so far.
Here is a revised copy of my original code:
' {$STAMP BS2sx}
' {$PBASIC 2.5}
'Test code for BS2sx running a MAX 6969 chip. Updated 1/23/10
DIN CON 15 'Data Input (Pin 2 on MAX 6969)
Clk CON 14 'Clock Input (Pin 3 on MAX 6969)
LE CON 13 'Latch Enable (Pin 4 on MAX 6969)
value VAR WORD '16 bit binary value for LED on/off state
idx VAR NIB 'Index variable (0-15), currently only 0-7 b/c I'm only using 8 LED's
'Data values for LED's turning on
one CON %1111111111111110
two CON %1111111111111100
three CON %1111111111111000
four CON %1111111111110000
five CON %1111111111100000
six CON %1111111111000000
seven CON %1111111110000000
eight CON %1111111100000000
nine CON %1111111000000000
ten CON %1111110000000000
eleven CON %1111100000000000
twelve CON %1111000000000000
thirteen CON %1110000000000000
fourteen CON %1100000000000000
fifteen CON %1000000000000000
sixteen CON %0000000000000000
main:
FOR idx = 0 TO 15 'have 8 repetitions
HIGH LE 'Latch enable high, accepts new data
PAUSE 1
LOOKUP idx, [noparse][[/noparse]one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen], value 'Lookup data based on the index variable in order to get the proper number of LED's to turn on
SHIFTOUT DIN,CLK,MSBFIRST,[noparse][[/noparse]value\16] 'Shift 16 bit data out MSBfirst
LOW LE 'Latch enable low, display data
PAUSE 1
idx=idx+1 'Go on to next number
IF idx = 15 THEN GOTO restart
NEXT
restart: 'used to go back to zero and start counting up again
idx=0
GOTO main
' {$PBASIC 2.5}
DIN CON 15
Clk CON 14
LE CON 13
DATA_VAR CON %1111111111111110
Setup:
·HIGH LE
Main:
·DO
··
········ SHIFTOUT DIN, Clk, MSBFIRST, [noparse][[/noparse]DATA_VAR\16]
· PULSOUT LE, 5
· PAUSE 100
·LOOP
·END
·It· dose· tell you what· (n) is
Table 1. 4-Wire Serial-Interface Truth Table
H R1 R2 … Rn-2 Rn-1······ What is Rn - #
L L R1 R2 … Rn-2 Rn-1
X R0 R1 R2 … Rn-1 Rn
X X X … X X H R0 R1 R2 — Rn-1 Rn
— — P1 P2 P3 … Pn-1 Pn L P0 P1 P2 … Pn-1 Pn L P0 P1 P2 … Pn-1 Pn····· What Pn- #
X X X … X X H Hi-Z Hi-Z Hi-Z … Hi-Z Hi-Z
L = Low-logic level.
H = High-logic level.
X = Don’t care.
P = Present state.
R = Previous state.
Hi-Z = High impedance.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
I do not understand the part in red
4-Wire Serial Interface
The serial interface on the MAX6969
is a 4-wire serial interface using four inputs (DIN, CLK, LE, OE)<<I think you need to use all four for this to work
·and adata output (DOUT).
·This interface is used to write display data to the MAX6969.
The serial-interface data word length is 16 bits, D0–D15. See Figure 2.
The functions of the five interface pins are as follows. DIN is the serial-data input, and must be stable when itis sampled on the rising edge of CLK. Data is shifted in, MSB first.
This means that data bit D15 is clocked in first, followed by 15 more data bits finishing with the LSB, D0.
CLK is the serial-clock input, which shifts data at DIN into the MAX6969 16-bit shift register on its rising edge.
LE is the latch load input of the MAX6969 that transfers data from the MAX6969 16-bit shift register to its 16-bit latch when LE is high (transparent latch), an
d latches the data on the falling edge of LE (Figure 2).
The fourth input provides output-enable control of the output drivers.
If I understand this part right you have use this in your code but sure how to write·the code
OE is high to force outputs OUT0–OUT15 high impedance, without altering the contents of the output latches, and low to enable outputsOUT0–OUT15 to follow the state of the output latches.
OE is independent of the operation of the serial interface.
Data can be shifted into the serial-interface shift register and latched, regardless of the state of OE.
DOUT is the serial-data output, which shifts data out from the MAX6969’s 16-bit shift register on the rising edge of CLK.
·Data at DIN is propagated through the shift register and appears at DOUT 16 clock cycles later.
Can some one explane how to read and understand the
Figure 2. 4-Wire Serial-Interface Timing Diagram
What dose··t_-_-_-·mean it term of how to the write the code to make it work
Figure 3. LE and CLK to OUT_ Timing
tLRF
tLRR
tCRF
tCRR
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 1/24/2010 3:01:25 AM GMT
Sam,
You only need to use DIN,CLK,LE...you can tie OE stright to ground.· You only need to use OE is if you plan on using the DOUT pin
As far as Table 1.· 4-Wire Serial_Interface Truth Table
When DIN is "H" than CLK rises and D0 goes "H" and D1 = R1 (Previous state) so with that said...
When DIN goes High then CLK rises and the shift-Regs contents of D0·goes HIGH and D1 - D15 stay in their previous states While LE is High the Latch Contents of D0 - D15 stay in their previous states.
When DIN goes Low then CLK rises and the shift-Regs contents of D0 goes Low and D1 - D15·change to the present state (you turned them on)·while LE is Low the Latch Contents D0 - D15 are updated to the prestent state you made them and OE is Low so whatever LEDs you wanted turned on should be on... Why this happens is because you set LE LOW and latched the data you supplied into the shift registers
tLRR stands for LE Rising to OUT_ Rising Delay....if you look at page three you can see what the symbols mean.
tLRF stands for LE Rising to OUT_ Falling Delay
tCRF stands for CLK Rising to OUT_ Falling Delay
tCRR stands for CLK Rising to OUT_ Rising Delay....You only need to worry about Figure 3 if you are going to use the DOUT Pin.
Post Edited (LEDboy) : 1/24/2010 4:20:22 AM GMT
LEDboy
Thank you for explaining those item to me that help alot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
So far I havn't been able to fully turn any one LED off. I'm also using the pulsout command (as reccomended by LEDboy). It seems that the LED's that are supposed to be off just flicker, while the ones that are on are solid. It also appears that they "ripple" from outputs 0-15. I thought that the data was shifted out MSB first, so the binary %1111111111111110 would just light the led on d0, but that doesn't appear to be the case.
Try this and see if it works:
' {$STAMP BS2sx}
' {$PBASIC 2.5}
DIN CON 15
Clk CON 14
LE CON 13
DATA_VAR CON %1111111111111110
Setup:
LOW LE
Main:
DO
SHIFTOUT DIN, Clk, MSBFIRST, [noparse][[/noparse]DATA_VAR\16]
PULSOUT LE, 5
PAUSE 100
LOOP
END
Redline,
·· Take out the DO.....LOOP statement.· That will help with the flickering....Theres no need to put it in a loop.....all its doing is updating the data with the same data it already has.
Post Edited (LEDboy) : 1/29/2010 5:37:08 AM GMT