You have no items in your shopping cart.

Subtotal: 0.00

How to Interface Switch with 8051 Lab Trainer Kit

8051 TRAINER KIT

PS-TRAINER-8051 trainer kit is proposed to smooth the progress of learning and developing designs of MCU from Intel and NXP. It has the facility to connect PC’s 101/104 Keyboard, to enter user programs in Assembly languages. Serial communication achieved using 8051. It also supports C & assembly language in standalone kit (P89V51RD2). It’s designed as to facilitate On-board Programmer for NXP 8051 MCU through ISP on serial port.

SWITCH

A switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. A switch may be directly manipulated by a human as a control signal to a system, or to control power flow in a circuit.

INTERFACING SWITCH

Fig.1 shows how to interface the switch to microcontroller. A simple switch has an open state and closed state. However, a microcontroller needs to see a definite high or low voltage level at a digital input. A switch requires a pull-up or pull-down resistor to produce a definite high or low voltage when it is open or closed. A resistor placed between a digital input and the supply voltage is called a "pull-up" resistor because it normally pulls the pin's voltage up to the supply.



Fig. 1 Interfacing switch to Microcontroller

 

INTERFACING SWITCH WITH 8051

We now want to control theLED by using switches in 8051 Trainer Board. It works by turning ON a LED & then turning it OFF when switch is going to LOW or HIGH.

The PS-2 8051 Trainer board has eight numbers of point LEDs, connected with I/O Port lines (P1.0 – P1.7) to make port pins high. Eight switches, connected with I/O port lines (3.0 – P3.7) are used to control eight LEDs.



PIN ASSIGNMENT WITH 8051



 

Slide Switch

8051 Lines

Input Logic Selection

  DIGITAL INPUTS

SW20

P3.0

 

pin assignment 8051 circuit2

         

Make Switch            Close – Low

         Make Switch Open – High

SW21

P3.1

SW22

P3.2

SW23

P3.3

SW24

P3.4

SW25

P3.5

SW26

P3.6

SW27

P3.7

 



CIRCUIT DIAGRAM TO INTERFACE SWITCH WITH 8051





ASSEMBLY PROGRAM TO INTERFACE SWITCH AND LED WITH 8051

 

MEMORY ADDRESS

OPCODE

MNEMONICS

8500

90 40 03

     MOV DPTR, #4003

8503      

74 90

      MOV A, #90

8505

F0

      MOVX @DPTR, A

8506

90 40 00

HERE:MOV DPTR, #4000

8509

E0

      MOVX A,@DPTR

850A

90 40 01

      MOV DPTR, #4001

850D     

F0

      MOVX @DPTR, A

850E

80 FE     

          SJMP HERE

 

SOURCE CODE

 

The Interfacing switch with 8051 program is very simple and straight forward, that controls LED by using switches when it going LOW or HIGH.