PDA

View Full Version : USART Problem , but don't know where, in pc? or in PIC?



precision
- 15th July 2007, 08:12
When i connect hyperterminal to PIC , Rs232 reception is good like +00000 .but when i disconnect to termibal and then connect again,
Hyper terminal received junk data, problem fixed after reset PIC.
Problem is reset required every time when connect terminal.
I tried on dif. Xtal osc and dif. code from mister_e's calculator.



'chipi8f4550
'configuration of osc - '@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H

define osc 48 ; actual xtal mount 20mhz
.
.
.
.
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 8 ' 9600 Baud @ 20MHz, -0.03%
SPBRGH = 2
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
.
.
.
.
.
.

HSerout [ss,dec5 ABS(LastW0),13,10]


baud rate is 38400 in this position - no problem , no reset require

.


'chipi8f4550
'configuration of osc - '@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H

define osc 48 ' actual xtal 20

DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 225 ' 9600 Baud @ 48MHz, 0.0%
SPBRGH = 4
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
.
.
.
.
.

HSerout [ss,dec5 ABS(LastW0),13,10]

baud rate is 9600 in this position - reset require ( problem )
.




chip 18f4550
'configuration of osc HS

DEFINE OSC 10 ;actual xtal mount 11.0592



DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 71 ' 9600 Baud @ 11.0592MHz, 0.0%
SPBRGH = 0
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
.
.
.
.
.

HSerout [ss,dec5 ABS(LastW0),13,10]

baud rate is 9600 in this position - no problem , no reset require
baud 19200 if i mount xtal 21.47727 in same code -- no problem , no reset require

but my requirment is

@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
define osc 48
xtal - 20mhz
baudrate 9600

.