Not exactly the above situation but i kept trying different things, i got stucked a little on Acidtech Int solution for capturing pulses so i went back to the pulsein solution to test other things until i fully understand the int approach.
This time I used the bit banged pulsin function to read 3 pins and scale the readings for driving 3 servos attached to pins 10-12 using HPWM function. It works ok when only one HPWM sentence is present, if you add a second the three servos start oscillating, here it is the code:
[code]
canal1 var word
canal2 var word
canal3 var word
control_loop
PULSIN P4,0,canal1
PULSIN P5,0,canal2
PULSIN P6,0,canal3
serout S_OUT,i9600,"ch1 ", dec canal1, " ", "ch2 ", dec canal2, " ", "ch3 ", dec canal3,13]
canal1 = (canal1-900)*12+16000
canal2 = (canal2-900)*12+16000
canal3 = (canal3-900)*12+16000
HPWM 10,320000,canal1 ; if only one HPWM sentence it works ok
HPWM 11,320000,canal2 ; adding this new HPWM line generate jitters in all 3 servos
HPWM 12,320000,canal3 ; same as above
goto control_loop[/code]
Alan,
Thanks for the interesting link! but i need the serial channel free for telemetry tasks
ps. I also discovered that HSERVO interferes in some way with PULSEIN reading, is there any way to stop the HSERVO service while executing PULSEIN and then reactivate it?