Elevator

23
Register Help Remember Me? Forum o Today's Posts o FAQ o Calendar o Community o Forum Actions o Quick Links Home Projects Blogs Tutorials Code Library 8051 Tools What's New? Advanced Search Forum Electronics Electronic Projects Design/Ideas/Reviews 3 Level Mini-Elevator... Semi-Finished... Needs Debugging... Needs Help... 1. If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Transcript of Elevator

Page 1: Elevator

Register Help

Remember Me?

Forum o Today's Posts o FAQ o Calendar o Community

Forum Actions Quick Links Home

Projects Blogs Tutorials Code Library 8051 Tools What's New?

Advanced Search

Forum Electronics Electronic Projects Design/Ideas/Reviews 3 Level Mini-Elevator... Semi-Finished... Needs Debugging... Needs Help...

1. If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

+ Reply to Thread Results 1 to 7 of 7

Page 2: Elevator

Thread: 3 Level Mini-Elevator... Semi-Finished... Needs Debugging... Needs Help...

Thread Tools

o Search Thread

o 23-03-2009 10:23 PM #1

redsel24

o View Profile

o View Forum Posts

o Private Message

Junior Member

Join DateFeb 2009

Location, Manila, Philippines.

Posts3

3 Level Mini-Elevator... Semi-Finished... Needs Debugging... Needs Help...

Hi to all...

So I have come to a point where I was able to think about a certain circuit design and write the Assembly code program for my 3 level mini elevator project... I personally have chosen this project for my final lab activity in school...

So I used the AT89C2051 microcontroller to facilitate the elevator action... In this design, I have a schematic shown below...

For the software part, I made a program in Assembly language code... However, the program does not seem to work... Because of this, I placed comments on it so that everyone can help me...

For the hardware part, the schematic is fairly easy to understand... Let me summarize them:1. The right part of the microcontroller has all the input switches corresponding to their names... The ones with the Up and Down are like the switches outside the elevator, while the Level are the switches inside the elevator...

2. Two of port 3's pins are connected to the 6V DC Motor, which I know would not work since I have got to construct an H-bridge there first... I consulted with the people in this forum and they were a huge help to me... (thank you all of you)... However, I am yet to construct the H-bridge...

Page 3: Elevator

3. For the detection of the floors, three of port 3's pins are designated to detect the elevator at each level... You may say that I could have used some proximity sensors or IR transmitter-receivers, but as of now, I lack time for it... Sorry about that... But I have been a little resourceful by connecting the elevator with a wire connection such that when that wire touches the other wire from the microcontroller pin, then they will all conduct to the ground, which I believe will give an input to the micrcontroller... For the first floor detection, the image below shows how it is done...

Please help me...

Also comment on my design... Do I have to add resistors, diodes, more capacitors? I purposefully exhausted almost all the pins of this microcontroller so that when I create another elevator, I should be able to have more time and more thinking about reducing these stuff. Thus, maybe sooner, I can make a real elevator...

Again, please help me...

*I have only attached my code here but it seems that the way my computer presents it is not very readable... Use Keil instead...

Page 4: Elevator

Code:

;################################################################################;# THIS IS A 3-LEVEL MINI-ELEVATOR PROJECT. IT CONSISTS OF 9 SWITCHES OF #;# WHICH 3 ARE FOR UP, 3 FOR DOWN, AND 3 FOR LEVEL. THE UP AND DOWN SWITCHES ARE#;# USED OUTSIDE THE ELEVATOR WHILE THE OTHER 3 SWITCHES ARE FOR THE INSIDE OF #;# ELEVATOR.

#;################################################################################

;################################################################################

Page 5: Elevator

;# THIS IS THE INITIALIZATION PROCESS... IT WILL MAKE SURE THAT THE ELEV #;# LOCATION IS IN THE GND FLOOR... AFTER DETECTING THE GND FLOOR, IT STOPS THE #;# MOTOR AND THEN DECLARES ALL PINS AT THE RIGHT SIDE OF AT89C2051 (P1 AND P3.5)#;# AS INPUTS...

#;################################################################################

ORG 0000HMOV TMOD,#11H ;SET BOTH TIMERS

