I got all of the code to emulate the way the A2100 powers up the system and handles the E-STOP, basically just went through programware on the A2100 and made kflop do the same thing in the same sequence. My X axis drifts very slowly when the physical drives get their enable signal even with no input; will have to figure that out. I have the software (motion link) for the drives so hopefully that wont be too hard to fix.
Tomorrow is wiring the limit switches. After that I can start playing with getting the servo motors moving. As the limit switches kill power to the servo motor power bus but aren't directly in the e-stop circuit I am going to have to emulate that directly for the time being, I think the placeholder code I put in will do that once I stick it in the forever loop. I have not programmed in C for a long time so this is all going to get pretty ugly before I am done!
It will be kind of cool to have 2 fully functioning controls temporarily. Just swap the DB50 I/O connectors and the DE-15 connectors from one to the other, power up and go.
This is my temporary C code to make kflop emulate the A2100 power and e-stop process. The e-stop kills the drive and spindle power directly and also feeds in to the control.
Code:
#include "KMotionDef.h"
#define ESTOP 1025
#define POWER 1024
#define PWRRDY 48
#define AXISENABLE 49
#define ZBRAKE 50
#define LUBE 52
/*#define xPos 33
#define xNeg 34
#define yPos 35
#define yNeg 36
#define zPos 37
#define zNeg 38*/
main()
{
InitAux();
AddKonnect_Aux0(0,&VirtualBits,VirtualBitsEx);
for (;;) // loop forever
{
WaitNextTimeSlice(); // execute loop once every time slice
// Handle ESTOP
if (!ReadBit(ESTOP))
{
if (ch0->Enable) DisableAxis(0); // axis still enabled? - Disable it
if (ch1->Enable) DisableAxis(1); // axis still enabled? - Disable it
if (ch2->Enable) DisableAxis(2); // axis still enabled? - Disable it
//Kill servo power
ClearBit(PWRRDY);
//Disable Physical Drive
ClearBit(AXISENABLE);
//Clear Z brake on/off? Relay is off with A2100 Control
ClearBit(ZBRAKE);
//Turn lube off, old control did this
ClearBit(LUBE);
}
if (ReadBit(POWER))
{
if(!ReadBit(PWRRDY))
{
//Turn on power to servos
SetBit(PWRRDY);
}
//enable physical axis, turn on z brake,
SetBit(AXISENABLE);
SetBit(ZBRAKE);
SetBit(LUBE);
//enable kanalog axis
}
} // end of forever loop
}
// limits to emulate A2100 limit switch process for now
// A2100 performs same process as e-stop, hold main power button and jog off limits
// to clear.
void limitKillPower()
{
int xLPos = ReadBit(xPos);
int xLNeg = ReadBit(xNeg);
int yLPos = ReadBit(yPos);
int yLNeg = ReadBit(yNeg);
int zLPos = ReadBit(zPos);
int zLNeg = ReadBit(zNeg);
if(xLPos || xLNeg || yLPos || yLNeg || zLPos || zLNeg)
{
//z brake
//disable physical drive ready
//disable drive power
}
}