Jump to content

CWAVE

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About CWAVE

  • Rank
    Newbie
  1. Here's some code I use all the time for this purpose, it handles rollover with no issues. To explain: MB45 - motor running / belt moving. You should make this a time delay off to allow for when the belt stops. or just remove it from the second rung to allow for belt decel. MI27 - High speed counter input wired to encoder. In your case you will need to have 2 MI's per product on the belt in a shift register or data table. These will equate to MI58 and MI38 in the image. MI58 - The position of the HSC the last time the line was executed. MI35 - The position of the product on the belt. MI59 - temporary calculation store. It works simply by adding the position offset between the last time it was executed and the current belt value. As long as you use MI's for everything, the rollover doesn't bother it. I've used this counting at about 1kHz. If you set MI35 to 0 when a new product is sensed, and shift the registers, it will accurately track each product up to 327 revs at 100ppr. You can init MI35 to -32768 if you need to double the scope.
×