I have a design with a 3 digit 7 segment multiplexed display that showed a certain value. The circuit and the code worked fine while the display was about the only thing the PIC had to do.

Now, I tried to use Darrel's "DT_INTS-14.bas" as I need a few other things done in the code as well.

The chip is a 16F887.

My observations; the display flickers a lot; changing the prescaler to 1:1 is still bad, but better than other settings. Pre-loading TMR1 with any value seems to have no effect.

What am I doing wrong?


ANSEL = 0
ANSELH = 0
CM1CON0.7 = 0
CM2CON0.7 = 0

TRISA = 0
TRISB = 0
TRISC = 0
TRISD = 0
TRISE = 0

N VAR BYTE

SEGDEF VAR BYTE

INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _DISP, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM

T1CON = $1
; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts

Main:


'********************
TMR1H = %11111111
TMR1L = %11110111
'********************

toggle stat_LED
pause 500

GOTO Main

'---[TMR1 - interrupt handler]--------------------------------------------------
DISP: N = 1
GOSUB BIN2SEG
PORTC = SEGDEF
PORTE = 6
PAUSE 3

N = 2
GOSUB BIN2SEG
PORTC = SEGDEF
PORTE = 5
PAUSE 3

N = 3
GOSUB BIN2SEG
PORTC = SEGDEF
PORTE = 3
PAUSE 3

@ INT_RETURN

BIN2SEG:LookUp n,[132,175,193,137,170,152,144,143,128,136,210,251],SEGDEF

Return