Menu

doubt on oscillator with bootloader

epy
2017-08-16
2017-08-16
  • epy

    epy - 2017-08-16

    Hi,
    I am using PIC18F45k22 controller. And i select tinybld18F23K22_int16MHz_19200 and modified for 18f45k22 pic controller.
    I have doubt, whether this will work with internal crystal or i will have to change the crystal?
    Or will it work with 4MHz/8Mhz crystal? if change the MACRO in code.

    #include "p18f45k22.inc"
    IdTypePIC = 0x64        ; Please refer to the table below, must exists in "piccodes.ini"    
    #define max_flash  0x8000   ; in WORDS, not bytes!!! (= 'max flash memory' from "piccodes.ini" divided by 2), Please refer to the table below
    #define SELECTEUSART 1      ; EUSART(1/2), Please refer to the table below
    #define EEPROMSIZE 256      ; Size of EEPROM (256/1024), Please refer to the table below
    
    xtal    EQU     16000000    ; you may also want to change: _HS_OSC _XT_OSC
    baud    EQU     19200       ; standard TinyBld baud rates: 115200 or 19200
    

    Epy

     
  • Dan

    Dan - 2017-08-21

    Hi Epy

    I have doubt, whether this will work with internal crystal ?

    config FOSC = INTIO67 ;Internal oscillator block, port function on RA6 and RA7
    config PLLCFG = OFF ;Oscillator used directly
    config PRICLKEN = ON ;Primary clock enabled

    bsf OSCCON,IRCF2 ;int clock 16MHz

    Or will it work with 4MHz/8Mhz crystal?

    ;use only SPBRG (8 bit mode default) not using BAUDCON
    movlw spbrg_value
    movwf _SPBRG

    from Dan.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.