Rc signal help


Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 40 of 43

Thread: Rc signal help

  1. #1
    Join Date
    Aug 2006
    Posts
    91

    Default Rc signal help

    I have read quite a bit on this and most sources point to using PulsIn.

    I found some code on the web for another chip and am trying to modify it for 12F675 but am getting no love.

    Code:
    '12F675
    @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    OPTION_REG.5 = 0                                                       ' clock source internal
    
    Pulselen   var Byte                                                 ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
    Init       var Byte                                                 ' Init used to flash LED
    Clear                                                                  ' set all variables = 0
    
    Input GPIO.3                                                           ' set pin 5 to RX signal
    
    ReadPWM:
       PulsIn GPIO.3, 1,Pulselen                 ' pin 4 - read high pulse length, times out after .65535 seconds 
       pause 15                   
       If Pulselen < 50 Then GoTo Blink           ' no signal  -> blink led
       If Pulselen > 50 Then GoTo Solid           ' signal  -> Solid led
       GoTo ReadPWM               
            
    Blink: 
       For Init = 1 To 3                                                   ' blink led 3 times
          High GPIO.1                                                      
          pause 200                                                      
          Low GPIO.1                                                     
          pause 200                                                      
       Next
    pause 1000		    
     GoTo ReadPWM 
     
    Solid: 
          High GPIO.1                                                      
          pause 3000                                                      
          Low GPIO.1
          pause 200
     GoTo ReadPWM
    It should blink when no signal and be solid when there is but it seems to do whatever it wants no matter what signal I try and send it.

    Is it the config settings?
    Last edited by geckogrotto; - 25th August 2006 at 12:23.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Your program jumps to the same location whatever the pulsewidth is:
    Code:
    ReadPWM:
       PulsIn GPIO.3, 1,Pulselen                 ' pin 4 - read high pulse length, times out after .65535 seconds 
       pause 15                   
       If Pulselen < 50 Then GoTo Blink     '<----HERE......
       If Pulselen > 50 Then GoTo Blink     '<----and HERE.....
       GoTo ReadPWM
    Change the the second If statement to
    Code:
    If Pulselen > 50 then Goto Solid
    HTH
    /Henrik Olsson.

  3. #3
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Yea that was an accident when I retyped to simplify the code but its fixed now and still doesn't work.

    I also added this
    CMCON = 7 ' PortA Digital inputs

    I think this chip starts as analog or something still no help.
    Last edited by geckogrotto; - 25th August 2006 at 12:27.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default

    Hi,
    The 'F675 has one comparator AND an A/D converter.
    The comparator is turned off with CMCON=7 and the the pins for the A/D is set to digital only with ANSEL=0.

    However....

    You're using GP3 for your input and that pin is not connected to either the comparator or the A/D so none of the above should really matter but I'm not sure. GP3 is however the MCLR pin and it seems you have a typo in your config setting. I THINK it should be MCLR_OFF and not MCLRE_OFF. - try it.

    Also, you're using a byte-size variable to store the pulsewidth, try switching that to a Word instead.

    /Henrik Olsson.

  5. #5
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson
    Hi,
    The 'F675 has one comparator AND an A/D converter.
    The comparator is turned off with CMCON=7 and the the pins for the A/D is set to digital only with ANSEL=0.

    However....

    You're using GP3 for your input and that pin is not connected to either the comparator or the A/D so none of the above should really matter but I'm not sure. GP3 is however the MCLR pin and it seems you have a typo in your config setting. I THINK it should be MCLR_OFF and not MCLRE_OFF. - try it.

    Also, you're using a byte-size variable to store the pulsewidth, try switching that to a Word instead.

    /Henrik Olsson.

    I tried swapping back and forth on ANSEL and CMCON neither seem to make a difference. Also when I change to MCLR_OFF it errors and will not even compile.

    I tried using word as well no luck.

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default No problem w/ MPLAB

    Hi, gecko

    No problem compiling with MPASM 7.41 and PbP 2.46a ...

    Error [ 118 ] is to forget when using @ __config

    May be add END ... at the end !!!, but that's not compulsory ( good habit then ... )

    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 " !!!
    *****************************************

  7. #7
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics
    Hi, gecko

    No problem compiling with MPASM 7.41 and PbP 2.46a ...

    Error [ 118 ] is to forget when using @ __config

    May be add END ... at the end !!!, but that's not compulsory ( good habit then ... )

    Alain

    I'm not sure I understand what your saying exactly but.
    Code:
    '12F675
    @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLR_OFF & _CP_OFF
    DEFINE OSC 4 
    OPTION_REG.5 = 0                                                       ' clock source internal
    CMCON = 7 
    ANSEL=0
    
    Pulselen   var word                                                 ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
    Init       var word                                                 ' Init used to flash LED
    Clear                                                                  ' set all variables = 0
    
    Input GPIO.3                                                           ' set pin 5 to RX signal
    
    ReadPWM:
       PulsIn GPIO.3, 1,Pulselen                 ' pin 4 - read high pulse length, times out after .65535 seconds 
       pause 15                   
       If Pulselen < 50 Then GoTo Blink           ' no signal  -> blink led
       If Pulselen > 75 Then GoTo solid           ' signal  -> Solid led
       GoTo ReadPWM               
            
    Blink: 
       For Init = 1 To 3                                                   ' blink led 3 times
          High GPIO.1                                                      
          pause 200                                                      
          Low GPIO.1                                                     
          pause 200                                                      
       Next
    pause 1000		    
     GoTo ReadPWM 
     
    Solid: 
          High GPIO.1                                                      
          pause 3000                                                      
          Low GPIO.1
          pause 200
     GoTo ReadPWM 
     END
    fails compile saying

    error 113 Symbol not previously defined (MLCR_OFF)

    When I use _MCLRE_OFF instead it compiles with no error.

  8. #8
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Just a few comments from my basic understanding of RC

    Code:
    Pulselen   var word        ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
    Init       var word          ' Init used to flash LED
    Clear                           ' set all variables = 0
    
    Input GPIO.4                ' set pin 3 to RX signal - changed as GPIO3 is not ideal
    
    ReadPWM:
       PulsIn GPIO.4, 1,Pulselen    ' pin 3 - read high pulse length, times out after .65535 seconds 
       pause 15                   
       If Pulselen < 50 Then GoTo Blink     ' no signal  -> blink led
       If Pulselen > 75 Then GoTo solid     ' signal  -> Solid led
       GoTo ReadPWM
    If you read the comments for pulselen it states that 100 = 1ms and 200 = 2ms, but your if / then statement states that if its less than 50 go blink. If you are monitoring a "normal" PPM signal from a receiver, the pulse length will be around 1ms for low stick and 2ms for full stick, with 1.5ms at centre. So even at low stick the signal will be 1ms or a pulse length of 100, it will never be lower than 50, and this the code will never jump to flash.

    I too had to change the config line to MCLRE_OFF for it to program without error

    EDIT:
    Oh and one other thing that may be causing the problem is that the RX will be sending the PPM pulse every 20ms, so you will need to get the timing right so that the pin is checked for a pulse at the right time. According to code it times out after .65535 seconds, maybe you need to make this time out after 20ms so it loops back round. Most of my experiments with other languages used the pre-scaler to get the timer to roll over at the desired timing if a pulse wasn't present. Maybe some of the more experienced guys can jump in here as I don't know if PBP features this option ?
    Last edited by malc-c; - 26th August 2006 at 00:53.

  9. #9
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Thank Melanie

    '12F675
    @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic12F675, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic12F675, WDT_OFF
    ' Watchdog Timer
    @ DEVICE pic12F675, CPD_OFF


    DEFINE OSC 4
    OPTION_REG.5 = 0 ' clock source internal
    CMCON = 7
    ANSEL=0

    Pulselen var word ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
    Init var word ' Init used to flash LED
    Clear ' set all variables = 0

    Input GPIO.3 ' set pin 5 to RX signal

    ReadPWM:
    PulsIn GPIO.3, 1,Pulselen ' pin 4 - read high pulse length, times out after .65535 seconds
    pause 15
    If Pulselen < 50 Then GoTo Blink ' no signal -> blink led
    If Pulselen > 75 Then GoTo solid ' signal -> Solid led
    GoTo ReadPWM

    Blink:
    For Init = 1 To 3 ' blink led 3 times
    High GPIO.1
    pause 200
    Low GPIO.1
    pause 200
    Next
    pause 1000
    GoTo ReadPWM

    Solid:
    High GPIO.1
    pause 3000
    Low GPIO.1
    pause 200
    GoTo ReadPWM
    END

  10. #10
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    ugg that doesn't compile either
    A bunch of illegal opcode warnings and errors
    207 and 122.

  11. #11
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    This is what the author of the original code said to me.

    That clock is much faster (meaning the 12F657) . The 12c508 has a 4Mhz clock. The return from Pulsin for the 12c508 is: 100 = 1.0 ms, 150 = 1.5 ms, 200 = 2.0 ms. You need to adjust the numbers to whatever your PIC returns in Pulsin. I have not looked at the data sheet. It will be there somewhere, or in the help data for your compiler.

    Maybe this is the problem?

  12. #12
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Really?

    It compiled without error on my PBP ver 2.47, I don't mean to be rude, Did you remember to select the appropriate device in the compiler (IDE) up at the top? I am confused are we talking about a 12F675, a 12f657, or a 12c508?
    It shows 199 words compiled for 12F675, it will not compile for a 12c508 or 12f508 as is. As for if it will work or not, that's beyond the scope of my examination, and likely ability, but it does compile as is.
    Last edited by Archangel; - 26th August 2006 at 07:00.

  13. #13
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    The reason it fails to compile is due to the config lines beginning with the @ sign. Change it to the format

    @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF

    and it compiles OK. This is due to using either PBP or MPSAM as the compiler.

  14. #14
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    What Malc said.
    whenever I use
    @ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic12F675, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic12F675, WDT_OFF
    ' Watchdog Timer
    @ DEVICE pic12F675, CPD_OFF

    it errors all over the place.

    @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    Works fine but HenrikOlsson said "I THINK it should be MCLR_OFF and not MCLRE_OFF. - try it."

    I'm not even sure thats were the problem is or why having the @ device lines like that fails.
    I have PBP 2.46 and MPLAB 7.41 MPSAM 5.04

    I still have no idea if thats the actual problem im having where the RC signal is basically ignored.

    Is anyone able to get this chip to actually work with RC signal with any settings?

  15. #15
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S.
    It compiled without error on my PBP ver 2.47, I don't mean to be rude, Did you remember to select the appropriate device in the compiler (IDE) up at the top? I am confused are we talking about a 12F675, a 12f657, or a 12c508?
    It shows 199 words compiled for 12F675, it will not compile for a 12c508 or 12f508 as is. As for if it will work or not, that's beyond the scope of my examination, and likely ability, but it does compile as is.

    Oh and yes I chose and am using 12F675

  16. #16
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    I've used the 12F675 as an RC switch and it works fine. The only thing is it was programmed in Assembler, and JAL (which I lost the notes on due to a PC crash).

    I'm sure its just a matter of getting the timing correct, so the PIC is able to detect and measure the pusle width of every pulse. As I mentioned above, the RX will be sending a pulse every 20ms, which is generally 1 - 2 ms in duration.

  17. #17
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Wouldn't holding the stick cause the signal to repeat and therefore catch it at some point?

    I have tried and assumed that it would eventually see the signal but never seems to see anything.

    I may have to go picaxe as I can't seem to dissect a data sheet.

  18. #18
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Well I just compiled the following and I get flashing LEDs (I haven't got the time this morning to hook up a receiver and test the reading of the PPM signal)

    Code:
    '12F675
    @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    
    
    DEFINE OSC 4
    OPTION_REG.5 = 0 ' clock source internal
    CMCON = 7
    ANSEL=0
    
    Pulselen var word ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
    Init var word ' Init used to flash LED
    Clear ' set all variables = 0
    
    Input GPIO.4 ' set pin 5 to RX signal
    
    ReadPWM:
    PulsIn GPIO.4, 1,Pulselen ' pin 4 - read high pulse length, times out after .65535 seconds
    pause 15
    If Pulselen < 50 Then GoTo Blink ' no signal -> blink led
    If Pulselen > 75 Then GoTo solid ' signal -> Solid led
    GoTo ReadPWM
    
    Blink:
    For Init = 1 To 3 ' blink led 3 times
    High GPIO.1
    pause 200
    Low GPIO.1
    pause 200
    Next
    pause 1000
    GoTo ReadPWM
    
    Solid:
    High GPIO.1
    pause 3000
    Low GPIO.1
    pause 200
    GoTo ReadPWM
    END
    The only change I made was to use GPIO.4 and not GPIO.3

    EDIT:
    OK so I couldn't go out without testing the code to see if it reads the PPM signal.. sorry to say it doesn't detect it
    Last edited by malc-c; - 26th August 2006 at 08:37.

  19. #19
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Malc bud when you get back could you try it for me?

    I get the blinking light as well that means it is seeing no signal. I can't seem to get it to go solid tho, well actually it does when it feels like it sometimes but not when im pressing the stick.

    This has been the problem the whole time just blinks how it wants and seemingly ignores any signal no matter what changes I make to the config or anything.

  20. #20
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c
    EDIT:
    OK so I couldn't go out without testing the code to see if it reads the PPM signal.. sorry to say it doesn't detect it

    Ahh posted edit right as I posted hehe. Yea thats the same thing I get

  21. #21
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    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 " !!!
    *****************************************

  22. #22
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Looking at the manual it states

    If the pulse edge never happens
    or the width of the pulse is too great to measure, Var is set to zero.
    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.

  23. #23
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    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 ?

  24. #24
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Well there are no sync pulses coming out of the rx, just a nice train of 1ms pulses at 20ms intervals
    Attached Images Attached Images  

  25. #25
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    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 " !!!
    *****************************************

  26. #26
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    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 ??

  27. #27
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Talking

    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 " !!!
    *****************************************

  28. #28
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Gecko and Dan are one and the same

  29. #29
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    soooooo,

    If Pulselen < 50 Then GoTo Blink ' no signal -> blink led
    If Pulselen > 50 Then GoTo Solid ' signal -> Solid led

    that's all !!!
    ************************************************** ***********************
    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 " !!!
    *****************************************

  30. #30
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Something is really screwed up !

    Code:
    ReadPWM:
       pulsin GPIO.4,1,Pulselen                  ' pin 3 - read high pulse length                  
       If Pulselen  > 0  Then GoTo Blink      ' on  -> blink led
       GoTo ReadPWM
    I've tried various settings for "if pulselen >" and it makes no difference, the code just won't jump to the blink led section. I also tried the RCTIME as it mentions in the manual that RCTIME measures the time it takes for a pulse to change state from on to off.. even that didn't work.

    Dan (Gecko) - maybe you can use your 16F628 as a test bead and hook up your LCD to display the value of pulselen for a 1ms signal, and 2ms signal and then use that to set the threshold ?

  31. #31
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Talking La Pallice already told it

    Nothing surprising Malc ...

    If Pulselen > 0 Then GoTo Blink ... means the only "Solid led" possibility is Tx ON, but no frame sent ( pupil switch ON, but
    no pupil Tx )

    Too Bad !!!

    Now, ... understand you've received info from Gecko ... and we didn't !!! .... difficult to understand each others then !!!
    Last edited by Acetronics2; - 26th August 2006 at 13:13.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  32. #32
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    varified that the output from the RX is being received on input pin of the PIC and still no joy

  33. #33
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Default

    Malc,

    An Update of this Thread would be welcome ...

    We do not know any more what is looked for, and what Gecko really wants ...
    or what YOU're looking for.

    Thanks for Everyone

    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 " !!!
    *****************************************

  34. #34
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics

    Now, ... understand you've received info from Gecko ... and we didn't !!! .... difficult to understand each others then !!!
    We've been communicating via e-mail when he started his pellet counter, and it was me that suggested he joined this forum... not received anything on this project so you are still in the loop !

  35. #35
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Im in US so was sleeping... Your in the loop you have missed nothing other than Malc knows my name lol.

    I want to be able to get the RX signal and tell weather the stick is left or right or center and flash the LED acordingly. Thats it, nothing overly complicated. I just got up and will be checking the latest code. From what I read from Malcs response its still no go.

    Ok to make it make more sense lets think of it as a blinker on a car.
    Left on the stick will cause the 1 blinker to blink right on the stick will cause another to blink and center will cause none to blink.

    I have been just trying to blink or solid a led but that may make more sense.

    Malc I will try the LCD and see what I get. Wish I had a serial connect some how.
    Last edited by geckogrotto; - 26th August 2006 at 18:17.

  36. #36
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Have you tried timers?

    Hi,

    I am not a big fan of PULSIN. It is sometimes hard to know what is happening so I prefer setting up timers to measure things myself. There are several posts in this forum how to use timers and it is really not that hard. If you pick a 16 bit timer and set the prescaler to 1:1 you can measure up to 65 ms without overflowing at 4 Mhz and 2.55 ms with a 8-bit timer and getting a nice resolution. The RC signal shouldn't be hard to catch this way.

    If you have tried everything else, Timers might be worth a try.



    /me
    Last edited by Jumper; - 26th August 2006 at 18:35.

  37. #37
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Ok im feeling really dumb but may have it worked out. Doing some tests
    Last edited by geckogrotto; - 26th August 2006 at 19:13.

  38. #38
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Ok man I found the problem it was infinite resistance between the keyboard and chair

    Its working now. Working on cleaning up the code and will post new code when i'm done... It wasn't my code that was the problem it was me lol

  39. #39
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,651


    Did you find this post helpful? Yes | No

    Wink goal revisiting ...

    Hi, Gremlin - lotto ( ! )

    The blinking rate could help ( US, European ... ??? ) ... thanks.

    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 " !!!
    *****************************************

  40. #40
    Join Date
    Aug 2006
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    Ok so here it is Im stupid was the main problem. Somehow I figured that the signal would just come pouring out of that little white wire without any ground to the signal cable... Once I got over that blonde moment everything fell into place. The code below could be done a lot better and some saftys put in for wild RC signals but I wanted to get out some working code.
    Basically by moving the stick back and forth it will figure out whats the max high and low and then accept anything thats about 1/3 of that in that direction. Now that its clear as mud here is the code
    Code:
    '12F675
    @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    OPTION_REG.5 = 0                                                       ' clock source internal
    
    Pulselen   var Byte                                                 ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms
    Init       var Byte                                                 ' Init used to flash LED
    HighCode   Var Byte
    LowCode    Var Byte
    clear
    highcode = 0 ' setup vars to be changed
    lowcode = 200 ' setup vars to be changed
    Input GPIO.3                                                           ' set pin 5 to RX signal
    
    ReadPWM:
       PulsIn GPIO.3, 1,Pulselen                 ' pin 4 - read high pulse length, times out after .65535 seconds 
    If pulselen > highcode then Highcode = Pulselen ' make sure highcode is at full throw This will avoid having to go though a setup
    If pulselen < LowCode and Pulselen > 50 then Lowcode = Pulselen ' make sure lowcode is at full throw This will avoid having to go though a setup
    if (Pulselen + 20) >= highcode then
       For Init = 1 To 6                                                 
          High GPIO.1                                                      
          pause 60                                                      
          Low GPIO.1                                                     
          pause 60                                                      
       Next
    pause 1000		    
     endif
    If (Pulselen - 20) <= LowCode Then 
          High GPIO.1                                                      
          pause 3000                                                      
          Low GPIO.1
          pause 200
    endif
    
       GoTo ReadPWM

Similar Threads

  1. Replies: 24
    Last Post: - 1st December 2009, 08:01
  2. Decoding an incoming infrared signal: need advice
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 9th May 2008, 16:28
  3. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. Rc PCM signal Read (Help)
    By jetpr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th March 2005, 03:37

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts