I do not understand this result. The gist is that the pulse generating command seems to influence
the interrupt frequency. Here is exactly our same code with a PULSOUT PORTD.7, 50 inside the
interrupt routine.
Code:
OSCCON = %01100000 '4 Mhz
DEFINE OSC 4
LED1 VAR PORTD.4
wsave VAR BYTE $70 SYSTEM
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, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
'5.0 mSec OR 200 Hz INTERRUPTS
T1CON = %00000001 'Prescaler = 1:1, TMR1ON
'PRELOAD 60543
PreLoad VAR WORD
PreLoad = 60543
TMR1L = PreLoad.LowByte
TMR1H = PreLoad.HighByte
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main: 'DO WHATEVER YOU WANT HERE
' PAUSE 1000
' HIGH PORTD.7
' PAUSE 1000
' LOW PORTD.7
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
TOGGLE LED1
pulsout PORTD.7,50
' PWM PORTD.7,127,1
' TOGGLE PORTC.6 'CONNECTED TO METER
TMR1L = PreLoad.LowByte ' Load the timer with preload value.
TMR1H = PreLoad.HighByte
@ INT_RETURN
And here's the LOGIC TOOL picture.
Bookmarks