Difference between revisions of "Events/2020/AVR"
Jump to navigation
Jump to search
(Created page with "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 arch...") |
|||
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. | ||
+ | |||
+ | == Code Samples == | ||
+ | === Godbolt 1 === | ||
+ | #define __AVR_ATmega328P__ | ||
+ | |||
+ | #include "https://raw.githubusercontent.com/vancegroup-mirrors/avr-libc/master/avr-libc/include/stdlib.h" | ||
+ | #include "https://raw.githubusercontent.com/vancegroup-mirrors/avr-libc/master/avr-libc/include/avr/io.h" | ||
+ | |||
+ | #define DIRECTION_PORT DDRB | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | const int DIRECTION_MASK = 0b00001110; | ||
+ | uint8_t direction = 0b00001010; | ||
+ | DIRECTION_PORT = (DIRECTION_PORT & ~DIRECTION_MASK) | (direction & DIRECTION_MASK); | ||
+ | return 0; | ||
+ | } |
Revision as of 11:55, 24 January 2021
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.
Code Samples
Godbolt 1
#define __AVR_ATmega328P__ #include "https://raw.githubusercontent.com/vancegroup-mirrors/avr-libc/master/avr-libc/include/stdlib.h" #include "https://raw.githubusercontent.com/vancegroup-mirrors/avr-libc/master/avr-libc/include/avr/io.h" #define DIRECTION_PORT DDRB int main() { const int DIRECTION_MASK = 0b00001110; uint8_t direction = 0b00001010; DIRECTION_PORT = (DIRECTION_PORT & ~DIRECTION_MASK) | (direction & DIRECTION_MASK); return 0; }