Positron Compiler Documentation

Config

Source: Positron8 Compiler User Manual, PDF page 417

Syntax

Config { configuration fuse settings }

Overview

Enable or Disable particular fuse settings for the PICmicro™.

Parameters

configuration fuse settings vary from device to device, however, certain settings are standard to most PICmicro™ types. Refer to the microcontroller’s datasheet for details.

Example

' Disable Watchdog timer and specify an HS_OSC etc, on a PIC16F877 device
  Config  HS_OSC, WDT_OFF, PWRTE_ON, BODEN_OFF, LVP_OFF, _
          WRTE_ON, CP_OFF, DEBUG_OFF

18F Fuse Setting.

Because of the complexity that 18F devices require for adjusting their many fuses, the Config directive is not suitable. Instead a more intuitive approach is adopted using the Config_Start and Config_End directives: -

Config_Start
  OSC = HS
                      ' Oscillator Selection HS
  OSCS = Off
                      ' Osc. Switch Enable Disabled
  PWRT = On
                      ' Power-up Timer Enabled
  BOR = Off
                      ' Brown-out Reset Disabled
  BORV = 25
                      ' Brown-out Voltage 2.5V
  WDT = Off
                      ' Watchdog Timer Disabled
  WDTPS = 128
                      ' Watchdog Postscaler 1:128
  CCP2MUX = On
                      ' CCP2 MUX Enable (RC1)
  STVR = Off
                      ' Stack Overflow Reset Disabled
  LVP = Off
                      ' Low Voltage ICSP Disabled
  DEBUG = Off
                      ' Background Debugger Enable Disabled
  CP0 = Off
                      ' Code Protection Block 0 Disabled
  CP1 = Off
                      ' Code Protection Block 1 Disabled
  CP2 = Off
                      ' Code Protection Block 2 Disabled
  CP3 = Off
                      ' Code Protection Block 3 Disabled
  CPB = Off
                      ' Boot Block Code Protection Disabled
  CPD = Off
                      ' Data EEPROM Code Protection Disabled
  WRT0 = Off
                      ' Write Protection Block 0 Disabled
  WRT1 = Off
                      ' Write Protection Block 1Disabled
  WRT2 = Off
                      ' Write Protection Block 2 Disabled
  WRT3 = Off
                      ' Write Protection Block 3 Disabled
  WRTB = Off
                      ' Boot Block Write Protection Disabled
  WRTC = Off
                      ' Configuration Register Write Protection Disabled
  WRTD = Off
                      ' Data EEPROM Write Protection Disabled
  EBTR0 = Off
                      ' Table Read Protection Block 0 Disabled
  EBTR1 = Off
                      ' Table Read Protection Block 1 Disabled
  EBTR2 = Off
                      ' Table Read Protection Block 2 Disabled
  EBTR3 = Off
                      ' Table Read Protection Block 3 Disabled
  EBTRB = Off
                      ' Boot Block Table Read Protection Disabled
Config_End

The configs shown are for the 18F452 device and differ from device to device. A complete list of Config fuse settings can be found in the "hlpPIC18ConfigSet.chm" file downloadable from www.microchip.com.

The fuse setting text between Config_Start and Config_End will have the preceding Config text added, then is passed directly to the assembler. Any errors in the fuse setting texts will result in Assembler errors being produced.

Notes

If the Config directive is not used within the BASIC program then default values are used. These may be found in the .ppi files within the “Includes\PPI” folder.

When using either of the Config directives, always use all the fuse settings for the particular PICmicro™ used. With 14-bit core (16F) devices, the compiler will always issue a reminder after the Config directive has been issued, however, this may be ignored if you are confident that you have assigned all the relevant fuse names.

Any fuse names that are omitted from the Config list will normally assume an Off or Disabled state. However, this is not always the case, and unpredictable results may occur, or the PICmicro™ may refuse to start up altogether.

Before programming the PICmicro™, always check the user configured fuse settings at programming time to ensure that the settings are correct.

Always read the datasheet for the particular PICmicro™ of interest, before using this directive.

Subtopics