Bill Legge
- 1st August 2009, 03:26
I'm using a PIC18F8722 at 40 MHz to display data on 7-Segment displays.
There are 8 digits on each display
Each display is driven by a MAX7219 driver.
Initially, I had three displays, each on it's own port - all worked OK.
Then, to save ports, I daisy-chained the displays (Data_out of one MAX7219 to Data_in of the next). Clock and Data in parallel to all three MAX7219
Initially, all worked Ok with this chain and then:
1. After a few minutes, the third display (last in the chain) went blank.
2. Over the next half hour the second display dimmed and finally turned off.
3. Then the first display froze on '88888888'
The voltage without the displays connected in 4.97 and with all three displays connected it is 4.94, so i don't think suppy voltage is the problem?
Too high a load for the port?
Recompiling to run at 10 MHz makes no difference.
The connections between the PIC and displays is via 10-way IDC and ribbon cable.
Anyone experienced difficulties daisy-chaining displays/MAX7219?
' ************************************************** ***************************
' * *
' * File...... 8722 Segments Daisey chained displays with MAX7219 *
' * Purpose... PIC18F8722 on BIGPIC5 *
' * Date...... July 2009 *
' * *
' ************************************************** ***************************
' 1. PIC18F8722 on BIGPIC5 @ 40 MHz
' 2. Three display boards each with 8 digits controlled by MAX7219 drivers
' 3. All displays daisy-chained (Data_out to Data_in) on PORTE
define OSC 40 ' Define Xtal as 20 MHz, use "HSPLL" for programming
include "modedefs.bas" ' Include serout defines
Z var word
I var byte
DataPin var PORTE.0 ' For ETT display
ClockPin var PORTE.2 ' For ETT display
Load var PORTE.1 ' For ETT display
ADCON1 = %00001111 ' All ports digital
CMCON = $07 ' Comparators OFF
INTCON = $80 ' Turns off interrupts. See PBP page 187
TRISA=0 : TRISB=0 : TRISC=0 : TRISD=0 : TRISE=0 : TRISF=0 : TRISG=0 : TRISH=0 : TRISJ=0
PORTA=0 : PORTB=0 : PORTC=0 : PORTD=0 : PORTE=0 : PORTF=0 : PORTG=0 : PORTH=0 : PORTJ=0
' Clear displays:
low load
shiftout datapin,clockpin,1,[$0F, $00] ' 3rd Display Test mode off
shiftout datapin,clockpin,1,[$0F, $00] ' 2nd Display Test mode off
shiftout datapin,clockpin,1,[$0F, $00] ' 1st Display Test mode off
high load
low load
shiftout datapin,clockpin,1,[$09, $FF] ' Decode register - decode all 8 digits
shiftout datapin,clockpin,1,[$09, $FF] ' Decode register - decode all 8 digits
shiftout datapin,clockpin,1,[$09, $FF] ' Decode register - decode all 8 digits
high load
low load
shiftout datapin,clockpin,1,[$0A, $0F] ' Intensity register - 32/32 brightness
shiftout datapin,clockpin,1,[$0A, $0F] ' Intensity register - 32/32 brightness
shiftout datapin,clockpin,1,[$0A, $0F] ' Intensity register - 32/32 brightness
high load
low load
shiftout datapin,clockpin,1,[$0B, $07] ' Scan limit register - display all digits
shiftout datapin,clockpin,1,[$0B, $07] ' Scan limit register - display all digits
shiftout datapin,clockpin,1,[$0B, $07] ' Scan limit register - display all digits
high load
low load
shiftout datapin,clockpin,1,[$0C, $01] ' Shutdown register - normal operation
shiftout datapin,clockpin,1,[$0C, $01] ' Shutdown register - normal operation
shiftout datapin,clockpin,1,[$0C, $01] ' Shutdown register - normal operation
high load
for i=1 to 8
low load
shiftout datapin,clockpin,1,[i, $0F] ' Clear all digits
shiftout datapin,clockpin,1,[i, $0F] ' Clear all digits
shiftout datapin,clockpin,1,[i, $0F] ' Clear all digits
high load
next I
' ************************************************** ***************************
' * *
' * MAIN *
' * *
' ************************************************** ***************************
Main:
for Z= 0 to 64000
for I=0 to 4
low load
shiftout datapin,clockpin,1,[I+1,Z dig I] ' 3rd Display
shiftout datapin,clockpin,1,[I+1,Z dig I] ' 2nd Display
shiftout datapin,clockpin,1,[I+1,Z DIG I] ' 1st Display
high load
next I
pause 300
next Z
for i=1 to 8
low load
shiftout datapin,clockpin,1,[i,$F] ' Clear all digits
shiftout datapin,clockpin,1,[i,$F] ' Clear all digits
shiftout datapin,clockpin,1,[i,$F] ' Clear all digits
high load
next I
goto main
end
There are 8 digits on each display
Each display is driven by a MAX7219 driver.
Initially, I had three displays, each on it's own port - all worked OK.
Then, to save ports, I daisy-chained the displays (Data_out of one MAX7219 to Data_in of the next). Clock and Data in parallel to all three MAX7219
Initially, all worked Ok with this chain and then:
1. After a few minutes, the third display (last in the chain) went blank.
2. Over the next half hour the second display dimmed and finally turned off.
3. Then the first display froze on '88888888'
The voltage without the displays connected in 4.97 and with all three displays connected it is 4.94, so i don't think suppy voltage is the problem?
Too high a load for the port?
Recompiling to run at 10 MHz makes no difference.
The connections between the PIC and displays is via 10-way IDC and ribbon cable.
Anyone experienced difficulties daisy-chaining displays/MAX7219?
' ************************************************** ***************************
' * *
' * File...... 8722 Segments Daisey chained displays with MAX7219 *
' * Purpose... PIC18F8722 on BIGPIC5 *
' * Date...... July 2009 *
' * *
' ************************************************** ***************************
' 1. PIC18F8722 on BIGPIC5 @ 40 MHz
' 2. Three display boards each with 8 digits controlled by MAX7219 drivers
' 3. All displays daisy-chained (Data_out to Data_in) on PORTE
define OSC 40 ' Define Xtal as 20 MHz, use "HSPLL" for programming
include "modedefs.bas" ' Include serout defines
Z var word
I var byte
DataPin var PORTE.0 ' For ETT display
ClockPin var PORTE.2 ' For ETT display
Load var PORTE.1 ' For ETT display
ADCON1 = %00001111 ' All ports digital
CMCON = $07 ' Comparators OFF
INTCON = $80 ' Turns off interrupts. See PBP page 187
TRISA=0 : TRISB=0 : TRISC=0 : TRISD=0 : TRISE=0 : TRISF=0 : TRISG=0 : TRISH=0 : TRISJ=0
PORTA=0 : PORTB=0 : PORTC=0 : PORTD=0 : PORTE=0 : PORTF=0 : PORTG=0 : PORTH=0 : PORTJ=0
' Clear displays:
low load
shiftout datapin,clockpin,1,[$0F, $00] ' 3rd Display Test mode off
shiftout datapin,clockpin,1,[$0F, $00] ' 2nd Display Test mode off
shiftout datapin,clockpin,1,[$0F, $00] ' 1st Display Test mode off
high load
low load
shiftout datapin,clockpin,1,[$09, $FF] ' Decode register - decode all 8 digits
shiftout datapin,clockpin,1,[$09, $FF] ' Decode register - decode all 8 digits
shiftout datapin,clockpin,1,[$09, $FF] ' Decode register - decode all 8 digits
high load
low load
shiftout datapin,clockpin,1,[$0A, $0F] ' Intensity register - 32/32 brightness
shiftout datapin,clockpin,1,[$0A, $0F] ' Intensity register - 32/32 brightness
shiftout datapin,clockpin,1,[$0A, $0F] ' Intensity register - 32/32 brightness
high load
low load
shiftout datapin,clockpin,1,[$0B, $07] ' Scan limit register - display all digits
shiftout datapin,clockpin,1,[$0B, $07] ' Scan limit register - display all digits
shiftout datapin,clockpin,1,[$0B, $07] ' Scan limit register - display all digits
high load
low load
shiftout datapin,clockpin,1,[$0C, $01] ' Shutdown register - normal operation
shiftout datapin,clockpin,1,[$0C, $01] ' Shutdown register - normal operation
shiftout datapin,clockpin,1,[$0C, $01] ' Shutdown register - normal operation
high load
for i=1 to 8
low load
shiftout datapin,clockpin,1,[i, $0F] ' Clear all digits
shiftout datapin,clockpin,1,[i, $0F] ' Clear all digits
shiftout datapin,clockpin,1,[i, $0F] ' Clear all digits
high load
next I
' ************************************************** ***************************
' * *
' * MAIN *
' * *
' ************************************************** ***************************
Main:
for Z= 0 to 64000
for I=0 to 4
low load
shiftout datapin,clockpin,1,[I+1,Z dig I] ' 3rd Display
shiftout datapin,clockpin,1,[I+1,Z dig I] ' 2nd Display
shiftout datapin,clockpin,1,[I+1,Z DIG I] ' 1st Display
high load
next I
pause 300
next Z
for i=1 to 8
low load
shiftout datapin,clockpin,1,[i,$F] ' Clear all digits
shiftout datapin,clockpin,1,[i,$F] ' Clear all digits
shiftout datapin,clockpin,1,[i,$F] ' Clear all digits
high load
next I
goto main
end