If I'm using a PIC16F1825 how do I know whether to use the USART or EUSART settings from Mister E's PIC Multi-Calc application? This is what I have set currently:
I see that Mister E's app doesn't use DEFINE HSER_BAUD. For USART I get:Code:DEFINE OSC 16 ; Set oscillator 16Mhz DEFINE HSER_TXSTA 20h ; Set transmit status and control register DEFINE HSER_BAUD 2400 ; Set baud rate DEFINE HSER_CLROERR 1 OSCCON = %01111000 ; 16MHz internal osc PAUSE 100 APFCON0.2 = 0 ; Tx on RC4 for LCD display APFCON0.7 = 0 ; Rx on RC5 BAUDCON.4 = 1 ; Transmit inverted data to the Tx pin
For EUSART:Code:DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0 DEFINE HSER_SPBRG 103 ' 2400 Baud @ 16MHz, 0.17% DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Which should I use? And should I continue to use DEFINE HSER_BAUD which I think I got from this board a ling time ago?Code: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 130 ' 2400 Baud @ 16MHz, 0.0% SPBRGH = 6 BAUDCON.3 = 1 ' Enable 16 bit baudrate generator




Bookmarks