kcnypmeknaj
Member
I did a specific project with a Teensy 3.2 where I needed also a DAC output, which worked very well and correctly.
For this specific application, the 3.2 looked overschooted, so I bought some LC's to do the same job, but the 1st one that I tested, could not go higher dan 1.58V on the DAC pin/A12
So I test it again with a very small program just to test the DAC and I got the same results.
////////////////////////////////////////////////////////////
int DACpin = A12;
int bitnumber = 4096; // maximum 12 bit
void setup() {
pinMode(DACpin, OUTPUT);
analogWriteResolution(12); // 12 bit resolution
}
void loop() {
analogWrite(DACpin, number);
}
////////////////////////////////////////////////////////////////////
RESULTS (Measurements)
with bitnumber = 512 -> 0.410V seems +/- 1/8 of 3.3V so OK
with bitnumber =1024 -> 0.81751 V seems +/-1/4 of 3.3V so OK
with bitnumber = 2048 -> 1.56995 V not excactly the 1/2 of 3.3V
with bitnumber = 4096 -> 1.58V instead +/- 3.3V -> NOT OK
So everything above +/ - 2000 -> 4096 gives 1.58V.
I did the test with 10 bit resolution and it also stocks at the 1/2 of 3.3V from +/- 512bit -> 1024 bit
What can be the problem? A bad LC or something else?
For this specific application, the 3.2 looked overschooted, so I bought some LC's to do the same job, but the 1st one that I tested, could not go higher dan 1.58V on the DAC pin/A12
So I test it again with a very small program just to test the DAC and I got the same results.
////////////////////////////////////////////////////////////
int DACpin = A12;
int bitnumber = 4096; // maximum 12 bit
void setup() {
pinMode(DACpin, OUTPUT);
analogWriteResolution(12); // 12 bit resolution
}
void loop() {
analogWrite(DACpin, number);
}
////////////////////////////////////////////////////////////////////
RESULTS (Measurements)
with bitnumber = 512 -> 0.410V seems +/- 1/8 of 3.3V so OK
with bitnumber =1024 -> 0.81751 V seems +/-1/4 of 3.3V so OK
with bitnumber = 2048 -> 1.56995 V not excactly the 1/2 of 3.3V
with bitnumber = 4096 -> 1.58V instead +/- 3.3V -> NOT OK
So everything above +/ - 2000 -> 4096 gives 1.58V.
I did the test with 10 bit resolution and it also stocks at the 1/2 of 3.3V from +/- 512bit -> 1024 bit
What can be the problem? A bad LC or something else?
