This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:exercisesbook:arduinouno [2026/03/26 22:54] – [Table] pczekalski | en:multiasm:exercisesbook:arduinouno [2026/03/26 23:42] (current) – [Reading analogue values] pczekalski | ||
|---|---|---|---|
| Line 35: | Line 35: | ||
| ==== Instructions ==== | ==== Instructions ==== | ||
| - | There is a set of assembler instructions that operate on port registers, | + | There is a set of assembler instructions that operate on Ports (I/O registers), as shown in table {{ref> |
| + | < | ||
| <table assemblergpioinstructions> | <table assemblergpioinstructions> | ||
| - | < | + | < |
| - | ^ Instruction | + | ^ Instruction |
| - | | sbi'' | + | | '' |
| - | | | + | | '' |
| - | | | + | | '' |
| - | | | + | | '' |
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| </ | </ | ||
| + | A common scenario is to first set either the GPIO is input or output (using the correct DDRx register), then either set ('' | ||
| + | <note tip>'' | ||
| + | |||
| + | ==== Examples ==== | ||
| + | Below are sections representing common usage scenarios: | ||
| + | |||
| + | ==== Reading analogue values ==== | ||
| + | Reading of the analogue values is not so straightforward as in the case of binary ones. | ||
| + | Built-in ADC converter uses 10-bit resolution, has 6 channels (A0-A5, respectively). It also uses a reference voltage (configurable), | ||
| + | The low-level ADC register-based operations use the following formula to obtain an ADC value (figure {{ref> | ||
| + | |||
| + | <figure avreq1> | ||
| + | {{: | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | Analogue reading uses a complex setup of ADC-related registers as presented in table {{ref> | ||
| + | |||
| + | <table tabadcregisters> | ||
| + | < | ||
| + | ^ Register | ||
| + | | '' | ||
| + | | | | | ||
| + | | | | | ||
| + | | | | | ||
| + | </ | ||