Greetings,
I have a CNC machine with a air blow off function that I would like to function from either a push button on the front of the machine, or an M Code in the program. I can easily set up an if statement to make the button work, and then a separate thread for the MCode.
This code is in my infinite loop on the INIT file:
if(ReadBit(1030)) //If button is pushed blow off
SetBit(61);
else
ClearBit(61);
Unfortunately this clears bit 61 as quickly as my MCode thread sets it.
Is there a global variable that would be available to both the INIT thread and the M code thread? I could read the button (1030) and check to see if the other thread is running before I set or clear the bit. Does this make sense?
This should be be simple, I just dont know how to do it.
Thanks,
Scott