PDA

View Full Version : Can you Communicate with UART?



Steel
08-16-2005, 03:28 AM
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?

dandreae
08-16-2005, 03:35 AM
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 (mailto:dandreae@parallax.com)
http://www.parallax.com

·

allanlane5
08-16-2005, 04:51 AM
Yup,

MAIN:
SEROUT 16, 16384, ["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, ["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

Yanroy
08-16-2005, 10:35 PM
<nitpick>Well, I don't think you need to explicitly say inverted, since you're using pin 16...· Couldn't resist...</nitpick>

allanlane5
08-17-2005, 01:32 AM
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.

Steel
08-17-2005, 05:34 AM
Thanks for the help guys...It's workin like a champ.