OK. Let's try the instant interrupts. I have just added the II codes and it looks like this:
Code:
@ ERRORLEVEL -306 ; turn off crossing page boundary message
@ __CONFIG _CONFIG1, _CP_OFF & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _XT_OSC
INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
ASM
;T0IF = TMR0IF
;T0IE = TMR0IE
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR2_INT, _tick, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE TMR2_INT ; Enable Timer 1 Interrupts
'------- initial --------------------
TMR2_clock VAR WORD
OPTION_REG = %00000000
' INTCON = %11000000 ' enable interrupts ->NOW COMMENTED
TRISB = %00000000 ' portb all output
TRISA = %00111111 ' some analog inputs
ANSEL = %00001111 ' some analog inputs
CMCON = %00000111 ' turn of comparators
ADCON1 = %10000000' right justified
T2CON = %00000011 ' TMR2 prescale 1:16 --> TESTED WITH POST and PRESCALER (1:16)
'---------------------------------------------------
TMR2_clock = 0
Lcdout $FE,1 ' clear screen
PR2 = 194 ' load tmr2 PR2 to reset every 1ms
'PIE1.1 = 1 ' enable TMR2 interrupt -> NOW COMMENTED
'PIR1.1 = 0 ' disabled interrupt flag - TMR2 -> NOW COMMENTED
T2CON.2 = 1 ' turn TMR2 on
'ON INTERRUPT GOTO tick -> -> NOW COMMENTED
MAIN:
Lcdout $FE,$A0, DEC TMR2_clock ---> CHANGED
GOTO MAIN
tick:
TMR2_clock = TMR2_clock + 1
IF TMR2_clock = 500 THEN
TMR2_clock = 0
' Set some flag..
ENDIF
@ INT_RETURN
Well.. the LCD gets cleared. No text at all..
What's wrong?
Thank you.
Sylvio
Bookmarks