Shop OBEX P1 Docs P2 Docs Learn Events
Sony Infrared Protocol Help — Parallax Forums

Sony Infrared Protocol Help

Happy New Year!

Please help on generating proper signal for SIR protocol. I'm want to write the entire code in PASM. So far with the P1, I am able to generate the logical "1" signal at 1.2ms and a "space" signal at 600us. However, for some reason there are other signals that follow the "1", and then the "space" signal.

I've attached a screenshot of the logic analyzer.

On the picture, the "1" signal is between the #1 flags. The "space" signal is between the #5 flags. Signals between #2, 3, 4 flags were not intended, I'm not sure where they're coming from.

Also, it seems the "1" and "space" signals are in reverse order?

I'm working on the code little chunk at a time, so I'm just trying to send the "1" and space right now. I think if I can get this working, I can try for the entire protocol.

I've read through OBEX's projects and Discussion Forums but found little reference to PASM pertaining infrared protocol. I'm also very new to the electronic world, so if I missed any sound advice, please point me in the right location.

Thank you in advance.


  • JonnyMacJonnyMac Posts: 8,888
    edited 2024-01-13 17:17

    I've been writing SIRCS code in assembly since the days of the SX chip and we had to use an interrupt. The process is the same, though (which I'm sure you understand)

    • Modulate your IR LED output at the desired frequency for 2.4 milliseconds (start bit)
    • Turn off the IR LED output for 0.6 milliseconds
    • For a "1" bit, modulate the IR LED output at your desired frequency for 1.2 milliseconds
    • For a "0" bit, modulate the IR LED output at your desired frequency for 0.6 milliseconds
    • For the padding between bits, turn off the output for 0.6 milliseconds
    • Data is transmitted LSB first as the bit size is variable (standards are 12-, 15-, and 20-bit packets for Sony device control)

    You can use a cog counter in NCO mode to create the desired LED modulation. You can control this modulation being on or off using the DIRA bit for your output pin.

    At work I design and code laser tag weapons and accessories that use Sony IRCS bit encoding for the laser tag "bullets" and command packets. The attached object is generic and can be used to send for general Sony IR control. In the test I sent $AF which you can see is output LSBFIRST. Again, normal SIRCS commands are 12-, 15-, or 20-bits, and are usually repeated 3 to 5 times. The tx() method in the object gives you full control of those parameters.

    1445 x 384 - 32K
  • JonnyMac, thank you so much for your advice and example. I will study the example carefully. This is a great guide on learning to write Assembly language for the Propeller.
    I definitely will have a different perspective next time doing laser tag :).

  • JonnyMacJonnyMac Posts: 8,888

    I'm glad I could help. Have fun.

Sign In or Register to comment.