Gitchie
- 10th April 2012, 17:29
Hi All,
Currently using a PIC18LF26K80, and have found the HSEROUT command to outputing data at quarter of the specified rate.
Here is the header to my code:
#config
CONFIG RETEN = OFF
CONFIG INTOSCSEL = LOW
CONFIG SOSCSEL = LOW
CONFIG XINST = OFF
CONFIG FOSC = INTIO1
CONFIG PLLCFG = ON
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG PWRTEN = OFF
CONFIG BOREN = OFF
CONFIG BORV = 0
CONFIG BORPWR = LOW
CONFIG WDTEN = OFF
CONFIG WDTPS = 1
CONFIG CANMX = PORTC
CONFIG MSSPMSK = MSK7
CONFIG MCLRE = OFF
CONFIG STVREN = OFF
CONFIG BBSIZ = BB1K
CONFIG CP0 = OFF
CONFIG CP1 = OFF
CONFIG CP2 = OFF
CONFIG CP3 = OFF
CONFIG CPB = OFF
CONFIG CPD = OFF
CONFIG WRT0 = OFF
CONFIG WRT1 = OFF
CONFIG WRT2 = OFF
CONFIG WRT3 = OFF
CONFIG WRTC = OFF
CONFIG WRTB = OFF
CONFIG EBTR0 = OFF
CONFIG EBTR1 = OFF
CONFIG EBTR2 = OFF
CONFIG EBTR3 = OFF
CONFIG EBTRB = OFF
#endconfig
'*****
'* Defines and Device Configurations
'*****
define OSC 8 ' Internal OSC runs at 8MHz
define HSER_RCSTA1 90h ' Enable USART1 Receiver
define HSER_TXSTA1 20h ' Enable USART1 Transmitter
define HSER_RCSTA2 90h ' Enable USART2 Receiver
define HSER_TXSTA2 24h ' Enable USART2 Transmitter
define HSER_BAUD1 9600
define HSER_BAUD2 9600
TRISA=%00000001 ' Make PORTA.0 an input
ADCON0=%00000001 ' Turn on ADC AN0
ADCON1=%00000000 ' Turn off PORTB ADC's
ADCON2=%00000000 ' Turn off PORTC ADC's
INTCON=%11000000 ' Enable Interrupts
PIE1=%00100000 ' Enable USART1 Interrupt
OSCCON=%01100000
REFOCON=%10100111
OSCTUNE=%10000000
By connecting at 2400 baud, the comms works fine, but I am hoping to find the real reason behind my errors...
Cheers :)
Mark
Currently using a PIC18LF26K80, and have found the HSEROUT command to outputing data at quarter of the specified rate.
Here is the header to my code:
#config
CONFIG RETEN = OFF
CONFIG INTOSCSEL = LOW
CONFIG SOSCSEL = LOW
CONFIG XINST = OFF
CONFIG FOSC = INTIO1
CONFIG PLLCFG = ON
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG PWRTEN = OFF
CONFIG BOREN = OFF
CONFIG BORV = 0
CONFIG BORPWR = LOW
CONFIG WDTEN = OFF
CONFIG WDTPS = 1
CONFIG CANMX = PORTC
CONFIG MSSPMSK = MSK7
CONFIG MCLRE = OFF
CONFIG STVREN = OFF
CONFIG BBSIZ = BB1K
CONFIG CP0 = OFF
CONFIG CP1 = OFF
CONFIG CP2 = OFF
CONFIG CP3 = OFF
CONFIG CPB = OFF
CONFIG CPD = OFF
CONFIG WRT0 = OFF
CONFIG WRT1 = OFF
CONFIG WRT2 = OFF
CONFIG WRT3 = OFF
CONFIG WRTC = OFF
CONFIG WRTB = OFF
CONFIG EBTR0 = OFF
CONFIG EBTR1 = OFF
CONFIG EBTR2 = OFF
CONFIG EBTR3 = OFF
CONFIG EBTRB = OFF
#endconfig
'*****
'* Defines and Device Configurations
'*****
define OSC 8 ' Internal OSC runs at 8MHz
define HSER_RCSTA1 90h ' Enable USART1 Receiver
define HSER_TXSTA1 20h ' Enable USART1 Transmitter
define HSER_RCSTA2 90h ' Enable USART2 Receiver
define HSER_TXSTA2 24h ' Enable USART2 Transmitter
define HSER_BAUD1 9600
define HSER_BAUD2 9600
TRISA=%00000001 ' Make PORTA.0 an input
ADCON0=%00000001 ' Turn on ADC AN0
ADCON1=%00000000 ' Turn off PORTB ADC's
ADCON2=%00000000 ' Turn off PORTC ADC's
INTCON=%11000000 ' Enable Interrupts
PIE1=%00100000 ' Enable USART1 Interrupt
OSCCON=%01100000
REFOCON=%10100111
OSCTUNE=%10000000
By connecting at 2400 baud, the comms works fine, but I am hoping to find the real reason behind my errors...
Cheers :)
Mark