Question

In: Electrical Engineering

Design an elevator control system for an 8 floors building, draw the logic diagram, and illustrate...

Design an elevator control system for an 8 floors building, draw the logic diagram, and illustrate the system with the following situations:

1. The car is on the ground floor, John Doe wants to go from ground floor to 7th floor;

2. The car is on 8th floor, John Doe wants to go from 6th floor to the ground floor;

3. The car is moving up from 4th floor to 7th floor, John Doe wants to go from 6th floor to the ground floor;

4. The car is moving down from 7th floor to 4th floor, John Doe wants to go from 6th floor to the ground floor.

Solutions

Expert Solution

  1. ;################################################################################

  2. ;# THIS IS A 3-LEVEL MINI-ELEVATOR PROJECT. IT CONSISTS OF 9 SWITCHES OF #

  3. ;# WHICH 3 ARE FOR UP, 3 FOR DOWN, AND 3 FOR LEVEL. THE UP AND DOWN SWITCHES ARE#

  4. ;# USED OUTSIDE THE ELEVATOR WHILE THE OTHER 3 SWITCHES ARE FOR THE INSIDE OF #

  5. ;# ELEVATOR.    #

  6. ;################################################################################

  7. ;################################################################################

  8. ;# THIS IS THE INITIALIZATION PROCESS... IT WILL MAKE SURE THAT THE ELEV #

  9. ;# LOCATION IS IN THE GND FLOOR... AFTER DETECTING THE GND FLOOR, IT STOPS THE #

  10. ;# MOTOR AND THEN DECLARES ALL PINS AT THE RIGHT SIDE OF AT89C2051 (P1 AND P3.5)#

  11. ;# AS INPUTS... #

  12. ;################################################################################

  13. ORG 0000H

  14. MOV TMOD,#11H ;SET BOTH TIMERS INTO MODE 1... TIMER 0 FOR WAIT_5S... TIMER 1 FOR TIMER

  15. SETB P3.3 ;SET P3.3,P3.4,P3.5 AS INPUT FOR ELEV LOCATION

  16. SETB P3.4

  17. SETB P3.5

  18. CLR P3.0 ;STOP ELEV FROM MOVING

  19. CLR P3.1

  20. INIT: JNB P3.5,STOP_MOTOR_INIT ;SEE IF ELEV IS IN GND FLOOR

  21. CLR P3.0 ;MOTOR DOWN

  22. SETB P3.1

  23. SJMP INIT ;GO BACK IS ELEV IS NOT YET IN GND FLOOR

  24. STOP_MOTOR_INIT: CALL MOTOR_STOP ;STOP THE MOTOR SINCE ELEV IS IN GND FLOOR

  25. MOV R3,#01H ;R3 IS ELEV LOCATION... ELEV IS IN GND FLOOR

  26. MOV P1,#0FFH    ;P1 ARE ALL INPUTS FOR FLOOR SELECTION...

  27. SETB P3.7 ;P3.7 IS AN INPUT TOO FOR 3-DOWN...

  28. ;################################################################################

  29. ;# THIS IS THE POLLING PROCESS... IT POLLS EVERY SWITCH OF THE FLOOR #

  30. ;# SELECTION BY OR-ING THE CORRESPONDING VALUE TO THE R-BANK 0... OR LOGIC #

  31. ;# WAS USED INSTEAD OF A MOV OR ANY OTHER COMMAND IN ORDER TO PRESERVE OTHER #

  32. ;# FLOOR SELECTIONS WHEN THEY ARE SWITCHED/SELECTED... R0 IS FOR THE UP #

  33. ;# FUNCTION, R1 IS FOR THE LEVEL FUNCTION, R2 IS FOR THE DOWN FUNCTION... THE #

  34. ;# VALUES ARE: GND FLOOR = 0000 0001, 2ND FLOOR = 0000 0010,    #

  35. ;# 3RD FLOOR = 0000 0100... ACC IS USED TEMPORARILY TO STORE THESE VALUES AND #

  36. ;# TO OR LOGIC THEM ACCORDINGLY... 1U MEANS FIRST FLOOR WITH UP FUNCTION... #

  37. ;# 1D MEANS FIRST FLOOR WITH DOWN FUNCTION... 1 MEANS THE FIRST FLOOR SWITCH #

  38. ;# INSIDE THE ELEVATOR... I CALL THIS 'LEVEL'...    #

  39. ;################################################################################

  40. POLL_1U:JB P1.0,POLL_1A ;SEE IF 1UP IS SELECTED

  41. MOV R7,A ;STORE ACC VALUE TEMPORARILY

  42. MOV A,#01H ;0000 0001 IN R0 MEANS THAT 1UP IS SELECTED

  43. ORL A,R0 ;OR LOGIC TO SAVE OTHER SWITCHES THAT WERE SELECTED

  44. MOV R0,A ;SEND TO R0 THE SELECTION FOR UP SWITCHES

  45. MOV A,R7 ;GIVE BACK TO ACC ITS ORIGINAL VALUE

  46. POLL_1A:JB P1.3,POLL_2U ;CKECK THE SWITCH INSIDE ELEV IF GND IS SELECTED

  47. MOV R7,A

  48. MOV A,#01H

  49. ORL A,R1 ;R1 STORES THE SELECTION OF THE SWITCHES INSIDE ELEV...

  50. MOV R1,A

  51. MOV A,R7

  52. POLL_2U:JB P1.1,POLL_2A ;CKECK IF 2UP IS SELECTED

  53. MOV R7,A

  54. MOV A,#02H ;0000 0010 IS THE VALUE FOR 2ND FLOOR

  55. ORL A,R0 ;UP FUNCTION IS STORED IN R0

  56. MOV R0,A

  57. MOV A,R7

  58. POLL_2A: JB P1.4,POLL_3U   

  59. MOV R7,A

  60. MOV A,#02H

  61. ORL A,R1

  62. MOV R1,A

  63. MOV A,R7

  64. POLL_3U: JB P1.2,POLL_3A   

  65. MOV R7,A

  66. MOV A,#04H

  67. ORL A,R0

  68. MOV R0,A

  69. MOV A,R7

  70. POLL_3A: JB P1.5,POLL_3D   

  71. MOV R7,A

  72. MOV A,#04H

  73. ORL A,R1

  74. MOV R1,A

  75. MOV A,R7

  76. POLL_3D: JB P3.7,POLL_3B   

  77. MOV R7,A

  78. MOV A,#04H

  79. ORL A,R2

  80. MOV R2,A

  81. MOV A,R7

  82. POLL_3B: JB P1.5,POLL_2D   

  83. MOV R7,A

  84. MOV A,#04H

  85. ORL A,R1

  86. MOV R1,A

  87. MOV A,R7

  88. POLL_2D: JB P1.7,POLL_2B   

  89. MOV R7,A

  90. MOV A,#02H

  91. ORL A,R2

  92. MOV R2,A

  93. MOV A,R7

  94. POLL_2B: JB P1.4,POLL_1D   

  95. MOV R7,A

  96. MOV A,#02H

  97. ORL A,R1

  98. MOV R1,A

  99. MOV A,R7

  100. POLL_1D: JB P1.6,POLL_1B   

  101. MOV R7,A

  102. MOV A,#01H

  103. ORL A,R2

  104. MOV R2,A

  105. MOV A,R7

  106. POLL_1B: JB P1.3,UP ;AFTER POLLING EVERY SWITCH, SERVE THEM IF THERE ARE ANY... SEE DESCRIPTION BELOW

  107. MOV R7,A

  108. MOV A,#01H

  109. ORL A,R1

  110. MOV R1,A

  111. MOV A,R7

  112. RET ;RET TO KEEP INPUTS POSTED WHILE IN WAIT_5S, MOTOR_DOWN, MOTOR_UP, MOTOR_STOP, TIMER

  113. ;################################################################################

  114. ;# AFTER POLLING, THIS PROCEDURE WILL SERVE EACH FLOOR ACCORDINGLY... THE #

  115. ;# SEQUENCE OF SERVICE IS JUST LIKE ANY OTHER ELEVATOR... FOR MY SYSTEM, THE #

  116. ;# ELEVATOR WILL SERVICE THIS WAY: 1U,1,2U,2,3U,3,3D,3,2D,2,1D,1...

  117. ;#    IN THIS WAY, THE ELEVATOR HAS A SYSTEM THAT DETERMINES THE FLOORS TO GO.#

  118. ;# THE ELEVATOR IS ASSUMED TO BE AT THE GND FLOOR... THEN IT SERVES ANY ONE WHO #

  119. ;# SWITCHED UP OR LEVEL BECAUSE THE ELEVATOR IS GOING UP... WHEN THE ELEVATOR #

  120. ;# (1)REACHES THE HIGHEST FLOOR OR (2a)THAT THE ELEVATOR HAS REACHED THE HIGHEST#

  121. ;# FLOOR VALUE SELECTED BY THE USER AND (2b) NOTHING MORE IS SWITCHED ABOVE IT, #

  122. ;# THE ELEVATOR THEN WILL SERVE THE DOWN FUNCTION IF THERE ARE ANY... OTHERWISE,#

  123. ;# WHEN THERE WAS AN UP SWITCH LEFT BEHIND DUE TO (e.g.) A SLOW MOVING PERSON #

  124. ;# WHO WISHES TO GO UP FROM 2ND FLOOR TO 3RD FLOOR, BUT THE ELEVATOR IS ALREADY #

  125. ;# AT THE 3RD FLOOR, THAT PERSON HAS TO WAIT UNTIL THE DOWN FUNCTION ARE FULLY #

  126. ;# SERVED OR UNTIL IT REACHES GND FLOOR... WHEN THERE IS NO ONE TO SERVE FOR THE#

  127. ;# DOWN FUNCTION, OR THAT THE ELEVATOR HAS REACHED GND FLOOR, THEN THE ELEVATOR #

  128. ;# WILL SERVE THE SLOW MOVING PERSON... THE SAME IS THE PROCEDURE FOR THE DOWN #

  129. ;# FUNCTION, ONLY INVERTED IN LOGIC...    #

  130. ;################################################################################

  131. UP: MOV R7,A ;BEFORE STARTING, STORE IN R7 THE ACC SO THAT DOWN PROCEDURE'S 2ND FLOOR CAN BE SERVED OF NECESSARY...

  132. MOV A,R0 ;REMEMBER THAT R0 CONTAINS THE UP SWITCHES... OR LOGIC IT

  133. ; WITH R1 TO COMBINE SELECTIONS OF UP AND LEVEL

  134. ORL A,R1 ;ACC HAS THE FLOOR VALUES TO BE SERVED WHEN ELEV GOES UP...

  135. ORL A,R6 ;OR LOGIC AGAIN IF THE SERVICE TO THE 2ND FLOOR IS NECESSARY...

  136. CLR AC ;AC FLAG DETERMINES IF ELEV IS GOING UP OR DOWN... AC=0 FOR UP... AC=1 FOR DOWN

  137. JZ DOWN ;IF ACC IS ZERO (MEANS NO FLOOR WAS SELECTED FOR UP FUNCTION AND INSIDE ELEV),

  138. ;THEN CHECK DOWN SWITCHES IF THERE WERE ANY SELECTED

  139. CHECK_1U: JNB ACC.0, CHECK_2U ; IF ACC.0 IS ZERO, THEN IT MEANS THAT NEITHER THE 1UP NOR 1-LEVEL WAS SELECTED... CHECK 2UP IF TRUE...

  140. CALL CHECK_ELEV_LOC ;CHECK ELEVATOR LOCATION TO DETERMINE THE SOURCE OF WHICH THE ELEVATOR IS COMING FROM...

  141. SERVE_1U: JNB P3.5, STOP_MOTOR_1U ;SINCE GND IS LOWEST FLOOR IN THIS PROJECT, SET LOGIC FOR MOTOR-DOWN...

  142. CALL MOTOR_DOWN ; P3.5 IS THE DETECTOR IF THE ELEVATOR HAS REACHED GND FLOOR...

  143. SJMP SERVE_1U

  144. STOP_MOTOR_1U: CLR ACC.0 ;SINCE GND FLOOR IS SERVED, CLEAR THIS BIT...

  145. MOV R3,#01H ;THEN UPDATE R3, WHICH CONTAINS THE VALUE OF THE LOCATION OF THE ELEVATOR...

  146. CALL MOTOR_STOP ;MAKE THE MOTOR STOP BECAUSE DESTINATION IS REACHED...

  147. CALL WAIT_5S ;WAIT 5 SECONDS FOR A SIMULATION THAT THE CARGOS ARE LOADED IN/OUT...

  148. CHECK_2U: JNB ACC.1, CHECK_3U ;AFTER SERVING FIRST FLOOR, DO THE SAME PROCEDURE OF CHECKING TO 2U...

  149. CALL CHECK_ELEV_LOC

  150. SERVE_2U: CJNE R3,#02H, CHECK_2U_CY ;IF EQUAL, MEANS ELEV IS ALREADY IN 2ND FLOOR, IF NOT CHECK CARRY FLAG

  151. JMP SERVE_2U_FROM1    ;WHAT IF ELEV DROPS A LITTLE DUE TO GRAVITY...

  152. ;JMP STOP_MOTOR_2U

  153. CHECK_2U_CY:JNC CHECK_2U_AC ;CHECK CY FLAG... CY=1 IF ELEV IS IN GND FLOOR... CY=0 IF ELEV IS IN 3RD FLOOR...

  154. SERVE_2U_FROM1:JNB P3.4, STOP_MOTOR_2U ;IF ELEV IS IN 1ST FLOOR, PROCEED...

  155. CALL MOTOR_UP

  156. JMP SERVE_2U_FROM1

  157. CHECK_2U_AC:JB AC,CHECK_3U ;CY=0, SO ELEV IS IN 3RD FLOOR... CHECK AC FLAG... AC=0 FOR UP PROCEDURE, AC=1 FOR DOWN PROCEDURE

  158. SERVE_2U_FROM3:JNB P3.4, STOP_MOTOR_2U ;IF AC=1, THEN IT MEANS THAT THE ELEVATOR IS SERVING THE DOWN PROCEDURE... SO WAIT UNTIL DOWN PROCEDURE IS FINISHED

  159. CALL MOTOR_DOWN ;WHEN NOTHING WAS SELECTED AND ELEV DID NOT MOVE, IT MEANS ELEV IS IN 3RD FLOOR SO LET MOTOR-DOWN

  160. SJMP SERVE_2U_FROM3 ;WHEN SOMETHING WAS SELECTED, THEN IT MEANS THAT THE ELEV CHANGED LOCATION, SO SERVE 2ND FLOOR ACCORDING TO FUNCTIONS ABOVE...

  161. STOP_MOTOR_2U: CLR ACC.1 ;SINCE 2ND FLOOR IS SERVED, CLEAR THIS BIT, JUST LIKE WHAT I DID TO CHECK-1U

  162. MOV R3,#02H

  163. CALL MOTOR_STOP

  164. CALL WAIT_5S

  165. CHECK_3U: JNB ACC.2, DOWN ;SAME LOGIC AS BEFORE...

  166. CALL CHECK_ELEV_LOC

  167. SERVE_3U: JNB P3.3, STOP_MOTOR_3U

  168. CALL MOTOR_UP

  169. SJMP SERVE_3U

  170. STOP_MOTOR_3U: CLR ACC.2

  171. CALL MOTOR_STOP

  172. MOV R3,#04H

  173. CALL WAIT_5S

  174. ;################################################################################

  175. ;# THE DOWN PROCEDURE IS ALMOST THE SAME AS THE UP PROCEDURE, ONLY THE #

  176. ;# LOGIC FOR THE 2ND FLOOR IS INVERTED... THIS TIME, AFTER THE DOWN, START TIMER#

  177. ;# WHENEVER THERE ARE NO FLOORS THAT NEEDS TO BE SERVED... #

  178. ;################################################################################

  179. DOWN: MOV R6,A ;BEFORE STARTING, STORE IN R6 THE ACC SO THAT THE UP PROCEDURE'S 2ND FLOOR CAN BE SERVED IF NECESSARY...

  180. MOV A,R2 ;REMEMBER THAT R2 CONTAINS THE DOWN SWITCHES... AGAIN... SAME PROCEDURE...

  181. ORL A,R1 ;THIS TIME, START CHECKING FROM 3RD FLOOR SINCE DECREMENTING A VALUE STARTS FROM

  182. ORL A,R7 ;OR LOGIC AGAIN IF THE SERVICE TO THE 2ND FLOOR IS NECESSARY...

  183. SETB AC ;A HIGHER VALUE...

  184. JZ TIMER ;IF ACC IS ZERO, NO FLOOR IS SELECTED... START THE TIMER...

  185. CHECK_3D: JNB ACC.2,CHECK_2D ;SAME LOGIC AS BEFORE...

  186. CALL CHECK_ELEV_LOC

  187. SERVE_3D: JNB P3.3, STOP_MOTOR_3D

  188. CALL MOTOR_UP

  189. JMP SERVE_3D

  190. STOP_MOTOR_3D: CLR ACC.2

  191. CALL MOTOR_STOP

  192. CALL WAIT_5S

  193. MOV R3,#04H

  194. CHECK_2D: JNB ACC.1, CHECK_1D ;SAME CHECKING AS I DID IN CHECK_2U... ALSO, I INVERTED SOME CONDITIONS...

  195. CALL CHECK_ELEV_LOC

  196. SERVE_2D: CJNE R3, #02H, CHECK_2D_CY ;IF EQUAL, MEANS ELEV IS ALREADY IN 2ND FLOOR, IF NOT CHECK CARRY FLAG

  197. JMP SERVE_2D_FROM1    ;WHAT IF ELEV DROPS A LITTLE DUE TO GRAVITY...

  198. ;JMP STOP_MOTOR_2D

  199. CHECK_2D_CY:JC CHECK_2D_AC ;CHECK CY FLAG... CY=1 IF ELEV IS IN GND FLOOR... CY=0 IF ELEV IS IN 3RD FLOOR...

  200. SERVE_2D_FROM3:JNB P3.4, STOP_MOTOR_2D ;IF ELEV IS IN 3RD FLOOR, PROCEED...

  201. CALL MOTOR_DOWN

  202. JMP SERVE_2D_FROM3

  203. CHECK_2D_AC:JNB AC,CHECK_1D ;ELEV IS IN GND FLOOR... CHECK AC FLAG... AC=0 FOR UP PROCEDURE, AC=1 FOR DOWN PROCEDURE

  204. SERVE_2D_FROM1:JNB P3.4, STOP_MOTOR_2D

  205. CALL MOTOR_UP

  206. SJMP SERVE_2D_FROM1

  207. STOP_MOTOR_2D: CLR ACC.1

  208. MOV R3,#02H

  209. CALL MOTOR_STOP

  210. CALL WAIT_5S

  211. CHECK_1D: JNB ACC.0, FINISH

  212. CALL CHECK_ELEV_LOC

  213. SERVE_1D: JNB P3.5, STOP_MOTOR_1D

  214. CALL MOTOR_DOWN

  215. JMP SERVE_1D

  216. STOP_MOTOR_1D: CLR ACC.0

  217. CALL MOTOR_STOP

  218. CALL WAIT_5S

  219. MOV R3,#01H

  220. FINISH: JMP TIMER ;AFTER SERVING ALL FLOORS, CHECK AGAIN AND SERVE THEM...

  221. ;################################################################################

  222. ;#    THE FUNCTIONS BELOW ARE ONLY SUBROUTINES, EXCEPT FOR TIMER, WHICH HAS A #

  223. ;# CHARACTERISTIC TO JMP BACK TO POLL_1U WHENEVER THERE IS A FLOOR THAT NEEDS #

  224. ;# TO BE SERVED... #

  225. ;################################################################################

  226. ;################################################################################

  227. ;# FIND THE LOCATION OF THE ELEVATOR... THIS WILL UPDATE THE SYSTEM FOR THE#

  228. ;# THE LOCATION OF THE ELEVATOR (WHEN DUE TO A LIMITATION THAT MY MECHANICAL #

  229. ;# SYSTEM HAS NO STOPPER, GRAVITY CAN LOWER THE ELEVATOR LOCATION)... #

  230. ;################################################################################

  231. CHECK_ELEV_LOC: JNB P3.5, MAYBE_2

  232. MOV R3,#01H

  233. MAYBE_2: JNB P3.4, MAYBE_3

  234. MOV R3, #02H

  235. MAYBE_3: JNB P3.3, ELEV_LOCATED

  236. MOV R3,#04H

  237. ELEV_LOCATED: RET ;RETURN BECAUSE ELEV IS ALREADY LOCATED

  238. ;################################################################################

  239. ;#    WAIT 5S FOR PASSENGERS TO GET IN AND OUT OF THE ELEV... ***ONLY FOR #

  240. ;# MINI-ELEVATOR DESIGN... THIS CAME FROM TIMER 0...    #

  241. ;################################################################################

  242. WAIT_5S: MOV R4, #70

  243. WAIT_5S_LOAD: MOV TL0,#00

  244. MOV TH0,#00

  245. SETB TR0

  246. WAIT_5S_TF0: JB TF0, WAIT_5S_R4

  247. CALL POLL_1U ;POLL WHILE WAITING SO THAT THE ELEV CAN STILL INTERACT ON THIS WAIT TIME...

  248. JMP WAIT_5S_TF0

  249. WAIT_5S_R4: CLR TF0

  250. CLR TR0

  251. DJNZ R4, WAIT_5S_LOAD

  252. RET

  253. ;################################################################################

  254. ;#    TO GO BACK TO DEFAULT FLOOR (GND FLOOR) WHEN ELEVATOR IS UNINTERRUPTED #

  255. ;# FOR A LONG TIME (15 SECONDS)...    #

  256. ;################################################################################

  257. TIMER: MOV R5, #211

  258. TIMER_LOAD: MOV TL1,#00

  259. MOV TH1,#00

  260. SETB TR1

  261. TIMER_TF1: JB TF1, TIMER_R5

  262. CALL QUICK_POLL ;QUICK POLL CAN DETERMINE FASTER IF TIMER IS TO BE RESET AND SERVE THE FLOOR...

  263. JB TR1, TIMER_PROCEED

  264. JMP POLL_1U ;IF TR1 = 0, THEN IT MEANS THERE WAS AN INTERRUPTION, OR THAT THERE HAS A FLOOR TO BE SERVED...

  265. TIMER_PROCEED: JMP TIMER_TF1

  266. TIMER_R5: CLR TF1

  267. CLR TR1

  268. DJNZ R5, TIMER_LOAD ; IF R5 REACHES ZERO, THEN GO BACK TO DEFAULT FLOOR (GND FLOOR)

  269. TIMER_FULL: SETB TR1 ;JUST TO CHECK FOR THE INTERRUPTION/QUICK_POLL SUBROUTINE... NOT NECESSARILY FOR THE TIMER...

  270. CALL CHECK_ELEV_LOC ;UPDATE FLOOR FIRST BEFORE GOING TO GND...

  271. CALL QUICK_POLL

  272. JNB TR1, TIMER_FULL_INT

  273. CJNE R3,#02H, TIMER_CHECK_CY ;MEANS THAT ELEV IS ON 2ND FLOOR...

  274. TIMER_FROM_2: JNB P3.5, TIMER_REACHED_1 ;IF EQUAL, THEN IT MEANS THAT ELEV IS IN 2ND FLOOR... MOTOR-DOWN...

  275. CALL QUICK_POLL

  276. JNB TR1, TIMER_FULL_INT

  277. CALL MOTOR_DOWN

  278. JMP TIMER_FROM_2

  279. TIMER_REACHED_1:CALL MOTOR_STOP ;P3.5 DETECTED THAT ELEV IS IN GND FLOOR ALREADY... SO MOTOR-STOP...

  280. MOV R3,#01H

  281. JMP POLL_1U ;BACK TO POLLING...

  282. TIMER_CHECK_CY: JC TIMER_REACHED_1 ;COMPARISON CONFIRMS THAT ELEV IS IN GND FLOOR... SO ELEV'S TIMER_REACHED_1...

  283. MOV R3,#04H ;IF THERE IS NO CARRY, MEANS THAT ELEV IS IN 3RD FLOOR...

  284. TIMER_FROM_3: JNB P3.4, TIMER_FROM_2 ;SO MOTOR-DOWN UNTIL IT REACHES 2ND FLOOR...

  285. CALL QUICK_POLL

  286. JNB TR1, TIMER_FULL_INT

  287. CALL MOTOR_DOWN

  288. JMP TIMER_FROM_3

  289. TIMER_FULL_INT: JMP POLL_1U ;TIMER WAS FULL, BUT WAS INTERRUPTED... SO SERVE THE FLOOR(S) SELECTED BY FIRST FINDING WHICH FLOOR WAS SELECTED...

  290. ;################################################################################

  291. ;#    A QUICK POLL THAT IS USED IN THE TIMER TO RESET THE TIMER IF ANY FLOOR #

  292. ;# WAS SELECTED... THE TIMER THEN IS INTERRUPTED IF ANY FLOOR IS SELECTED... #

  293. ;################################################################################

  294. QUICK_POLL: JNB P1.7, INTERRUPTED

  295. JNB P1.6, INTERRUPTED

  296. JNB P1.5, INTERRUPTED

  297. JNB P1.4, INTERRUPTED

  298. JNB P1.3, INTERRUPTED

  299. JNB P1.2, INTERRUPTED

  300. JNB P1.1, INTERRUPTED

  301. JNB P1.0, INTERRUPTED

  302. JNB P3.7, INTERRUPTED

  303. JNB ACC.0, INTERRUPTED ;GND FLOOR GENERAL

  304. JNB ACC.1, INTERRUPTED ;2ND FLOOR GENERAL

  305. JNB ACC.2, INTERRUPTED ;3RD FLOOR GENERAL

  306. RET

  307. INTERRUPTED: CLR TR1

  308. MOV R5, #211

  309. MOV TL0,#00

  310. MOV TH0,#00

  311. CLR TF1

  312. RET

  313. ;################################################################################

  314. ;# MOTOR MECHANISMS TO GO UP, DOWN, OR STOP, BY MANIPULATING TWO PORT BITS #

  315. ;# P3.0 AND P3.1... I NEED H-BRIDGE HERE... #

  316. ;################################################################################

  317. MOTOR_UP: SETB P3.0

  318. CLR P3.1

  319. CALL POLL_1U ;WHILE DOING THIS FUNCTION, MAKE SURE USER CAN SELECT OTHER FLOORS AS WELL...

  320. RET

  321. MOTOR_DOWN: CLR P3.0

  322. SETB P3.1

  323. CALL POLL_1U

  324. RET

  325. MOTOR_STOP: CLR P3.0

  326. CLR P3.1

  327. CALL POLL_1U

  328. RET

  329. END

  330. this is the code for the elevator


