I have written an G code interpreter/control app for a cnc machine in objective C. Everything runs fine for the first 20 - 30 secs but after that the whole thing stops for an other 20 sec and resumes super slow. I made a video so you can see for your self: video (about a minute). As far as I can tell it doesn't skip steps or something like that it just goes really slow.
In my X-code console I can see that code is interpreted at the normal speed (using a NSLog every time a byte is written).
I use the IOkit from the Arduino Cocoa reference to communicate. I have tried a lot of different Baudrates and sometimes that will prolong the time it keeps working correctly but eventually it always slows down.
I some thing after this line needs to clean up the serial buffer or something
// send a byte to the serial port
void writeByte(char val) {
write(serialFileDescriptor, [[NSString stringWithFormat:@"%c" , val] cStringUsingEncoding:NSUTF8StringEncoding], 1);
}
Update: I am developing the app on my 17"MBP running OS X 10.9, I tried this on a other 13"MBP running 10.9.1 same thing happens but when I use yet an other 13"MBP running 10.6.8 it works fine!
Any ideas on what is happening here?