Shop OBEX P1 Docs P2 Docs Learn Events
SX/B IR Remote — Parallax Forums

SX/B IR Remote

RsadeikaRsadeika Posts: 3,837
edited 2005-03-29 19:35 in General Discussion
My projects success depends on a working implementation of an IR remote control. So, I decided to try to convert Jon Williams 'Control From the Couch' program so it can function in the SX/B environment. Right off the bat, I can see it will be a pretty demanding task. Since their are other people that are starting to convert from the BS2 to the SXxx platform, I will try to make my quetions as general as possible, so everybody can get some use out of this thread. Their will be a lot of questions that will have to be resolved.

First up - Variables:

Original PBASIC code

irStart····VAR Word
irBit······· VAR irStart
numDigits VAR Nib

Any ideas as to how I can implement Word, and Nib in SX/B? As for the 'irBit VAR irStart' I tried 'irBit VAR @irStart', that did not work.
·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-29 17:40
    SX/B does not directly translate from PBASIC 2 -- it's going to take some work; it will be worth it though because you'll get the full-speed performance of the SX. With the SX you'll be able to receive the IR bits in a loop, that is, you don't need to make a giant array of variables as required in PBASIC. Make a variable that is used for the bit width input and set the resolution of PULSIN such that a Start bit will fit into a byte variable. Your code would wait for a valid start bit, then enter a loop to receive the other bits. If you're going to use the full 12-bit code then you'll need two loops to get the low and high bytes of the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-03-29 18:25
    Jon,

    I got lost right after "SX/B does not directly translate from PBASIC 2 -- ...". Since this idea (Receive and decode Sony IR command) is the key to the whole program, a few lines of example code would be appreciated. Speciffically addressing the "... resolution of PULSIN ...", and "... Start bit will fit into a byte variable ...". I think that once I have a code start point I should be able to create the loops, and anything else that is necessary.

    Since you made no mention of the variables "Word", and "Nib", can I assume that those will be showing up in the next version of SX/B?

    Also one other point, in your original article, you write "Generic Sony IR remote codes (not a complete list)". Is their a location where I can get the complete list?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-29 19:35
    Nope, SX/B will use the native variable type (byte) of the SX. Please understand that the intent of SX/B is a bridge between PBASIC and SX programming -- it is not meant (and never will be) a replacement for PBASIC. SX/B keeps things clean and efficient so that student programmers can learn from the code output. And with a few tricks, pros can optimize SX/B programs for space and get the ease of BASIC programming.

    The best thing to do is read through the current help file. SX/B is very new (about five months old) and there aren't yet as many application examples as there are for BASIC Stamps (BS1 introduced in 1993).

    I'm currently swamped with updating the SX/B help file for version 1.2 so that we can get it finalized and released. Once I'm done with that, I will have time to go through and create a Sony IR example. I fear "a few lines of example" code at this point would create more questions than they answer.· Work through the help file examples and projects so that you can get your mind around SX/B; then tackle the IR project.

    Search the Internet for Sony device codes -- there are many sites that list them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.