Does GCBASIC have a function/command to measure the width of a pulse (Input in PIC). I see a PulseOut command to send a pulse but is there anything for measuring pulses?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Like for decoding a RC or servo signal? I had a tough time trying to pin down exact timing, whether running a 20mhz osc, or an internal 8mhz osc. You could try starting and stopping one the Timers. My inconclusive, and perhaps erroneous?, Timer tests showed up to a 20% variation from the wait routines they captured.
#define PPM PortA.5
dir PortA.5 in
...
...
Do While PPM On
wait 5 us ;weird time but works, int osc?
TimerHigh = TimerHigh + 1
Loop
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well the beauty of GCBasic is you can make up whatever command that you want. With something as simple as a servo command, it should be easy to just make a small subroutine.
Say like:
...
...
Servo(RServo,200)
...
...
Sub Servo(servo1,pulse1)
Set Servo1 On ;could use Pulseout?
wait pulse1 10us
set Servo1 Off
wait 18 ms
End sub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does GCBASIC have a function/command to measure the width of a pulse (Input in PIC). I see a PulseOut command to send a pulse but is there anything for measuring pulses?
Like for decoding a RC or servo signal? I had a tough time trying to pin down exact timing, whether running a 20mhz osc, or an internal 8mhz osc. You could try starting and stopping one the Timers. My inconclusive, and perhaps erroneous?, Timer tests showed up to a 20% variation from the wait routines they captured.
#define PPM PortA.5
dir PortA.5 in
...
...
Do While PPM On
wait 5 us ;weird time but works, int osc?
TimerHigh = TimerHigh + 1
Loop
Exactly... for R/C servos signals.
I'll give that a shot. Thanks.
Too bad there is no "SERVO" command either...
Well the beauty of GCBasic is you can make up whatever command that you want. With something as simple as a servo command, it should be easy to just make a small subroutine.
Say like:
...
...
Servo(RServo,200)
...
...
Sub Servo(servo1,pulse1)
Set Servo1 On ;could use Pulseout?
wait pulse1 10us
set Servo1 Off
wait 18 ms
End sub
That's great for controlling servos (via PIC output & pulseout)... but I need to read/measure the servo signal (same PWM signal seen by servo).
whoops, misunderstood what you meant by "Servo" command. Is that a documented command for Pic Basic or some other Basic?