INTO MODE 1... TIMER 0 FOR WAIT_5S... TIMER 1 FOR TIMER

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

SETB P3.4SETB P3.5

CLR P3.0 ;STOP ELEV FROM MOVING

CLR P3.1

INIT: JNB P3.5,STOP_MOTOR_INIT ;SEE IF ELEV IS IN GND FLOORCLR P3.0 ;MOTOR DOWNSETB P3.1SJMP INIT ;GO BACK IS

ELEV IS NOT YET IN GND FLOORSTOP_MOTOR_INIT: CALL MOTOR_STOP ;STOP THE MOTOR SINCE ELEV IS IN GND FLOOR

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

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

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

;################################################################################;# THIS IS THE POLLING PROCESS... IT POLLS EVERY SWITCH OF THE FLOOR #;# SELECTION BY OR-ING THE CORRESPONDING VALUE TO THE R-BANK 0... OR LOGIC #;# WAS USED INSTEAD OF A MOV OR ANY OTHER COMMAND IN ORDER TO PRESERVE OTHER #;# FLOOR SELECTIONS WHEN THEY ARE SWITCHED/SELECTED... R0 IS FOR THE UP #;# FUNCTION, R1 IS FOR THE LEVEL FUNCTION, R2 IS FOR THE DOWN FUNCTION... THE #;# VALUES ARE: GND FLOOR = 0000 0001, 2ND FLOOR = 0000 0010,

#;# 3RD FLOOR = 0000 0100... ACC IS USED TEMPORARILY TO STORE THESE VALUES AND #;# TO OR LOGIC THEM ACCORDINGLY... 1U MEANS FIRST FLOOR WITH UP FUNCTION... #;# 1D MEANS FIRST FLOOR WITH DOWN FUNCTION... 1 MEANS THE FIRST FLOOR SWITCH #;# INSIDE THE ELEVATOR... I CALL THIS 'LEVEL'...

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

MOV R7,A ;STORE ACC VALUE TEMPORARILY

Page 6: Elevator

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

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

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

MOV A,R7 ;GIVE BACK TO ACC ITS ORIGINAL VALUEPOLL_1A:JB P1.3,POLL_2U ;CKECK THE SWITCH INSIDE ELEV IF GND IS SELECTED

MOV R7,AMOV A,#01HORL A,R1 ;R1 STORES THE

SELECTION OF THE SWITCHES INSIDE ELEV...MOV R1,AMOV A,R7

POLL_2U:JB P1.1,POLL_2A ;CKECK IF 2UP IS SELECTEDMOV R7,AMOV A,#02H ;0000 0010

IS THE VALUE FOR 2ND FLOORORL A,R0 ;UP FUNCTION IS

STORED IN R0MOV R0,AMOV A,R7

POLL_2A: JB P1.4,POLL_3U MOV R7,AMOV A,#02HORL A,R1MOV R1,AMOV A,R7

POLL_3U: JB P1.2,POLL_3A MOV R7,AMOV A,#04HORL A,R0MOV R0,AMOV A,R7

POLL_3A: JB P1.5,POLL_3D MOV R7,AMOV A,#04HORL A,R1MOV R1,AMOV A,R7

POLL_3D: JB P3.7,POLL_3B MOV R7,AMOV A,#04HORL A,R2MOV R2,AMOV A,R7

POLL_3B: JB P1.5,POLL_2D MOV R7,AMOV A,#04HORL A,R1MOV R1,AMOV A,R7

POLL_2D: JB P1.7,POLL_2B MOV R7,AMOV A,#02HORL A,R2MOV R2,AMOV A,R7

POLL_2B: JB P1.4,POLL_1D

Page 7: Elevator

MOV R7,AMOV A,#02HORL A,R1MOV R1,AMOV A,R7

POLL_1D: JB P1.6,POLL_1B MOV R7,AMOV A,#01HORL A,R2MOV R2,AMOV A,R7

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

MOV R7,AMOV A,#01HORL A,R1MOV R1,AMOV A,R7

RET;RET TO KEEP INPUTS POSTED WHILE IN WAIT_5S, MOTOR_DOWN, MOTOR_UP,

