I would do it like this. Change PULSE_PIN for the second channel
Code not tested but should give some idea how to use timer 1
Code:PIE.0 = 1 'Enable timer 1 overflow flag T1CON = 0 'Timer 1 stopped, internal clock PULSE_OUT VAR WORD START: PULSE_OUT = 1500 'Servo center value PULSE_OUT = $FFFF - PULSE_OUT 'Timer 1 counts upwards TMR1H = PULSE_OUT.HIGHBYTE TMR1L = PULSE_OUT.LOWBYTE 'Set timer 1 PULSE_PIN_1 = 1 'Start pulse T1CON.0 = 1 'Start timer 1 WHILE PIE1.0 = 0 : WEND 'Wait for Timer 1 overflow PULSE_PIN_1 = 0 'End pulse T1CON.0 = 0 'Stop timer 1 PIE1.0 = 0 'Reset overflow flag 'wait 20ms ............................. GOTO START




Bookmarks