RC switch
Posted: Thu Aug 17, 2006 2:55 pm
I have made a board using a PIC 08 chip which takes the pulse of the rx and gives an on/off/reverse output using a L293 motor control chip. I have put 2 leds on the output to check direction. However the output is picking up alot of noise. I have tried putting error detection in, however i have been unable to get a smoother output. The simple code i have atm is:
symbol Pulse_Lenth = b0
main:
pulsin 4,1,Pulse_Lenth
if Pulse_Lenth >= 145 and Pulse_Lenth <= 165 then Set_Off
if Pulse_Lenth >= 90 and Pulse_Lenth <= 144 then Set_For
if Pulse_Lenth <= 210 and Pulse_Lenth >= 166 then Set_Rev
if Pulse_Lenth > 210 or Pulse_Lenth < 90 then Set_Off
goto main
Set_Off:
high 2
high 1
goto main
Set_For:
high 1
low 2
goto main
Set_Rev:
high 2
low 1
goto main
I tried counting the number of out of range pulses, and if this was above 500 then stop, if the pulse was in range -50 from the counter. However there was no respoce from the output, the output continued its current direction until it got a valid signal or and error occured. Has anyone got any suggestions?
Thanks
symbol Pulse_Lenth = b0
main:
pulsin 4,1,Pulse_Lenth
if Pulse_Lenth >= 145 and Pulse_Lenth <= 165 then Set_Off
if Pulse_Lenth >= 90 and Pulse_Lenth <= 144 then Set_For
if Pulse_Lenth <= 210 and Pulse_Lenth >= 166 then Set_Rev
if Pulse_Lenth > 210 or Pulse_Lenth < 90 then Set_Off
goto main
Set_Off:
high 2
high 1
goto main
Set_For:
high 1
low 2
goto main
Set_Rev:
high 2
low 1
goto main
I tried counting the number of out of range pulses, and if this was above 500 then stop, if the pulse was in range -50 from the counter. However there was no respoce from the output, the output continued its current direction until it got a valid signal or and error occured. Has anyone got any suggestions?
Thanks