2011-01-21, 09:22:58
(This post was last modified: 2012-12-23, 15:13:39 by Mikael Gustavsson.)
Uart1 seems to work, but not for Uart2. Can anyone help?
;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
list P=18F67J10; ;xxx
;------------------------------------------------------------------------------
; Includes
;------------------------------------------------------------------------------
#include "devices.inc"
;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
radix DEC
#define DEV_MODE 1 ;xxx remove or comment this line
#define OSCF 10000000 ;xxx oscillator frequency
#define BLTIME 2000 ;xxx time in ms before bootloader loads the user application
#define BLINIT 2000 ;xxx time in ms before bootloader loads the user application immediately after boot
#define HELLOTRIES 2 ;xxx number of non hello characters received before branching to the user application
;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------
#define BAUDRATE 115200 ;xxx baudrate
;#define USE_UART1 1 ;xxx uncomment to use uart1
#define USE_UART2 1 ;xxx uncomment to use uart2
#define USE_BRG16 1 ;xxx uncomment to use 16-bit brg
;#define USE_TXENABLE 1 ;xxx uncomment to use a tx enable pin
#ifdef USE_TXENABLE
#define TRISR_TXE TRISG ;xxx tris register containing tx enable
#define LATR_TXE LATG ;xxx port register containing tx enable
#define TRISB_TXE TRISG0 ;xxx tris bit for tx enable
#define LATB_TXE RG0 ;xxx port bit for tx enable
#endif
;------------------------------------------------------------------------------
; Advanced settings
;------------------------------------------------------------------------------
#define PROT_GOTO 1 ;protect goto at 0x00
#define PROT_BL 1 ;protect bootloader
#define BLPLP 2 ;bootloader placement, pages from end
#define BLSIZEP 1 ;bootloader size [pages], used by bl protection
;------------------------------------------------------------------------------
; Configuration bits, these macros can be found at the end of the inc-files located in
; C:\Program Files\Microchip\MPASM Suite\
;
; These can also be set in MPLAB IDE instead, they are found in Configure->Configuration bits...
;------------------------------------------------------------------------------
;for pic18f67j10
CONFIG WDTEN = OFF ;wathcdog timer
CONFIG STVREN = OFF ;stack over-/underflow reset
CONFIG XINST = OFF ;extended instruction set
CONFIG CP0 = OFF ;code protect
CONFIG FOSC = HS ;oscillator
;CONFIG T1DIG = OFF ;T1OSCEN enforcement
;CONFIG LPT1OSC = OFF ;low-power timer1 oscillator
CONFIG FCMEN = OFF ;fail-safe clock monitor
CONFIG IESO = OFF ;nternal External Oscillator Switch Over Mode
CONFIG WDTPS = 1 ;watchdog postscaler
;CONFIG DSWDTOSC= INTOSCREF ;dswdt clock select
;CONFIG RTCOSC = INTOSCREF ;rtcc clock select
;CONFIG DSBOREN = OFF ;deep sleep bor
;CONFIG DSWDTEN = OFF ;deep sleep watchdog timer
;CONFIG DSWDTPS = 2 ;deep sleep watchdog postscaler
;CONFIG IOL1WAY = OFF ;iolock one-way set enable bit
;CONFIG MSSP7B_EN=MSK5 ;mssp address masking
;CONFIG WPFP = PAGE_0 ;write/Erase Protect Page Start/End Location:
;CONFIG WPEND = PAGE_0 ;write/Erase Protect Region Select bit (valid when WPDIS = 0):
;CONFIG WPCFG = OFF ;write/Erase Protect Configuration Region
;CONFIG WPDIS = OFF ;write Protect Disable bit
;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
list P=18F67J10; ;xxx
;------------------------------------------------------------------------------
; Includes
;------------------------------------------------------------------------------
#include "devices.inc"
;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
radix DEC
#define DEV_MODE 1 ;xxx remove or comment this line
#define OSCF 10000000 ;xxx oscillator frequency
#define BLTIME 2000 ;xxx time in ms before bootloader loads the user application
#define BLINIT 2000 ;xxx time in ms before bootloader loads the user application immediately after boot
#define HELLOTRIES 2 ;xxx number of non hello characters received before branching to the user application
;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------
#define BAUDRATE 115200 ;xxx baudrate
;#define USE_UART1 1 ;xxx uncomment to use uart1
#define USE_UART2 1 ;xxx uncomment to use uart2
#define USE_BRG16 1 ;xxx uncomment to use 16-bit brg
;#define USE_TXENABLE 1 ;xxx uncomment to use a tx enable pin
#ifdef USE_TXENABLE
#define TRISR_TXE TRISG ;xxx tris register containing tx enable
#define LATR_TXE LATG ;xxx port register containing tx enable
#define TRISB_TXE TRISG0 ;xxx tris bit for tx enable
#define LATB_TXE RG0 ;xxx port bit for tx enable
#endif
;------------------------------------------------------------------------------
; Advanced settings
;------------------------------------------------------------------------------
#define PROT_GOTO 1 ;protect goto at 0x00
#define PROT_BL 1 ;protect bootloader
#define BLPLP 2 ;bootloader placement, pages from end
#define BLSIZEP 1 ;bootloader size [pages], used by bl protection
;------------------------------------------------------------------------------
; Configuration bits, these macros can be found at the end of the inc-files located in
; C:\Program Files\Microchip\MPASM Suite\
;
; These can also be set in MPLAB IDE instead, they are found in Configure->Configuration bits...
;------------------------------------------------------------------------------
;for pic18f67j10
CONFIG WDTEN = OFF ;wathcdog timer
CONFIG STVREN = OFF ;stack over-/underflow reset
CONFIG XINST = OFF ;extended instruction set
CONFIG CP0 = OFF ;code protect
CONFIG FOSC = HS ;oscillator
;CONFIG T1DIG = OFF ;T1OSCEN enforcement
;CONFIG LPT1OSC = OFF ;low-power timer1 oscillator
CONFIG FCMEN = OFF ;fail-safe clock monitor
CONFIG IESO = OFF ;nternal External Oscillator Switch Over Mode
CONFIG WDTPS = 1 ;watchdog postscaler
;CONFIG DSWDTOSC= INTOSCREF ;dswdt clock select
;CONFIG RTCOSC = INTOSCREF ;rtcc clock select
;CONFIG DSBOREN = OFF ;deep sleep bor
;CONFIG DSWDTEN = OFF ;deep sleep watchdog timer
;CONFIG DSWDTPS = 2 ;deep sleep watchdog postscaler
;CONFIG IOL1WAY = OFF ;iolock one-way set enable bit
;CONFIG MSSP7B_EN=MSK5 ;mssp address masking
;CONFIG WPFP = PAGE_0 ;write/Erase Protect Page Start/End Location:
;CONFIG WPEND = PAGE_0 ;write/Erase Protect Region Select bit (valid when WPDIS = 0):
;CONFIG WPCFG = OFF ;write/Erase Protect Configuration Region
;CONFIG WPDIS = OFF ;write Protect Disable bit