MOTOR_STOP, TIMER

;################################################################################;# AFTER POLLING, THIS PROCEDURE WILL SERVE EACH FLOOR ACCORDINGLY... THE #;# SEQUENCE OF SERVICE IS JUST LIKE ANY OTHER ELEVATOR... FOR MY SYSTEM, THE #;# ELEVATOR WILL SERVICE THIS WAY: 1U,1,2U,2,3U,3,3D,3,2D,2,1D,1... ;# IN THIS WAY, THE ELEVATOR HAS A SYSTEM THAT DETERMINES THE FLOORS TO GO.#;# THE ELEVATOR IS ASSUMED TO BE AT THE GND FLOOR... THEN IT SERVES ANY ONE WHO #;# SWITCHED UP OR LEVEL BECAUSE THE ELEVATOR IS GOING UP... WHEN THE ELEVATOR #;# (1)REACHES THE HIGHEST FLOOR OR (2a)THAT THE ELEVATOR HAS REACHED THE HIGHEST#;# FLOOR VALUE SELECTED BY THE USER AND (2b) NOTHING MORE IS SWITCHED ABOVE IT,

#;# THE ELEVATOR THEN WILL SERVE THE DOWN FUNCTION IF THERE ARE ANY... OTHERWISE,#;# WHEN THERE WAS AN UP SWITCH LEFT BEHIND DUE TO (e.g.) A SLOW MOVING PERSON #;# WHO WISHES TO GO UP FROM 2ND FLOOR TO 3RD FLOOR, BUT THE ELEVATOR IS ALREADY #;# AT THE 3RD FLOOR, THAT PERSON HAS TO WAIT UNTIL THE DOWN FUNCTION ARE FULLY #;# SERVED OR UNTIL IT REACHES GND FLOOR... WHEN THERE IS NO ONE TO SERVE FOR THE#;# DOWN FUNCTION, OR THAT THE ELEVATOR HAS REACHED GND FLOOR, THEN THE ELEVATOR #;# WILL SERVE THE SLOW MOVING PERSON... THE SAME IS THE PROCEDURE FOR THE DOWN #;# FUNCTION, ONLY INVERTED IN LOGIC...

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

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

; WITH R1 TO COMBINE SELECTIONS OF UP AND LEVEL

Page 8: Elevator

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

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

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

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

;THEN CHECK DOWN SWITCHES IF THERE WERE ANY SELECTED

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...

CALL CHECK_ELEV_LOC ;CHECK ELEVATOR LOCATION TO DETERMINE THE SOURCE OF WHICH THE ELEVATOR IS COMING FROM... SERVE_1U: JNB P3.5, STOP_MOTOR_1U ;SINCE GND IS LOWEST FLOOR IN THIS PROJECT, SET LOGIC FOR MOTOR-DOWN...

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

SJMP SERVE_1USTOP_MOTOR_1U: CLR ACC.0 ;SINCE GND FLOOR IS SERVED, CLEAR THIS BIT...

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

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

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

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

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

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

;JMP STOP_MOTOR_2UCHECK_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...SERVE_2U_FROM1:JNB P3.4, STOP_MOTOR_2U ;IF ELEV IS IN 1ST FLOOR, PROCEED...

CALL MOTOR_UPJMP SERVE_2U_FROM1

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 PROCEDURESERVE_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

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

SJMP SERVE_2U_FROM3 ;WHEN SOMETHING WAS SELECTED, THEN IT MEANS THAT THE ELEV CHANGED LOCATION, SO SERVE 2ND FLOOR ACCORDING TO FUNCTIONS ABOVE... STOP_MOTOR_2U: CLR ACC.1 ;SINCE 2ND FLOOR IS SERVED, CLEAR THIS BIT, JUST LIKE WHAT I DID TO CHECK-1U

MOV R3,#02HCALL MOTOR_STOPCALL WAIT_5S

Page 9: Elevator

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

CALL CHECK_ELEV_LOCSERVE_3U: JNB P3.3, STOP_MOTOR_3U

CALL MOTOR_UPSJMP SERVE_3U

