Update

One new tab added. Open in browser view if it is not visible. (25/08/2022 08:48)

Interfacing Relay IC with 8051

Relay is an electrically operated switch. Relays control one electrical circuit by opening and closing contacts in another circuit
It works on the principle on Electromagnetic Induction.
When the coil is applied with DC current it starts attracting the contact. 

(Image Source : https://www.ultralibrarian.com/)


Transistors also work on a similar principle of electric switching but are way faster than relays.
But relays are used with applications involving very high voltages and currents that would otherwise destroy transistors.

In this interfacing, ULN2803 Relay IC is used.

 
1) main.c
//INTERFACING RELAY IC WITH 8051
#include<reg51.h>
sbit rel=P2^1;
void delay(int n)
{
int i=0;
for(;i<n*1000;i++);
}
void main()
{
rel=1;
delay(1000);
rel=0;
delay(1000);
}

Simulation








No comments: