Hey there,
I tried the DACC on the Arduino Due, but it doesn't work as expected. I used the function analogWrite() for setting a new DAC value. The following code will work as expected:
byte value;
void loop() {
analogWrite(DAC0, value++);
}
Same applies if you replace DAC0 with DAC1. For some unknown reason, I couldn't get both DACs to work simultaneously. The following code does not work:
byte value;
void loop() {
analogWrite(DAC0, value++);
analogWrite(DAC1, value * 2);
}
I think it has something to do with the code in hardware/arduino/sam/cores/arduino/wiring_analog.c. In the function analogWrite() there is the following lines:
// Write user value
ulValue = mapResolution(ulValue, _writeResolution, DACC_RESOLUTION);
dacc_write_conversion_data(DACC_INTERFACE, ulValue);
I'm missing the channel selection before writing conversion data. Did someone else use the DACs before with analogWrite()? Is the reported behaviour bug or feature?
mfg, Stefan.