Hi everybody,
I want to obtain servo control pulses. 50Hz (1520us center puls) using a 16F88 TMR0 interrupt. Running 8MHz (therefore 2MHz from FOSC/4) with 1/256 prescaler.
In the interrupt handler right after entry, I preload the TMR0 counter then PULSOUT. It is a very basic code.
It seems that the counter pauses during the PULSOUT because the outcoming signal's period is lengthened by the puls duration.
I tried different TMR0 values. Some does work fine some doesn't. By working fine I mean that the outcoming signal's period (therefore frequency) doesn't change with regard to puls duration.
Any idea?
Code for the interrupt handler:
DISABLE
INTERRUPT_HANDLER:
TMR0=160 'Tried different values here. Some work fine some doesn't.
PULSOUT SERVO, Duration 'SERVO is a SYMBOL for PORTA.2
LOW SERVO 'Just a precaution...
INTCON.2=0 'Interrupt flag cleared.
RESUME
ENABLE
Bookmarks