1

I'm trying to write a program like Mach3Mill that controls LPT servos. Now I use C# and library inpout32.dll to send data to LPT. The main problem is to make moving smooth like the original program does.

Now I'm sending data in loop changing data bit from 1 to 0 with intervals using Thread.SpinWait because Thread.Sleep produces larger intervals.

Are there any ways to send data with selected frequency?

pvf
  • 82
  • 1
  • 6
  • Short answer: no. Long answer: Windows isn't a real time operating system, but you can get close to what you're looking for. You could probably use a timer, do a search for "Real Time Timers". What kind of accuracy are you looking for? – MikeH Nov 20 '14 at 20:27
  • Windows is not a realtime operating system, so the typical solution for CNCs is to delegate this to a hardware motion controller. See http://electronics.stackexchange.com/questions/44631/writing-to-parallel-port-with-minimum-latency and http://blog.cnccookbook.com/2011/12/23/motion-control-boards-take-mach3-from-hobby-class-to-industrial-grade-part-1/ for elaboration. Setting your thread to the highest possible priority may help, but `SpinWait` should be a tight loop, so you may not do much better. If you can show us what you've done, and what your goal is, someone might be able to help. – pmcoltrane Nov 20 '14 at 20:37
  • What kind of time granularity do you need? 50ms, 250ms? – Eric Nov 20 '14 at 20:43
  • Thanks to everybody, yes windows is not RTOS and I'm quite discouraged because this device(default with cutter) relies only on Mach3Mill performance. I'll record a short video next Monday how it works, and now I started to think about replacing original controller which actions like useless transport between PC and servos(actually can't use G-codes)... – pvf Nov 21 '14 at 00:24
  • Found out that there's "BUSY FLAG", will check it also. – pvf Nov 21 '14 at 01:03

0 Answers0