1 Attachment(s)
Re: Servo Driven Toolchanger
Tom,
I tried to add code to my init program. The result i get is after an axis disabled condition i can not get it to re-enable.And rest of init code seems to be hanging. That said, wouldn't this code also cause a fault when referencing the axis? As the referencing ccode disables the axis to zero then re-enables.
Attached is my 3 axis main init code.
Troy
Re: Servo Driven Toolchanger
Hi Troy,
Quote:
The result i get is after an axis disabled condition i can not get it to re-enable.And rest of init code seems to be hanging.
Oops. The purpose of WasEnabled is to only EStop once, not many times. So code this:
Code:
// if any axis disables and was enabled do EStop
if (WasEnabled && (!ch0->Enable || !ch1->Enable || !ch2->Enable || !ch5->Enable))
Quote:
That said, wouldn't this code also cause a fault when referencing the axis? As the referencing ccode disables the axis to zero then re-enables.
Good point. In that case you might set a Virtual Bit to disable the check while homing is disabling. ie.
Code:
// if any axis disables and was enabled do EStop
if (ReadBit(48) && WasEnabled && (!ch0->Enable || !ch1->Enable || !ch2->Enable || !ch5->Enable))
Re: Servo Driven Toolchanger
Tom,
So, i can use the same type of code to block my axis limit pop up message during referencing? Here is a snippet of the X axis limit switch from main init code.
Code:
// Handle axis X minus limit switch
result = Debounce(ReadBit(XMINUSLIMITBIT), &xmcount, &xmlast, &xmlastsolid);
if (result == 1)
{
ClearBit(152);
MsgBox("X - Limit. Jog opposite direction.", MB_OK | MB_ICONEXCLAMATION);
}
How would i change the 'if' statement to also look at the state of VirtualBit that i will set at beginning of my referencing Ccode program?
Thanks,
Troy
Re: Servo Driven Toolchanger
Hi Troy,
In this case you would only want to display the message when the original condition AND (logical and operator '&&') a ReadBit(48) is equal to '==' 0
Re: Servo Driven Toolchanger
Leaving the pop up window issue for now as i cant get an estop to occur when axis disables.Here is code i added to main init but there nothing happens when axis is disabled.
Code:
.......
{
double Tau = 0.002; //seconds for low pass filtertime constant
KLP = exp(-TIMEBASE / Tau);
printf("Tau=%f KLP=%f\n", Tau, KLP);
}
BOOL WasEnabled = TRUE;
for (;;) // loop forever
{
//if any axis disables and was enabled do Estop
if (WasEnabled && ( !ch5->Enable))
{
WasEnabled = FALSE;
DoPC(PC_COMM_HALT);
}
SetStateBit(1059, BLOCK_DELETE_CHECKED);
//From SetFROwithpot.c and SetSSOwithpot.c
.......
Any coders for hire? This ccode stuff is getting the best of me.:confused::drowning:
Re: Servo Driven Toolchanger
Hi Troy,
Why are you only checking Axis 5? See the example in post 42.
Re: Servo Driven Toolchanger
Quote:
Originally Posted by
TomKerekes
Hi Troy,
Why are you only checking Axis 5? See the example in post 42.
I could not get code to work so i was trying to simplify code as much as i could.
Re: Servo Driven Toolchanger
Ah. So I assume you were disabling Axis 5?
But I think you want PC_COMM_ESTOP not PC_COMM_HALT
HTH