Re: [MacRuby-devel] CNC Machine control using USB to IEEE 1284 Parallel port adapter

2012-01-18 Thread Dave Baldwin
Hi Bob,

You don't really say what your final goal is so this may not suit your purpose.

PC based CNC controllers are suck in the dark ages - not only for the GUI they 
present but in how they control the steppers via the printer port.  They rely 
on low level Window's drivers to generate accurate timing pulses (on the 
parallel port pins) and this process is easily disrupted by other system 
activity.  On a dedicated controller you can disable many of the system 
activities (network wifi, virus scanning, etc.) that will loose you accuracy, 
but even so the number of steps per second you can reliably generate is limited.

If you don't have to go down that route then using a USB pulse generator will 
be a far superior solution.  Example of such a products can be found at 
http://www.planet-cnc.com/ and http://www.warp9td.com/.  In this the timing 
pulses are generated by hardware and you just supply the 4 axis motion vector 
you want over the USB bus and it generates the appropriate pulse trains to 
control the steppers.

Dave.


On 18 Jan 2012, at 02:11, Robert Rice wrote:

> Hi,
> 
> I've become interested in Computer Numeric Control (CNC) machine control. I 
> find there is very little support for the Macintosh platform and many PC 
> programs for the task have a crude user interface so I would like to create a 
> Macintosh CNC application using MacRuby.
> 
> CNC programs and motor drivers generally use the LPT parallel port output 
> from a PC in the basic unidirectional mode. Most PC CNC apps do not support 
> PC laptops due to processor sleep logic interfering with stepper motor 
> timing. I would need a similar fast interface on the Mac.
> 
> I have a Prolific 2305 based USB to IEEE 1284 adapter cable that I would like 
> to use. Mac OS recognizes the device as an "IEEE-1284 Controller" in the USB 
> device tree and I can add a generic print queue for the device, but I don't 
> know how to connect to the device at high speed as the printer controller 
> does.
> 
> Prolific provides documentation for the simple report protocol for the 
> device. I suspect that an appropriate driver already exists for this device 
> but how would I find it?
> 
> Thanks,
> Bob Rice
> 
> 
> On Jan 17, 2012, at 2:27 PM, Alan Skipp wrote:
> 
>> Hi folks,
>> just a quick note (followed by a question) to let you know that my GCD 
>> rendition of ruby 1.9's most used feature – Fibers, is nearing completion. 
>> Code here:
>> 
>> https://github.com/alskipp/MacrubyFibers
>> 
>> Currently passes 51 expectations from the fiber spec. 3 failures, all 
>> related to raising exceptions, 2 of which can't be solved just yet as 
>> Macruby doesn't raise LocalJumpError for errant procs. The final test 
>> failure I'd like to fix, so here's the question…
>> 
>> When executing code on a serial dispatch queue, how can I raise an exception 
>> on the main queue? The following works in an Xcode project:
>> 
>> Dispatch::Queue.new('serial_queue').async do
>> Dispatch::Queue.main.sync do
>> raise "Exception from #{Dispatch::Queue.current}"
>> end
>> end
>> #> Exception from com.apple.main-thread (RuntimeError)
>> 
>> My assumption is that this works because it is executed within an 
>> application run loop. The same code does not work if invoked directly by 
>> Macruby, presumably due to the lack of an application run loop, Macruby 
>> exits before the Exception can be raised on the main queue, sometimes 
>> resulting in a EXC_BAD_ACCESS crash.
>> 
>> Is there an alternative approach? 
>> 
>> Cheers,
>> Al
>> 
>> 
>> On 10 Jan 2012, at 18:44, Joshua Ballanco wrote:
>> 
>>> Hey Alan,
>>> 
>>> Awesome! I haven't had a chance to go through the code in detail, but I 
>>> like the general approach. I'll definitely be looking into this in more 
>>> detail later, but for now I just wanted to let you know that there are 
>>> specs for Ruby 1.9's fibers in the MacRuby repo at 
>>> 'spec/frozen/library/fiber'. It would be interesting to see how many of 
>>> them pass with your implementation.
>>> 
>>> Cheers,
>>> 
>>> Josh
>>> On Thursday, January 5, 2012 at 10:36 AM, Alan Skipp wrote:
>>> 
 Hi everyone,
 I've had a go at implementing Fibers using dispatch queues. The code can 
 be found here:
 
 https://gist.github.com/1565393
 
 Inspiration was taken from the following ruby 1.8 Fibers implementation: 
 https://gist.github.com/4631
 
 The implementation of Fiber.yield currently relies upon a hash stored as a 
 class variable. This is hopefully just a temporary solution to get things 
 started. The hash is always accessed through a serial queue (so it should 
 be thread safe) and dead fibers are removed after use. There are a couple 
 of GCD functions that look like they could be used to solve this problem: 
 'dispatch_queue_set_specific' and 'dispatch_set_context'. Though I'm not 
 sure how to use these from Macruby. If anyone has any experience using 
 either of those 

