Veteranpete
Member
I am working on a project in which I will be tracking multiple parts on a conveyor with specific positions where the parts are marked. The conveyor has an encoder and I am using the encoder count difference from my last scan to increment the part positions.
My issue is that my logic works in a completely forward direction. In my application, there exists the potential for reverse travel(briefly). My problem is that I assume if my current encoder count is less than my last encoder count, the encoder has rolled over and I have missed a whole rotation plus the current encoder count. This is resulting in large jumps in part positions. I have tried to manage it by truncating the scan difference such that if the scan difference is greater than a limit, I set it to a maximum value.
The only solutions I can think of are band-aids and I am looking for a better alternative that allows movement in both directions and can identify the difference between a rollover and a roll back motion.
I am using a Micrologix 1100 - but this issue exists in RSLogix 5k as well.
Anyone have any suggestions?
Thanks for the help.
I have uploaded an example of my code.
F8:26 is the encoder count difference from my last scan
F8:25 is the encoder count read on the last scan
F8:20 is the encoder count difference limit
My issue is that my logic works in a completely forward direction. In my application, there exists the potential for reverse travel(briefly). My problem is that I assume if my current encoder count is less than my last encoder count, the encoder has rolled over and I have missed a whole rotation plus the current encoder count. This is resulting in large jumps in part positions. I have tried to manage it by truncating the scan difference such that if the scan difference is greater than a limit, I set it to a maximum value.
The only solutions I can think of are band-aids and I am looking for a better alternative that allows movement in both directions and can identify the difference between a rollover and a roll back motion.
I am using a Micrologix 1100 - but this issue exists in RSLogix 5k as well.
Anyone have any suggestions?
Thanks for the help.
I have uploaded an example of my code.
F8:26 is the encoder count difference from my last scan
F8:25 is the encoder count read on the last scan
F8:20 is the encoder count difference limit