Hello everyone
I'm trying to use Instant Interrupts with the PT_INT interrupt (PWM time base) in my code.
I'm using a 18F2431 with a 40MHz clock frequency. My PWM interrupt frequency is about 15kHz (PTPER=333).
With a code like that (with no interrupt, just waiting the PIR3.4 flag in a loop), it works very well :
However, this code below should give me the same results and execute my PWM ISR at each PWM pulse, but it doesn't work :Code:DEFINE OSC 40 ' PCPWM registers configuration PTCON0=%00000010 PTCON1=%10000000 PWMCON0=%01000000 PWMCON1=%00000001 DTCON=%00110110 PTPERH=$1:PTPERL=$4d ' PWM ISR pwmint: ' Wait PIR3 interrupt while PIR3.4=%0 wend PIR3.4=%0 . . . (there is my PWM code) . . . GOTO pwmint
I need helpCode:DEFINE OSC 40 INCLUDE "DT_INTS-18.bas" ' Base Interrupt System INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts ' PCPWM registers configuration PTCON0=%00000010 PTCON1=%10000000 PWMCON0=%01000000 PWMCON1=%00000001 DTCON=%00110110 PTPERH=$1:PTPERL=$4d ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler PT_INT, _pwmint, PBP, yes endm INT_CREATE ; Creates the interrupt processor ENDASM @ INT_ENABLE PT_INT ' PWM ISR pwmint: ' Wait PIR3 interrupt PIR3.4=%0 . . . (there is my PWM code) . . . @ INT_RETURNthanks



thanks



Bookmarks