Action
This statement configures the DACA or DACB in the Xmega.
Syntax
CONFIG DACx=dac, IO0=IO0, IO1=IO1, INTERNAL_OUTPUT =INTOTP, CHANNEL=channel, TRIGGER_CH0=trig0, TRIGGER_CH1=trig1, REFERENCE=ref, LEFT_ADJUSTED=adjusted, EVENT_CHANNEL=event, INTERVAL=interval, REFRESH=refresh
Remarks
DACX |
Chose either DACA or DACB. DACA is connected to PORTA. DACB is connected to PORTB. |
dac |
ENABLED or DISABLED. Chose ENABLED to enable the DAC. |
IO0 |
ENABLED or DISABLED. Chose ENABLED to enable output 0. Each DAC has 2 outputs. When multiple outputs are used, the DAC is using S&H. |
IO1 |
ENABLED or DISABLED. Chose ENABLED to enable output 1. |
Intotp |
ENABLED or DISABLED. Chose ENABLED to enable the internal output. |
Channel |
SINGLE or DUAL. If both outputs are used, you need to enable the second output with IO1. |
Trig0 |
ENABLED or DISABLED. Chose ENABLED to enable the trigger of channel 0. |
Trig1 |
ENABLED or DISABLED. Chose ENABLED to enable the trigger of channel 1. |
Ref |
The DAC needs a stable voltage reference. You can chose one of the following: - INT1V. This will select the internal 1V reference - AVCC. This will use AVCC as reference. - AREFA. This will use AREFA as reference. - AREFB. This will use AREFB as reference. The output of the DAC can never be higher then the voltage reference. When you chose INT1V, the output is from 0-1V in 4096 steps. |
Adjusted |
ENABLED or DISABLED. By default the DAC output is right adjusted. You can left alight the result. |
Event |
The event channel to use for the event system. |
Interval |
The minimum interval between 2 conversions. This is a value of : 1,2,4,8,16,32,64 or 128. The default in the register is 64. A value of 64 will give an interval of 64 clock cycles. |
Refresh |
The DAC channel refresh timing. This is the interval refresh time in DUAL channel mode. Possible values: OFF 16, 32, 128, 256, 512, 1014, 2048, 4096, 8192, 16384, 32768, 65536. A value of 16 means an interval of 16 clock cycles. The default loaded is 64. |
The DAC data register is available in the DACA0, DACA1 and DACB0 and DACB1 variables.
See also
Example
Config Daca = Enabled , Io0 = Enabled , Channel = Single , Reference = Int1v , Interval = 64 , Refresh = 64
Daca0 = 4095 '1 V output on porta.2
See also the example xm128a1.bas from the samples\chips folder