The DDRx Register
AVR-Specific Commands
AVR-Specific Commands
- All information in the microcontroller, from the program memory, the timer information, to the state on any of input or output pins, is stored in registers. Registers are like shelves in the bookshelf of processor memory. In an 8-bit processor, like the AVR ATMega 16 we are using, the shelf can hold 8 books, where each book is a one bit binary number, a 0 or 1. Each shelf has an address in memory, so that the controller knows where to find it.
- The 32 IO pins of the ATMega16 are divided into 4 ports, A, B, C, and D. Each port has 3 associated registers. For example, for port D, these registers are referred to in C-language by PORTD, PIND, and DDRD. For port B, these would be PORTB, PINB, and DDRB, etc. In C-language, PORTD is really a macro, which refers to a number that is the address of the register in the AVR, but it is much easier to remember PORTD than some arbitray hexadecimal number.
Subsections
The DDRx Register
AVR-Specific Commands
AVR-Specific Commands
Copyright © 2004-07-05
Center for Computer Research in Music and Acoustics (CCRMA),
Stanford University