CONFIG 2085 IMPROVED

Top  Previous  Next

The CONFIG statement is used to configure the various hardware devices.

Some CONFIG statements depend on the processor platform. Since some platforms have unique hardware not found on other platforms.

 

DIRECTIVE

RE-USABLE

NORMAL AVR

XMEGA

XTINY/MEGAX/AVRX

XMEGA ONLY

XTINY/UPDI ONLY

CONFIG 1WIRE

NO

X

X

X

 

 

CONFIG ACAX|ACBX

YES

 

X

 

X

 

CONFIG ACI

YES

X

 

 

 

 

CONFIG ACx 2083 NEW

YES

 

 

X

 

X

CONFIG ADC

NO

X

 

 

 

 

CONFIG ADCA|ADCB

YES

 

X

 

X

 

CONFIG ADC0|ADCx 2083 NEW

YES

 

 

X

 

X

CONFIG ATEMU

NO

X

 

 

 

 

CONFIG BASE

NO

X

X

X

 

 

CONFIG BCCARD

NO

X

 

 

 

 

CONFIG CANBUS

YES

X

 

 

 

 

CONFIG CANMOB

YES

X

 

 

 

 

CONFIG CLOCK 2083 ENHANCED

NO

X

X

X

 

 

CONFIG CLOCKDIV

YES

X

 

 

 

 

CONFIG COM1 2083 ENHANCED

YES

X

X

X

 

 

CONFIG COM2 also COM3 - COM8

YES

X

X

X

 

 

CONFIG COMx

YES

X

X

X

 

 

CONFIG DACA|DACB

YES

 

X

 

X

 

CONFIG DACX 2083 NEW

YES

 

 

X

 

X

CONFIG DATE

NO

X

X

X

 

 

CONFIG DCF77

NO

X

X

 

 

 

CONFIG DEBOUNCE

NO

X

X

X

 

 

CONFIG DMA

YES

 

X

 

X

 

CONFIG DMACHx

YES

 

X

 

X

 

CONFIG DMXSLAVE

NO

X

X

X

 

 

CONFIG DP

NO

X

X

X

 

 

CONFIG EDMA

 

 

X

 

x

 

CONFIG EDMAx

 

 

X

 

x

 

CONFIG EEPROM

NO

 

X

X

X

 

CONFIG ERROR

NO

X

X

X

 

 

CONFIG EVENT_SYSTEM XMEGA

YES

 

X

 

X

 

CONFIG EVENT_SYSTEM XTINY 2083 NEW

YES

 

 

X

 

X

CONFIG EXTENDED_PORT

NO

X

 

 

 

 

CONFIG FT800

NO

X

X

X

 

 

CONFIG GRAPHLCD

NO

X

X

X

 

 

CONFIG HITAG

NO

X

 

 

 

 

CONFIG I2CBUS

YES

X

X

X

 

 

CONFIG I2CDELAY

NO

X

 

 

 

 

CONFIG I2CSLAVE

NO

X

X

 

 

 

CONFIG INPUT

NO

X

X

X

 

 

CONFIG INPUTBIN

NO

X

X

X

 

 

CONFIG INTx

YES

X

X

X

 

 

CONFIG INTVECTORSELECTION

YES

X

X

X

 

 

CONFIG KBD

NO

X

X

 

 

 

CONFIG KEYBOARD

NO

X

X

X

 

 

CONFIG LCD

NO

X

X

X

 

 

CONFIG LCDBUS

NO

X

X

X

 

 

CONFIG LCDMODE

NO

X

X

X

 

 

CONFIG LCDPIN

NO

X

X

X

 

 

CONFIG OPAMP 2085 NEW

YES

 

 

X

 

X

CONFIG OSC XMEGA

YES

 

X

X

 

 

CONFIG OSC XTINY 2085 NEW

YES

 

 

X

 

 

CONFIG PORT

YES

X

X

X

 

 

CONFIG PORT_MUX 2084 NEW

YES

 

 

X

 

X

CONFIG POWERMODE

YES

X

X

X

 

 

CONFIG POWER_REDUCTION

NO

 

X

 

X

 

CONFIG PRIORITY XMEGA

YES

 

X

 

X

 

CONFIG PRIORITY XTINY 2083 NEW

YES

 

 

X

 

X

CONFIG PRINT

NO

X

X

X

 

 

CONFIG PRINTBIN

NO

X

X

X

 

 

CONFIG PS2EMU

NO

X

 

 

 

 

CONFIG RAINBOW

NO

X

X

X

 

 

CONFIG RC5

NO

X

 

 

 

 

CONFIG RND

NO

X

X

X

 

 

CONFIG SERIALIN

NO

X

X

X

 

 

CONFIG SERIALIN1

NO

X

X

 

 

 

CONFIG SERIALIN2

NO

X

X

 

 

 

CONFIG SERIALIN3

NO

X

X

 

 

 

CONFIG SERIALOUT

NO

X

X

 

 

 

CONFIG SERIALOUT1

NO

X

X

 

 

 

CONFIG SERIALOUT2

NO

X

X

 

 

 

CONFIG SERIALOUT3

