PDA

View Full Version : settings check please



Megahertz
- 19th March 2015, 16:10
I tried running two USARTs on an 18f45k22. The first one runs fine (PortC.6) but the second one (D.6) outputs junk.

DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 51 ' 4800 Baud @ SPBRGH = 0
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
DEFINE HSER2_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER2_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER2_CLROERR 1 ' Clear overflow automatically
DEFINE HSER2_SPBRG 51 ' 4800 Baud @ SPBRGH = 0

can someone please advise me what am I doing wrong here? Cheers

Tabsoft
- 19th March 2015, 23:51
Make sure you have CCP1 PWM module disabled. It has a higher priority than the EUSART.