TMR2INT

TMR2_INT -- TMR2 to PR2 Match Interrupt

Uses PIR1,TMR2IF, PIE1,TMR2IE Registers and Control Bits.
Uses PIR1,T2IF, PIE1,T2IE Registers and Control Bits. -- PR2 Match alt
TMR2 to PR2 Match Interrupt

DT's Interrupts MUST be used with PicBasic Pro and MPASM.

The following block of instructions will establish the interrupt used and the PBP label (your ISR) to jump to once interrupt occurs. Remember; all PBP labels or variables used inside ASM code blocks must be preceded by the underscore,( _TimeOut). All instruction to the interrupt processor should be in ASM and preceded by the @ symbol and to the far left column of the editor if not included in other ASM code blocks.
Example:
@ INT_DISABLE TMR2_INT

ASM

 INT_LIST     macro     ;IntSource      Label,    Type,    ResetFlag?
            INT_Handler   TMR2_INT     _TimeOut   PBP       Yes
            endm
            INT_CREAT               ;Creates the interrupt processor
            INT_ENABLE    TMR2_INT  ;enables TMR2 interrupts

ENDASM

Command functions:
INT_CREATE ;Creates the interrupt processor
INT_ENABLE TMR2_INT – to enable TMR2 interrupt
INT_DISABLE TMR2_INT – disable TMR2 interrupt.
INT_CLEAR TMR2_INT -- clear flags
INT_RETURN ------------- To restore and return to the program where interrupt was made.

NOTE See datasheet for specific details of operation.

The Timer2/4/6 output signal (TMRx-to-PRx match) provides the input for the 4-bit counter/postscaler. This counter generates the TMRx match interrupt flag which is latched in TMRxIF of the PIRx register.

TMR2 counts up to the PR2 value + 1, then resets and interrupts.

<< TMR1_INT | 14-bit sources | TMR4_INT >>

Page last modified on March 20, 2018, at 03:40 PM