This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:piot:chapter_4_9 [2026/01/20 12:57] – [Examples] ktokarz | en:multiasm:piot:chapter_4_9 [2026/02/27 01:13] (current) – [Examples] jtokarz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== 3 Levels of Programming: | ====== 3 Levels of Programming: | ||
| - | Programming AVR microcontrollers can be divided into three levels: C++, libraries, and assembler. Each of these levels offers distinct benefits and is utilized | + | Programming AVR microcontrollers can be divided into three levels: C++, libraries, and assembler. Each of these levels offers distinct benefits and is utilised |
| * **C++** is a high-level language that allows programmers to write code in a more abstract and understandable way. Using C++ for AVR enables advanced features such as object-oriented programming, | * **C++** is a high-level language that allows programmers to write code in a more abstract and understandable way. Using C++ for AVR enables advanced features such as object-oriented programming, | ||
| * **Libraries** are sets of predefined functions and procedures that facilitate programming AVR microcontrollers. An example is the AVR Libc library, which provides functions for I/O, memory management, and mathematical operations. Using libraries enables rapid application development without writing code from scratch. Libraries are particularly useful in projects that require frequent use of standard functions. | * **Libraries** are sets of predefined functions and procedures that facilitate programming AVR microcontrollers. An example is the AVR Libc library, which provides functions for I/O, memory management, and mathematical operations. Using libraries enables rapid application development without writing code from scratch. Libraries are particularly useful in projects that require frequent use of standard functions. | ||
| - | * **Assembler** is a low-level language that allows direct programming of the AVR microcontroller. Writing code in assembler gives full control over the hardware and allows for performance | + | * **Assembler** is a low-level language that allows direct programming of the AVR microcontroller. Writing code in assembler gives full control over the hardware and allows for performance |
| - | + | ||
| - | The choice of programming level depends on the project' | + | |
| + | The choice of programming level depends on the project' | ||
| Line 18: | Line 17: | ||
| <code c> | <code c> | ||
| void setup() { | void setup() { | ||
| - | // Set PB5 (pin 13) as output | + | // Set PB5 (pin 13) as output |
| + | | ||
| asm volatile(" | asm volatile(" | ||
| } | } | ||
| Line 56: | Line 56: | ||
| **Read digital input (PD2, bit 2 on PORTD)** | **Read digital input (PD2, bit 2 on PORTD)** | ||
| + | <code c> | ||
| void setup() { | void setup() { | ||
| Serial.begin(9600); | Serial.begin(9600); | ||
| Line 69: | Line 70: | ||
| delay(200); | delay(200); | ||
| } | } | ||
| - | | + | </ |