STOP_MOTOR_3U: CLR ACC.2CALL MOTOR_STOPMOV R3,#04HCALL WAIT_5S

;################################################################################;# THE DOWN PROCEDURE IS ALMOST THE SAME AS THE UP PROCEDURE, ONLY THE #;# LOGIC FOR THE 2ND FLOOR IS INVERTED... THIS TIME, AFTER THE DOWN, START TIMER#;# WHENEVER THERE ARE NO FLOORS THAT NEEDS TO BE SERVED...

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

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

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

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

SETB AC ;A HIGHER VALUE...

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

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

CALL CHECK_ELEV_LOCSERVE_3D: JNB P3.3, STOP_MOTOR_3D

CALL MOTOR_UPJMP SERVE_3D

STOP_MOTOR_3D: CLR ACC.2CALL MOTOR_STOPCALL WAIT_5SMOV R3,#04H

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

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

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

;JMP STOP_MOTOR_2DCHECK_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...SERVE_2D_FROM3:JNB P3.4, STOP_MOTOR_2D ;IF ELEV IS IN 3RD FLOOR, PROCEED...

CALL MOTOR_DOWNJMP SERVE_2D_FROM3

Page 10: Elevator

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

CALL MOTOR_UPSJMP SERVE_2D_FROM1

STOP_MOTOR_2D: CLR ACC.1MOV R3,#02HCALL MOTOR_STOPCALL WAIT_5S

CHECK_1D: JNB ACC.0, FINISHCALL CHECK_ELEV_LOC

SERVE_1D: JNB P3.5, STOP_MOTOR_1DCALL MOTOR_DOWNJMP SERVE_1D

STOP_MOTOR_1D: CLR ACC.0CALL MOTOR_STOPCALL WAIT_5SMOV R3,#01H

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

;################################################################################;# THE FUNCTIONS BELOW ARE ONLY SUBROUTINES, EXCEPT FOR TIMER, WHICH HAS A #;# CHARACTERISTIC TO JMP BACK TO POLL_1U WHENEVER THERE IS A FLOOR THAT NEEDS #;# TO BE SERVED...

#;################################################################################

;################################################################################;# FIND THE LOCATION OF THE ELEVATOR... THIS WILL UPDATE THE SYSTEM FOR THE# ;# THE LOCATION OF THE ELEVATOR (WHEN DUE TO A LIMITATION THAT MY MECHANICAL #;# SYSTEM HAS NO STOPPER, GRAVITY CAN LOWER THE ELEVATOR LOCATION)... #;################################################################################CHECK_ELEV_LOC: JNB P3.5, MAYBE_2

MOV R3,#01HMAYBE_2: JNB P3.4, MAYBE_3

MOV R3, #02HMAYBE_3: JNB P3.3, ELEV_LOCATED

MOV R3,#04HELEV_LOCATED: RET ;RETURN BECAUSE ELEV IS ALREADY LOCATED

;################################################################################;# WAIT 5S FOR PASSENGERS TO GET IN AND OUT OF THE ELEV... ***ONLY FOR #;# MINI-ELEVATOR DESIGN... THIS CAME FROM TIMER 0...

#;################################################################################WAIT_5S: MOV R4, #70

Page 11: Elevator

WAIT_5S_LOAD: MOV TL0,#00MOV TH0,#00SETB TR0

WAIT_5S_TF0: JB TF0, WAIT_5S_R4CALL POLL_1U ;POLL WHILE

WAITING SO THAT THE ELEV CAN STILL INTERACT ON THIS WAIT TIME... JMP WAIT_5S_TF0

WAIT_5S_R4: CLR TF0CLR TR0DJNZ R4, WAIT_5S_LOADRET

;################################################################################;# TO GO BACK TO DEFAULT FLOOR (GND FLOOR) WHEN ELEVATOR IS UNINTERRUPTED #;# FOR A LONG TIME (15 SECONDS)...

#;################################################################################TIMER: MOV R5, #211TIMER_LOAD: MOV TL1,#00

MOV TH1,#00SETB TR1

TIMER_TF1: JB TF1, TIMER_R5CALL QUICK_POLL ;QUICK POLL

