1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Record Signal (IR from pin)

Discussion in 'Microcontrollers' started by AtomSoft, Apr 30, 2009.

  1. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    i doubt it since i use there hex file and also i used there program. It shouldnt be a issue.
     
  2. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    Are you using the same PIC frequency?
     
  3. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    im using the exact same hex file and PIC used as the website shows. So there shouldnt be a issue on code. It has to be hardware related.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US

    ARE YOU USING THE SAME PIC CLOCK?
    IF the clock isn't the same the code won't have the same delay it will be set to an entirely different baud rate.
     
  6. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    NIGEL i tried your IR tutorial and when i press a button it says Device = 00 and Command = 16 for every button i press. i hope to mod it for use with my remote. It does work well with my sony remote..


    im referring to Tutorial 5-1
     
  7. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US

    Its a internal clock how would it be different?
     
  8. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    Because the internal oscillator can be set via a few prescalers, and the calibration from one pic to another may not be good enough. If you said it I missed it, what baud rate are you trying to receive from?
     
  9. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
  10. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    So what frequency is YOUR pic running at?
     
  11. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    can a 12f629 go that fast most of what I have seen are set a lot slower it only runs 4mhz. When doing uart with one the fastest I have been able to get to work in hyper terminal was slow 9600 But it maybe my cable is to long it was about 6 feet. Atom your right it's 115200 that what there site said
     
    Last edited: May 1, 2009
  12. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,225
    Likes:
    641
    Location:
    Derbyshire, UK
    That's because it's Sony specific, it won't work for anything else.
     
  13. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,225
    Likes:
    641
    Location:
    Derbyshire, UK
    You can do 115200 with a 4MHz clock, even in software, it's just under 9uS per bit.
     
  14. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    I think this was what was wrong with my setup
     
  15. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Ok im going to try RC5 which is 36khz. I found this info:

    How did he get to that conclusion of 32 pulses and the length on and stuff?

    Like if its 36khz how do i figure out how long each actual pulse is?

    If you go here:
    SB-Projects: IR remote control: Philips RC-5

    you will see under "Modulation" how a ir signal is pulsed. How do i figure out the pulse time?
     
  16. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    1/36000=22.7u

    The pulse time is listed right on the website you linked.
     
  17. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
  18. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    OK ok i think i understand more now...

    If it takes 27.8uS for 1 pulse and 1.78mS for a pulse half on/off. then

    0.00178 / 0.0000278 = 64 and since its half on/off thats 32 pulses.

    Does that sound right?

    EDIT:

    If you look at that PDF it says. 1 Pulse is 27.8uS meaning :

    "The pulse/pause ratio of the 36kHz carrier frequency is 1/3 or 1/4 which reduces power consumption.
    Protocol "

    so that makes it 1/4 (25% on) aka 0.00000695 Seconds = 6.95uS high then 20.85uS low. To make one pulse. then you need 32 pulses to make a one or zero.

    and 64 pulses to make 2 start bits.

    so i would turn off the pin for 890uS then pulse for 890uS 2 times to make the 2 start bits.
    etc....
     
    Last edited: May 2, 2009
  19. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Can someone find out why this LED isnt blinking? For some reason i think its a OSC issue. Im trying to use internal OSC at 8Mhz but no luck. I know the led is turning off and on by stepping but its going to fast. Any thoughts?

    darn ASM:
    Code (text):

        LIST P=18F2525  ;directive to define processor
        #include <P18F2525.INC> ;processor specific variable definitions


        CONFIG  OSC = INTIO7, WDT = OFF, MCLRE = ON, LVP = OFF, XINST = OFF, LPT1OSC = OFF
       

    #DEFINE irL LATB
    #DEFINE irT TRISB
    #DEFINE ir 0

            CBLOCK  0x000
            EXAMPLE     ;example of a variable in access RAM
            d1
            d2
            d3
            ENDC

            ORG 0x0000
    Init:
        movlw   0x00
        movwf   OSCTUNE
        movlw   0x72
        movwf   OSCCON
    Osc:   
        btfss   OSCCON,IOFS
        goto    Osc
        bcf     irT,ir
    Main:
        bsf     irL,ir
        call    Delay500mS

        bcf     irL,ir
        call    Delay500mS

        goto    Main

    ;Delay 500mS aka half a second
    Delay500mS
        movlw   0x07
        movwf   d1
        movlw   0x2F
        movwf   d2
        movlw   0x03
        movwf   d3
    Delay500mS_0
        decfsz  d1, f
        goto    $+4
        decfsz  d2, f
        goto    $+4
        decfsz  d3, f
        goto    Delay500mS_0
        goto    $+2
        goto    $+2
        goto    $+2
        return

            END
     
     
  20. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Hey it was the delay:
    Code (text):

    Delay500mS
        movlw   0x07
        movwf   d1
        movlw   0x2F
        movwf   d2
        movlw   0x03
        movwf   d3
    Delay500mS_0
        decfsz  d1, f
        goto    $+6
        decfsz  d2, f
        goto    $+6
        decfsz  d3, f
        goto    Delay500mS_0
        goto    $+4
        goto    $+4
        goto    $+4
        return
     
     
  21. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,807
    Likes:
    135
    Location:
    morristown,tn
    Manchester coding Is what your reading you know swordfish has a module to read it with.Here the sample code
    Code (text):

    Manchester library.

    Example Code

    // import libraries...

    include "Manchester.bas"

    include "USART.bas"

    include "Convert.bas"

     

    dim EncodedValue as word

    dim DecodedValue as byte

     

    SetBaudrate(br19200)

    EncodedValue = Encode(42)

    USART.Write("Encode : ", BinToStr(EncodedValue, 16), 13, 10)

    if Decode(EncodedValue,DecodedValue) then

       USART.Write("Decode : ", DecToStr(DecodedValue), 13, 10)

    else

       USART.Write("Error!", 13, 10)

    endif  
     
     
     
     
    Last edited: May 2, 2009

Share This Page