Jump to content
OMRON Forums

position compare question


smyers

Recommended Posts

Hello,

 

I'm using a GeoBrickLV NSLS2 model. I'm using it to run a motor which is combined with a shutter. The shutter needs to open and close at specific encoder counts, and I'm using position compare for that purpose.

 

My problem is that every time I power-cycle the GeoBrick controller, position compare wants to "zero" at wherever the motor was at powerup, even after a motor home. What I've been doing is setting an offset to my software, but everytime the controller is turned off/on, I need to rejigger my offsets. Is there a way to force this register to zero along with a motor home?

 

Best,

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

We cannot robustly reset the encoder counter on homing, because in between the time we would decide to do so and the time the resetting would actually occur, one or more counts could come in, destroying the accuracy of the re-referencing. For this reason, we instead store the exact count captured by the homing search move, so this can be added into the desired motor count value of your event to get the hardware encoder count value.

 

The register where this offset is stored is Y:$0000CE for Motor 1, Y:$00014E for Motor 2, etc., and the suggested M-variable is Mxx73 for Motor xx. Sample equations for using this value are given in the "Synchronizing Turbo PMAC to External Events" chapter of the Users Manual.

Link to comment
Share on other sites

The position compare feature uses the raw position counts which are scanned at encoder sampling frequency (10MHz or higher) in the hardware. This data does not reset while the hardware is on unless PMAC is reset using $$$ or $$$*** commands. There is also a reset bit which can be set in order to reset the encoder counters, but doing so while the motor is in closed loop can result in run-away or jump situation and can be very dangerous and Delta Tau strongly advises against doing so.

 

The best method for your application is to setup the position compare edges (high and low which in your case open and close states of the shutter) based upon the raw phase capture counter in the gate. The following example shows how to do this:

 

Quick Review of Position Compare Feature

To use the position compare, there are a few register which needs to be set before use:

 

1276049142_LaserControlwithPMAC.docx-MicrosoftWord_2012-08-27_11-03-59.png.e627567db65a2f6277327b110131fef2.png

 

There are two approaches in setting up the position compare outputs. First approach is if the exact position of one set of edges A and B are known and also the distance between the pulses is know.

 

// Example 1, Position Compare Settings For known Edge A and Edge B, Based upon
// Current position

#define Mtr1PosCntr	M101		; ENC1 24-bit counter position
Mtr1PosCntr->X:$078001,0,24,S
#define Mtr1CompA	M108		; ENC1 compare A position
Mtr1CompA->Y:$078007,0,24,S
#define Mtr1CompB	M109		; ENC1 compare B position
Mtr1CompB->X:$078007,0,24,S 
#define Mtr1AutoInc	M110		; ENC1 compare autoincrement value
Mtr1AutoInc ->X:$078006,0,24,S
#define Mtr1WrtEna	M111		; ENC1 compare initial state write enable
Mtr1WrtEna->X:$078005,11
#define Mtr1InitState	M112		; ENC1 compare initial state
Mtr1InitState->X:$078005,12
#define Mtr1EQUOutput	M116		; ENC1 compare output value
Mtr1EQUOutput->X:$078000,9 

#define DistanceToEdgeA	P100	; Value Set by user, in user encoder counts
#define DistanceToEdgeB	P101	; Value Set by user, in user encoder counts
#define Period			P102	; Value Set by user, in user encoder counts

Mtr1CompA = Mtr1PosCntr + DistanceToEdgeA
Mtr1CompB = Mtr1PosCntr - DistanceToEdgeB
Mtr1AutoInc = Period

Mtr1InitState=0		; Setting the initial state of the output
Mtr1WrtEna=1			; Writing the initial state to the output

 

 

Note that edges A and B of the compare feature, doesn’t have to be on either side of the current position. If the edges are placed on both sides, regardless of movement direction, the auto-increment feature will update the edge registers properly. However, if you set the edges A and B on one side of current position, the pulses will only be generated moving in the same direction which edges where defined.

The other approach is similar to first approach, but it is for applications where the duty cycle of the output signal is more important. An example based upon this approach is provided here:

 

// Example 6, Position Compare Settings For desired Duty Cycle

#define Mtr1PosCntr	M101		; ENC1 24-bit counter position
Mtr1PosCntr->X:$078001,0,24,S
#define Mtr1CompA	M108		; ENC1 compare A position
Mtr1CompA->Y:$078007,0,24,S
#define Mtr1CompB	M109		; ENC1 compare B position
Mtr1CompB->X:$078007,0,24,S 
#define Mtr1AutoInc	M110		; ENC1 compare autoincrement value
Mtr1AutoInc ->X:$078006,0,24,S
#define Mtr1WrtEna	M111		; ENC1 compare initial state write enable
Mtr1WrtEna->X:$078005,11
#define Mtr1InitState	M112		; ENC1 compare initial state
Mtr1InitState->X:$078005,12
#define Mtr1EQUOutput	M116		; ENC1 compare output value
Mtr1EQUOutput->X:$078000,9 

#define DutyCycle		P100	; Percent Value
#define Period			P101	; Value Set by user, in user encoder counts

Mtr1CompA = Mtr1PosCntr + int ((100-DutyCycle)*Period/100)/2)
Mtr1CompB = Mtr1PosCntr - int ((100-DutyCycle)*Period/100)/2+0.5)
Mtr1AutoInc = Period

Mtr1InitState=0		; Setting the initial state of the output
Mtr1WrtEna=1			; Writing the initial state to the output

Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.

×
×
  • Create New...