-|---------------|- -|-------------|- X03 | | X03 | Garage | Bit Status 1 | |\| | 1 | |\| Door | --- | | --- | | | Garage | |_____________| | Door | X04 | | X04 Bit Status 1 | |\|_______________| 0 | |\ --- --- Open Button = X00 Top Proximity Sensor = X03 Close Button = X01 Bottom Proximity Sensor = X04 Stop Button = X02 Motor Up = Y0 Motor Down = Y1 Open = V00 Close = V01 Stop = V02 V00 X03 V02 V01 Y0 ---| |---| |---| / |---| / |----------(OUT)--- V01 X04 V02 V00 Y1 ---| |---| / |---| / |---| / |----------(OUT)--- X02 V02 ---| |----------------------------------(SET)--- | | | Y0 Y1 | -| |--| |- X00 V00 ---| |----------------------------------(SET)--- | | V01 |--(RST)--- | | V02 |--(RST)--- X01 V01 ---| |----------------------------------(SET)--- | | V00 |--(RST)--- | | V02 |--(RST)--- _______ ----------------| END |-------------------------- ------- There are two things that must happen, the door must close and open. The conditions when the door is opening are: The door can only open when the top proximity sensor is on, the stop variable is off and the door is not closing indicated by the V01 variable The door can only close when the bottom proximity sensor is off, the stop variable is off and the door is not opening. These criteria are attended to in lines 1 and 2. Then we need two put in a line to stop the door anywhere, this is done in line 3, there is also a by pas line for protection, so that if the sensors fail in any why we will not burn out the motor. Line 4 deals with the open button, if it is pushed it requests the door to open by setting the V00 variable, and resets the close door variable witch stops the door if it is moving down and resets the stop variable. Line 5 handles the close button, by requesting the door to close in setting the V01 variable, and stops the door by resetting the open variable, and also resets the stop variable.