18F2620 hserout baud rates off consistently.
I'm using hserout to send data to a PC running the old plx-daq excel data acquisition macro/control.
It's worked in the past but i haven't used it for a long time.
I have cranked up my pic speed to 32mhz using the PLL etc and that's confirmed by the simple flashing 1hz led trick.
I set the ESUART with data from PicMulticalc using 32mhz as osc speed.
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 51 ' 38400 Baud @ 32MHz, 0.16%
SPBRGH = 0
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
The pic is transmitting data correctly but when checked with my logic probe I can see the baud rate is off.
At 38400 it is actually 40000
At 19200 it is 20000
At 9600 it is 10000
Seems very consistent and perhaps the windows serial port can't tolerate this error?
Do you thing this is a ESUART register setting problem or a wayward oscillator that needs OSCTUNE tweaking?
Bookmarks