Hi Tom
Here are the files. The Mach version I am using is R3.043.066 and the kmotion is 4.33k
George
Hi George,
There still might be some race condition like deactivating the output and then re-activating it before it had a chance to be detected off.
Post your GCode, Simple Init program, Mach3 XML configuration, and Mach3 Version you are using and I will test it.
Regards
Regards
TK http://dynomotion.com
Hi Tom
Here are the files. The Mach version I am using is R3.043.066 and the kmotion is 4.33k
George
Hi George,
Sorry for the delay but we were having fun at the ATX show
I actually wasn't able to duplicate the problem on my system (I have a very fast PC might be why), but I think I see a bug in your C code:
while(ReadBit(48))
ClearBit(54);
I think your intent was to clear bit 54 after bit 48 is cleared by mach3. But you are missing a semicolon. So instead the ClearBit(54) is included in the while loop and immediately cleared.
But regardless I think a better approach is to use a "two wire handshake" for guaranteed synchronization rather than using delays and pulses that you expect to be always long enough to be observed. The idea works like this: Imagine person A wants to signal person B to do something and wants to know when they have completed. Each person has one flag and they are both down initially. To signal the steps are:
#1 - A puts up his flag and waits to see B has raised his flag
#2 - when B sees A put his flag up, he performs a task and puts his flag up
#3 - when A sees B has put his flag up he drops his flag and waits until B puts his flag down
#4 - when B sees A put his flag down, he drops his flag
The nice thing about this approach is that no delays or pulse times need to be defined and things progress as fast as the communication allows.
Here is some code I tried on the KFLOP side:
Here is the mach3 side code:Code:for(;;) { if (ReadBit(48)) // signal from mach3 ? { Delay_sec(5); // simulate performing a task SetBit(54); // flag we are done while(ReadBit(48)); // wait for mach3 to acknowledge by removing signal ClearBit(54); } }
HTHCode:ActivateSignal(Output5) 'Send signal to input bit 48 on 'Kflop to start THC While Not IsActive(Input1) 'Wait for THC to complete.Sent from Kflop,Bit 54 Wend DeactivateSignal(Output5) While IsActive(Input1) 'Wait for THC to complete.Sent from Kflop,Bit 54 to be removed Wend
Regards
Regards
TK http://dynomotion.com
Hi Tom
Tried it your way and still doing the same thing. The interesting thing is that I even went as far as just turning on Output 5 nothing else . When the program gets to M03,
Mach3 freezes without setting the output on. I can see this in the diagnostic screen in Mach. If I step through the program, the output goes high. For fun I disabled the Kflop drivers in mach and set input 1 to a key on the
keyboard to simulate the feedback from Kflop. Mach works fine. Do you think I should reload mach3 or try with another computer?
George
Hi George,
Hmmm. There was a Mach3 hang fixed in Version 4.33l (the version after the one you are using). Please update to the latest Released Version 4.33 and see if you still have the problem. The code I tested with had that fix in it and I couldn't see the problem.
Regards
Regards
TK http://dynomotion.com
HI Tom
Trying to update Kflop. I updated Kflop and rebooted both kflop and computer and I can't connect to kflop.
See message in att.
George
Hi George,
Strange. Did the Flash operation complete?
Try doing the Flash Recovery.
#1 Power down KFLOP
#2 Restart KMotion.exe V4.33
#3 Press Recovery on the Config/Flash Screen
#4 follow prompts
#5 if successful Flash "New Version"
Regards
Regards
TK http://dynomotion.com
Hi Tom
Re flashed and all is working. I/O is responding the why God (and you) intended !!!
George
heh heh thanks for the patience.
Regards
Regards
TK http://dynomotion.com