Just need some guidance on setting up the defines for serial communications when using a particular crystal.
I'm using a 20 mhz crystal.
Here are my config settings
I've cut and pasted code from a previous project but that won't allow connection with the port.Code:ASM __CONFIG _CONFIG1H, _OSC_HS_1H __CONFIG _CONFIG2L, _PWRT_ON_2L __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L ENDASM
I've tried changing the baud rate to 9600, and different values for SPBRG as I'm not running the PIC at 40Mhz...Code:DEFINE HSER_BAUD 115200 ' Hser baud rate DEFINE HSER_RCSTA 90h ' Hser receive status init DEFINE HSER_TXSTA 20h ' Hser transmit status init DEFINE HSER_CLROERR 1 ' Hser clear overflow automatically DEFINE HSER_SPBRG 25 ' 115200 Baud @ 40MHz, -0.22% SPBRGH = 0 BAUDCON.3 = 1 ' Enable 16 bit baudrate generator ColumnWidth CON 10
Any help would be appreciated
Malcolm




Bookmarks