NO

X

X

 

 

 

CONFIG SERVOS

NO

X

X

 

 

 

CONFIG SHIFTIN

NO

X

X

X

 

 

CONFIG SINGLE

YES

X

X

X

 

 

CONFIG SDA

NO

X

X

X

 

 

CONFIG SCL

NO

X

X

X

 

 

CONFIG SPI

NO

X

 

 

 

 

CONFIG SPIx

YES

 

X

X

X

 

CONFIG SUBMODE

NO

X

X

X

 

 

CONFIG SYSCLOCK XMEGA

YES

 

X

 

X

 

CONFIG SYSCLOCK XTINY 2083 NEW

YES

 

 

X

 

X

CONFIG TCXX

YES

 

X

X

X

 

CONFIG TCA0

YES

 

 

X

 

X

CONFIG TCB0, TCB1 2084 NEW

YES

 

 

X

 

X

CONFIG TCD0 2084 NEW

YES

 

 

X

 

X

CONFIG TCPIP

NO

X

X

X

 

 

CONFIG TWI

YES

X

X

X

 

 

CONFIG TWISLAVE

NO

X

 

 

 

 

CONFIG TWIxSLAVE

NO

 

X

 

x

 

CONFIG TIMER0

YES

X

 

 

 

 

CONFIG TIMER1

YES

X

 

 

 

 

CONFIG TIMER2 and 3

YES

X

 

 

 

 

CONFIG USB

NO

X

 

 

 

 

CONFIG USI

NO

X

 

 

 

 

CONFIG VPORT

YES

 

X

 

X

 

CONFIG VREF XTINY 2083 NEW

YES

 

 

X

 

X

CONFIG VREGPWR AVRX 2085 NEW

YES

 

 

X

 

X

CONFIG WATCHDOG

YES

X

X

X

 

 

CONFIG WAITSUART

NO

X

X

X

 

 

CONFIG X10

NO

X

 

 

 

 

CONFIG XPIN

YES

X

X

X

 

 

CONFIG XRAM

YES

X

X

 

 

 

CONFIG ZCDx 2085 NEW

YES

 

 

X

 

X

 

Some CONFIG directives are intended to be used once. Others can be used multiple times. For example you can specify that a port must be set to input after you have specified that it is used as an input.

 

You cannot change the LCD pins during run time. In that case the last specification will be used or an error message will be displayed.

 

Some configuration commands are only available to the Xmega. An X in the 'Xmega Only' column indicates that the command can only be used for an Xmega processor.

Some configuration commands are exclusive for the Xtiny processors. An X in the 'Xtiny Only' column indicates that the commands can only be used for an Xtiny processor.

With XTYINY we also mean MEGAX and AVRX.

 

PRESERVE and OVERWRITE

In version 2084 a part of the hard coded option logic is moved to the DAT files.

Some CONFIG statements like CONFIG PORT_MUX have a new value : PRESERVE or OVERWRITE.

Other CONFIG statements might have an option named REGMODE. This REGMODE option has the same possible values : PRESERVE and OVERWRITE.

 

So what is this OVERWRITE or PRESERVE about?

When you configure the various options for a piece of hardware, the compiler will convert these options to the proper values and write this to the proper registers.

Only registers that are changed will be written too. But normally the whole register will be written too.

When a register sets just one option for example the clock speed, that is no problem. But when the register also has a few bits that set other hardware it might become a problem.

When you create the initial CONFIG statement there is no problem since all required bits will be set. But if you want to change a configuration later and you want to change just a single part of the configuration you could erase an option.

 

Lets add a simple sample. Assume there is a register named REGCTRLA and it has 8 bits. The 3 lower bits are used to set the prescaler. The upper 1 bit is used to enable some output pin.

BIT 7

BIT 6

BIT 5

BIT 4

BIT 3

BIT 2

BIT 1

BIT 0

O

x

x

x

x

S

S

S

 

The x mean don't care. It does not mean what we write to it.

Now when you would : CONFIG TEST=DUMMY, PRESCALER=2, OUTPUT=ENABLED

Here you configure all the bits in the register. So it is not needed to preserve any bits, the compiler can simply write the proper value to the register.

 

When REGMODE is not used it is the same as OVERWRITE and the same as : CONFIG TEST=DUMMY, PRESCALER=2, OUTPUT=ENABLED, REGMODE=OVERWRITE

Here all the bits will be written. But also when you use : CONFIG TEST=DUMMY, PRESCALER=2

This has the implicit OVERWRITE. What happens however is that only the prescaler value is provided. Since there is no preservation for other bits, the compiler will write a zero for the P bit.

 

And that is why the PRESERVE option exist : it will load the  register value, alter it, and write it back. This will use more code.

 

When you use the default OVERWRITE mode the compiler will try to re-use register values. This also means that the compiler output might vary depending on the settings !

For example when you set an option that need to write to 3 registers, and all registers values are different, 3 registers are loaded with those values and written to the hardware registers.

But when the options you select result in a similar values, it is not needed to load the same value multiple times, and a different register will be used.

So the resulting binary might become bigger/smaller depending on the options.