SlideShare uma empresa Scribd logo
1 de 7
RELAY INTERFACING WITH
8051
PRATIK PHADTE
COURSE : ELECTRICAL AND ELECTRONICS ENGINEERING
@pratikphadte19@gmail.com
TOPICS
• What`s a relay
• Interfacing relay with 8051
• Assembly code for interfacing
• C code for interfacing
WHAT`S A RELAY
• A relay is nothing but a switch, it can be controlled(ON/OFF) by a low power signal(ex:
current in microamps).
• Its mainly used as a switch in high power circuits(230v,50hz).
• When control signal is given
(ex:HIGH) ,then the switch is
CLOSED
• Similarly when control signal is
LOW ,then switch in OPEN
WHAT`S A RELAY
• The figure shows practical internal
operation of a relay.
• Here ,when the small switch is closed ,the coil gets
energized becoming an ELECTROMAGNET
• Thus ,attracting the metallic plate and hence
CLOSING the main switch.
• When the small switch is open, the coil is
de-energized ,hence the SPRING pulls the
metallic plate back therefore OPENING the
main switch.
INTERFACING RELAY WITH 8051
For interfacing with the controller we need a setup like below:
• Here the 8051 uc can be programmed to
to set its any port pin as output(HIGH/LOW
(one /zero)
• A HIGH signal from port pin P0.1 will turn o
transistor and energize the coil, hence MAIN
switch will CLOSE thus the bulb GLOWS.
• When LOW signal is given by 8051 uc ,
the transistor is off and the coil gets
de-energized via the free wheeling diode
hence the metallic plate is lifted and
main switch is OPEN.
ASSEMBLY CODE FOR INTERFACING
For assembly code we need to just send a high signal to the used Port PIN
High signal=LOGIC ONE
CODE:
org 00h
setb P0.2 [output of port zero pin two is set to HIGH(one)]
acall delay
clr P0.2 [output of port zero pin two is set to LOW(zero)]
END
NOTE: delay code is not mentioned here
C CODE FOR INTERFACING
#include<reg52.h>
sbit relay_pin = P0^2; [naming port zero pin two]
Void delay(int); [Define delay function]
Void main( )
{
do
{
relay_pin=0; [relay switched ON]
delay( );
relay_pin=1; [relay switched ON]
delay( );
} while(1);
}
NOTE: delay code is not mentioned here

Mais conteúdo relacionado

Mais procurados

8259 Programmable Interrupt Controller by vijay
8259 Programmable Interrupt Controller by vijay8259 Programmable Interrupt Controller by vijay
8259 Programmable Interrupt Controller by vijayVijay Kumar
 
Sensor interfacing in 8051
Sensor interfacing in 8051Sensor interfacing in 8051
Sensor interfacing in 8051Irfan Ahmad
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerbhadresh savani
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller NotesDr.YNM
 
8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notesDr.YNM
 
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONSRamaPrabha24
 
8085 interfacing with memory chips
8085 interfacing with memory chips8085 interfacing with memory chips
8085 interfacing with memory chipsSrikrishna Thota
 
Microcontroller 8051 and its interfacing
Microcontroller 8051 and its interfacingMicrocontroller 8051 and its interfacing
Microcontroller 8051 and its interfacingAnkur Mahajan
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adcPRADEEP
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051hello_priti
 
Ladder Intro Tutorial
Ladder Intro TutorialLadder Intro Tutorial
Ladder Intro Tutorialplc_course
 

Mais procurados (20)

PLC LADDER DIAGRAM
PLC LADDER DIAGRAMPLC LADDER DIAGRAM
PLC LADDER DIAGRAM
 
Interrupts in 8051
Interrupts in 8051Interrupts in 8051
Interrupts in 8051
 
8259 Programmable Interrupt Controller by vijay
8259 Programmable Interrupt Controller by vijay8259 Programmable Interrupt Controller by vijay
8259 Programmable Interrupt Controller by vijay
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Sensor interfacing in 8051
Sensor interfacing in 8051Sensor interfacing in 8051
Sensor interfacing in 8051
 
Shift Registers
Shift RegistersShift Registers
Shift Registers
 
Subroutine in 8051 microcontroller
Subroutine in 8051 microcontrollerSubroutine in 8051 microcontroller
Subroutine in 8051 microcontroller
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
 
8096 microcontrollers notes
8096 microcontrollers notes8096 microcontrollers notes
8096 microcontrollers notes
 
boolean 8051
boolean 8051boolean 8051
boolean 8051
 
8051 ch9-950217
8051 ch9-9502178051 ch9-950217
8051 ch9-950217
 
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
 
8085 interfacing with memory chips
8085 interfacing with memory chips8085 interfacing with memory chips
8085 interfacing with memory chips
 
Microcontroller 8051 and its interfacing
Microcontroller 8051 and its interfacingMicrocontroller 8051 and its interfacing
Microcontroller 8051 and its interfacing
 
8051 block diagram
8051 block diagram8051 block diagram
8051 block diagram
 
8051 memory
8051 memory8051 memory
8051 memory
 
Interfacing adc
Interfacing adcInterfacing adc
Interfacing adc
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
8251 USART
8251 USART8251 USART
8251 USART
 
Ladder Intro Tutorial
Ladder Intro TutorialLadder Intro Tutorial
Ladder Intro Tutorial
 

Semelhante a Relay interfacing with 8051

digitalelectronicslogicfamilies-190628101225-converted.pptx
digitalelectronicslogicfamilies-190628101225-converted.pptxdigitalelectronicslogicfamilies-190628101225-converted.pptx
digitalelectronicslogicfamilies-190628101225-converted.pptxBijaySharma51
 
Digital electronics logic families
Digital electronics logic familiesDigital electronics logic families
Digital electronics logic familiesBLESSINAR0
 
Digital integrated circuits
Digital integrated circuitsDigital integrated circuits
Digital integrated circuitsTamilarasan N
 
L6561 Power Factor Corrector
L6561 Power Factor CorrectorL6561 Power Factor Corrector
L6561 Power Factor CorrectorPremier Farnell
 
Logic families ppt eceb srp
Logic families ppt eceb srpLogic families ppt eceb srp
Logic families ppt eceb srpSaikat Dutt
 
Original Power Supply IC TNY254PN TNY254P TNY254 New
Original Power Supply IC TNY254PN TNY254P TNY254 NewOriginal Power Supply IC TNY254PN TNY254P TNY254 New
Original Power Supply IC TNY254PN TNY254P TNY254 NewAUTHELECTRONIC
 
Introduction to Integrated Circuits
Introduction to Integrated CircuitsIntroduction to Integrated Circuits
Introduction to Integrated CircuitsGurpawan Mand
 

Semelhante a Relay interfacing with 8051 (20)

Clap switch mini project using 555 timer IC
Clap switch mini project using 555 timer ICClap switch mini project using 555 timer IC
Clap switch mini project using 555 timer IC
 
digitalelectronicslogicfamilies-190628101225-converted.pptx
digitalelectronicslogicfamilies-190628101225-converted.pptxdigitalelectronicslogicfamilies-190628101225-converted.pptx
digitalelectronicslogicfamilies-190628101225-converted.pptx
 
Digital electronics logic families
Digital electronics logic familiesDigital electronics logic families
Digital electronics logic families
 
Digital integrated circuits
Digital integrated circuitsDigital integrated circuits
Digital integrated circuits
 
Unit5 session 5
Unit5 session 5Unit5 session 5
Unit5 session 5
 
Unit 5 session 4
Unit 5 session 4Unit 5 session 4
Unit 5 session 4
 
Unit 5 session 4
Unit 5 session 4Unit 5 session 4
Unit 5 session 4
 
L6561 Power Factor Corrector
L6561 Power Factor CorrectorL6561 Power Factor Corrector
L6561 Power Factor Corrector
 
Logic families ppt eceb srp
Logic families ppt eceb srpLogic families ppt eceb srp
Logic families ppt eceb srp
 
Logic not gate tutorial with logic gate truth table
Logic not gate tutorial with logic gate truth tableLogic not gate tutorial with logic gate truth table
Logic not gate tutorial with logic gate truth table
 
Logic Gates & Family.pdf
Logic Gates & Family.pdfLogic Gates & Family.pdf
Logic Gates & Family.pdf
 
UNIT 3.pptx
UNIT 3.pptxUNIT 3.pptx
UNIT 3.pptx
 
Original Power Supply IC TNY254PN TNY254P TNY254 New
Original Power Supply IC TNY254PN TNY254P TNY254 NewOriginal Power Supply IC TNY254PN TNY254P TNY254 New
Original Power Supply IC TNY254PN TNY254P TNY254 New
 
Switches and LEDs interface to the 8051 microcontroller
Switches and LEDs interface to the 8051 microcontrollerSwitches and LEDs interface to the 8051 microcontroller
Switches and LEDs interface to the 8051 microcontroller
 
Logic families
Logic familiesLogic families
Logic families
 
PLC
PLCPLC
PLC
 
Logic families
Logic familiesLogic families
Logic families
 
Introduction to Integrated Circuits
Introduction to Integrated CircuitsIntroduction to Integrated Circuits
Introduction to Integrated Circuits
 
34866616-Relay.ppt
34866616-Relay.ppt34866616-Relay.ppt
34866616-Relay.ppt
 
Digital logic, an inverter or NOT gate
Digital logic, an inverter or NOT gateDigital logic, an inverter or NOT gate
Digital logic, an inverter or NOT gate
 

Último

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 

Último (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 

Relay interfacing with 8051

  • 1. RELAY INTERFACING WITH 8051 PRATIK PHADTE COURSE : ELECTRICAL AND ELECTRONICS ENGINEERING @pratikphadte19@gmail.com
  • 2. TOPICS • What`s a relay • Interfacing relay with 8051 • Assembly code for interfacing • C code for interfacing
  • 3. WHAT`S A RELAY • A relay is nothing but a switch, it can be controlled(ON/OFF) by a low power signal(ex: current in microamps). • Its mainly used as a switch in high power circuits(230v,50hz). • When control signal is given (ex:HIGH) ,then the switch is CLOSED • Similarly when control signal is LOW ,then switch in OPEN
  • 4. WHAT`S A RELAY • The figure shows practical internal operation of a relay. • Here ,when the small switch is closed ,the coil gets energized becoming an ELECTROMAGNET • Thus ,attracting the metallic plate and hence CLOSING the main switch. • When the small switch is open, the coil is de-energized ,hence the SPRING pulls the metallic plate back therefore OPENING the main switch.
  • 5. INTERFACING RELAY WITH 8051 For interfacing with the controller we need a setup like below: • Here the 8051 uc can be programmed to to set its any port pin as output(HIGH/LOW (one /zero) • A HIGH signal from port pin P0.1 will turn o transistor and energize the coil, hence MAIN switch will CLOSE thus the bulb GLOWS. • When LOW signal is given by 8051 uc , the transistor is off and the coil gets de-energized via the free wheeling diode hence the metallic plate is lifted and main switch is OPEN.
  • 6. ASSEMBLY CODE FOR INTERFACING For assembly code we need to just send a high signal to the used Port PIN High signal=LOGIC ONE CODE: org 00h setb P0.2 [output of port zero pin two is set to HIGH(one)] acall delay clr P0.2 [output of port zero pin two is set to LOW(zero)] END NOTE: delay code is not mentioned here
  • 7. C CODE FOR INTERFACING #include<reg52.h> sbit relay_pin = P0^2; [naming port zero pin two] Void delay(int); [Define delay function] Void main( ) { do { relay_pin=0; [relay switched ON] delay( ); relay_pin=1; [relay switched ON] delay( ); } while(1); } NOTE: delay code is not mentioned here