Using a MAX7219 with SHIFTOUT
John Couture
Posts: 370
Using a MAX7219 with SHIFTOUT
=============================
Definition:
A MAX7219 is a chip that enables you to control up to
eight 7 segement digits using just three pins on your
mcu.· (Datasheet attached).
Problem:
·· Just trying to setup a simple test where I control the
·· 7 seg digits on the Prof Dev Board using a MAX7219.
···(source code attached)
··
Setup:
·· SX28
·· Prof Dev Board (PDB)
·· MAX7219
··
Connections: (pin connections pg 1)
·· RB.0 is DQ·· (pin 01 on 7219)
·· RB.1 is LOAD (pin 12)
·· RB.2 is Clk· (pin 13)
··
·· 7 seg displays connected (seg A-G)
·· digit control connected (dig 0-4)··
·· power (19), ground (4,9)
·· pull-high resistor, 10k, (18)
·· DOUT (24) connected to an LED0 on PDB··
··
Experiment:
·· 1) Timing Diagram (pg 6) says to set LOAD to
····· LOW during data send and then toggle HIGH
····· once done sending 16 bits.
·····
·· 2) 7219 expects 16 bit packet (see pg 6),
····· the MSB 8 are control, LSB 8 are data.
·····
·· 3) Using SX/B command:
··
·· SHIFTOUT DQ,Clk,MSBFirst,$03· ' to indicate Digit 3
·· SHIFTOUT DQ,Clk,MSBFirst,$04· ' to display a 4
·····
Observation:
·· 1) I observed that LED0 briefly blinks each cycle
····· indicating that SOMETHING is coming OUT of the
····· 7219 implying that SOMETHING must be going
····· INTO the 7219 (I know, wishful thinking).
·····
Goal:
·· To write a program that will read the DS1307 on
·· the PDB and display the time on the 7 seg displays
·· also on the PDB.· SX/B has sample code for doing
·· something similar but it runs the LEDs directly
·· and uses many pins.· The MAX7219 will only use
·· three pins.··
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
=============================
Definition:
A MAX7219 is a chip that enables you to control up to
eight 7 segement digits using just three pins on your
mcu.· (Datasheet attached).
Problem:
·· Just trying to setup a simple test where I control the
·· 7 seg digits on the Prof Dev Board using a MAX7219.
···(source code attached)
··
Setup:
·· SX28
·· Prof Dev Board (PDB)
·· MAX7219
··
Connections: (pin connections pg 1)
·· RB.0 is DQ·· (pin 01 on 7219)
·· RB.1 is LOAD (pin 12)
·· RB.2 is Clk· (pin 13)
··
·· 7 seg displays connected (seg A-G)
·· digit control connected (dig 0-4)··
·· power (19), ground (4,9)
·· pull-high resistor, 10k, (18)
·· DOUT (24) connected to an LED0 on PDB··
··
Experiment:
·· 1) Timing Diagram (pg 6) says to set LOAD to
····· LOW during data send and then toggle HIGH
····· once done sending 16 bits.
·····
·· 2) 7219 expects 16 bit packet (see pg 6),
····· the MSB 8 are control, LSB 8 are data.
·····
·· 3) Using SX/B command:
··
·· SHIFTOUT DQ,Clk,MSBFirst,$03· ' to indicate Digit 3
·· SHIFTOUT DQ,Clk,MSBFirst,$04· ' to display a 4
·····
Observation:
·· 1) I observed that LED0 briefly blinks each cycle
····· indicating that SOMETHING is coming OUT of the
····· 7219 implying that SOMETHING must be going
····· INTO the 7219 (I know, wishful thinking).
·····
Goal:
·· To write a program that will read the DS1307 on
·· the PDB and display the time on the 7 seg displays
·· also on the PDB.· SX/B has sample code for doing
·· something similar but it runs the LEDs directly
·· and uses many pins.· The MAX7219 will only use
·· three pins.··
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
pdf
187K
Comments
This driver is blanked on startup. It has to be turned on. Then it never hurts to set PWM (0-31).
Second, the latch/load line has to present a rising edge after data is shifted. It's like saying "do it". So after every 16 bits, if you want to see that info on the driver, you need to pulse the /CS-load pin. Not sure if you have the segs wired for automatic hex decode or raw control of the segments, so you may need to set the mode you want also. See the datasheet for register assignments.
So presuming you have everything hooked up properly, you might want something like:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
http://forums.parallax.com/forums/default.aspx?f=7&m=448191
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College