Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Power PMAC Teach Mode
#1
Any idea on how I can get a teach mode working?

I tried the attached PLC on my system with real axes today and I still get locations of zero(0).

What I am doing is:

1. Run the attached PLC
2. Jog XYZA axes to some location
3. Set the CurrentTeachIndex global to 1 for the first location, 2 for the second location, etc
4. Set the TeachPositionNow global to 1 to teach the point
5. Now look at the XTaughtPosition(1), YTaughtPosition(1), ZTaughtPosition(1), and ATaughtPosition(1) values that were saved.

global XTaughtPosition(100);
global YTaughtPosition(100);
global ZTaughtPosition(100);
global ATaughtPosition(100);
global TeachPositionNow;
global CurrentTeachIndex;
open plc 3

if(TeachPositionNow > 0.0) {
XTaughtPosition(CurrentTeachIndex) = Coord[0].CdPos[6];
YTaughtPosition(CurrentTeachIndex) = Coord[0].CdPos[7];
ZTaughtPosition(CurrentTeachIndex) = Coord[0].CdPos[8];
ATaughtPosition(CurrentTeachIndex) = Coord[0].CdPos[0];

TeachPositionNow = 0.0;
}
close
The code you have written works fine. The problem is a misunderstanding of what the Coord[].CDPos[] variable contains. Coord[].CDPos[] contains the coordinate system commanded position which comes from a motion program, not a jog move. If you move the axes from a program type move (either in a motion program or from a PLC with axis moves, or on-line with cx (command execute) statements then the structures update and your code is OK.

If you need to do this using Jog commands then you can not use the Coord[].CDPos[] unless you first issue the "PMatch" command. Alternatively you can use the (Motor[i].DesPos - Motor[i].HomePos) / Motor[i].CoordSf[n] and the index "n" has the numbering 1=a 2=b 3=c 4=u 5=v 6=x 7=y 8=z and so on to know which axis scale factor to get.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)