PDA

View Full Version : Simple RS232 Program



BlackNoir
- 7th January 2006, 21:45
I'm looking for a simple PBP proram to get me started with using the serial port to communicate with a PIC, either using the Max232 or the following:
http://www.piclist.com/techref/io/serial/RCL1.htm

Thanks,
BlackNoir

Charles Linquis
- 8th January 2006, 00:57
I assume you are using the Hardware serial port - so:


DEFINE OSC XX <- replace XX with your oscillator frequency
DEFINE HSER_RCSTA 90H
DEFINE HSER_TXSTA 20H
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1

TRISC = %10000000

InChar VAR BYTE

HSEROUT ["Hello World",13,10]

Loop:
HSERIN [InChar]
HSEROUT [" ",InChar,13,10]
GOTO Loop