Shop OBEX P1 Docs P2 Docs Learn Events
Remote Control Encoder — Parallax Forums

Remote Control Encoder

pusinkpusink Posts: 68
edited 2007-06-05 17:25 in General Discussion
HOW TO MAKE IR ENCODER USING SX28.

Post Edited By Moderator (Bean (Hitt Consulting)) : 6/5/2007 5:31:07 PM GMT

Comments

  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-06-04 19:59
    The devil is in the details and your post is lacking.... which protocol, for example?
  • pusinkpusink Posts: 68
    edited 2007-06-04 20:10
    I WANT MAKE MY OWN REMOTE CONTROL TRANSMITER USING 8 BUTTON AND TRANSMIT WITH IR DIODE. THE RECIEVER CIRCUIT, I'M USING Sony IRCS Decoding EXAMPLE INSIDE SXB SOFTWARE. I PREFER USING SXB. TQ.
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-06-04 20:18
    The SIRCS protocol is well-documented, and there are any number of approaches; what I would probably do is use an ISR to modulate the LED and take care of base timing, with a subroutine setup for taking the bits from the value you intend to transmit and loading the appropriate timer.

    EDIT: I've attached an untested program to get you started.

    EDIT #2: I've updated the program to add an ISR-based frame timer so that the frame timing can be consistent, regardless of the value(s) transmitted.

    Post Edited (JonnyMac) : 6/5/2007 6:43:26 PM GMT
  • DosManDanDosManDan Posts: 179
    edited 2007-06-04 21:53
    Man, I learn a ton from your code Jonny....thanks!

    Dan
  • pusinkpusink Posts: 68
    edited 2007-06-05 14:56
    ANYBODY CAN EXPLAIN THIS SXB CODE FOR ME.................

    ' Use: Tx_SIRCS irWord
    ' -- transmit 12-bit (device + command) SIRCS code
    ' -- sends three frames

    SUB Tx_SIRCS
    tmpW2 = __WPARAM12 ' capture code

    FOR tmpB1 = 1 TO 3 ' send three frames
    ' start bit
    IrAnode = IR_ENABLE ' activate IR LED
    Delay MS_24 ' wait 2.4 ms
    IrAnode = IR_DISABLE ' deactivate IR LED
    Delay MS_06 ' wait 0.6 ms

    ' clock the bits, LSB first
    tmpW3 = tmpW2 ' make copy of ir word
    FOR tmpB2 = 1 TO 12 ' send 12 bits
    IrAnode = IR_ENABLE ' activate IR LED
    IF tmpW3.0 = 1 THEN ' if 1
    Delay MS_12 ' wait 1.2 ms
    ELSE ' otherwise
    Delay MS_06 ' wait 0.6 ms
    ENDIF
    IrAnode = IR_DISABLE ' deactivate IR LED
    Delay MS_06
    tmpW3 = tmpW3 >> 1 ' get next bit
    NEXT
    Delay_MS 33 ' pad for ~45 frame time
    NEXT
    ENDSUB
  • BeanBean Posts: 8,129
    edited 2007-06-05 15:12
    It looks like it is pretty well documented to me ???
    What part of it doesn't make sense ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • pusinkpusink Posts: 68
    edited 2007-06-05 15:27
    FOR tmpB2 = 1 TO 12 ' send 12 bits
    IrAnode = IR_ENABLE ' activate IR LED
    IF tmpW3.0 = 1 THEN ' if 1
    Delay MS_12 ' wait 1.2 ms
    ELSE ' otherwise
    Delay MS_06 ' wait 0.6 ms
    ENDIF
    IrAnode = IR_DISABLE ' deactivate IR LED
    Delay MS_06
    tmpW3 = tmpW3 >> 1 ' get next bit
    NEXT
    Delay_MS 33 ' pad for ~45 frame time
    NEXT

    WHAT IS VALUE 12-BIT DATA TRANSMIT (dEVICE + COMMAND)?
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-06-05 17:00
    Okay, KEELOQ, you're going to have to do a bit more reading. The SIRCS protocol is documented all over the Internet -- go do a Google search and read up on it; that's what I did to write that demo for you. If you happen to have Parallax's "IR Remote for the Boe-Bot" it's explained in there as well, though that book deals with decoding so you'll need additional information on encoding.

    What you'll want to look for, specifically, is information on Sony's 12-bit protocol; the lower seven bits are called the command code, the upper five bits are called the device code; you have to load a word with the appropriate bits before transmitting. The receiver code you cited (which I also wrote when I worked for Parallax) expects to receive 12 bits and splits them into the LSB and MSB of the return value.
  • BeanBean Posts: 8,129
    edited 2007-06-05 17:25
    Here is a link to the book Jon mentioned: http://www.parallax.com/dl/docs/prod/sic/WebIR-%20v1.1.pdf

    Only Parallax would make all their books free downloads...

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
Sign In or Register to comment.