adnan namal
Junior Member level 3
- Joined
- Dec 17, 2013
- Messages
- 26
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 3
- 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.
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: