Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

3 Floor lift programming issue

Status
Not open for further replies.

adnan namal

Junior Member level 3
Junior Member level 3
Joined
Dec 17, 2013
Messages
26
Helped
3
Reputation
6
Reaction score
3
Trophy points
3
Visit site
Activity points
178
i am facing issue in programming of micro-controller pic16f877a for 3 floor lift controller.
i am using mikroC pro environment for programming. There are 7 push buttons and three inductive proximity switches for positioning of lift cabin. i designed a prototype for lift, RA0=floor0, RA1=floor1, RA2=floor2 are connected to push buttons which are inside the lift, when i pressed button it sends signal to micro-controller. RA3 is call button at floor 2, RA4 is call up button at floor1, RA5 is call down button at floor 1, RE0 is call button at floor0. RD4 is connected to inductive proximity switch at floor 0, RD5 is connected to floor1 sensor and RD6 is connected to floor 2 sensor. Sensors value remains high until lift cabin is detected.
Here is some part of my code which is not working because when push button is equal to 1 for very short time and comes zero i think that's why nested if condition is not working. I have to implement many conditions like that but this is start of my programming which is not working. only motor move up but does not stop at floor1.
kindly suggest me better solution for programming of elevator. This is my FYP.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if (RA1_bit==1||RA4_bit==1)       //if floor1 call button or button inside the lift for floor1 is pressed
             
            {             
               delay_ms(40);
               initializepwm();   //function is call to initialize pwm 
               up();                //function to move motor upward
 
                  }
                  if(RD5_bit==1)   // "nested if" if sensor at floor1 is become 0
                {
                delay_ms(40);
                 stop();            //stop motor at floor1
                
 
                        }

 
Last edited by a moderator:

Here is attachment... i used mosfet based h-bridge to rotate motor in both directions.

- - - Updated - - -

in nested if it is sesnor input at floor1 "RD5_bit==0" not RA1_bit==1.
 

Attachments

  • elevator project.zip
    105 KB · Views: 139

Your Proteus Schematic is not complete. Zip and post the complete circuit. It doesn't show Motor Circuit. In Proteus use L293D to control motor. Mention the pins used for motor. You need two pins to control motor as motor has to run in both directions. You don't need PWM as there is no need to control the speed of Motor.

In below code


Code C - [expand]
1
2
3
4
5
6
if(RA0_bit) {
                   Delay_ms(40);
                   down();
                   RC3_bit = 1;
                   RD0_bit = 1;
             }



What does void Zero(), void One(), void Two() do?

It uses RC4, 5, 6, 7 but there is no connection for them.
 
Last edited:
Sir i need to control the speed of motor because i am working on prototype. i am using MOSFET based H-bridge (with 7414 schmitt trigger IC to add dead time) to control the motor speed and direction. i will control the speed and direction of motor using only pwm. when pwm is more than 50% motor will rotate in one direction and if it is less than 50% it will rotate in other direction and at 50% it will stop. i want to implement real time traffic flow algorithm. now i attached complete file of proteus and MicroC project file.
void zero(),void one(),void two() to display digit on 7-segment display. i used 4511 decoder IC to display numbers on three 7-segments. i used only two bits of 4511 decoder IC to display 0,1,2.
 

Attachments

  • elevator project (3).zip
    109.6 KB · Views: 129

Button is debounced like this. It also applies to sensors. It will be better if you use Ext INT pins for sensors.


Code C - [expand]
1
2
3
4
5
6
7
8
9
if(RA0_bit) {
   Delay_ms(40);
 
   while(RA0_bit);
        
   down();
   RC3_bit = 1;
   RD0_bit = 1;   
}



I am attaching a Proteus file. Add motor, LED, and other circuit to it and post the new file after zipping. I need to know the complete circuit to make changes to the code.

You don't need 6 pins for 3 SSD circuits. Use 2 pins to drive 3 parallel SSD displays. You can do it in many ways. See if you can get a high current sourcing buffer chip which cn be placed between 4511 and SSD so that it drives 3 SSDs.
 

Attachments

  • CONTROLLER1 v3.rar
    18.8 KB · Views: 127
  • elevator project.rar
    40.4 KB · Views: 119
Last edited:
Sir i am attaching my flow code chart, H-bridge and controller proteus file as well. I added some additional circuit in place of schmitt trigger for the purpose of adding dead time, schmitt trigger two outputs are connected to IR2110 pins. IR2110 circuit is on other proteus file name "mosfet" . On the controller proteus file my purpose is to check the all programming by monitoring PWM which is given to motor control circuit to rotate motor that's why i am not including the motor control circuit. I connected oscilloscope with optocoplar output. Your given sample code is not generating pwm when i pressed F1(RA1) or call up@ floor1(RA4) in proteus file because program stuck in "PWM1_Init(5000);" this command. I checked this code in debugger and in proteus file as well. Motor must be stopped when RD5 sensor input becomes zero and also update SSD value. I attached flow code diagram so you can better understand what i want to do. There are some part of your given sample code which i couldn't understand properly, so i wrote comment in front of that part "kindly write in comments small explanation".
 

Attachments

  • elevator project.zip
    457.4 KB · Views: 133

PWM is working now. Add conditions to call Stop_Motor() function. In traffic flow algorithm it can be used to check weight of cabin, frequency of certain floor used at certain time duration etc... You need to have a keypad which can be used to keyin the floor no. from outside of lift. It will be an intelligent system so you need to key the destination floor no. Starting at floor G (0) if you entered floor 2 and there is no request to floor 1 then it directly goes to floor 2 without stopping at floor 1. Your up/down keys outside lift not sufficient for an intelligent lift control system.


Check this new circuit and tell if it is ok.
 

Attachments

  • elevator project rev1.rar
    40.6 KB · Views: 116
  • iElevatorControl rev1.rar
    29.3 KB · Views: 115
Last edited:
Sir i appreciate your help and suggestions but i am not as good as you are expecting in programming, that is the reason i used this simple approach.
 

See attached circuit. It has a better 7 Segment circuit. it has 2 versions, One using CC and another CA type displays.
 

Attachments

  • iElevatorControl rev1b.rar
    30.6 KB · Views: 122
Sir i am trying to implement my programming flow char but when i build the program some errors appear. Do you suggest me a better solution to implement my flow chart..
 

Attachments

  • PROGRAM.zip
    371.8 KB · Views: 129

Your flow code is difficult to understand. Use MS Paint to draw the flow chart. Use diamond, rectangle, rounded rectangle and parallelogram shapes to draw the fc. Represent all buttons and sensors input test with conditional element in flowchart. Provide fc in .png or pdf format.
 
The button press requests should be stored and then processed as required. If cabin is moving from 2nd to 0th floor and it is between 2nd and 1st floor and if there is a request at floor 1 to go up then it should be stored for later servicing but if request is received to go down (0th floor) then cabin should stop at 1st floor and pick up the person and then start going down to 0th floor. After this it should start upward journey and service the previous request of going to 1st floor and to do that it has to halt and pick up person at 1st floor.

Does your elevator work like that?

Does it log requests when cabin is moving?
 
No Sir it doesn't log request, i stuck on that part. i don't know what to do for these condition.
 

Then it means that when cabin is somewhere in between 2 floors then button either doesn't work or if works then it will change to cabin movement according to the new request(s).

Think more about the working. Priority of servicing the requests should depend upon the current position of the cabin.
 
Store it in a variable and also internal eeprom. The eeprom data can be used after a power restore if there was a power failure earlier. Priority of servicing requests changes in real time. If cabin is in between floor 2 and 1 (going down) and there are 2 requests one from floor 2 and another from floor 1 then to go down then a halt is made at floor 1 and then it goes to floor 0 and finishes the downward sequence and then service the request of floor 2 to floor 0. So, after reaching floor 0 it automatically starts upward move to floor 2 and then to floor 0.

So, during downward move, requests which are from floor lower than current cabin position are serviced in sequence and requests from floor which are above current cabin position are serviced later.

During upward move, requests which are from floor above current cabin position are serviced in sequence and requests from floor which are below current cabin position are serviced later.
 
- - - Updated - - -

Sir i did the basic part of the programming using Hall buttons + Lift buttons. when lift is moving from floor 0 to floor 2 and someone press the up call button @ floor 1 or Lift F2 button before it pass form floor 1, it will stop there and then it will move to floor 2, but not when it passed form floor 1. Know sir kindly add one thing in my code is to store one request when lift is moving from floor 0 to floor 2 and there is one request from floor 1 down hall call (to move down), lift continue to move up to floor 2 then it will move down to floor 1. By understanding this part i will be able to complete all other tasks.
 

Attachments

  • PROGRAM.zip
    31 KB · Views: 126

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top