Jump to content
OMRON Forums

Breaking the 20 bit limit on encoder counts in position compare triggering


Recommended Posts

In position-compare triggering, I need to handle a range of 300 mm worth of quadrature encoder counts of 0.1 micron, i.e., 3 million.  The trigger positions need to be stuffed into Gate3[0].Chan[1].CompA and .CompB for the leading and trailing edges of the TTL pulses.  The units of CompA and CompB are 1/4096th of an encoder count, leaving a range of 20 bits for the full encoder counts, or about 1 million.  With the Turbo PMAC family, I had 24 bits for a full range of 16 million plus.  My encoder settings are Gate3[0].Chan[j].EncCtrl=3 or 7 (j=0, 1).

Now the Power PMAC Software Reference Manual says this, under Gate3[i].Chan[j].CompA (last paragraph):

In the Script environment, it is possible to write values from -2^31 to +2^31-1 to this element. (An attempt to write a value outside this range will cause the element value to saturate at the end of this legal range.) That is, for writing purposes, it can be treated as either a signed 32-bit value with a range of -2^31 to 2^31-1 or an unsigned 32-bit value with a range of 0 to 2^32-1. However, for reading purposes, it is always reported as an unsigned value, so if it is set to a negative value, the value reported will be 2^32 greater than that value.

Note the second sentence, in parentheses: "An attempt to write a value outside this range will cause the element value to saturate at the end of this legal range." I understand this to mean that there is no rollover mechanism but rather a Procrustean bed, i.e., excess values are truncated down to the limit value.

What are my options?  Can CompA and CompB be made to operate on different units, e.g., with one unit in CompA and CompB being worth 1000 of my encoder counts?  My trigger position set points need to be accurate to the 1 micron level, not 1/4000th of 0.1 micron.

  • Like 1
Link to comment
Share on other sites

That is the nature of position compare. Since it is in hardware it is a “fixed” scheme.

It is the case that you are limited to the range (signed, -2^31 to 2^31-1 or unsigned, 2^32-1) and granularity (1/4096) as defined in the manual. If you require a “pulse” greater than that you would need to handle this in a PLC to effect the “other far” edge – you would perform rollover math there.

The “CompA” and “CompB” registers are always interpreted by PMAC as the same units.

The Auto-Increment feature will internally “rollover” to permit continuous compare edges (within the above restrictions) in either direction indefinitely.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...