Re: [MacRuby-devel] CNC Machine control using USB to IEEE 1284 Parallel port adapter

2012-01-18 Thread Dömötör Gulyás
Indeed, I can only agree that USB based parallel port adapters have
very shitty timing, in no small part due to USB itself. You cannot do
motion control over USB->PP like you could straight to the parallel
port on Windows (which wasn't that great to begin with), the motion
control part needs to be located at the other end of the USB
connection. The PC should only supply "high level commands", like it
does for the controllers Dave linked.

On 18 January 2012 10:10, Dave Baldwin  wrote:
> Hi Bob,
>
> You don't really say what your final goal is so this may not suit your
> purpose.
>
> PC based CNC controllers are suck in the dark ages - not only for the GUI
> they present but in how they control the steppers via the printer port.
>  They rely on low level Window's drivers to generate accurate timing pulses
> (on the parallel port pins) and this process is easily disrupted by other
> system activity.  On a dedicated controller you can disable many of the
> system activities (network wifi, virus scanning, etc.) that will loose you
> accuracy, but even so the number of steps per second you can reliably
> generate is limited.
>
> If you don't have to go down that route then using a USB pulse generator
> will be a far superior solution.  Example of such a products can be found at
> http://www.planet-cnc.com/ and http://www.warp9td.com/.  In this the timing
> pulses are generated by hardware and you just supply the 4 axis motion
> vector you want over the USB bus and it generates the appropriate pulse
> trains to control the steppers.
>
> Dave.
>
>
> On 18 Jan 2012, at 02:11, Robert Rice wrote:
>
> Hi,
>
> I've become interested in Computer Numeric Control (CNC) machine control. I
> find there is very little support for the Macintosh platform and many PC
> programs for the task have a crude user interface so I would like to create
> a Macintosh CNC application using MacRuby.
>
> CNC programs and motor drivers generally use the LPT parallel port output
> from a PC in the basic unidirectional mode. Most PC CNC apps do not support
> PC laptops due to processor sleep logic interfering with stepper motor
> timing. I would need a similar fast interface on the Mac.
>
> I have a Prolific 2305 based USB to IEEE 1284 adapter cable that I would
> like to use. Mac OS recognizes the device as an "IEEE-1284 Controller" in
> the USB device tree and I can add a generic print queue for the device, but
> I don't know how to connect to the device at high speed as the printer
> controller does.
>
> Prolific provides documentation for the simple report protocol for the
> device. I suspect that an appropriate driver already exists for this device
> but how would I find it?
>
> Thanks,
> Bob Rice
>
>
> On Jan 17, 2012, at 2:27 PM, Alan Skipp wrote:
>
> Hi folks,
> just a quick note (followed by a question) to let you know that my GCD
> rendition of ruby 1.9's most used feature – Fibers, is nearing completion.
> Code here:
>
> https://github.com/alskipp/MacrubyFibers
>
> Currently passes 51 expectations from the fiber spec. 3 failures, all
> related to raising exceptions, 2 of which can't be solved just yet as
> Macruby doesn't raise LocalJumpError for errant procs. The final test
> failure I'd like to fix, so here's the question…
>
> When executing code on a serial dispatch queue, how can I raise an exception
> on the main queue? The following works in an Xcode project:
>
> Dispatch::Queue.new('serial_queue').async do
>     Dispatch::Queue.main.sync do
>         raise "Exception from #{Dispatch::Queue.current}"
>     end
> end
> #> Exception from com.apple.main-thread (RuntimeError)
>
> My assumption is that this works because it is executed within an
> application run loop. The same code does not work if invoked directly by
> Macruby, presumably due to the lack of an application run loop, Macruby
> exits before the Exception can be raised on the main queue, sometimes
> resulting in a EXC_BAD_ACCESS crash.
>
> Is there an alternative approach?
>
> Cheers,
> Al
>
>
> On 10 Jan 2012, at 18:44, Joshua Ballanco wrote:
>
> Hey Alan,
>
> Awesome! I haven't had a chance to go through the code in detail, but I like
> the general approach. I'll definitely be looking into this in more detail
> later, but for now I just wanted to let you know that there are specs for
> Ruby 1.9's fibers in the MacRuby repo at 'spec/frozen/library/fiber'. It
> would be interesting to see how many of them pass with your implementation.
>
> Cheers,
>
> Josh
>
> On Thursday, January 5, 2012 at 10:36 AM, Alan Skipp wrote:
>
> Hi everyone,
> I've had a go at implementing Fibers using dispatch queues. The code can be
> found here:
>
> https://gist.github.com/1565393
>
> Inspiration was taken from the following ruby 1.8 Fibers implementation:
> https://gist.github.com/4631
>
> The implementation of Fiber.yield currently relies upon a hash stored as a
> class variable. This is hopefully just a temporary solution to get things
> started. The hash is always accessed through 

Re: [MacRuby-devel] CNC Machine control using USB to IEEE 1284 Parallel port adapter

2012-01-18 Thread Will Thorne
Hello,

Long time lurker making first post here. You could use an Arduino and do the 
real time pulse generation stuff on that. Then just write a macruby app that 
serialises the commands and feeds them to the Arduino which interprets them and 
flips the necessary IO pins on and off. It's years since I looked at this stuff 
but I seem to remember that CNC commands work such that they could be grouped 
into a single machining operation. Hypothetical example to cut a slot on a 
horizontal miller: Start milling cutter, start carriage +z, stop carriage, 
start carriage +x, stop carriage, start carriage -z, stop carriage, stop 
cutter. You could load that whole sequence into the Arduino if you break it 
down into groups like this. Put the arduino in a plastic box with a parallel 
port on one end and usb cable coming out the other? I don't know for sure that 
this would work, but in my experience microcontrollers are much simpler to do 
real time stuff on because they have pretty much no software stack compared to 
a desktop PC.

Will

On 18 Jan 2012, at 09:10, [email protected] wrote:

> Hi,
> 
> I've become interested in Computer Numeric Control (CNC) machine control. I 
> find there is very little support for the Macintosh platform and many PC 
> programs for the task have a crude user interface so I would like to create a 
> Macintosh CNC application using MacRuby.
> 
> CNC programs and motor drivers generally use the LPT parallel port output 
> from a PC in the basic unidirectional mode. Most PC CNC apps do not support 
> PC laptops due to processor sleep logic interfering with stepper motor 
> timing. I would need a similar fast interface on the Mac.
> 
> I have a Prolific 2305 based USB to IEEE 1284 adapter cable that I would like 
> to use. Mac OS recognizes the device as an "IEEE-1284 Controller" in the USB 
> device tree and I can add a generic print queue for the device, but I don't 
> know how to connect to the device at high speed as the printer controller 
> does.
> 
> Prolific provides documentation for the simple report protocol for the 
> device. I suspect that an appropriate driver already exists for this device 
> but how would I find it?
> 
> Thanks,
> Bob Rice


___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] CNC Machine control using USB to IEEE 1284 Parallel port adapter

