dolphinlabs
...
Doplhin labs
News

Relay Interface


·         Program Statement: Interfacing of Relay with 89C51 microcontroller

Connections :  Port P0.0 = Relay(12V supply)

                          Output is connected to PORT0 therefore Pull up Resistor is connected.

 

Hardware Connections for 8051 Board:-

1.      Give supply to 8051 board with the help of adapter

2.       Connect +5V pin of 8051 microcontroller to +5V supply and GND pin of 8051 microcontroller to GND pin of supply.

3.      Connect +5V pin of RS232 interface to +5V supply and GND pin of RS232 interface to GND pin of supply.

4.      Connect R2OUT pin of RS232 interface to RXD pin of 8051 and T2IN pin of RS232 interface to TXD pin of 8051.

5.      Connect 12V pin of RELAY interface block to +12V supply and GND pin of RELAY interface block to GND pin of supply.

6.      Connect RELAY pin of RELAY interface block to P0.0 pin of microcontroller.

 

 

 

 

 

 

 

 

 

 

 

 

 

Circuit Diagram:

 

 

 

 

 

 

Program Code:

#include<stdio.h>

#include<reg51.h>

sbit relay_pin = P0^0;                         //P0.0 =relay

void delay();

void main()

{

while(1)

{

relay_pin=1;                  // Relay on

delay();                          //call delay function

relay_pin=0;                  // Relay off

delay();                          //call delay function

}

}

void delay()                           //delay function defination

{

int i,j;

for(i=0;i<20000;i++);

for(j=0;j<30000;j++);

}

 

 

 

 

 

 


Get SOCIAL







SAFE & SECURE SHOPPING

visa card master card maestro card
Maverick IT Industries Pvt. Ltd.