(2015-03-06, 14:43:07)Mikael Gustavsson Wrote: Hi,
You say 1MHz but the code comment says 16MHz. Which is it?
I had the 16 Mhz stuff comented out. I did how ever change it to 16 Mhz
Code:
; Set internal oscillator to 16MHz
movlw 0x72
movwf OSCCON
movlw 0x04
movwf OSCCON2
Code:
;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
radix DEC
#define OSCF 16000000 ;xxx oscillator frequency (including pll)
#define BLINIT 2000 ;xxx hello receive timeout [ms]
#define HELLOTRIES 2 ;xxx number of non hello characters received before branching to the user application
#define BLTIME 2000 ;xxx data receive timeout [ms]
;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------
#define USE_UART1 1 ;xxx uncomment to use uart1
;#define USE_UART2 1 ;xxx uncomment to use uart2
#define BAUDRATE 19200 ;xxx baudrate
;#define USE_ABAUD 1 ;xxx uncomment to use auto baud rate detection, READ ERRATA FIRST
#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 TXE_DELAY 10 ;xxx time in us to wait before transmitting after pulling the tx enable pin high
#define TRISR_TXE TRISD ;xxx tris register containing tx enable
#define LATR_TXE LATD ;xxx port register containing tx enable
#define TRISB_TXE TRISD0 ;xxx tris bit for tx enable
#define LATB_TXE RD0 ;xxx port bit for tx enable
endif
I also set the GPIO to a known good setting.
Code:
movlw 0x00
movwf LATA
movlw 0xF7
movwf TRISA
movlw 0x20
movwf ANSELA
movlw 0x00
movwf LATB
movlw 0xD7
movwf TRISB
movlw 0x00
movwf ANSELB
movlw 0x00
movwf WPUB
movlw 0x18
movwf LATC
movlw 0xFF
movwf TRISC
movlw 0x04
movwf ANSELC
movlw 0x00
movwf LATD
movlw 0xFD
movwf TRISD
movlw 0xDD
movwf ANSELD
movlw 0x00
movwf LATE
movlw 0x00
movwf TRISE
movlw 0x00
movwf ANSELE