The Giga has two 12-bit DAC pins. Can you use analogWriteResolution() to access that resolution level with analogWrite()?
The reference page (analogWriteResolution() - Arduino Reference ) has no mention of the Giga. I don't see any way programmatically to tell if a call to analogWriteResolution() has been successful.
Thanks.
That's exactly the link I included in my original post.
The link has no mention of the Giga as a supported board. But Arduino documentation is often incomplete or out of date. I'm trying to find out if the documentation is in fact correct, or if this function is supported on the Giga.
Thanks.
Well, does the "giga" have identical A/D functions? They are specifically documented in the PDF. What does the "giga" specification report?
You can easily test
Just compile some code for the Giga that contains the function; you do not need a board for that (just the board package). If the compiler complains it is not supported.
Well no. From the documentation:
Notes and Warnings
If you set the analogWriteResolution() value to a value higher than your board’s capabilities, the Arduino will discard the extra bits. For example: using the Due with analogWriteResolution(16) on a 12-bit DAC pin, only the first 12 bits of the values passed to analogWrite() will be used and the last 4 bits will be discarded.
If you set the analogWriteResolution() value to a value lower than your board’s capabilities, the missing bits will be padded with zeros to fill the hardware required size. For example: using the Due with analogWriteResolution(8) on a 12-bit DAC pin, the Arduino will add 4 zero bits to the 8-bit value used in analogWrite() to obtain the 12 bits required.
If it isn't supported, you don't get an error, it just pretends that it is supported.
The only way to tell by observation that it's working would be to see whether the output actually produced has 4096 discrete values. Since the Giga runs at 3.3V, each increment represents well under 1mv. My digital voltmeter only has a precision of 10mv so it's not something I can measure.
Which is why I'm hoping that someone who knows the answer might chime in.
My interpretation of your question was different. You asked
Which for me means you asked if the function exists.
Sorry for wasting your time.
OK, I think I've answered my own question, and my tentative answer is yes.
I wrote a simple sketch:
int DacPin= A12;
pinMode(DacPin, OUTPUT);
analogWriteResolution(12);
int x;
for(x=0; x< 410; x++)
{
Serial.println(x);
analogWrite(DacPin, x*10);
delay(2000);
}
I put my digital voltmeter across A12 and ground, and measured. The voltage steadily increased. Even with a 2 second delay between changes the meter couldn't stabilize completely, but it seemed to be increasing about 7 or 8 mv every two seconds. At 100% I read 3.23 volts, with 12 bit precision I should have 4095 intervals, so each interval is .79 mv. So ten would 7.9 volts, which seems to be the behavior I'm seeing.
Thanks to everyone who replied.
1 Like