Added HSERVOINT_SERVO# interrupts(# = 0 to 31). These ints trip once at the end of any movement. t The interrupt handler is called just before the last servo pulse of this movement. This last pulse is already calculated and nothing you do in the interrupt handler will effect this pulse(unless you trash registers you shouldn't in an asm handler). Any hservo command changes will take effect after this pulse. A 0 rate hservo movement will cause the int to trip on the next pulse after the hservo command.
Can use with ONINTERRUPT or ONASMINTERRUPT
Same rules apply as with any asm interrupts. You have to save any trashed registers.
Here is a simple example program:
Code:
enablehservo
ONINTERRUPT HSERVOINT_SERVO0,handler_hservo0
ONINTERRUPT HSERVOINT_SERVO1,handler_hservo1
servo0 var long
servo1 var long
servo0=0
servo1=0
hservo [p0\0,p1\0] ;causes end of movement interrupts to trip
main
goto main
handler_hservo0
servo0=servo0+1
if(servo0=1)then
hservo [p0-16000200]
endif
if(servo0=2)then
hservo [p08000100]
endif
if(servo0=3)then
hservo [p0-8000200]
endif
if(servo0=4)then
hservo [p016000100]
servo0=0
endif
resume
handler_hservo1
servo1=servo1+1
if(servo1=1)then
hservo [p1-16000200]
endif
if(servo1=2)then
hservo [p18000100]
endif
if(servo1=3)then
hservo [p1-8000200]
endif
if(servo1=4)then
hservo [p116000100]
servo1=0
endif
resume