Hi,
I'm trying to interpret a signal from an RC receiver using a PIC16f627. I'm going on the receiver sending a pulse every 20ms and the length of that pulse determining the position of the joystick on the controller. I'd just like to know if I have the timing of my pin testing correct, my code is:
And servo delay is given by the code:
I think my problem is that the code makes my sample time more than 20ms but I'm not sure can anyone tell me if it is or not?
If you want to see the full code you can get the .asm files here. The code above is from RC Cobra LED C. The other file bridge_oisin is an attempt I made to redo someone else's code but it didn't work properly either I'm not sure why.
Thanks in advance for any help
I'm trying to interpret a signal from an RC receiver using a PIC16f627. I'm going on the receiver sending a pulse every 20ms and the length of that pulse determining the position of the joystick on the controller. I'd just like to know if I have the timing of my pin testing correct, my code is:
Rich (BB code):
;**** All Input Pulse Test ****
Pulse_Check MOVLW D'10'
MOVWF T_10
MOVLW D'10'
MOVWF Ind_T
MOVLW D'210'
MOVWF IN1_S
MOVLW D'210'
MOVWF IN2_S
MOVLW D'210'
MOVWF IN3_S
INC_T2 MOVLW D'200'
MOVWF T_200
IN1_Check call Servo_Delay
BTFSC PORTA,IN1
DECFSZ IN1_S,1
goto IN2_Check
IN2_Check BTFSC PORTA,IN2
DECFSZ IN2_S,1
goto IN3_Check
IN3_Check BTFSC PORTA,IN3
DECFSZ IN3_S,1
goto INC_T
INC_T DECFSZ T_200,1
goto IN1_Check
DECFSZ Ind_T,1
goto INC_T3
INC_T3 DECFSZ T_10,1
goto INC_T2
Rich (BB code):
Servo_Delay
;6 cycles
goto $+1
goto $+1
goto $+1
;4 cycles (including call)
return
If you want to see the full code you can get the .asm files here. The code above is from RC Cobra LED C. The other file bridge_oisin is an attempt I made to redo someone else's code but it didn't work properly either I'm not sure why.
Thanks in advance for any help