eloew61 Posted January 10, 2014 Share Posted January 10, 2014 We are using an ACC-14E interface to a PPMAC to provide absolute position for two axes via synchro to digital (S/D) converters. When the PPMAC is first powered on, PLC1 is executed which performs a homez on both motor axes using the following code: Motor[AZ_MOTOR_NUMBER].pAbsPos=ACC14E[0].DataReg[0].a Motor[EL_MOTOR_NUMBER].pAbsPos=ACC14E[0].DataReg[3].a Motor[AZ_MOTOR_NUMBER].AbsPosFormat=$00200F08; Motor[EL_MOTOR_NUMBER].AbsPosFormat=$00200F08; Motor[AZ_MOTOR_NUMBER].AbsPosSF=1.0; Motor[EL_MOTOR_NUMBER].AbsPosSF=1.0; Coord[1].PosRollOver[0]=360.0; Coord[1].PosRollOver[0]=360.0; homez AZ_MOTOR_NUMBER; homez EL_MOTOR_NUMBER; This routine correctly initializes the absolute position about 20% of the time. At other times, the position is exactly twice what it should be. When this occurs, acc14r0, acc14r1, acc14r3 and acc14r4 all contain the correct 16 bit angles; however #1p and #2p contain twice the angle, respectively. Re-running PLC1 from the IDE command line fixes the problem. I have attached before and after IDE screenshots of this. Link to comment Share on other sites More sharing options...
steve.milici Posted January 13, 2014 Share Posted January 13, 2014 Note that it is not necessary to set these structure elements in your PLC: Motor[n].pAbsPos Motor[n].AbsPosFormat Motor[n].AbsPosSF Coord[n].PosRollOver[0] as these are saved elements in Power PMAC. If you set these in your project and save them they will be permanent. Your PON PLC will be simpler. Also note that if bit 4 of Motor[x].PowerOnMode is set then this could be interfering with the homez commands your PLC. Link to comment Share on other sites More sharing options...
eloew61 Posted January 14, 2014 Author Share Posted January 14, 2014 Note that it is not necessary to set these structure elements in your PLC: Motor[n].pAbsPos Motor[n].AbsPosFormat Motor[n].AbsPosSF Coord[n].PosRollOver[0] as these are saved elements in Power PMAC. If you set these in your project and save them they will be permanent. Your PON PLC will be simpler. Also note that if bit 4 of Motor[x].PowerOnMode is set then this could be interfering with the homez commands your PLC. steve.milici, thanks for your advice. Motor[x].PowerOnMode is set to 0 for both motor 1 and motor2. Link to comment Share on other sites More sharing options...
steve.milici Posted January 14, 2014 Share Posted January 14, 2014 This could be a problem with the power-on PLC that initializes the ACC-14E. This may not be ready when your 'homez' PLC runs. Put a timer delay at the beginning of this PLC. Link to comment Share on other sites More sharing options...
eloew61 Posted January 15, 2014 Author Share Posted January 15, 2014 This could be a problem with the power-on PLC that initializes the ACC-14E. This may not be ready when your 'homez' PLC runs. Put a timer delay at the beginning of this PLC. Forgive my ignorance, but will a "dwell" command work in this context? Link to comment Share on other sites More sharing options...
steve.milici Posted January 15, 2014 Share Posted January 15, 2014 No - the "dwell" command is intended for motion programs only. In PLCs you must use a timer delay. Below is code for a timer delay. Put it in a subprogram and use it like this in you top level PLC programs: Call timer(0.1); // delay 0.1 seconds. // This subprogram creates a timed delay of duration specified in the argument "time" [seconds] open subprog timer (time) local EndTime; EndTime = Sys.Time + time; do {} while (EndTime > Sys.Time); close Link to comment Share on other sites More sharing options...
Recommended Posts