Changes

Jump to navigation Jump to search

Events/2020/AVR

771 bytes added, 13:00, 24 January 2021
Code Samples
interrupts();
}
 
// --- Interrupt service routines
 
ISR(TIMER1_COMPA_vect) {
// Begin a conversion on the first channel in the sequence and record the time.
readComplete = false;
index = 0;
ADMUX = channelSequence[index];
bitSet(ADCSRA, ADSC); // ADSC == "Analog-Digital converter Start Conversion"
sampleTime = micros();
}
 
ISR(ADC_vect) {
// Store the conversion result.
rawADC[index] = ADC;
 
// Check if all channels have been read. If not, start the next one.
if (index == maxIndex) readComplete = true;
else {
index++;
ADMUX = channelSequence[index];
bitSet(ADCSRA, ADSC);
}
}
 
// --- Interrupt service routines
 
ISR(TIMER0_COMPA_vect) {
// Debounce the button. See comments in 'AccelCalib.ino'.
static volatile uint16_t btnHistory = 0xFFFF;
</pre>
50
edits

Navigation menu