Getting started in PIC micro development. I've done a couple of hello world style blinking LED and speaker circuits to cut my teeth on, but would to to progress from here. Just wanted to know if there was a PULSIN command possibly in the works. Looking at hooking up a 12F629 to monitor a spare channel on my R/C car receiver to turn lights on and off (possibly other things later on, baby steps ;) ).
Any idea for how I would go about monitoring a servo pulse that swings from limit to limit without a PULSIN command?.
Thanks in advance,
Ross
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The undocumented PULSIN command is in the stdbasic.h include/lowlevel folder. The macro/sub shown below gives the syntax expected.
'PulseIn
macro PulseIn (Pin, Variable, Units)
Variable = 0
Do While Pin = On
Wait 1 Units
Variable += 1
If Variable = 0 Then Exit Do
Loop
end macro
The other way to accomplish this is to just use the Do While loop, with the appropriate wait state. In the case of the servo decode, a 'wait 10 us' works best. You might also expect the RC receiver to invert the signal, and would therefore use, Do While Pin = Off.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
Getting started in PIC micro development. I've done a couple of hello world style blinking LED and speaker circuits to cut my teeth on, but would to to progress from here. Just wanted to know if there was a PULSIN command possibly in the works. Looking at hooking up a 12F629 to monitor a spare channel on my R/C car receiver to turn lights on and off (possibly other things later on, baby steps ;) ).
Any idea for how I would go about monitoring a servo pulse that swings from limit to limit without a PULSIN command?.
Thanks in advance,
Ross
The undocumented PULSIN command is in the stdbasic.h include/lowlevel folder. The macro/sub shown below gives the syntax expected.
'PulseIn
macro PulseIn (Pin, Variable, Units)
Variable = 0
Do While Pin = On
Wait 1 Units
Variable += 1
If Variable = 0 Then Exit Do
Loop
end macro
The other way to accomplish this is to just use the Do While loop, with the appropriate wait state. In the case of the servo decode, a 'wait 10 us' works best. You might also expect the RC receiver to invert the signal, and would therefore use, Do While Pin = Off.