helenevans
- 20th August 2005, 17:48
hello all,
i'm working on a project which drives a row of number displays with the Maxim7219 which is in turn driven from a pic16f627. The pic16f627 gets it's instructions using 'serin' which is sent to it by an external computer. I'm using no decode so i can access the segments directly and a 4 mhz crystal.
Thanks to alot of the previous posts, everything almost works perfectly, apart from a strange, recurrent problem. After about 3 minutes, the last digit in the row goes out of synch. Then, all the numbers go to full brightness. Then 4 out of five digits turn off completely. To get the set up running again, i have to shut off and on the power and then everything is ok again...for another three minutes. It seems to be a problem somewhere between the PIC and the Maxim, as this happens even if i stop using the serin from the computer.
Any ideas?
i have added 10k pull down resistors to clk, data,load.
and I have posted the code below...
Cheers,
helen
'''''''''''''''''''''''''
Device = 16F627
XTAL = 4
DIM IDnr as byte 'registers adress
DIM value as byte 'registers data
DIM digit as byte 'which digit
DIM current as byte 'curent digit data
SYMBOL datapin = PORTB.1 'orange
SYMBOL clkpin = PORTB.2 'brown
SYMBOL load1 = PORTB.3 'red
DIM byt_01 as byte '1st header byte
DIM byt_02 as byte '2nd header
DIM byt_03 as byte 'read 1st byte
DIM byt_04 as byte
DIM byt_05 as byte
DIM byt_06 as byte
DIM byt_07 as byte
'''''''''''''''''''''''''INIT MAXIM
IDnr=12
value=1
GOSUB configure 'init shutdown
IDnr=9
value=0
GOSUB configure 'init decode mode
IDnr=11
value=4
GOSUB configure 'init scanlimit
IDnr=10
value=1
GOSUB configure 'init intensity
IDnr=15
value=0
GOSUB configure 'init testmode/normal operation
delayms 1000
'''''''''''''''''''''''''
main:
SERIN PORTB.0, 16468, [byt_01]
byt_01 = dec byt_01
if byt_01=170 then 'this is the 1st header number
SERIN PORTB.0, 16468, [byt_02]
gosub check
end if
goto main
'''''''''''''''''''''''''
check:
byt_02 = dec byt_02 'this is the second header number
if byt_02 = 20 then
SERIN PORTB.0, 16468, [byt_03] 'now get 5 bytes from pc
SERIN PORTB.0, 16468, [byt_04]
SERIN PORTB.0, 16468, [byt_05]
SERIN PORTB.0, 16468, [byt_06]
SERIN PORTB.0, 16468, [byt_07]
end if
for digit = 1 to 5
current = LOOKUPl digit, [byt_03,byt_04,byt_05,byt_06,byt_07]
SHIFTOUT datapin, clkpin, MSBFIRST, [digit] 'digit adress
SHIFTOUT datapin, clkpin, MSBFIRST, [current] 'digit data
PULSOUT load1, 3
next
return
''''''''''''''''''''''''' CONFIGURE MAXIMS: add line for each LOAD/ROW
configure:
SHIFTOUT datapin, clkpin, MSBFIRST, [IDnr] 'adress
SHIFTOUT datapin, clkpin, MSBFIRST, [value] 'data
PULSOUT load1, 3
RETURN
'''''''''''''''''''''''''FIN
i'm working on a project which drives a row of number displays with the Maxim7219 which is in turn driven from a pic16f627. The pic16f627 gets it's instructions using 'serin' which is sent to it by an external computer. I'm using no decode so i can access the segments directly and a 4 mhz crystal.
Thanks to alot of the previous posts, everything almost works perfectly, apart from a strange, recurrent problem. After about 3 minutes, the last digit in the row goes out of synch. Then, all the numbers go to full brightness. Then 4 out of five digits turn off completely. To get the set up running again, i have to shut off and on the power and then everything is ok again...for another three minutes. It seems to be a problem somewhere between the PIC and the Maxim, as this happens even if i stop using the serin from the computer.
Any ideas?
i have added 10k pull down resistors to clk, data,load.
and I have posted the code below...
Cheers,
helen
'''''''''''''''''''''''''
Device = 16F627
XTAL = 4
DIM IDnr as byte 'registers adress
DIM value as byte 'registers data
DIM digit as byte 'which digit
DIM current as byte 'curent digit data
SYMBOL datapin = PORTB.1 'orange
SYMBOL clkpin = PORTB.2 'brown
SYMBOL load1 = PORTB.3 'red
DIM byt_01 as byte '1st header byte
DIM byt_02 as byte '2nd header
DIM byt_03 as byte 'read 1st byte
DIM byt_04 as byte
DIM byt_05 as byte
DIM byt_06 as byte
DIM byt_07 as byte
'''''''''''''''''''''''''INIT MAXIM
IDnr=12
value=1
GOSUB configure 'init shutdown
IDnr=9
value=0
GOSUB configure 'init decode mode
IDnr=11
value=4
GOSUB configure 'init scanlimit
IDnr=10
value=1
GOSUB configure 'init intensity
IDnr=15
value=0
GOSUB configure 'init testmode/normal operation
delayms 1000
'''''''''''''''''''''''''
main:
SERIN PORTB.0, 16468, [byt_01]
byt_01 = dec byt_01
if byt_01=170 then 'this is the 1st header number
SERIN PORTB.0, 16468, [byt_02]
gosub check
end if
goto main
'''''''''''''''''''''''''
check:
byt_02 = dec byt_02 'this is the second header number
if byt_02 = 20 then
SERIN PORTB.0, 16468, [byt_03] 'now get 5 bytes from pc
SERIN PORTB.0, 16468, [byt_04]
SERIN PORTB.0, 16468, [byt_05]
SERIN PORTB.0, 16468, [byt_06]
SERIN PORTB.0, 16468, [byt_07]
end if
for digit = 1 to 5
current = LOOKUPl digit, [byt_03,byt_04,byt_05,byt_06,byt_07]
SHIFTOUT datapin, clkpin, MSBFIRST, [digit] 'digit adress
SHIFTOUT datapin, clkpin, MSBFIRST, [current] 'digit data
PULSOUT load1, 3
next
return
''''''''''''''''''''''''' CONFIGURE MAXIMS: add line for each LOAD/ROW
configure:
SHIFTOUT datapin, clkpin, MSBFIRST, [IDnr] 'adress
SHIFTOUT datapin, clkpin, MSBFIRST, [value] 'data
PULSOUT load1, 3
RETURN
'''''''''''''''''''''''''FIN