Menu

Config definitions

Help
2008-10-19
2013-05-30
  • Nobody/Anonymous

    I have a question about which I've found no documentation. Looking at the 16f887.dat (parts pasted below), I can see that the [ConfigOps] section gives the options for use in the #config directive, and it looks like they each reference a line by state in the [config] section, but what do the numbers after each mean? Perhaps you could give me some guidance for mapping it to the datasheet more clearly.

    Also, this line is from the help file:
    #config OSC = RC, BODEN = OFF

    but these don't appear to be valid for this chip, even though RC is a valid oscillator type for the hardware. Is this a change in syntax since it was written, or should one examine the dat file for each chip and not rely on general advice in the help file?

    Thanks.

    [ConfigOps]
    DEBUG=ON,OFF
    LVP=ON,OFF
    FCMEN=ON,OFF
    IESO=ON,OFF
    BOR=ON,NSLEEP,SBODEN,OFF
    CPD=ON,OFF
    CP=ON,OFF
    MCLRE=ON,OFF
    PWRTE=ON,OFF
    WDT=ON,OFF
    OSC=LP_OSC,XT_OSC,HS_OSC,EC_OSC,INTRC_OSC_NOCLKOUT,INTRC_OSC_CLKOUT,EXTRC_OSC_NOCLKOUT,EXTRC_OSC_CLKOUT,INTOSCIO,INTOSC,EXTRCIO,EXTRC
    WRT=OFF,256,1FOURTH,HALF
    BORV=21,40

    [Config]
    DEBUG_ON,1,8191
    DEBUG_OFF,1,16383
    LVP_ON,1,16383
    LVP_OFF,1,12287
    FCMEN_ON,1,16383
    FCMEN_OFF,1,14335
    IESO_ON,1,16383
    IESO_OFF,1,15359
    BOR_ON,1,16383
    BOR_NSLEEP,1,16127
    BOR_SBODEN,1,15871
    BOR_OFF,1,15615
    CPD_ON,1,16255
    CPD_OFF,1,16383
    CP_ON,1,16319
    CP_OFF,1,16383
    MCLRE_ON,1,16383
    MCLRE_OFF,1,16351
    PWRTE_ON,1,16367
    PWRTE_OFF,1,16383
    WDT_ON,1,16383
    WDT_OFF,1,16375
    LP_OSC,1,16376
    XT_OSC,1,16377
    HS_OSC,1,16378
    EC_OSC,1,16379
    INTRC_OSC_NOCLKOUT,1,16380
    INTRC_OSC_CLKOUT,1,16381
    EXTRC_OSC_NOCLKOUT,1,16382
    EXTRC_OSC_CLKOUT,1,16383
    INTOSCIO,1,16380
    INTOSC,1,16381
    EXTRCIO,1,16382
    EXTRC,1,16383
    WRT_OFF,2,16383
    WRT_256,2,15871
    WRT_1FOURTH,2,15359
    WRT_HALF,2,14847
    BOR21V,2,16127
    BOR40V,2,16383

     
    • Nobody/Anonymous

      Bump!

      Just a quick sentence from a guru would be helpful... ;)

      Anyone?

      TIA.

       
    • Hugh Considine

      Hugh Considine - 2008-10-25

      The general rule is try using the config settings in the help file, and if they don't work look at the datasheet or .dat file and use what is specified there instead. In the 16F887, RC has been renamed to EXTRC, and BODEN has been renamed BOR.

      The lines in the config file are in this format:

      SettingName, ConfigWord, ConfigValue

      SettingName is the name of the setting in assembly. ConfigWord is the location in which the particular value is stored, most 16F PICs only have 1 config word, but some newer ones (including the 16F887) have 2, and the 18Fs have several. ConfigValue is the value that GCBASIC must And with 16383 to calculate the value for the config word.

       

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.