Go Down

Topic: No GND or full range on DAC0 (Read 806 times) previous topic - next topic

BlackSnake

Hi,
I have just started using the DUE board and have ran into a problem. I used te following code to test wether or not my problems were code or electronic related. This code is meant to see if the DAC output would do what it says it will. instead I get the following results
DAC set to 0 = 0.625V
DAC set to 1023 = 0.825 (Correct)
DAC set to 2048 = 1.65 (Correct)
DAC set to 4096 = 2.74.

Can anyone please tell me why I don't have ground (0 Volts) or full range (3.3 Volts) ?

Code: [Select]

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  analogWriteResolution(12);
  analogWrite(DAC0, 0);
  Serial.print("DAC Value = 0 ");
  delay(5000);
 
  analogWriteResolution(12);
  analogWrite(DAC0, 1023);
  Serial.print("DAC Value = 1023 ");
  delay(5000);
 
  analogWriteResolution(12);
  analogWrite(DAC0, 2048);
  Serial.print("DAC Value = 2048 ");
  delay(5000);
 
  analogWriteResolution(12);
  analogWrite(DAC0, 4095);
  Serial.println("DAC Value = 4095 ");
  delay(5000);
}

Magician

It was mentioned  on this forum many times, that range of the Due DAC is only 1/6 to 5/6 Vcc. You 'd need external circuitry to get it over rail-to-rail.

Go Up