100% found this document useful (2 votes)
2K views6 pages

Interfacing Relay With 8051

Interfacing Relay with 8051
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views6 pages

Interfacing Relay With 8051

Interfacing Relay with 8051
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Interfacing Relay

with 8051
Microcontroller
www.pantechsolutions.net
RELAY INTERFACE WITH 8051

Technology beyond the Dreams™ Copyright © 2006 Pantech Solutions Pvt


WHAT IS RELAY?

• A relays is an electrical switch that opens and closes under control of


another electrical circuit.
• It is therefore connected to ouput pins of the microcontroller and used to
turn on/off high-power devices such as motors, transformers, heaters,
bulbs, antenna systems etc
• Relay is connected to port 1.0

Technology beyond the Dreams™ Copyright © 2006 Pantech Solutions Pvt


RELAY INTERFACING ASSEMBLY CODE

org 00h
back: mov a,#00h
mov P1,a
acall secdelay
mov a,#01h
mov P1,a
acall secdelay
Sjmp back
Secdelay: mov r5,#25
H3: mov r4,#55
H2: mov r3,#ff
Djnz r3,h1
Djnz r4,h4
Djnz r5,h5ret

Technology beyond the Dreams™ Copyright © 2006 Pantech Solutions Pvt


RELAY INTERFACE C CODE
#include <reg51.h>
#include<stdio.h>
sbit relay1 = P0^4;
void DelayMs(unsigned int);
void main (void)
{
P2 = 0;
while(1)
{
relay1 = 1;
DelayMs(200);
relay1 = 0;

DelayMs(200);
}
} void DelayMs(unsigned int n)
{
unsigned int i,j;
for(j=0;j<n;j++)
{
for(i=0;i<1000;i++);
}
}

Technology beyond the Dreams™ Copyright © 2006 Pantech Solutions Pvt


For More Tutorials
www.pantechsolutions.net
http://www.slideshare.net/pantechsolutions
http://www.scribd.com/pantechsolutions
http://www.youtube.com/pantechsolutions

Technology beyond the Dreams™ Copyright © 2006 Pantech Solutions Pvt

You might also like