Shop OBEX P1 Docs P2 Docs Learn Events
Serin Debug/Receive trouble — Parallax Forums

Serin Debug/Receive trouble

Wouter BacWouter Bac Posts: 4
edited 2009-04-27 18:38 in BASIC Stamp
Hi, I am trying to debug letters and numbers that are sent from the Windows HyperTerminal. The hardware is running correctly because I am measuring signals at the DATA pin of the receiver with scope when I type numbers of letters on the keyboard. The receiver is mounted on a Boe-Bot (USB connected to computer). How is it possible that I don't see anything in the Debug Terminal when I type something in the Hyperterminal?


My code is:
' {$STAMP BS2}
' {$PBASIC 2.5}
Rx PIN 15 ' 443 MHZ Receiver(27981)DATA pin


SerData VAR Byte 'Variable to store data that is sended from the hyperterminal on the PC

SERIN Rx, 16468, [noparse][[/noparse]DEC Serdata ]
DEBUG Serdata 'Debugs letters or numbers (that were sent by the PC) in the Debug Terminal

Comments

  • vaclav_salvaclav_sal Posts: 451
    edited 2009-04-24 17:09
    Read the desription of DEC qualifier you are using.

    Your SERIN· is looking for decimals and will terminate on non decimal character.
  • Wouter BacWouter Bac Posts: 4
    edited 2009-04-24 18:33
    It doesn't even receive decimal characters, What should I do to get it to work. Does anyone have experience with sending data by RF to a microcontroller?
  • JDJD Posts: 570
    edited 2009-04-24 19:04
    Wouter Bac,

    Are they the Parallax 433 MHz RF modules? Also, are you sending the data through a level shifter, like a MAX232 chip·to go from the PC to RF modules?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com

    Post Edited (Joshua Donelson (Parallax)) : 4/24/2009 7:09:59 PM GMT
  • Wouter BacWouter Bac Posts: 4
    edited 2009-04-24 21:36
    Hello Joshua,

    Yes I am using the 433 MHz Rf modules. And I am also using a MAX 232 chip. I am using 9600 baud 8,1,N from the Hyperterminal in Windows.
  • FranklinFranklin Posts: 4,747
    edited 2009-04-24 22:45
    The program you posted reads one serial byte when it is turned on and then quits. By the time you send something the program is done.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • JDJD Posts: 570
    edited 2009-04-24 23:45
    Wouter Bac,

    If you insert the serin into a do loop you would have a much higher chance of receiving the Byte in. Like Stephen explained, the BASIC Stamp is watching the I/O pin for only a moment of time before going on to another task. Also you can bring in the Byte as an ASCII format and then use a formatter to display what you would like in the terminal window.

    For Example:

    DO
    SERIN Rx, 16468, [noparse][[/noparse]Serdata]
    DEBUG DEC Serdata 'Debugs letters or numbers (that were sent by the PC) in the Debug Terminal
    LOOP

    I hope this helps,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-04-26 15:44
    Joshua,
    Please revise / explain need for loop in your post.
    According to the manual the·DEC qualifier makes SERIN to collect decimals into an array until non-decimal character is received.
    Than SERIN exits.
    As written - no loop is necessary and the variable should contain LAST decimal character received.·
    Cheeers· Vaclav
    ·
  • FranklinFranklin Posts: 4,747
    edited 2009-04-26 16:07
    vaclav_sal, the OP defined Serdata as a byte so SERIN will get a byte of data and the exit. SERIN will only collect into an array if that is how serdata is defined.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Wouter BacWouter Bac Posts: 4
    edited 2009-04-27 16:27
    Thank you all of you! I got it to work. When I put my code in a DO LOOP it worked. Besides I changed the Baudrate to 2400 8,N,1 (non Inverted) to avoid noise.

    Wouter
  • JDJD Posts: 570
    edited 2009-04-27 18:38
    Wouter Bac,

    Excellent, just let us know if there is anything else. Once you are all done, you can post it in the Complete Projects Forum. It's always great to see new projects posted.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
Sign In or Register to comment.