Hello all, first time poster here!
I have a toggle button "REVERSE_ENABLE_BUTTON" on our HMI's that disables our "bad product rejections" by simply preventing a conveyor from going in reverse.
I added my program Vision() to run OnTick to look for when the button is toggled off. When toggled off it looks for 3 lanes to have good product and adds +1 to a counter. when my counter hits 10 i want to toggle the button "REVERSE_ENABLE_BUTTON" to re-enable our "Rejection System" automatically.
MY program works properly except for 1 thing. The tags im using so see good product (LANE_A_PASSED...) are latched for a few seconds in the plc to display an image for a few seconds, and what im seeing is that when:
(LANE_A_PASSED) && (LANE_B_PASSED) && (LANE_C_PASSED) are all true,
ALLPASS continues to count while by tags are latched, but i only want ALLPASS to increse by 1 despite however long my tags are latched in.
Any help is greatly appreciated, here is my code:
I have a toggle button "REVERSE_ENABLE_BUTTON" on our HMI's that disables our "bad product rejections" by simply preventing a conveyor from going in reverse.
I added my program Vision() to run OnTick to look for when the button is toggled off. When toggled off it looks for 3 lanes to have good product and adds +1 to a counter. when my counter hits 10 i want to toggle the button "REVERSE_ENABLE_BUTTON" to re-enable our "Rejection System" automatically.
MY program works properly except for 1 thing. The tags im using so see good product (LANE_A_PASSED...) are latched for a few seconds in the plc to display an image for a few seconds, and what im seeing is that when:
(LANE_A_PASSED) && (LANE_B_PASSED) && (LANE_C_PASSED) are all true,
ALLPASS continues to count while by tags are latched, but i only want ALLPASS to increse by 1 despite however long my tags are latched in.
Any help is greatly appreciated, here is my code:
if (REVERSE_ENABLE_BUTTON == 0)
{
if ( (LANE_A_PASSED) && (LANE_B_PASSED) && (LANE_C_PASSED) ) ALLPASS++ ;
if ( (LANE_A_FAILED) || (LANE_B_FAILED) || (LANE_C_FAILED) ) ALLPASS = 0;
if (ALLPASS >= 50)
{
REVERSE_ENABLE_BUTTON = 1;
ALLPASS = 0;
};
};