examples/ASM/data-direct.S
raw| 1 | |
| 2 | ddrb = 0x17 ; I/O mapped address of register DDRB |
| 3 | portb = 0x18 |
| 4 | PORTA = 0x3b ; memory mapped address of PORTA |
| 5 | |
| 6 | .section .text ; denotes code section |
| 7 | .global main |
| 8 | main: |
| 9 | LDI R16, 0xff ; load r16 with 255 |
| 10 | OUT ddrb, R16 ; set port B as output |
| 11 | |
| 12 | STS PORTA, R16 ; Store R16 to the memory location PORTA |
| 13 | LDS R17, PORTA ; read it back to R17 |
| 14 | OUT portb, R17 ; display it on port B LEDs |
| 15 | .end |