Jump to content
OMRON Forums

Motor[n].DesPos resets to zero by Motor[n].ServoCtrl=1 command.


moha_sa
 Share

Recommended Posts

I aim to update the desired position of Motor#n in a user-defined servoCtrl externally via a background C program. Unfortunately, as soon as I enable motor by Motor[n].ServoCtrl=1 command in terminal, the desired value of Motor[n].DesPos on watch window resets to zero. How can I avoid it? My goal is to update the value of Motor[n].DesPos in user-defined servo from a background C program.

 

 

Link to comment
Share on other sites

If a motor's servo algorithm is enabled, PMAC will write to certain registers for that motor every servo cycle. You will not be able to write to these registers directly. Fortunately, PMAC has several ways to inject a little bit extra into a few of them for flexibility.

In your case the easiest method will be to enable the motor at a position of 0 #nJ=0 and write your desired position to Motor[n].MasterPos. Note that Motor[x].MasterMaxSpeed and Motor[x].MasterMaxAccel can be used to smooth this trajectory. If you are already using Motor[x].pMasterEnc for position following this may interfere.

This method is better suited for cases where you are creating a smooth trajectory and calculating a desired position every servo cycle. A custom servo routine for motor 0 would be a good location if it is not computationally intensive.

It is also possible to jog motors or run motion programs from C code. This allows you to take advantage of PMAC's trajectory generation.

  • Like 1
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.

Guest
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.

 Share

×
×
  • Create New...