Hi all. I have been making r/c led lighting circuits which are turned on or off via a spare r/x channel PPM pulse
Here is an example of code to detect an on pulse greater than 170ms using an 08M pin 4
start:
pulse:
pulsin 3,1,b2 ; read pulse on pin 4
if b2 < 170 then pulse ; if pulse is less than 1.7ms then go back to pulse and read again
if b2 >= 170 then go ; if pulse is greater than 1.7ms goto go start running led flash pattern
go:
'flashing program here
goto pulse ;go back to pulse and make sure state has not changed.
It can often be a pain having to plug in a spare rx and setting the transmitter up just to test the circuit.
I tried to write a short code after looking at data sheet for a 08M to generate a pulse to drive the input pin of the circuit to be tested:-
start:
main:
pulsout 4,180 ;generate a pulse of 1.8ms on pin 3 08M
pause 20 ; wait 20ms
goto main
I know its rough. Tried it but it did not work. Not got access to a scope but logic probe was pulsing away on pin 3. Put the r/x on instead and it worked.
I must be overlooking something obvious. Scratching my head.
Any ideas anyone.
cheers
Ash
Here is an example of code to detect an on pulse greater than 170ms using an 08M pin 4
start:
pulse:
pulsin 3,1,b2 ; read pulse on pin 4
if b2 < 170 then pulse ; if pulse is less than 1.7ms then go back to pulse and read again
if b2 >= 170 then go ; if pulse is greater than 1.7ms goto go start running led flash pattern
go:
'flashing program here
goto pulse ;go back to pulse and make sure state has not changed.
It can often be a pain having to plug in a spare rx and setting the transmitter up just to test the circuit.
I tried to write a short code after looking at data sheet for a 08M to generate a pulse to drive the input pin of the circuit to be tested:-
start:
main:
pulsout 4,180 ;generate a pulse of 1.8ms on pin 3 08M
pause 20 ; wait 20ms
goto main
I know its rough. Tried it but it did not work. Not got access to a scope but logic probe was pulsing away on pin 3. Put the r/x on instead and it worked.
I must be overlooking something obvious. Scratching my head.
Any ideas anyone.
cheers
Ash
Last edited: