AVR Programming: Digital I/O September 10, 2010. What is Digital I/O?. Digital – A 1 or 0 Input – Data (a voltage) that the microcontroller is reading from an external source Output – Data (a voltage) that the microcontroller is setting to be used by an external source.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
September 10, 2010
Each register and bit within it is defined for you
//set the bottom three bits of Port A to output
DDRA |= _BV(DDA0) | _BV(DDA1) | _BV(DDA2);
//output high on pins 0 and 2 of port A
PORTA |= _BV(PA0) | _BV(PA2);
//output low on pin 1 of port A
PORTA &= ~(_BV(PA1));
//set Port B to input
DDRB = 0x00;
//read Port B
char x = PINB;
Note: Pin 33 and 34 are PG0 and PG1