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

IR Remote

RsadeikaRsadeika Posts: 3,837
edited 2005-02-09 17:18 in General Discussion
What I am trying to do is convert the Parallax IR Remote (Appkit #29122) example program for the Basic Stamp to SX/B; to be used with an sx tech board setup.

I am not having very much sucess, I will post my·code, which is very ugly. If anybody has the time to help out and make the thing work, it would be appreciated.

The next step would be is to make an interrupt handle the IR detect.

Thanks in advance.

Comments

  • RsadeikaRsadeika Posts: 3,837
    edited 2005-02-09 12:38
    I noticed their were a few people that down loaded my listing, thanks for the interest.

    I have a question that arose from my coding attempt, it concerns the use of constants.

    An example: irPulse CON 1000
    When this gets assembled I get a warning thst states - Warning 37.Pass2. Literal truncated to 8 bits.

    1. So, does that mean that constants are limited to a value that is less than 256?

    2. Is their a way of getting around this?

    3. Is this an SX/B thing or does this also occur in assembly?
  • BeanBean Posts: 8,129
    edited 2005-02-09 14:54
    You can define constants larger than 255, but you can only use them where a value larger than 255 is allowed (like PAUSE).

    If you post your code, I can help further.

    Bean.
  • BeanBean Posts: 8,129
    edited 2005-02-09 15:00
    Looking at your code I think you want to set a different bit in each of your bitx: routines. Currently you are only setting bit 0 for every one.

    I think you want:


    bit1:
    remoteCode.1 = 1
    goto bit1bp

    bit2:
    remoteCode.2 = 1
    goto bit2bp

    bit3:
    remoteCode.3 = 1
    goto bit3bp

    bit4:
    remoteCode.4 = 1
    goto bit4bp

    bit5:
    remoteCode.5 = 1
    goto bit5bp

    bit6:
    remoteCode.6 = 1
    goto bit6bp

    Hope this helps,

    Bean.
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-02-09 16:08
    Bean, thanks. For the bits thing, that was a glaring mistake on my part, but it did not reolve the issue.

    The constants question stems from the code I posted.
    thStart CON 2 ;this value should be 2400
    thPulse CON 1 ;this value should be 500 * 5/2

    In the original Basic Stamp code, the constants were used in this manner:
    thresholdStart CON 2400
    thresholdPulse CON 500 * 5/2

    These values are used to check for different pulse rates that the IR Remote strobes out. The thresholdStart is checking for a 2.4ms duration, hence the 2400 value. The thresholdPulse is checking for the data pulse, 1.2ms.

    My problem is, how do I check for these exact pulse rates.
  • BeanBean Posts: 8,129
    edited 2005-02-09 17:18
    Actually the PULSIN count is in 10uSec
    So your constant should be 240 anyway.(240 = 2.4mSec)

    If you need larger values use the RESOLUTION parameter of PULSIN

    Bean.
Sign In or Register to comment.