Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIC18f45k22
#3
(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
I attached project code as it is right now. 


Attached Files
.zip   ds30Loader.X.zip (Size: 95.51 KB / Downloads: 4)
Reply


Messages In This Thread
PIC18f45k22 - by richcj10 - 2015-03-05, 05:39:07
RE: PIC18f45k22 - by Mikael Gustavsson - 2015-03-06, 14:43:07
RE: PIC18f45k22 - by richcj10 - 2015-03-11, 07:05:28
RE: PIC18f45k22 - by richcj10 - 2015-03-13, 20:49:15
RE: PIC18f45k22 - by Mikael Gustavsson - 2015-03-15, 19:29:36
RE: PIC18f45k22 - by richcj10 - 2015-03-15, 22:38:24
RE: PIC18f45k22 - by Mikael Gustavsson - 2015-04-05, 21:04:06
RE: PIC18f45k22 - by richcj10 - 2015-04-18, 11:19:12
RE: PIC18f45k22 - by eur - 2017-10-28, 18:28:59
RE: PIC18f45k22 - by Mikael Gustavsson - 2017-10-31, 16:26:39

Forum Jump:


Users browsing this thread: 1 Guest(s)