Hello,
I am programming a ladder routine that finds a part on a conveyor that has a given part number. I am having no problem finding the part and assigning a tag to its position. However, then I need to compare it with another pointer tag and calculate how much I need to move my conveyor to reach the position of that compared to tag. And then I need to update an offset tag that moves around a few pointer tags in the conveyor. The problem I am having is that I use a FOR block that executes as many times as I will need to move my conveyor and it evaluates the value in the offset tag. Since it is a cyclical conveyor, if the tag has a value of 18, I move the value to 0. If the offset has a value less than or equal to 16, I sum 2 to the tag. In other words. If I need to move my conveyor 3 times, I will sum 6 to the offset. But if the offset is at 18, I need to reset it to 0 before I sum 2 more. The FOR executes and exits fine. But the offset value keeps having +2 added and reset to 0 infinitely. It doesn't stop after the FOR loop is done.
I am programming a ladder routine that finds a part on a conveyor that has a given part number. I am having no problem finding the part and assigning a tag to its position. However, then I need to compare it with another pointer tag and calculate how much I need to move my conveyor to reach the position of that compared to tag. And then I need to update an offset tag that moves around a few pointer tags in the conveyor. The problem I am having is that I use a FOR block that executes as many times as I will need to move my conveyor and it evaluates the value in the offset tag. Since it is a cyclical conveyor, if the tag has a value of 18, I move the value to 0. If the offset has a value less than or equal to 16, I sum 2 to the tag. In other words. If I need to move my conveyor 3 times, I will sum 6 to the offset. But if the offset is at 18, I need to reset it to 0 before I sum 2 more. The FOR executes and exits fine. But the offset value keeps having +2 added and reset to 0 infinitely. It doesn't stop after the FOR loop is done.
Last edited: