+ All Categories
Home > Documents > Relay and AVR Atmel Atmega 16

Relay and AVR Atmel Atmega 16

Date post: 04-Oct-2015
Category:
Upload: robo-india
View: 35 times
Download: 0 times
Share this document with a friend
Description:
Robo India presents the working and concept of electro mechanical switch Relay. It also explains how to use it with AVR family's microcontroller Atmel Atmega 16.
Popular Tags:

of 12

Transcript

Input/output Ports

Relay and AVR Atmel Atmega16Robo Indiahttp://roboindia.com

Input/output Ports 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 NOTE:- X is the name of port and it can be A, B, C or D .

I/O PORT REGISTERDDRX 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 .USES OF REGISTER 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 .

Defining Port (Data Direct Register)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 }

CONDITION AND LOOP

ELECTRO MECHANICAL SWITCHINGEle. Mec. Switching ?Qn. What is RELAY ?ANS. RELAY is a electromechanical switch which use ELECTROMAGNET for switching operations.

RELAY#include

#include

RELAY

#include

#include

RELAYThanks & RegardsTeam Robo IndiaTo share your views and queries please write us-

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


Recommended