11
Robo India http://roboindia.com

Relay and AVR Atmel Atmega 16

Embed Size (px)

Citation preview

Page 1: Relay and AVR Atmel Atmega 16

Robo Indiahttp://roboindia.com

Page 2: Relay and AVR Atmel Atmega 16

• Atmega16 have total of 40 pins

32 I/O pins..

PORT “A” = 8 Pins

PORT “B” = 8 Pins

PORT “C” = 8 Pins

PORT “D” = 8 Pins

Page 3: Relay and AVR Atmel Atmega 16

Port “X”

DDRX PORTX PINX

NOTE:- X is the name of port and it can be A, B, C or D .

Page 4: Relay and AVR Atmel Atmega 16

• DDRX – For setting the direction i.e. Input or output.

• PORTX – For setting output value of port.

• PINX – For reading data available in port.

NOTE:- X is the name of port and it can be A,

B, C or D .

Click here to visit -ROBO INDIA

Page 5: Relay and AVR Atmel Atmega 16

DDRX= 0xFF; (O/P-Port)

DDRX= 0x00; (I/P-Port)

or

DDRX = 0b 1 1 1 1 1 1 1 1 ; (O/P-Port)

DDRX = 0b 0 0 0 0 0 0 0 0 ; (I/P-Port)

NOTE:- X is the name of port and it can be A, B, C or D .

Click here to visit -ROBO INDIA

Page 6: Relay and AVR Atmel Atmega 16

1.Ifif ( conditions ){ code to be executed }

2.For loopfor(start ; condition ; step){code to be executed}

3.While loopwhile( Condition){ code to be executed }

Click here to visit -ROBO INDIA

Page 7: Relay and AVR Atmel Atmega 16

Click here to visit -ROBO INDIA

Page 8: Relay and AVR Atmel Atmega 16

Click here to visit -ROBO INDIA

Page 9: Relay and AVR Atmel Atmega 16

Qn. What is RELAY ?ANS. RELAY is a electromechanical switch

which use ELECTROMAGNET for switchingoperations.

Click here to visit -ROBO INDIA

Page 10: Relay and AVR Atmel Atmega 16

• #include <avr/io.h>

• #include <util/delay.h>

Click here to visit -ROBO INDIA

Page 11: Relay and AVR Atmel Atmega 16

To share your views and queries please write us-

Website: http://roboindia.comEmail- [email protected]

Click here to visit -ROBO INDIA