Originally Posted by malc-c
Ahh posted edit right as I posted hehe. Yea thats the same thing I get![]()
Originally Posted by malc-c
Ahh posted edit right as I posted hehe. Yea thats the same thing I get![]()
Hi, Gecko
Some little gags here and there ... but try it !!!
'12F675
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF ' clock source internal
OPTION_REG.5 = 0
DEFINE PULSIN_MAX 2500
DEFINE OSCCAL_1K 1
CMCON = 7 'Tout digital pour 12F675
ADCON0 = 0 'ADC off "
ANSEL = 0
VRCON = 0
Pulselen var Byte ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
Init var Byte ' Init used to flash LED
Compte var Byte
In var GPIO.3
Led var GPIO.1
Clear ' set all variables = 0
TRISIO = %001000
High Led
ReadPWM:
PulsIn In, 1,Pulselen ' pin 4 - read high pulse length, times out after .65535 seconds
If Pulselen < 80 OR Pulselen > 220 Then
Pause 15
Compte = Compte + 1
IF Compte // 16 THEN
Pulsout Led, 10000
ENDIF
Else
HIGH Led
ENDIF
GoTo ReadPWM
END
I'll do better next time ...
Alain
PS: ... breadboard verified .... Yess !!!
Last edited by Acetronics2; - 26th August 2006 at 10:25.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Looking at the manual it states
Maybe the the pulsein statement is reaching the 65535 counts before the end of the pulse width and thus is setting the value of pulselen to 0 which will always cause the code to jump to the flash led section.If the pulse edge never happens
or the width of the pulse is too great to measure, Var is set to zero.
Alain,
Now we're getting somewhere... when the TX is powered the LED is constant, when the TX is off (ie no signal beeing transmitted) the LED falshes...
However when the TX is on and the channel that is connected has its state changed (ie gear switch on CH5) nothing happens. Now could this be down to the fact that its detecting a sync pulse and not the actual channel PPM pulse ?
Well there are no sync pulses coming out of the rx, just a nice train of 1ms pulses at 20ms intervals
Hi, Malc - the - bass - beat - filter - forum ...
I do not understant your question so well ...
When the transmitter is on ( and good link to Rx !!! ) the received channels durations are ALWAYS in the 800 - 2200 µS range ...
WHATEVER you do with your sticks and switches ...
THE ONLY exception is the LM1872 IC coder where pulses can " disappear" from the frame. But I didn't see such circuit in any of our R/C dedicated radios for, at least 30 years ...
I Think you're mixing memory switch and missing ( or wrong ) pulse detector ...
Nothing has to happend on a stick position change, here ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Don't talk to me about base beat filters!!
Let me explain the test rig. I,m using a simple GWS 8ch RX. Ch5 is a straight switched channel on the TX. Ch5 on the RX is connected to the input pin on the PIC. With power applied to the RX and the TX turned on with the switch in one position you get a nice train of 1ms pulses appearing on the PIC input. - There is no mixining involved.
I think whats happening here is we are getting confused over Dan's requirements are. He doesn't want to simply detect the presence of a signal, he needs to detect the change of state of that pulse from 1ms width to 2ms. So maybe the IF/THEN statement should read if pulselen <150 flash LED else LEDS is solid ??
Does pulsein measure the time between positive going pulses, or is it triggered by the positive going pulse, then measures the time in 10us chuncks until it goes negative ? The reason I ask is that if it measures from one positive going pulse to the next then the value will be 20ms (or 2000 counts) and will thus always invoke a "no signal" responce ??
Heuuuuuu,
Who's that DAN ????
and what does he do in this thread ... may be your castle's ghost ???
gecko was looking for a signal/no signal indicator ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks