Shop OBEX P1 Docs P2 Docs Learn Events
Can you Communicate with UART? — Parallax Forums

Can you Communicate with UART?

SteelSteel Posts: 313
edited 2005-08-16 22:34 in BASIC Stamp
I would really like to have my·BS2 run a program that communicates with the PC.· Obviously (for program and debug) it has UART capabilities, however, I haven't seen anything in the BS2 instruction set that uses the capabilities.

Is there a way to interface with the UART on the Interpreter Chip?

Comments

  • dandreaedandreae Posts: 1,375
    edited 2005-08-15 20:35
    You can use pin 16 which is a software pin using the SERIN/SEROUT command.· HyperTerminal is an example of software that you can use and it comes free with Windows XP.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-08-15 21:51
    Yup,

    MAIN:
    SEROUT 16, 16384, [noparse][[/noparse]"Hi",13]
    PAUSE 200
    GOTO MAIN

    will output "Hi" to Hyperterminal from the BS2, every 200 mSecs.

    P.S. -- edit 8/16/2005 -- the "16384" baud-mode is incorrect for 9600 baud.

    Better:

    I9600 CON 84 + 16384

    SEROUT 16, I9600, [noparse][[/noparse]"Hi", 13]

    This way, you can more easily change your baud rates.
    The '84' tells a plain BS2 to send at 9600 baud.· The "+16384" says to use "Inverted" mode -- which is needed if you have a MAX232 circuit in there, which the BS2 does.


    Post Edited (allanlane5) : 8/16/2005 12:48:15 PM GMT
  • YanroyYanroy Posts: 96
    edited 2005-08-16 15:35
    <nitpick>Well, I don't think you need to explicitly say inverted, since you're using pin 16...· Couldn't resist...</nitpick>
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-08-16 18:32
    Good point, Yanroy. On pin 16 you don't need to say 'Inverted', it's automatically 'Inverted'. I still do say "Inverted", though I usually have to work out the sense when I'm NOT using Pin 16.
  • SteelSteel Posts: 313
    edited 2005-08-16 22:34
    Thanks for the help guys...It's workin like a champ.
Sign In or Register to comment.