Originally Posted by
bhurts
The question is do you have or know of how I can turn off and on soft limits in c code and attach it to a toggle button so I can turn them off without changing my initiate file. I tried to turn them off in my homing routine and it worked. At the end of the routine I tried to turn them back on and it didn't work. For me I think a button would be better to toggle them on and off and just leave them out of the homing program.
Any advice would be great.
I'm not sure why you'd want to disable/enable softlimits regularly, but it is possible.
You would need to alter your init.c to contain code to continually monitor the switch and alter the soft limits depending on the state of the switch.
Something like this within an infinite loop-
Code:
if(ReadBit(xx)){ // if switch input high, set softlimits
ch1->SoftLimitPos=7000;
ch1->SoftLimitNeg=-278000;
} else { // else clear softlimits (set them really high)
ch1->SoftLimitPos=1e+09;
ch1->SoftLimitNeg=-1e+09;
}
You might want to extend it to add some debounce.