IndianEngineer

ProjectsectsBazaar.in

Interfacing Relays

http://www.shree-electronics.com/images/DSC00305.JPG  http://www.shree-electronics.com/images/DSC00305.JPG

Relays allow us to control the high power circuits or instruments using low power circuits and voltage levels such as output of microcontrollers. Interfacing relays to 8051 or any other microcontroller is just simple as controlling a LED.

A relay consists of a coil which is driven by low power circuits such as microcontrollers in order to control high power ac circuits through output switches. Normally there are two types of switches in a relay, they are Normally Open (NO) and Normally Closed (NC) contacts. ‘NO’ contacts are open when relay is not activated where as the ‘NC’ contacts are closed, when relay is activated by supplying power to the input coil, the ‘NO’ contacts are now closed and the ‘NC’ contacts are open.

The circuit diagram for interfacing relay to a 8051 microcontroller is shown below.

http://www.shree-electronics.com/images/uc_relay_small.gif  http://www.shree-electronics.com/images/uc_relay_small.gif

The assembly program for interfacing relay is given below.

;*************************************************
;
;Program: Interfacing relay
;Author: Srikanth
;Website: http://shree-electronics.com/
;Description: Relay turns ON when the switch
;connected to P1.0 and turns OFF when pressed
;again
;
;*************************************************

relay equ P0.0
sw equ P1.0

;*************************************************
org 0000h

Main:clr relay        ;Configure inp and outp
setb sw
up:  jnb sw,on        ;wait for switch to be pressed
clr relay
acall delay
sjmp up
on:  setb relay       ;Turn ON relay
acall delay
acall delay
here:jb sw,here       ;wait for switch to be released
clr relay        Turn OFF relay
acall delay
acall delay
sjmp up          ;Loop

;*************************************************
delay:mov r7,#0ffh    ;delay subroutine
again:mov r6,#0ffh
djnz r6,$
djnz r7,again
ret

;*************************************************
end

BACK


Advertisements

April 11, 2010 - Posted by | Microcontroller Interfacing |

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: