bradp Posted September 9, 2010 Share Posted September 9, 2010 Sometimes you need to calculate a number that should be used as the motor's position. To do this you can use the absolute position read feature of PPmac. Here is a quick example of the setup. //--- Motor Abs Position Setup --------------------- // Motor[x].AbsPosFormat consists of four byte fields. hexadecimal format $aabbccdd. // $dd specifies the number of the starting bit to be used. It can take a value from $00 to $1F (0 to 31). // $cc specifies the total number of bits to be used. a value of up to $20 (32) // $bb use data in subsequent registers. only used if the number of bits in $cc cannot be found in the first register. // $aa specifies how the Power PMAC will interpret the data. It can take the following values: // $00: Interpret as numerical binary (no conversion required) // $02: Interpret as Gray code and convert to numerical binary // $04: Interpret as 3-phase digital Hall-sensor data with 120o signal spacing and convert to numerical binary // $05: Interpret as 3-phase digital Hall-sensor data with 60o signal spacing and convert to numerical binary // Motor[3].AbsPosFormat = $01002000 // have 32-bit signed register for simulated encoder Motor[3].AbsPosSf = 1 // want 1 to 1 in this register Motor[3].HomeOffset = 0 // no offset Motor[3].pAbsPos = Sys.IData[8].a Motor[3].ServoCtrl = 1 //--- How To Use This ---------------------------------- // 1. Load the value you want to set the position to into Sys.IData[8]. For this // example lets use 100000. In the terminal window enter Sys.IData[8]=100000 // 2. Verify value is received. In the terminal window enter Sys.IData[8]. PPmac // will respond with 100000 // 3. Set motor 3's position with the command #3hmz. In the terminal window // enter #3hmz. // 4. Verify this is OK by looking at the position window. The position of motor 3 // will now read 100000. //-------------------------------------------------------- Link to comment Share on other sites More sharing options...
Recommended Posts