Shop OBEX P1 Docs P2 Docs Learn Events
MOBO BS2pe micro-controller — Parallax Forums

MOBO BS2pe micro-controller

JavedJaved Posts: 11
edited 2010-02-12 20:06 in BASIC Stamp
Hi,

I am communicating with a MOBO BS2pe micro-controller. I input through pin 5 and output pin 16. When I type one letter twice I am getting to different letter. I have also placed the ASCII value in the debug screen to show the letter are not the same. Here is the code



' {$STAMP BS2pe}
Loop:
serData VAR Byte
serData = 0
DEBUG ? serData
SERIN 5, 16468, [noparse][[/noparse]serData]
DEBUG "Command Input: ", STR serData, CR
DEBUG "Command Input: ", DEC serData, CR
GOTO Loop


I get ASCII number 65 and 193 as the output. However, I am only pressing the A on the other keyboard.

Post Edited By Moderator (Joshua Donelson (Parallax)) : 2/12/2010 12:41:46 AM GMT
768 x 505 - 75K

Comments

  • davejamesdavejames Posts: 4,047
    edited 2010-02-11 21:42
    Javed,

    First, I'd put the "serData VAR Byte" line before the "Loop:" so it's not always re-declared.

    Second, what's the reason for using STR? It looks for an ASCII string and you're only looking for one character.


    Regards,

    DJ

    P.S. please edit your original post and include a subject line.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • JavedJaved Posts: 11
    edited 2010-02-11 22:01
    Hi DJ,

    Thanks for the tips. There was reason for using STR.

    Were you able to duplicate the issue. I made those corrections and still found the same toggling error.
  • davejamesdavejames Posts: 4,047
    edited 2010-02-12 00:03
    Hi Javed,

    I won't be able to duplicate the issue as I don't have a MOBO and not able to use pins 5/16 for serial i/o.

    One other thing...the compiler directive like "{$PBASIC 2.5}" is missing. Did you leave it out of the example or is it missing from your actual code?

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • JDJD Posts: 570
    edited 2010-02-12 01:12
    Javed,

    Can you try the program attached to see if you can read in from the standard serial port on PIN 16? I was able to get the same value of 65 for "A" everytime, the other·A is an extended character, so I'm not sure where that is coming from.

    Please let me know of your results.

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


    Joshua Donelson
    www.parallax.com
  • JavedJaved Posts: 11
    edited 2010-02-12 01:58
    Hi Josh,

    Thanks for the reply! When I use pin 16 there are no issues on my computer either. However, when I input through an I/O pin, I get the a toggling character. The hyperterminal I am using on the other computer is setup properly, but for some reason, the characters can not be type consecutively. If I however, type different letters each time, then life is good and what I type on one computer I see exactly on the other.

    Bests,

    Javed
  • davejamesdavejames Posts: 4,047
    edited 2010-02-12 16:29
    SEROUT/SERIN with HyperTerm...

    If SEROUT/SERIN are used in their simple form ,·i.e. no "flow control", make sure HyperTerm flow control is set to "none".

    HyperTerm's flow control setting can be found:

    File -> Properties -> Connect To -> Configure -> Port Settings -> Flow Control (Hardware, Xon/Xoff, None)


    Regards,

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • JavedJaved Posts: 11
    edited 2010-02-12 19:18
    Hi Dave,



    Thanks for the reply. Yes I have hyperterminal set at 2400 or 9600 baud rate 8, N, 1, None.

    I was able to get the degug output error to stop. My suspisions are that the basic stamp is working properly and not software related. I have a custom connection betweem the RS232 and TTL between the computer and I/O pin I am using. After some efforts yesterday, I was able to type the same letter consecutively and not having any issue. Thank you again for you help in resolving the issue.





    Bests,



    Javed
  • davejamesdavejames Posts: 4,047
    edited 2010-02-12 20:06
    ...you're welcome!

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.