ECC3105Lab 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 # 0F CMPB AL. The program will be in the loop and to come out.#0FFE2 LOOP2 INB DX ANDB AL.Configure 8255 for mode 0 .port B as I/P .Get requesting floor code 2 OUTB DX XORW AX.Any request? .Floor request found .Port A as O/P .#0000 FINDF: RORB AL. To open the cover.No. continue Polling .AH ORB AL.Deassert CLR lines PA7 to . # 82 COMMENTS .#0FFE6 MOVB AL. This is used for connecting to interface to the ESA 86/88-2 trainer with a flat cable connector set. AX LOOP1: MOVB AL.Ground floor initially . The +5V DC power required by the interface is drawn from the trainer via the flat cable connector set. push in the locking mechanism with a finger and lift the cover to open. ADD 2000 2003 2005 2006 2008 200A 200C 200F 2010 2013 2014 2016 2018 201A 201D 201F 2021 2022 2024 2025 OPCODE BA E6 FF B0 82 EE 31 C0 88 E0 0C F0 BA E0 FF EE BAE2 FF EC 24 0F 3C 0F 74 F9 BE 00 00 D0 C8 73 04 46 EB F9 2E 8A 84 73 20 LABEL INSTRUCTION MOVW DX. This program can be entered and executed either from KEYBOARD MODE or from SERIAL MODE of ESA 86/88-2 trainer. PROGRAMMING A program to illustrate the operation of this is listed below. The interface is connected over J4 of ESA 86/88-2 trainer.1 24/09/07 .search . # F0 MOVW DX. The interface module has a 26-pin connector at one edge of the card.1 JNB 2025 INCW SI JMP 201D CS FOUND: MOVB AL2073[SI] Rev 0.Get request status .ECC3105 Lab 7 & 8 INSTALLATION The interface is houses in a plastic enclosure which has a locking mechanism.Strip off higher nibble .requesting floor .AH=Floor position .PA4= 1 port A .# 0F JE 2013 MOVW SI.PORT B . press RESET key on the trainer.#0FFE0 OUTB DX MOVW DX.Index of .Continue . Time interval .09 DB 0E0.1 24/09/07 .Elevator goes up .elevator .elevator . AH JNE 2051 JMP 2030 MOVW CX.PA3-PA0 DELAY: .PA3 .AH ORB AL.Yes. AH JNBE 203 A JB 2051 CS MOVB AL.Clear request .#FFE0 OUTB DX ANDB AL.79 .#0800 LOOP 206B MOVW CX.Position codes for floor .ECC3105 Lab 7 & 8 2029 202B 202D 202F 2030 2034 2037 2038 203A 203D 203F 2041 2043 2046 2047 2049 204B 204D 204F 2051 2054 2056 2058 205A 205D 205E 2060 2062 2064 2066 2068 206B 206D 2070 2072 2073 2077 38 E0 77 0D 72 22 2E 8A 84 77 20 BA E0 FF EE EB CE E8 2B00 FE C4 86 C4 0C F0 BA E0 FF EE 24 0F 86 E0 38 E0 75 EB EB DF E8 14 00 FE CC 86 E0 0C F0 BA E0 FF EE 24 0F 86 C4 38 E0 75 EB EB C8 B9 00 08 E2 FE B9 FF FF E2 FE C3 00 03 06 09 E0 D3 B6 79 CMPB AL.#F0 MOVW DX.Yes. continue moving .LED’s .0D3.AL CMPB AL.Compare with current floor .Clear position code .#FFE0 OUTB DX JMP 2008 CALL 2068 INCB AH XCHGB AL.Reached requested floor? .between . continue moving .03.06. #FFE0 OUTB DX ANDB AL. AL ORB AL.Elevator position code on .Reached requested floor? .Correct floor clear .PA0 CLEAR: GOUP: GODN: .#0F XCHGB AL. clear request .AH JNE 203A JMP 2030 CALL 2068 DECB AH XCHGB AH.0B6. AH CMPB AL.code .Delay to simulate motion .Port A .Elevator has to go down .glow of successive .Delay to simulate motion Elevator goes down Elevator position code on .Elevator has to go up .Repeat all over .No. clear request .No.#FFFF LOOP 2070 RET DB 00.2077[SI] MOVW DX.for each floor 3 FCODE: FCLR: Rev 0.#F0 MOVW DX.#0F XCHGB AH. 3 AL 2.ECC3105 Lab 7 & 8 1. After finish enter the program. 5. Explain about these instruction i) ii) iii) iv) v) vi) vii) JE JB JNB JNE JNBE XCHG CMP Rev 0. Please make sure that the Code Segment (CS) address is 0000H by typing SG 0000 in ESAM-86.1 24/09/07 4 . Now copy the opcode of the program above then switch the ESA 86/88-2 to the Keyboard mode. 3. 2. #55 AL. MOVB ANDB ORB XORB RORB NOT AL. #0F AL. 4. Enter the opcode and execute the program. Describe the result of executing the following sequence of instructions. Enter the above program starting at location 2000H. #1F AL. #C0 AL. execute it. Exercises 1.