andyf Posted May 9, 2013 Share Posted May 9, 2013 I have a motion program subroutine that performs a homing routine common to several motors. I want to pass the motor number to the routine and then have the routine home that motor. The routine needs to read the HomeCapt register value, which is pointed to by Motor[n].pCaptPos. Since that gives me the address of the register I want to read, what is the syntax to read the value at that address? I do not want the routine to have to know which ACC24E3 IC and channel to access, but instead just use the Motor[n] pointers. Link to comment Share on other sites More sharing options...
steve.milici Posted May 10, 2013 Share Posted May 10, 2013 Your subroutine does not need to know what the servo gate address is because this is a motor register. You would pass the motor number to your subroutine and read Motor[local-var].pCaptPos. Link to comment Share on other sites More sharing options...
andyf Posted May 15, 2013 Author Share Posted May 15, 2013 The value of Motor[x].pCaptPos is the address of the gate channel HomeCapt register. If I try to assign this to a variable in the motion program, the variable value is set to the address, not the value of HomeCapt. I want to set my variable to the value of the HomeCapt register. In C language speak, I want: *pCaptPos Link to comment Share on other sites More sharing options...
steve.milici Posted May 15, 2013 Share Posted May 15, 2013 I misunderstood your original intent. This would be best done with M-variable definitions to the servo gate register in the same format as the "Power PMAC Equivalents to Turbo Suggested M-Variables" from the Power PMAC SRM. This would use Mxx03. Link to comment Share on other sites More sharing options...
andyf Posted May 16, 2013 Author Share Posted May 16, 2013 OK. I assigned the Mxx03 in my global definitions. Then in the motion program code I can use the motor number as the xx part and read Mxx03. Not pretty, but it works. I would add to the wish list the ability to dereference pointers. Link to comment Share on other sites More sharing options...
Recommended Posts