2012-01-18 Thread Jordan K. Hubbard

On Jan 18, 2012, at 1:10 AM, Dave Baldwin wrote:

> PC based CNC controllers are suck in the dark ages - not only for the GUI 
> they present but in how they control the steppers via the printer port.  They 
> rely on low level Window's drivers to generate accurate timing pulses (on the 
> parallel port pins) and this process is easily disrupted by other system 
> activity.  On a dedicated controller you can disable many of the system 
> activities (network wifi, virus scanning, etc.) that will loose you accuracy, 
> but even so the number of steps per second you can reliably generate is 
> limited.

That's an excellent point, of course.  I might also offer, depending on how 
real-time the requirements of your CNC equipment is, an alternative solution 
which would be to pick up a programmable microcontroller (many fine ones exist 
these days, with both USB and parallel interfaces to boot) and off-load the 
responsibility for servicing the equipment to it, then talking high-level to 
the microcontroller over USB from your MacRuby app.  There are quite a few 
folks doing smaller-scale Arduino CNC jobs (just google for "arduino CNC" for a 
random sampling) and, depending on how industrial your needs are, the Arduinos 
are a dream to program for.

- Jordan

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] CNC Machine control using USB to IEEE 1284 Parallel port adapter

2012-01-18 Thread Robert Rice
Hi Dave,

Thanks for the info. I do agree that these solutions are better than what I had 
intended to do, but they are a bit expensive for the average hobbyist. The 
controlling CNC applications are still PC based but can run under "Parallels" 
on the Mac since the controllers offload the realtime pulse generation from the 
PC or Mac. There would be a market for a Mac CNC application even if a separate 
motion controller board is required.

The Warp9 and Planet-cnc solutions require additional driver cards for each 
motor. While this provides the ultimate flexibility for hardware configuration 
(like component audio) is adds up to significantly more cost than a single 
board having the parallel port breakout and three or four motor drivers like 
the HobbyCNC controller.

I upgraded my MaxNC 10 to four axis using a HobbyCNC controller still having a 
parallel port input. I suspect that a USB 2.0 to 1284 parallel adapter would be 
fast enough so long as I don't set the micro-stepping drivers for too high a 
resolution. The drivers can be set for 1/2, 1/4, 1/8 or 1/16 motor step per 
controller step.

Thanks,
Bob Rice


On Jan 18, 2012, at 4:10 AM, Dave Baldwin wrote:

> Hi Bob,
> 
> You don't really say what your final goal is so this may not suit your 
> purpose.
> 
> PC based CNC controllers are suck in the dark ages - not only for the GUI 
> they present but in how they control the steppers via the printer port.  They 
> rely on low level Window's drivers to generate accurate timing pulses (on the 
> parallel port pins) and this process is easily disrupted by other system 
> activity.  On a dedicated controller you can disable many of the system 
> activities (network wifi, virus scanning, etc.) that will loose you accuracy, 
> but even so the number of steps per second you can reliably generate is 
> limited.
> 
> If you don't have to go down that route then using a USB pulse generator will 
> be a far superior solution.  Example of such a products can be found at 
> http://www.planet-cnc.com/ and http://www.warp9td.com/.  In this the timing 
> pulses are generated by hardware and you just supply the 4 axis motion vector 
> you want over the USB bus and it generates the appropriate pulse trains to 
> control the steppers.
> 
> Dave.
> 
> 
> On 18 Jan 2012, at 02:11, Robert Rice wrote:
> 
>> Hi,
>> 
>> I've become interested in Computer Numeric Control (CNC) machine control. I 
>> find there is very little support for the Macintosh platform and many PC 
>> programs for the task have a crude user interface so I would like to create 
>> a Macintosh CNC application using MacRuby.
>> 
>> CNC programs and motor drivers generally use the LPT parallel port output 
>> from a PC in the basic unidirectional mode. Most PC CNC apps do not support 
>> PC laptops due to processor sleep logic interfering with stepper motor 
>> timing. I would need a similar fast interface on the Mac.
>> 
>> I have a Prolific 2305 based USB to IEEE 1284 adapter cable that I would 
>> like to use. Mac OS recognizes the device as an "IEEE-1284 Controller" in 
>> the USB device tree and I can add a generic print queue for the device, but 
>> I don't know how to connect to the device at high speed as the printer 
>> controller does.
>> 
>> Prolific provides documentation for the simple report protocol for the 
>> device. I suspect that an appropriate driver already exists for this device 
>> but how would I find it?
>> 
>> Thanks,
>> Bob Rice
>> 
>> 
>> On Jan 17, 2012, at 2:27 PM, Alan Skipp wrote:
>> 
>>> Hi folks,
>>> just a quick note (followed by a question) to let you know that my GCD 
>>> rendition of ruby 1.9's most used feature – Fibers, is nearing completion. 
>>> Code here:
>>> 
>>> https://github.com/alskipp/MacrubyFibers
>>> 
>>> Currently passes 51 expectations from the fiber spec. 3 failures, all 
>>> related to raising exceptions, 2 of which can't be solved just yet as 
>>> Macruby doesn't raise LocalJumpError for errant procs. The final test 
>>> failure I'd like to fix, so here's the question…
>>> 
>>> When executing code on a serial dispatch queue, how can I raise an 
>>> exception on the main queue? The following works in an Xcode project:
>>> 
>>> Dispatch::Queue.new('serial_queue').async do
>>> Dispatch::Queue.main.sync do
>>> raise "Exception from #{Dispatch::Queue.current}"
>>> end
>>> end
>>> #> Exception from com.apple.main-thread (RuntimeError)
>>> 
>>> My assumption is that this works because it is executed within an 
>>> application run loop. The same code does not work if invoked directly by 
>>> Macruby, presumably due to the lack of an application run loop, Macruby 
>>> exits before the Exception can be raised on the main queue, sometimes 
>>> resulting in a EXC_BAD_ACCESS crash.
>>> 
>>> Is there an alternative approach? 
>>> 
>>> Cheers,
>>> Al
>>> 
>>> 
>>> On 10 Jan 2012, at 18:44, Joshua Ballanco wrote:
>>> 
 Hey Alan,
 
 Awesome! I haven't had a chance to go through the code 

