CONFIG XPIN/de
Contents |
= (**COPIED FROM ENGLISH PAGE**) === Action
Configures all other features of a Xmega port or port pin like for example pullup but not the data direction.
You still need to use PORTx = state or PINx.y = state to configure the data direction of that port or pin in addition to CONFIG XPIN.
Syntax
CONFIG XPIN=PORT|PIN, INVERTIO=invio, SLEWRATE=slew, OUTPULL=pull, SENSE=sense
Remarks
Normal AVR port pins can be configured as an input or output. When configured as an input (CONFIG PIN=INPUT) they can also be set to tri-state (write a 0 to the PORT register) or to activate the pull up resistor(write a 1 to the PORT register).
The xmega has many more options. The Xmega manual explains all the options.
The CONFIG XPIN statement will set the proper registers.
PORT PIN |
The pin to be configured. For example PORTC.0 When configuring the whole port (all the pins must have the same functionality), use PORT. For example : PORTD |
INVERTIO |
This option will invert the data for both input and output modes. Possible values : ENABLED (will invert data), DISABLED(normal mode) |
SLEWRATE |
Will enable or disable the slewrate. Enabling the slew rate will increase the rise/fall time by 50%-150%. Possible values : ENABLED, DISABLED |
OUTPULL |
Sets the output or pull mode. The following options are available: - TOTEM : output totem pole - BUSKEEPER : output totem pole, input bus keeper - PULLDOWN : output totem pole, input pull down - PULLUP : output totem pole, input pull up - WIREDOR : output wired OR - WIREDAND: output wired AND -WIREDORPULL : output wired OR, input pull down -WIREDANDPULL : output wired AND, input pull up |
SENSE |
In input mode, the trigger sense can be configured. Possible values : - BOTH : sense both edges - RISING : sense rising edge -FALLING : sense falling edge -LOW_LEVEL :sense low level - INP_DISABLED : digital input buffer disabled (only PORTA-PORTF) |
Normal AVR code that use : PORTX.Y=1 to activate the pul up, should be written as : CONFIG XPIN=PORTX.Y,OUTPULL=PULLUP
See also
Example
Config Porte.5 = Input Config Xpin = Porte.5 , Outpull = Pullup , Sense = Falling 'enable Pull up and reaction on falling edge
$regfile = "xm256a3budef.dat" $Crystal = 32000000 '32MHz Config Xpin = Portc.0 , Slewrate = Enabled , Outpull = Buskeeper , Sense = Low_level Config Xpin = Portc.1 , Slewrate = Enabled , Outpull = Buskeeper , Sense = Low_level 'setup the whole port at once Config Xpin = Portd , Slewrate = Enabled , Outpull = Buskeeper , Sense = Low_level
Languages | English • Deutsch |
---|