Related Solutions

Design a combinational logic circuit that performs the function of Full Subtractor. Draw a neat diagram...
Design a combinational logic circuit that performs the function of Full Subtractor. Draw a neat diagram of the final circuit and verify the design for at least two input samples.
Draw a PLC ladder logic diagram to simulate the operation of a sequential taillight system. The...
Draw a PLC ladder logic diagram to simulate the operation of a sequential taillight system. The light system consists of three separate lights on each side of the car. Each set of lights will be activated separately, by either the left or right turn signal switch. There is to be a 1-s delay between the activation of each light, and a 1-s period when all the lights are off. Ensure that when both switches are on, the system will not...
draw a PLC ladder diagram for 5 floor elevator
draw a PLC ladder diagram for 5 floor elevator
  Draw and carefully and thoroughly label a block diagram of an “open loop” control system. Draw...
  Draw and carefully and thoroughly label a block diagram of an “open loop” control system. Draw and carefully and thoroughly   label a block diagram of a  “closed loop” control system.
Describe the key concept of system approach and draw a diagram to illustrate the key components...
Describe the key concept of system approach and draw a diagram to illustrate the key components and sequence of a system approach. Discuss the effects of diversity within a group on group performance.
1. Design and develop a fuzzy logic system for DC motor speed control a) Develop the...
1. Design and develop a fuzzy logic system for DC motor speed control a) Develop the input membership function based on error and change in error as inputs b) Formulate the rules for the fuzzy based DC motor speed control. c) Develop and test the fuzzy system using both Mamdani and Sugeno Methods.
Give an example of a closed loop control system and draw its block diagram
Give an example of a closed loop control system and draw its block diagram
3.a Draw the logic diagram for the following Boolean expression. The diagram should correspond exactly to...
3.a Draw the logic diagram for the following Boolean expression. The diagram should correspond exactly to the equation (do not simplify). Assume that the complements of the inputs are available. ? = ?′?(? + ?) + ??′(? + ?) + ?′?(? + ?) + ??′(? + ?) b. Simplify the Boolean expression in (a) using a Karnaugh Map, then draw the corresponding two-level logic diagram as a sum of products implementation.
Give 4 examples of CLOSED LOOP control system and draw its block diagram
Give 4 examples of CLOSED LOOP control system and draw its block diagram
You have been asked to design an elevator system. The functions of an elevator includes moving...
You have been asked to design an elevator system. The functions of an elevator includes moving up and down, open and close doors, and pick up passengers. The elevator is supposed to be used in a building having floors numbered from 1 to MaxFloor, where the first floor is the lobby. There are car call buttons in the car corresponding to each floor. For every floor except for the top floor and the lobby, there are two hall call buttons...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT