Hi! I read a lot about working with registers and how to accelerate time delay between switches for different pins but cantt implement it to my pins: A1 and A2. Please help me.
void setup() {
REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000;
REG_ADC_MR = (REG_ADC_MR & 0xFFFFFF0F) | 0x00000080; //enable FREERUN mode
ADC->ADC_MR |= 0x80; // these lines set free running mode on adc 7 and adc 6 (pin A0 and A1 - see Due Pinout Diagram thread)
ADC->ADC_CR=2;
ADC->ADC_CHER=0xE0; // enable channels 7, 6, 5 (Arduino pins A0, A1, A2)
//PORTB = 0; // All outputs OFF
Serial.begin(115200);
analogReadResolution(12);
analogWriteResolution(12);
}
void loop() {
while((ADC->ADC_ISR & 0xE0)!=0xE0);//? I want to wait for two conversions[/color] (pin A2[5] and A1[6])
a1=ADC->ADC_CDR[6]; // read data on A1 pin
val3+=a1;
....
valP=analogRead(A2);
Serial.println(valP);
a2=ADC->ADC_CDR[5];