Microprocessor LAB 7& 8 Elevator Interface: Objectives

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ECC3105 Lab 7 & 8

MICROPROCESSOR
LAB 7& 8

ELEVATOR INTERFACE

Objectives

To show the operation of the elevator as follows:

• Initially, the elevator is at ground floor


• When the elevator reaches any floor, it stays at that floor until a request from
another floor is made. When such a request is detected, it moves to that floor.
• The floor request are scanned in fixed order i.e. floors 0, 1, 2 and 3

INTRODUCTION

Elevator Systems Associates Private Limited (ESA) offers a variety of modules which
can be interfaced to ESA 86/88-2. These modules can be effectively used for
teaching/training in the laboratories.
This interface simulates the control and operation of an elevator. Four floors assumed and
for each floor a key and corresponding LED indicator are provided to serve as request
buttons and request status indicator. The elevator itself is represented by a column of ten
LEDs. The motion of elevator can be simulated by turning on successive LEDs one at a
time. Te delay between turning off one LED and turning on the next LED can simulate
the “speed” of the elevator. User can read the request status information through one port,
reset the request indicators through another port and control the elevator (LED column)
through another port.

DESCRIPTION OF THE CIRCUIT

This interface has four keys, marked 0, 1, 2, and 3 representing the request buttons at the
four floors. Pressing of a key causes a corresponding Flip-Flop to be set . The outputs of
the four Flip-Flop can be read through port B (PBO, PBI, PB2 and PB3). Also, the status
of these signals is reflected by a setoff 4 LEDs. The Flip-Flop can be rest (LEDs are
cleared) through port A (PA54, PA5, PA6, and PA7). A column of 10 LEDs, representing
the elevator can be controlled through Port A (PA0, PA1, PA2 and PA3).
These port lines are fed to the inputs of the decoder 7442 whose outputs are used to
control the on/off states of the LEDs which simulate the motion of the elevator.

Rev 0.1 24/09/07 1


ECC3105 Lab 7 & 8

INSTALLATION

The interface is houses in a plastic enclosure which has a locking mechanism. To open
the cover, push in the locking mechanism with a finger and lift the cover to open.
The interface module has a 26-pin connector at one edge of the card. This is used for
connecting to interface to the ESA 86/88-2 trainer with a flat cable connector set.
The interface is connected over J4 of ESA 86/88-2 trainer. The +5V DC power required
by the interface is drawn from the trainer via the flat cable connector set.

PROGRAMMING

A program to illustrate the operation of this is listed below. This program can be entered
and executed either from KEYBOARD MODE or from SERIAL MODE of ESA 86/88-2
trainer.

The program will be in the loop and to come out, press RESET key on the trainer.

ADD OPCODE LABEL INSTRUCTION COMMENTS


2000 BA E6 FF MOVW DX,#0FFE6 ;Configure 8255 for mode 0
2003 B0 82 MOVB AL, # 82 ;Port A as O/P
;port B as I/P
2005 EE OUTB DX
2006 31 C0 XORW AX, AX ;Ground floor initially
2008 88 E0 LOOP1: MOVB AL,AH ;AH=Floor position
200A 0C F0 ORB AL, # F0 ;Deassert CLR lines PA7 to
200C BA E0 FF MOVW DX,#0FFE0 ;PA4= 1 port A
200F EE OUTB DX
2010 BAE2 FF MOVW DX,#0FFE2 ;PORT B
2013 EC LOOP2 INB DX ;Get request status
2014 24 0F ANDB AL,# 0F ;Strip off higher nibble
2016 3C 0F CMPB AL,# 0F ;Any request?
2018 74 F9 JE 2013 ;No, continue Polling
201A BE 00 00 MOVW SI,#0000 ;Index of
201D D0 C8 FINDF: RORB AL,1 ;requesting floor
201F 73 04 JNB 2025 ;Floor request found
2021 46 INCW SI
2022 EB F9 JMP 201D ;Continue
2024 2E CS ;search
2025 8A 84 73 20 FOUND: MOVB AL2073[SI] ;Get requesting floor code

Rev 0.1 24/09/07 2


ECC3105 Lab 7 & 8

2029 38 E0 CMPB AL, AH ;Compare with current floor


;code
202B 77 0D JNBE 203 A ;Elevator has to go up
202D 72 22 JB 2051 ;Elevator has to go down
202F 2E CS
2030 8A 84 77 20 CLEAR: MOVB AL,2077[SI] ;Correct floor clear
2034 BA E0 FF MOVW DX,#FFE0 ;Port A
2037 EE OUTB DX ;Clear request
2038 EB CE JMP 2008 ;Repeat all over
203A E8 2B00 GOUP: CALL 2068 ;Delay to simulate motion
203D FE C4 INCB AH ;Elevator goes up
203F 86 C4 XCHGB AL,AH
2041 0C F0 ORB AL,#F0 ;Elevator position code on
2043 BA E0 FF MOVW DX,#FFE0 ;PA3 - PA0
2046 EE OUTB DX
2047 24 0F ANDB AL,#0F
2049 86 E0 XCHGB AH,AL
204B 38 E0 CMPB AL,AH ;Reached requested floor?
204D 75 EB JNE 203A ;No, continue moving
;elevator
204F EB DF JMP 2030 ;Yes, clear request
2051 E8 14 00 GODN: CALL 2068 ;Delay to simulate motion
2054 FE CC DECB AH Elevator goes down
2056 86 E0 XCHGB AH, AL
2058 0C F0 ORB AL,#F0 Elevator position code on
205A BA E0 FF MOVW DX, #FFE0 ;PA3-PA0
205D EE OUTB DX
205E 24 0F ANDB AL,#0F
2060 86 C4 XCHGB AL, AH
2062 38 E0 CMPB AL, AH ;Reached requested floor?
2064 75 EB JNE 2051 ;No, continue moving
;elevator
2066 EB C8 JMP 2030 ;Yes, clear request
2068 B9 00 08 DELAY: MOVW CX,#0800 ;Time interval
206B E2 FE LOOP 206B ;between
206D B9 FF FF MOVW CX,#FFFF ;glow of successive
2070 E2 FE LOOP 2070 ;LED’s
2072 C3 RET
2073 00 03 06 09 FCODE: DB 00,03,06,09 ;Position codes for floor
2077 E0 D3 B6 FCLR: DB 0E0,0D3,0B6,79 ;Clear position code
79 ;for each floor

Rev 0.1 24/09/07 3


ECC3105 Lab 7 & 8

1. Enter the above program starting at location 2000H.


2. Please make sure that the Code Segment (CS) address is 0000H by typing SG
0000 in ESAM-86.
3. After finish enter the program, execute it.
4. Now copy the opcode of the program above then switch the ESA 86/88-2 to the
Keyboard mode.
5. Enter the opcode and execute the program.

Exercises

1. Describe the result of executing the following sequence of instructions.

MOVB AL, #55


ANDB AL, #1F
ORB AL, #C0
XORB AL, #0F
RORB AL, 3
NOT AL

2. Explain about these instruction

i) JE
ii) JB
iii) JNB
iv) JNE
v) JNBE
vi) XCHG
vii) CMP

Rev 0.1 24/09/07 4

You might also like