CAN DETERMINE FASTER IF TIMER IS TO BE RESET AND SERVE THE FLOOR... JB TR1, TIMER_PROCEEDJMP POLL_1U ;IF

TR1 = 0, THEN IT MEANS THERE WAS AN INTERRUPTION, OR THAT THERE HAS A FLOOR TO BE SERVED...TIMER_PROCEED: JMP TIMER_TF1TIMER_R5: CLR TF1

CLR TR1DJNZ R5, TIMER_LOAD ; IF R5

REACHES ZERO, THEN GO BACK TO DEFAULT FLOOR (GND FLOOR)

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

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

CALL QUICK_POLLJNB TR1, TIMER_FULL_INTCJNE R3,#02H, TIMER_CHECK_CY ;MEANS THAT

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

CALL QUICK_POLLJNB TR1, TIMER_FULL_INTCALL MOTOR_DOWNJMP TIMER_FROM_2

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

MOV R3,#01HJMP POLL_1U

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

MOV R3,#04H ;IF THERE IS NO CARRY, MEANS THAT ELEV IS IN 3RD FLOOR...TIMER_FROM_3: JNB P3.4, TIMER_FROM_2 ;SO MOTOR-DOWN UNTIL IT REACHES 2ND FLOOR...

Page 12: Elevator

CALL QUICK_POLLJNB TR1, TIMER_FULL_INTCALL MOTOR_DOWNJMP TIMER_FROM_3

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...

;################################################################################;# A QUICK POLL THAT IS USED IN THE TIMER TO RESET THE TIMER IF ANY FLOOR #;# WAS SELECTED... THE TIMER THEN IS INTERRUPTED IF ANY FLOOR IS SELECTED... #;################################################################################QUICK_POLL: JNB P1.7, INTERRUPTED

JNB P1.6, INTERRUPTEDJNB P1.5, INTERRUPTEDJNB P1.4, INTERRUPTEDJNB P1.3, INTERRUPTEDJNB P1.2, INTERRUPTEDJNB P1.1, INTERRUPTEDJNB P1.0, INTERRUPTEDJNB P3.7, INTERRUPTEDJNB ACC.0, INTERRUPTED ;GND FLOOR

GENERALJNB ACC.1, INTERRUPTED ;2ND FLOOR

GENERALJNB ACC.2, INTERRUPTED ;3RD FLOOR

GENERALRET

INTERRUPTED: CLR TR1MOV R5, #211MOV TL0,#00MOV TH0,#00CLR TF1RET

;################################################################################;# MOTOR MECHANISMS TO GO UP, DOWN, OR STOP, BY MANIPULATING TWO PORT BITS #;# P3.0 AND P3.1... I NEED H-BRIDGE HERE...

#;################################################################################ MOTOR_UP: SETB P3.0

CLR P3.1CALL POLL_1U ;WHILE DOING

THIS FUNCTION, MAKE SURE USER CAN SELECT OTHER FLOORS AS WELL... RET

MOTOR_DOWN: CLR P3.0SETB P3.1CALL POLL_1URET

MOTOR_STOP: CLR P3.0CLR P3.1CALL POLL_1U

Page 13: Elevator

RET

END

**best viewed in Keil software because my computer views it nicely while in Notepad (Windows), the texts are scrambled like eggs...

Attachment: Draft2 Zipped.zip ( 2247bytes )

Reply With Quote

2. 24-03-2009 09:29 PM #2

Binu

o View Profile

o View Forum Posts

o Private Message

o Visit Homepage

Administrator

Join DateJun 2007

LocationNagercoil, Tamilnadu, India.

Posts6,181

You worked nice, okIn the circuit you need to connect pull-up resistor of value 10k for each of the

Page 14: Elevator

switches.

Sure you need some proximity switches to sense the floor. First design the full circuit with the H-bridge.

I have done a similar project with stepper motor and sure it will help you.

Attachment: lift-controller-89s52.zip ( 792bytes )

Reply With Quote

Page 15: Elevator

3. 25-03-2009 10:01 PM #3

redsel24

o View Profile

o View Forum Posts

o Private Message

Junior Member

Join DateFeb 2009

Location, Manila, Philippines.

