PDA

View Full Version : R/C Servo pulse Monitor



Harddkyss
- 24th February 2007, 06:12
This is just a little Servo Pulse Code to monitor PPM Signals and output it to a Terminal Window via RS232 Comm's .9 to 2.0 PPM.
################################################## ##
'Defines
Define LOADER_USED 1
define osc 20
Include "modedefs.bas"

F1 con 6 'frequency input pin
W0 var word

loop:
Pulsin F1,1,W0 'Measure Input Pulse
w0 = (W0*/500) 'Some math to Convert from (mµ)Microseconds to (ms)Milliseconds

Serout2 portc.6,32,["ms= ", dec (w0/1000), ".", dec3 w0,13] 'Send Data out Port C pin 6 @ 19,200 Baud

pause 25 'Little Buffer to quite things down
Goto loop

malc-c
- 24th February 2007, 10:51
Could you elaborate a bit more on it.. what PIC have you used to test it on ?

Acetronics2
- 24th February 2007, 11:14
Fun ...


And, after all those years, I didn't know PbP was supporting decimal calculations ...

Or may be this is some binary arithmetics ( 0,1 ) demo ...

Wow ... I think I'll have to retire !!!

Steve ... you were right, I get old !!!

Alain

Harddkyss
- 24th February 2007, 16:20
I've tried it on 16F628(A), 16F88,16F876(A),16F877(A),etc......pretty much all of the 16F Picmicro Family will work fine.

Acetronics2
- 25th February 2007, 11:38
[QUOTE=Harddkyss;33261]

Pulsin F1,1,W0 'Measure Input Pulse

> Let's say the result is 750 ( Neutral position : 1500µS )

w0 = (W0*/500) 'Some math to Convert from (mµ)Microseconds to (ms)Milliseconds

> 750 * 500 / 256 = 1464 ... instead of 1500 !!!

500/256 = 1.953125 ...

Now ...

> 750 * 2 = 1500 ... or 750 << 1 .

Always do it simple !!!

Alain

Yes, it was showing " something " .... False !

Harddkyss
- 25th February 2007, 15:23
What OSC frequency you using...??

Acetronics2
- 25th February 2007, 15:54
What OSC frequency you using...??

Me ??? none

YOU : define osc 20

Calculations made from that ...

That's all !!!

Alain

PS ... may be you use a resonnator ???

Harddkyss
- 25th February 2007, 16:00
Weird....Scales correctly on my end with no problems, I eventually made a ESC to Control Powerchair Motors and this was just a snippet of code to aid in designing stuff from R/C Signals....