PDA

View Full Version : hserout nothing transmit



Pic2008
- 8th November 2008, 07:58
I'm using PIC16f877 connected to MAX232. Using serout no problem, but when i use the following, nothing appears in hyperterminal




define OSC 20

DEFINE HSER_BAUD 9600 ' Select the baud rate
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_SPBRG 31 ' 20MHZ 9600, brgh=0
DEFINE HSER_CLROERR 1 ' Clear overflow automatically

OPTION_REG.7 = 0 'enable internal pull up GPPU
OPTION_REG.6 = 1 'falling edge INT
ADCON1= %00000111
TRISE = 0 ' all output
TRISC = %10000000



loop:
pause 1000
low led

Hserout ["Hello World", 13, 10]
goto loop

Pic2008
- 8th November 2008, 08:35
Thread close. I discovered one wire came off from the breadboard connected to MAX232 IC.

No problem.

mister_e
- 8th November 2008, 08:36
Do you get something or just garbage character?

I would suggest you to use the following settings

DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 129 ' 9600 Baud @ 20MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
EDIT: seems we hit the buton at the same time or so... anyways, keep thse settings above handy... produce a better error %