DEFINE OSC Compiler Error Message


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: DEFINE OSC Compiler Error Message

    On these chips, I think you will have to put your configs back into the .inc file, rather than in your code. Basically, there is an OSC in the microchip pxxxx.inc file, that does not get allong with the pbp OSC definition.

    For instance, on the PIC18F4520, the oscillator settings are:
    ; Oscillator Selection bits:
    ; OSC = LP LP oscillator
    ; OSC = XT XT oscillator
    ; OSC = HS HS oscillator
    ; OSC = RC External RC oscillator, CLKO function on RA6
    ; OSC = EC EC oscillator, CLKO function on RA6
    ; OSC = ECIO6 EC oscillator, port function on RA6
    ; OSC = HSPLL HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
    ; OSC = RCIO6 External RC oscillator, port function on RA6
    ; OSC = INTIO67 Internal oscillator block, port function on RA6 and RA7
    ; OSC = INTIO7 Internal oscillator block, CLKO function on RA6, port function on RA7

    On a PIC18F4550 they are:
    ; Oscillator Selection bits:
    ; FOSC = XT_XT XT oscillator, XT used by USB
    ; FOSC = XTPLL_XT XT oscillator, PLL enabled, XT used by USB
    ; FOSC = ECIO_EC External clock, port function on RA6, EC used by USB
    ; FOSC = EC_EC External clock, CLKOUT on RA6, EC used by USB
    ; FOSC = ECPLLIO_EC External clock, PLL enabled, port function on RA6, EC used by USB
    ; FOSC = ECPLL_EC External clock, PLL enabled, CLKOUT on RA6, EC used by USB
    ; FOSC = INTOSCIO_EC Internal oscillator, port function on RA6, EC used by USB
    ; FOSC = INTOSC_EC Internal oscillator, CLKOUT on RA6, EC used by USB
    ; FOSC = INTOSC_XT Internal oscillator, XT used by USB
    ; FOSC = INTOSC_HS Internal oscillator, HS used by USB
    ; FOSC = HS HS oscillator, HS used by USB
    ; FOSC = HSPLL_HS HS oscillator, PLL enabled, HS used by USB

    At some point in time Microchip switched FOSC to OSC, and when you declare your Configs in your code, it brings up this conflict for some of these newer chips.
    For a wacky work around, and better explanation, I had the same problem with another chip.
    http://www.picbasic.co.uk/forum/show...0824#post90824

    Simple and cleaner solution is to declare these back in the PBP .inc files.

  2. #2
    Join Date
    Sep 2010
    Posts
    50


    Did you find this post helpful? Yes | No

    Default Re: DEFINE OSC Compiler Error Message

    Thanks for the reply. Does seem wacky! So what I need to do is:

    1. Make a backup copy of your PBPPIC18.LIB.
    2. Now use an editor to find & replace all instances of OSC with XTAL.
    3. Save the .LIB file, and compile with DEFINE XTAL 48, and the new config directives in your code.

    So for my need for 32 mHz, I should change my define statement to:
    DEFINE XTAL 32 instead of DEFINE OSC 32

    Do I also need to remove the config stuff and put it back in the .inc file?
    Thanks, again.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts