Tom,

In this case we should wait while the bit is not on rather then while it is on. Change:

while (ReadBit(1088));

to

while (!ReadBit(1088));
Thats all that was needed . It works now.


Onto other buttons, there is a few more i will need help with...... :drowning: in ccode here.

One is the Block Delete button. I have it toggling the check box in KMCNC but cant figure out how to toggle the LED for this button. Here is code i have so far.


Code:
/// Handle Blk Del Button
result = Debounce(ReadBit(BLKDELBBIT), &blkdelbcount, &blkdelblast, &blkdelblastsolid);
if (result == 1)
{
	SetBit(1059);				//BlkDel Button LED
	ScreenScript("WinMsg:DlgName;IDC_BlockDelete;BM_CLICK");	//toggle
	//ClearBit(1059);
	//ScreenScript("WinMsg:DlgName;IDC_BlockDelete;BM_SETCHECK;BST_CHECKED");   //Check it
	//ScreenScript("WinMsg:DlgName;IDC_BlockDelete;BM_SETCHECK;BST_UNCHECKED");
}
Troy