Shop OBEX P1 Docs P2 Docs Learn Events
IR Buddy Question — Parallax Forums

IR Buddy Question

GabeGabe Posts: 24
edited 2005-11-08 07:27 in BASIC Stamp
Hi guys,

I'm trying out the IR Buddy loopback test on one of the my IR Buddy. The test is printed on page 11 of the IR Buddy manual. I was wondering if the connections are the same as the previous program on page 10, because there wasn't any diagram on how the Buddy should be connected with regards to the Loopback test.

I tried out the program and the program kept returning the error "Timeout error - Check Connection" with the baud rate shown to be 2400 but no data was detected in the 0 to 255 loop in the program.

Main:
  FOR testNum = 0 TO 2
    LOOKUP testNum, [noparse][[/noparse]2400, 4800, 9600], testBaud
    DEBUG CrsrXY, 6, 3, DEC testBaud            ' display test baud rate
    LOOKUP testNum, [noparse][[/noparse]IRb24, IRb24, IRb24], testBaud
    FOR testVal = 0 TO 255      ' loop through holdoff values
      SEROUT IRbSIO, testBaud, [noparse][[/noparse]IRbLoopback, testVal]
      'DEBUG DEC iRbLoopback, DEC testVal,CR
      SERIN  IRbSIO, testBaud, 300, TO_Error, [noparse][[/noparse]STR buffer\4]
      FOR idx = 0 TO 3        ' display rx buffer
        DEBUG CrsrXY, 6, (idx + 5)
        DEBUG DEC buffer(idx), ClrEOL, CR
      NEXT
      IF (buffer(0) <> testVal) THEN Packet_Error
      IF (buffer(1) <> testVal) THEN Packet_Error
      IF (buffer(2) <> 254) THEN Packet_Error
      IF (buffer(3) <> 255) THEN Packet_Error
    NEXT ' testVal
  NEXT ' testNum
Test_Complete:
  DEBUG CR, "Test Complete - PASS"
  END
TO_Error:
  DEBUG CR, "Timeout Error - check connection"
  END
Packet_Error:
  DEBUG CR, "Packet Error"
  END


Here's part of the program:

Main:
  FOR testNum = 0 TO 2
    LOOKUP testNum, [noparse][[/noparse]2400, 4800, 9600], testBaud
    DEBUG CrsrXY, 6, 3, DEC testBaud            ' display test baud rate
    LOOKUP testNum, [noparse][[/noparse]IRb24, IRb24, IRb24], testBaud

·I was wondering if the last line is correctly printed in the manual, because in addition to the declaration of IRb24, there are also IRb48 and IRb96, do I need to change them accordingly? The declarations are as follow:

IRb96    CON   84 + $8000    ' 9600 baud, open
IRb48    CON  188 + $8000    ' 4800 baud, open
IRb24    CON  396 + $8000    ' 2400 baud, open

I'm of the opinion that this isn't the cause of my program·error, but just wanted to clarify this up anyway.

Any help would be greatly appreciated.

Thanks,
Gabe

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-08 05:24
    Gabe -

    The answer to your questions will greatly depend on which Stamp platform you are using. Those are certainly valid baud rates for some Stamps, but they may not be valid for the specific Stamp platform you are using.

    Which BS-2? are you using?

    Regards,

    Bruce Bates
  • GabeGabe Posts: 24
    edited 2005-11-08 06:54
    Hi Bruce,

    I'm using the BS2p40.·

    Regards,

    Gabe
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-08 07:07
    Gabe -

    Here is the appropriate baudmode table as directly extracted fom the ==> Help File! <==:

    attachment.php?attachmentid=73961



    Regards,

    Bruce Bates
    372 x 172 - 8K
  • GabeGabe Posts: 24
    edited 2005-11-08 07:11
    Hi Bruce,

    Okay. So now with these values, i just input it into the serin and serout commands (depending on what mode I want) respectively and perhaps my "Timeout error - Check Connection" error would be gone? So in other words, the error could be due to the wrong baud value being inserted, am I right?

    Regards,

    Gabe
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-08 07:27
    Gabe -

    Late's just put it this way. When you use the proper baud rate (baudmode parameter) you will receive the proper and correct data. Without the proper and correct input data, no program has an even chance at success. To hypothesize about what bad or erroneous data may or may not be doing, isn't normally an exercise I usually find worthwhile smile.gif

    Just give it a shot, and we can go on from there if there are further problems.

    Regards,

    Bruce Bates
Sign In or Register to comment.