Is it possible for the DACs ie A21 & A22 to read different
sine tables and output independent values based on those tables.
Here is my test code , but it wont read from each table.
If i comment out one DAC it will work but outputs
on both DACs sometimes.
Whats wrong with this picture ?
I can do it with an UNO and MP4922 but that is not fast enough.
sine tables and output independent values based on those tables.
Here is my test code , but it wont read from each table.
If i comment out one DAC it will work but outputs
on both DACs sometimes.
Code:
// Test DACs sine wave on Teensy 3.5
const int sine_dataA[192] = {512,529,545,562,579,595,612,628,645,661,677,692,708,723,738,753,768,782,796,810,824,837,850,862,874,886,897,908,918,928,938,947,
955,964,971,978,985,991,997,1002,1007,1011,1014,1017,1020,1022,1023,1024,1024,1024,1023,1022,1020,1017,1014,1011,1007,1002,997,991,
985,978,971,964,955,947,938,928,918,908,897,886,874,862,850,837,824,810,796,782,768,753,738,723,708,692,677,661,645,628,612,595,579,
562,545,529,512,495,479,462,445,429,412,396,379,363,347,332,316,301,286,271,256,242,228,214,200,187,174,162,
150,138,127,116,106,96,86,77,69,60,53,46,39,33,27,22,17,13,10,7,4,2,1,0,0,0,1,2,4,7,10,13,17,22,27,33,39,46,53,60,
69,77,86,96,106,116,127,138,150,162,174,187,200,214,228,242,256,271,286,301,316,332,347,363,379,396,412,429,445,462,479,495};
const int sine_dataB[192] ={512,545,579,612,645,677,708,738,768,796,824,850,874,897,918,938,955,971,985,997,1007,1014,1020,1023,1024,1023,1020,1014,1007,997,
985,971,955,938,918,897,874,850,824,796,768,738,708,677,645,612,579,545,512,479,445,412,379,347,316,286,256,228,200,174,
150,127,106,86,69,53,39,27,17,10,4,1,0,1,4,10,17,27,39,53,69,86,106,127,150,174,200,228,256,286,
316,347,379,412,445,479,
512,545,579,612,645,677,708,738,768,796,824,850,874,897,918,938,955,971,985,997,1007,1014,1020,1023,1024,1023,1020,1014,1007,997,
985,971,955,938,918,897,874,850,824,796,768,738,708,677,645,612,579,545,512,479,445,412,379,347,316,286,256,228,200,174,
150,127,106,86,69,53,39,27,17,10,4,1,0,1,4,10,17,27,39,53,69,86,106,127,150,174,200,228,256,286,
316,347,379,412,445,479};
int i =0;
void setup() {
analogWriteResolution(10);
pinMode(A21, OUTPUT);
pinMode(A22, OUTPUT);
}
void loop() {
{
for (int i=0; i<=191; i=i+1)
analogWrite(A21,sine_dataA[i]); //6.25 khz approx
analogWrite(A22,sine_dataB[i]); // 13.66 Khz approx
}
}
//
I can do it with an UNO and MP4922 but that is not fast enough.
Last edited by a moderator: