backendcode
Member
Good Morning everyone,
I need your help to rewrite the code or better way to write the code because honestly I didn't like how the code is right now and I know there can be a better way to write this code.
Project, This is working conveyor project PLC code and link to the PLC code is below.
https://ibb.co/ent6Tw
there are three conveyors and each conveyor has motor and prox sensor on it and I want to turn on the motor in the following condition.
Conveyor 1 conveyor 2 conveyor 3 MOTOR ON
1 (Part present) 0 (No part) 1/0 (Part/NO part) Motor 1 ON
1 (Part present) 0 (No part) 1/0 (Part/NO part) Motor 2 ON
1/0 (Part/No part) 1 (No part) 0 (Part/NO part) Motor 2 ON
In other words, when part present on conveyor 1 and no part present on conveyor 2, motor 1 and 2 will ON and sensor 2 on conveyor 2 will turn off both motor. (move part from conveyor 1 to 2)
When part present on conveyor 2, no part present on conveyor 3, it will turn on motor 2 (move part from conveyor 2 to 3)
I would like to use equ and great than equal to instruction but I think bool data type is not allowed to compare the source value to a destination. is there any way I can do it?
Thank you!
I need your help to rewrite the code or better way to write the code because honestly I didn't like how the code is right now and I know there can be a better way to write this code.
Project, This is working conveyor project PLC code and link to the PLC code is below.
https://ibb.co/ent6Tw
there are three conveyors and each conveyor has motor and prox sensor on it and I want to turn on the motor in the following condition.
Conveyor 1 conveyor 2 conveyor 3 MOTOR ON
1 (Part present) 0 (No part) 1/0 (Part/NO part) Motor 1 ON
1 (Part present) 0 (No part) 1/0 (Part/NO part) Motor 2 ON
1/0 (Part/No part) 1 (No part) 0 (Part/NO part) Motor 2 ON
In other words, when part present on conveyor 1 and no part present on conveyor 2, motor 1 and 2 will ON and sensor 2 on conveyor 2 will turn off both motor. (move part from conveyor 1 to 2)
When part present on conveyor 2, no part present on conveyor 3, it will turn on motor 2 (move part from conveyor 2 to 3)
I would like to use equ and great than equal to instruction but I think bool data type is not allowed to compare the source value to a destination. is there any way I can do it?
Thank you!