Posts3

I am using the AT89C2051, and the port bits there already has pull-up resistors, according to the datasheet... but because you said that I have to connect these 10k resistors, I will do so... But can I connect just one resistor for all these input switches? Nevertheless, I'll connect each...

I made P1 as inputs (MOV P1,#0FFH), but when I checked with a logic probe, P1.0 and P1.1 are neither logic high nor logic low... I do not quite understand this... Upon toggling these buttons, they both trigger a logic low, so I assumed that they work ok... But it bothers me because I made them inputs...

My DC Motor also runs too fast... it then tangles my thread... any simple ways to lower its speed? maybe adding a resistance?

I have constructed an H-Bridge using 2N3906 and 2N3904 transistors... however, they do not respond that fast like the microcontroller... I plan to use the op-amp but I do not know how... I have access to LM324, a quad-op-amp, so can you please show me a schematic for a guide to drive my 6V DC Motor?

Page 16: Elevator

I replaced the 100k resistance with a short to ease the driving of my Motor, but the drive was too eased... The elevator then moves too fast... So I am opting for an op-amp...

Hmmm... your schematic only has the motor... I implemented mine with a metal structure for the elevator... Sorry that I could not use the proximity sensor due to a lack of time... But thanks for the reply...

Reply With Quote

4. 26-03-2009 08:37 PM #4

Binu

o View Profile

o View Forum Posts

o Private Message

o Visit Homepage

Page 17: Elevator

Administrator

Join DateJun 2007

LocationNagercoil, Tamilnadu, India.

Posts6,181

For H bridge use L293D its the IC which can be used to control the DC motor. Please check the Line following robot project in which i have used this IC.Else use stepper motor so that you can stop the motor at each floor without any proximity switches.

Reply With Quote

5. 03-12-2009 01:54 PM #5

syahmxxx

o View Profile

o View Forum Posts

o Private Message

Junior Member

Join DateNov 2009

Location, Melaka, Malaysia.

Posts1

Page 18: Elevator

dear binu,

i am doing a similar project as resdel24 but the only difference in it is we have to use IR sensors to detect the floors...is there any modification that has to be done in the circuit diagram?...The diagram is similar to the one that u have uploaded in ur earlier post. Thank you.

Reply With Quote

6. 08-12-2009 09:29 PM #6

Binu

o View Profile

o View Forum Posts

o Private Message

o Visit Homepage

Administrator

Join DateJun 2007

LocationNagercoil, Tamilnadu, India.

Posts6,181

Then you have to add the sensors on the circuit also you need to change the code for it.

[Check out the new 8051 blog]

Reply With Quote

Page 19: Elevator

7. 10-09-2010 06:19 PM #7

peacemode

o View Profile

o View Forum Posts

o Private Message

Junior Member

Join DateSep 2010

Locationphilippines

Posts1

about : AT89C2051

(AT89C2051 ) this ic can be programs before to install?

Reply With Quote

+ Reply to Thread Quick Navigation Electronic Projects Design/Ideas/Reviews Top

Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums Site News And Announcements

1. Announcements 2. Issues on the site

From 8051projects.info 1. Doubts in My Projects 2. Doubts in My AVR Projects at avrprojects.info

Electronics 1. Electronic Projects Design/Ideas/Reviews

Page 20: Elevator

MicroControllers and Micro Processors 1. Microcontrollers 2. BASCOM 8051 Projects & Doubts 3. GPS 4. GSM 5. Bluetooth 6. New Ideas regarding projects 7. Project Doubts

General 1. Site Feedback/Help 2. Tech Talk 3. New Components Price and Availability

Photo Album 1. Project Kit's Album 2. Project Videos

« Previous Thread | Next Thread »

Tags for this Thread

3 Level Mini Elevator 8051 based lift controller 8051 elevator circuit AT89s52 lift controller program

View Tag Cloud

Bookmarks

Digg

del.icio.us

StumbleUpon

Google

Posting Permissions

You may not post new threads You may not post replies You may not post attachments You may not edit your posts

BB code is On Smilies are On [IMG] code is On HTML code is Off

Forum Rules

Contact Us 8051projects