
Type of ports in Atmega328p;
Digital and Analog
DIGITAL PORTS
PORTD : ( PD0 to PD7)
Pin No : PD0-:( Pin 0 to Pin 7)
example : PD2 = Pin 2 ;

DDRD = DDRD | B11111100; // this is safer as it sets pins 2 to 7 as outputs
// without changing the value of pins 0 & 1, which are RX & TX
PORTB : ( PB0 to PB5)
Pin No : PB0-5 : Pin 8 to Pin 13
BV=Bit Value.
PORTB |= _BV(PB5);
/* set bit 0 using _BV() */ PORTB |= _BV(PB5); /* set bit 0 using shift */ a |= (1<<0);
No comments:
Post a Comment