Using an MCP4725 with Arduino Uno and Arduino NANO V3 I get a precise sine wave @ 50 Hz 5Vpp
The same sketch loaded on Arduino NANO Every results in a frequency of 20 Hz.
To increase the frequency I should decrease the number of data in the array.
Il looks like the Every is slower than Uno and Nano V3, even if the cpu frequency is 20MHz (Every) instead of 16MHz (Uno and Nano v3),
Please note: the following sketch is a simplified program from the official MCP4725 Arduino Library (Version 2.0 - the latest). The modification I have done is just the number of data too get a precise 50Hz. With Uno and Nano v3 it works, with Every it does not work
Some suggestion?
This is the sketch:
#include <Wire.h>
#include <Adafruit_MCP4725.h>
int i = 0;
Adafruit_MCP4725 dac;
#define DAC_RESOLUTION (7)
const PROGMEM uint16_t DACLookup_FullSine_7Bit[137] = {
4036, 4057, 4073, 4085, 4092, 4095, 4094, 4089, 4079, 4065,
4047, 4025, 3998, 3967, 3933, 3894, 3852, 3805, 3755, 3702,
3644, 3584, 3520, 3454, 3384, 3311, 3236, 3158, 3078, 2996,
2912, 2826, 2738, 2649, 2559, 2467, 2375, 2282, 2188, 2094,
2001, 1907, 1813, 1720, 1628, 1536, 1446, 1357, 1269, 1183,
1099, 1017, 937, 859, 784, 711, 641, 575, 511, 451,
393, 340, 290, 243, 201, 162, 128, 97, 70, 48,
30, 16, 6, 1, 0, 3, 10, 22, 38, 59,
83, 112, 144, 181, 222, 266, 314, 366, 422, 480,
542, 608, 676, 747, 821, 898, 976, 1058, 1141, 1226,
1313, 1401, 1491, 1582, 1674, 1767, 1860, 1954, 2048, 2141,
2235, 2328, 2421, 2513, 2604, 2694, 2782, 2869, 2954, 3037,
3119, 3197, 3274, 3348, 3419, 3487, 3553, 3615, 3673, 3729,
3781, 3829, 3873, 3914, 3951, 3983, 4012,
};
void setup(void) {
dac.begin(0x62);
}
void loop(void) {
for (i = 0; i < 137; i++) {
dac.setVoltage(pgm_read_word(&(DACLookup_FullSine_7Bit[i])), false);
}
}