Re: [MacRuby-devel] CNC Machine control using USB to IEEE 1284 Parallel port adapter

2012-01-18 Thread Robert Rice
Hi Will,

Thanks for the info on Arduino - looks like some interesting possibilities 
there. I didn't realize that Arduino had several different boards available. I 
may be able to connect one or more boards to a DB25 parallel connector to 
control my HobbyCNC micro-stepping driver board.

Thanks,
Bob Rice

On Jan 18, 2012, at 10:33 AM, Will Thorne wrote:

> Hello,
> 
> Long time lurker making first post here. You could use an Arduino and do the 
> real time pulse generation stuff on that. Then just write a macruby app that 
> serialises the commands and feeds them to the Arduino which interprets them 
> and flips the necessary IO pins on and off. It's years since I looked at this 
> stuff but I seem to remember that CNC commands work such that they could be 
> grouped into a single machining operation. Hypothetical example to cut a slot 
> on a horizontal miller: Start milling cutter, start carriage +z, stop 
> carriage, start carriage +x, stop carriage, start carriage -z, stop carriage, 
> stop cutter. You could load that whole sequence into the Arduino if you break 
> it down into groups like this. Put the arduino in a plastic box with a 
> parallel port on one end and usb cable coming out the other? I don't know for 
> sure that this would work, but in my experience microcontrollers are much 
> simpler to do real time stuff on because they have pretty much no software 
> stack compared to a desktop PC.
> 
> Will
> 
> On 18 Jan 2012, at 09:10, [email protected] wrote:
> 
>> Hi,
>> 
>> I've become interested in Computer Numeric Control (CNC) machine control. I 
>> find there is very little support for the Macintosh platform and many PC 
>> programs for the task have a crude user interface so I would like to create 
>> a Macintosh CNC application using MacRuby.
>> 
>> CNC programs and motor drivers generally use the LPT parallel port output 
>> from a PC in the basic unidirectional mode. Most PC CNC apps do not support 
>> PC laptops due to processor sleep logic interfering with stepper motor 
>> timing. I would need a similar fast interface on the Mac.
>> 
>> I have a Prolific 2305 based USB to IEEE 1284 adapter cable that I would 
>> like to use. Mac OS recognizes the device as an "IEEE-1284 Controller" in 
>> the USB device tree and I can add a generic print queue for the device, but 
>> I don't know how to connect to the device at high speed as the printer 
>> controller does.
>> 
>> Prolific provides documentation for the simple report protocol for the 
>> device. I suspect that an appropriate driver already exists for this device 
>> but how would I find it?
>> 
>> Thanks,
>> Bob Rice
> 
> 
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel