Sina.Sattari Posted October 14, 2008 Share Posted October 14, 2008 There are 4 sections regarded as foreground user-written code in Power PMAC which are: - user phase - user servo - user rti - user thread You can find an example for each of these routines under [b]Realtime C Routines[/b] folder of the Power PMAC Project under IDE. I have attached an example project [attachment=1275:name] Once you have written the code, you need to follow these steps in order to get your code running: 1. build the project by right-clicking on the project name in project manager and selecting build. [attachment=1276:name] 2. right-click on the project name in the project manager one more time and select user servo setup. [attachment=1277:name] 3. Select the corresponding routines, a.e. user_plc_rti as Realtime PLC RTI [attachment=1278:name] 4. Download all files to Power PMAC. 5. Make sure that the user RTI is correctly selected in the Power PMAC by checking the [b]UserAlgo.RtiAddr[/b] which should be non-zero value representing the address of the RTI code. 6. Enable the RTI from the terminal window by setting [b]UserAlgo.Rti=1[/b] or disable it by setting it to zero. Link to comment Share on other sites More sharing options...
scottike Posted October 15, 2008 Share Posted October 15, 2008 I've succeeded in building, selecting, downloading and activating (UserAlgo.Rti=1) your example program. UserAlgo.RtiAddr showns a non-zero address, but otherwise I have no indication if the code is running. The "Delta Tau->Tools->Task Manager" does not show any RTI processes running. Any other suggestions on how to verify proper operation of your example? Second, if I try to assign the function to the Real Time PLC 1Msec Thread instead of the Real Time PLC RTI the UserAlgo.RtiAddr value stays at zero. Any thoughts? Lastly, if I assign a function in User Servo Setup I cannot clear it later, only change it to a different function. Thanks, Scott Link to comment Share on other sites More sharing options...
Sina.Sattari Posted October 15, 2008 Author Share Posted October 15, 2008 Scott, If you assign the routine to the Real Time PLC 1msec Thread instead of the RTI, you will see the [b]UserAlgo.ThreadAddr[/b] change and also you can enable or disable it by changing the [b]UserAlgo.Thread[/b] to a 1. I noticed that the 1msec is not really 1msec and it takes a little bit over 1msec. I will have to confirm this. About clearing the selections on the Servo Setup page, I'm working on a new way of assigning routines, and I'll keep in mind that you have to be able to clear the selection. Link to comment Share on other sites More sharing options...
scottike Posted October 15, 2008 Share Posted October 15, 2008 Sina, The variables for the 1 mSec thread seem to work properly, but I am still not able to get any feedback to indicate the function is running. In my own function I am trying to enable amp 1 (AENA1) on a ACC-24E2. I have succeeded in enabling amp 1 using the background PLC on the PPMAC, but using essentially the same code in the RTI thread yields no change of state in the enable light. How do you determine if a function is currently running on a PPMAC? Could I add a print function and look for the output somewhere? Should the task manager show the function running? Thanks again, Scott Link to comment Share on other sites More sharing options...
dzrong Posted May 7, 2010 Share Posted May 7, 2010 How can I get motor number of PPmac user servo algorithms? In turbo Pmac "MTRNUM" will tell me which motor(axis) is running when I use user servo algorithm. And I can't find it in the data structure file which name is "RtGpShm.h". Thanks Link to comment Share on other sites More sharing options...
bradp Posted May 10, 2010 Share Posted May 10, 2010 You have to calculate it based on the pointer you are given and the base address of the motor structures. MtrNum = ((int) Mptr - (int) pshm->Motor)) / sizeof(MotorData); Link to comment Share on other sites More sharing options...
Recommended Posts