Is there a way to use an assembly lookup table from within a DT INTS ASM interupt? When I try, the interrupt locks up on me. If I comment out the CALL SineTable, all is fine. I have tried it a few different ways, but no go so far.
Code:INCLUDE "DT_INTS-18.bas" ; Base Interrupt System LOW LED1 high led2 ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler TMR1_INT, ToggleLED1, ASM, yes endm INT_CREATE ; Creates the interrupt processor ENDASM T1CON = $31 ; Prescaler = 8, TMR1ON @ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts Main: @ NOP GOTO Main '---[TMR1_INT - interrupt handler]------------------------------------------ ASM ToggleLED1 btg _LED1 ; toggle the pin btg _LED2 StepLoop movf _STEPCOUNT,W ; Pass table offset via W call SineTable ; Get table value movwf CCPR1L decfsz _STEPCOUNT,F ; Next step goto $+6 movlw d'32' movwf _STEPCOUNT ;_STEPCOUNT ; Load counter for 32 steps NOP NOP NOP NOP INT_RETURN SineTable addwf WREG ;added for pic18f each address is 16 bits addwf PCL,F retlw d'0' ; Dummy table value retlw d'128' ; 0 degree, 2.5 volt retlw d'148' retlw d'167' retlw d'185' retlw d'200' retlw d'213' retlw d'222' retlw d'228' retlw d'230' ; 90 degree, 4.5 volt retlw d'228' retlw d'222' retlw d'213' retlw d'200' retlw d'185' retlw d'167' retlw d'148' retlw d'128' ; 180 degree, 2.5 volt retlw d'108' retlw d'89' retlw d'71' retlw d'56' retlw d'43' retlw d'34' retlw d'28' retlw d'26' ; 270 degree, 0.5 volt retlw d'28' retlw d'34' retlw d'43' retlw d'56' retlw d'71' retlw d'89' retlw d'108' ENDASM




Bookmarks