Hi guys,
I'm currently creating a project to learn with and it's all working except for one small thing. It uses 3 7-segment displays to basically create a counter that increases on an interrupt using a PIC16F685. I am using interrupt code from another forum post, could have been on here so I don't really understand it just yet. The rest of the code is my own as I have fiddled with multiplexing before. Here is the code I will post the problem after:
Code:
define OSC 4
'LEDTOP --> PORTC.0
'LEDTOPLEFT --> PORTC.1
'LEDTOPRIGHT --> PORTC.2
'LEDMIDDLE --> PORTC.3
'LEDBOTTOMRIGHT --> PORTC.4
'LEDBOTTOM --> PORTC.5
'LEDBOTTOMLEFT --> PORTC.6
'SEG1 --> PORTB.7
'SEG2 --> PORTB.5
'SEG3 --> PORTB.6
TRISA = %11111111
TRISB = %00000000
TRISC = %00000000
ADCON1=%00000111
ANSELH=0
ANSEL=0
CM1CON0=0
CM2CON0=0
num VAR WORD
var1 VAR WORD
var2 VAR WORD
var3 VAR WORD
num=0
DisArray var byte[10]
DisArray(0) = %01110111
DisArray(1) = %01000010
DisArray(2) = %01101101
DisArray(3) = %00111101
DisArray(4) = %00011110
DisArray(5) = %00111011
DisArray(6) = %01111010
DisArray(7) = %00010101
DisArray(8) = %01111111
DisArray(9) = %00111111
OPTION_REG = %00111000
INTCON.2 = 0
INTCON.5 = 1
TMR0 = $FF
On Interrupt Goto incNum
loop:
var1 = num DIG 2
var2 = num DIG 1
var3 = num DIG 0
GOSUB selseg1
PORTC = DisArray(var1)
pause 5
GOSUB selseg2
PORTC = DisArray(var2)
pause 5
GOSUB selseg3
PORTC = DisArray(var3)
pause 3
goto loop
disable
incNum:
If INTCON.2 = 1 then
num = num + 1
endif
TMR0 = $FF
INTCON.2 = 0
RETURN
ENABLE
Selseg1:
portb = %01111111
RETURN
Selseg2:
portb = %11011111
Return
Selseg3:
portb = %10111111
RETURN
End
It is creating a feint shadow of the 3rd segments number on the 1st segment. In other words if I make it display the number "123", it displays the number perfectly clear, but if you look closesly or in a dark room you can see the number "3" over the number "1".
I have tried fiddling with the delays but I can't get it right. Thanks 
Ross Steytler
Bookmarks