Design and implementation of simulated elevator I. Experimental purpose 1. Understand the elevator dispatching algorithm. 2. Use the microcomputer experimental system to simulate the elevator. 3. Further master the design method of the microcomputer interface. II. Experimental content and requirements 1. Basic design requirements Use keyboards, buttons, light-emitting diodes and LED display units to simulate the elevator working process. The number of floors is set to 5. Use the keyboard to enter the floor you want to stop. 5 light-emitting diodes display the floor you want to stop. The LED indicates the current floor of the elevator. The button is used to start and stop the elevator. When the elevator is running normally, it rises or falls at a speed of 1 floor every 2 seconds. 2. Improved requirements Design several buttons to simulate more elevator operation functions, such as: • Direct button. If this button is pressed, the elevator will run in a direct mode, that is, it will not stop for the newly entered stop floor during the operation (even if it has not reached the floor in the same direction) and will directly reach the terminal floor; • Emergency stop button. If this button is pressed during the operation of the elevator, the elevator will immediately stop at the next floor to be reached; • Power-off button for repair. The elevator does not work if the button is pressed. It can only work again if the button is pressed again. • Other function buttons (designers can freely use them). III. Experimental report requirements 1. Design purpose and content 2. Overall design 3. Hardware design: schematic diagram (wiring diagram) and brief description 4. Software design block diagram and program list 5. Design results and experience (including problems encountered and solutions) IV. Elevator working method The elevator works in the following way: 1. Assume that the elevator is currently parked at a certain floor (LED displays the corresponding floor, and all 5 LEDs are off). Type in the number keys. If the number typed is the same as the current elevator stop floor, nothing will be done. If it is different, the LED of the corresponding floor will light up; the elevator will automatically determine whether to rise or fall (the eight-segment code is used to display the floor change during operation) until it reaches the floor you want to stop (the eight-segment code displays the floor, and the corresponding LED is off). 2. Assuming that the elevator is currently ascending or descending (the eight-segment code shows the floor change, and the LED indicates the floor you want to arrive at), if you enter the new floor number you want to stop at (the corresponding LED is on), it can stop at the floors that have not been reached in the same direction (ascending or descending), and in other cases it will first stop at the floor you originally wanted to stop at, and then continue to run). The following are some examples: 1) Assuming that the elevator is currently on the 2nd floor and running upward, and the LED indicates that it wants to stop at the 4th floor, if you enter 3 at this time, the elevator will stop at the 3rd floor and then continue to run to the 4th floor; 2) In the same situation, if you enter 5 instead of 3, the elevator will first stop at the 4th floor and then run to the 5th floor; 3) In the same situation, if you enter 1 instead of 3 (or 5), the elevator will first stop at the 4th floor and then run to the 1st floor. V. Overall design ideas This design mainly uses a microcomputer application experiment platform to simulate the operation of the elevator, using a non-encoded keyboard, LED display, eight-segment digital tube and other modules on the platform. There are 5 floors. 5 buttons are needed to simulate the request buttons in the elevator, 5 buttons are used to simulate the buttons for the upward request of each of the 5 floors, and 5 buttons are used to simulate the buttons for the downward request of each of the 5 floors. The non-encoded keyboard has 16 keys. You can use keys 1-5 to simulate the buttons in the elevator, keys 6-0 to simulate the buttons for the upward request of each floor, and AE to simulate the buttons for the downward request of each floor. When the elevator is stationary, no matter which floor has a request from the outside, the elevator will switch from the stationary state to the upward or downward state until it reaches the requested floor; when the elevator is in the upward state, the upward request and internal request level above the floor are the highest, followed by the downward request of all floors, and then the upward request below the floor; when the elevator is in the downward state, the situation is the opposite. Since the interrupt level changes with the different floors of the elevator, and there are many interrupt sources. Therefore, it is inconvenient to use each interrupt source directly connected to the interrupt controller, and multiple 8259A cascades are required. To solve this problem, first define three single-byte variables REQ_U, REQ_D and REQ_IN to store the requests for each floor of the elevator to go up, down and inside respectively. Each variable uses the lower 5 bits, and each bit represents a floor. For example, REQ_U is 00000110B, which means there is an upward request on the 2nd and 3rd floors. The 8253 timer generates an interrupt every 20ms, and the interrupt program executes the keyboard scan. When the elevator internal or external key is scanned, the request is stored in the variable. When a state is reached, the values of the request variables REQ_U, REQ_D and REQ_IN are checked again, and the next operation of the elevator is determined according to the direction of the elevator and the request in the variable. Suppose the current floor of the elevator is floor (floor=1~5), and the direction of operation is dir (dir=0, up; dir=1, down). In the elevator operation project, the digital tube outputs the floor value to display the current floor. The LED output REQ_IN value displays the floor that has been requested in the elevator. 6. System Hardware Circuit Design Due to the use of PC resources and microcomputer experimental platform, no other hardware circuits are required. The 8253 timer/counter, 8255 parallel interface unit, LED unit, non-encoded keyboard, digital tube display unit, etc. on the microcomputer platform are used. The system structure block diagram is shown in Figure 1.
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore