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

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

CIRCUIT DIAGRAM TO INTERFACE SWITCH WITH 8051

ASSEMBLY PROGRAM TO INTERFACE SWITCH AND LED WITH 8051

MEMORY ADDRESSOPCODEMNEMONICS
850090 40 03    MOV DPTR, #4003
8503 74 90     MOV A, #90
8505F0     MOVX @DPTR, A
850690 40 00HERE:MOV DPTR, #4000
8509E0     MOVX A,@DPTR
850A90 40 01     MOV DPTR, #4001
850D F0     MOVX @DPTR, A
850E80 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.

Pantech:
Leave a Comment

This website uses cookies.