PDA

View Full Version : max7219 and pic16f627



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

Acetronics2
- 21st August 2005, 10:32
Hi, Helenevans

And what about power dissipation in the 7219 ??? did you check the maximum current available for the digits ?

No floating inputs ( Ck Enable or so ) ... for 7219 ???

Alain

helenevans
- 21st August 2005, 14:06
hi Alain,
thanks for your reply.
After the Maxim we have a high current circuit to drive the digits.

I just checked with an osciliscope to see what is happening when it has stopped working. The PIC is fine. The Maxims puts all the Segs to ground (therfore, off) and all the Digits are 5v (except, strangely Digit3)

The other thing i noticed is that when the digits starts to misbehave, i can see a lot of noise (or pulsing) in the 5v that goes to both the Pic and the maxim. I have just put a diode in to protect the maxim's 5volt supply and for the moment this seems to have solved the problem. i will post again if this hasn't worked.

best,
helen

Acetronics2
- 21st August 2005, 14:19
and just an idea ...

What if you make transmission a bit slowlier ??? ... (DEFINE SHIFT_PAUSEUS 100 i.e. )

Alain

mister_e
- 21st August 2005, 15:27
<img src=http://www.picbasic.co.uk/forum/attachment.php?attachmentid=439&stc=1>

helenevans
- 22nd August 2005, 01:16
thanks for all the responses.
So the problem has come back again. One thing i've done is to re-initialise the maxims, every now and again, so at least they come back to life eventually. but it's far from an ideal solution.

I have put a pause in as Acetronics suggests (although i need the speed) and they do keep going for much longer. but eventually they too, pack up (!)

the speed, yes, maybe this is the issue. i guess most people don't want to change them so rapidly...
Looking at the data sheet, I presume i need to consider the Pulse Width High (which is 50nS)? How can i calculate the right pauses and when to put them, to put the pic in synch with the maxims?
Sorry, i'm sure this is all pretty basic stuff...

any further thoughts, i'd be happy to hear them,
best, Helen

mister_e
- 22nd August 2005, 03:23
ARRGH i didn't notice how you did your code...


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

you must

enable the load line
use the shiftout
disable the load line

how about using something like


for digit = 1 to 5
current = LOOKUPl digit, [byt_03,byt_04,byt_05,byt_06,byt_07]

LOW Load1
SHIFTOUT datapin, clkpin, MSBFIRST, [digit] 'digit adress
SHIFTOUT datapin, clkpin, MSBFIRST, [current] 'digit data
HiGH load1
PAUSE 10
next


but more than likely


for digit = 1 to 5
current = LOOKUPl digit, [byt_03,byt_04,byt_05,byt_06,byt_07]

LOW Load1
SHIFTOUT datapin, clkpin, MSBFIRST, [digit,current]
HiGH load1
PAUSE 10
next


EDIT: It remind me a previous post => http://www.picbasic.co.uk/forum/showthread.php?t=879&highlight=tach%2A+max%2A

helenevans
- 24th August 2005, 16:56
hmm, thanks for that.
i was really hopeful, but it still doesn't solve the problem.
I was wondering if its worth getting hold of a max7221, perhaps they are more robust against EM interference?
I have currently testing with two separate rows of 5 digits (each with their own pic). there is definately some kind of current flow problem as when one come on, the other will die etc.

the other post, is interesting as the problem is very similar. However, i have already put the two capacitors between the 5v and the gnd . Any harm in increasing the values?
further thoughts, always welcome :)

mister_e
- 25th August 2005, 04:40
mmm, i should buy few of those one day!

No harm if you raise the cap value of course. BUT is the voltage regulator gives enough power? Is he come really hot. Those crapy 7805 will ruine your life when they comes hot !!!

A separate voltage regulator for the MAX could work... well case by case i guess!

Leonardo
- 25th August 2005, 17:10
Hello Helevans, You can send the scheme... that he wishes that makes the circuit.

Greetings




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