Quick questions for the gurus...
I notice that my machine now kills threads 2 and 3, which are my MPG and SSO,DRO programs, whenever the E-stop switch is pressed. In thread 1, the program detects the pressing and releasing of the E-stop. I have code in the release of the E-stop switch that starts threads 2 and 3, but this does not seem to work. If I go into the C program tab and start them manually, then everything is fine. Its a bit of a pain to do this though, every time you hit the switch.
This wasn't happening previously. I may have made a program change that is causing it.
Any suggestions?
Code:
// Handle ESTOP pressed
result = Debounce(ReadBit(ESTOP),&ecount,&elast,&elastsolid);
if (result == 0)
{
printf("Emergency Stop ON\n");
DoPC(PC_COMM_ESTOP);
ClearBit (DRIVE_ENABLE);
ClearBit (SPINDLE_ENABLE);
Estop = 1; // Set a flag so that the release code only happens once
}
// Handle ESTOP released
result = Debounce(ReadBit(ESTOP),&ecount2,&elast2,&elastsolid2);
if (result == 1)
{
if (Estop == 1) // Check for flag
{
//DoPC(PC_COMM_IDLE);
printf("Emergency Stop OFF\n");
Estop = 0;
SetBit (DRIVE_ENABLE);
EnableAxis (0);
EnableAxis (1);
EnableAxis (2);
EnableAxis (4);
StartThread(2);
StartThread(3);
}
}
Thanks,
Rick