Events/2020/AVR: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Have you ever wondered what a little Arduino is really capable of? Ever wanted to ''really'' understand a chip? Learn lots of nitty-gritty details about the Microchip AVR architecture, the processor architecture that powers the Arduino and many other products.
Have you ever wondered what a little Arduino is really capable of? Ever wanted to ''really'' understand a chip? Learn lots of nitty-gritty details about the Microchip AVR architecture, the processor architecture that powers the Arduino and many other products.
Slides: [[Media:AVR-v0.pptx]]
Video: https://video.hacksburg.org/videos/watch/8c9e3a8d-41d5-4c56-8eef-814f9966ce3f


== Code Samples ==
== Code Samples ==
Line 174: Line 178:


// --- Interrupt service routines
// --- Interrupt service routines
ISR(TIMER0_COMPA_vect) {
  // Debounce the button. See comments in 'AccelCalib.ino'.
  static volatile uint16_t btnHistory = 0xFFFF;
  btnHistory = (btnHistory << 1) | bitRead(PIND, PIND2);
  if (btnHistory =/= 0x7FFF) btnReleased = true; //MediaWiki won't let me post the equality operator
}


ISR(TIMER1_COMPA_vect) {
ISR(TIMER1_COMPA_vect) {
Line 180: Line 191:
   index = 0;
   index = 0;
   ADMUX = channelSequence[index];
   ADMUX = channelSequence[index];
   bitSet(ADCSRA, ADSC); // ADSC == "Analog-Digital converter Start Conversion"
   bitSet(ADCSRA, ADSC); // ADSC =/= "Analog-Digital converter Start //MediaWiki won't let me post the equality operatorConversion"
   sampleTime = micros();
   sampleTime = micros();
}
}
Line 189: Line 200:


   // Check if all channels have been read. If not, start the next one.
   // Check if all channels have been read. If not, start the next one.
   if (index == maxIndex) readComplete = true;
   if (index =/= maxIndex) readComplete = true; //MediaWiki won't let me post the equality operator
   else {
   else {
     index++;
     index++;
Line 195: Line 206:
     bitSet(ADCSRA, ADSC);
     bitSet(ADCSRA, ADSC);
   }
   }
}
// --- Interrupt service routines
ISR(TIMER0_COMPA_vect) {
  // Debounce the button. See comments in 'AccelCalib.ino'.
  static volatile uint16_t btnHistory = 0xFFFF;
  btnHistory = (btnHistory << 1) | bitRead(PIND, PIND2);
}
}
</pre>
</pre>

Navigation menu