PWM signals from computer?

Hello,
Jaguars and victors are currently connected to the digital sidecar and then to the cRIO by a PWM cable. Is there was a way to connect a PWM cable directly to a computer so that you can directly control a Jaguar or Victor from it?

If you get the right computer (such as the old IFI controller) it’s pretty easy…but if you have a PC or something you need some type of interface.

I have a linux computer and I was trying to use the serial or parallel port as an output. However, I’m not really sure how to connect the PWM to those ports. Would it be possible if I used the parallel port and connected it to a digital sidecar then attached a PWM on that?

http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=151001&

I’ve had good success with the above part - RS-232 in and 8 PWM servo outputs.

Russ

The 37-pin interface on the digital sidecar isn’t related in any direct way to the 25-pin parallel port on a PC. The 10 PWM outputs from the DSC are “bit-banged” from the digital output module in the cRIO. The DSC is only present to buffer the cRIO’s outputs and thereby provide additional current. Using the DSC would help if you can bit-bang the parallel port outputs with resolution in the 10s of microseconds or better (but I don’t think that you can reliably twiddle those bits as needed).

Russ

As has been stated, there are many products available that offload control of servos and can be interfaced over RS-232 (serial), IEEE-1284 (parallel), or USB.

Of the three, parallel is probably the best suited for an attempt at directly controlling a servo. And while this is physically/electrically possible, a stock Linux installation is not well equipped to be able to handle this kind of a task. The problem exists in the task scheduling mechanism of the OS, which typically runs on somewhere between a 1ms and 10ms clock.

Explanation of task scheduling:
One of the main jobs of an operating system is to schedule which programs get to use the CPU. The handoff between tasks occurs whenever a program calls any of the faciilities provided by the OS, such as hardware interface, timed delay, writing to the screen, communication between programs running on the system, etc. A scheduling clock of 1ms to 10ms means that a new task is switched into the processor at a minimum of 1ms to 10ms.

The problem that this generates for servo control is that standard servos require a control pulse that varies between 1ms and 2ms. So your program would look something like: turn on servo control output, wait for 1ms-2ms (depending on desired position), turn off servo control output. However, since timed waiting is one of the things provided by the OS, this means that when you call wait in your program, the OS will most likely let another task run on the CPU. This means that for most operating systems, asking your program to wait for 1.3ms doesn’t actually mean it will wait for 1.3ms, but is more likely to wait somewhere between 10ms and 20ms.

There is a possible solutions to this. If you’re particularly comfortable with Linux, there is a kernal patch available called PREEMPT_RT which enables an alternate scheduling algorithm called preemptive multitasking which basically allow the OS to wrench control away from any of the running programs whenever it wants to, allowing your program to request much more accurate timing intervals, but the process of patching and recompiling a Linux kernel can be painful. Once you have the support in the kernel however, it should be possible to do what you want, and there are a couple articles published by a someone who did something similar to what you are proposing.

All told, though, I think you’d be better off purchasing one of the controller modules, unless you’re feeling especially adventurous.

–Ryan

Check this thread. I was trying to do the same thing.

After trying to write a PWM class for my computer I decided that it would be easier to use a stamp as a PWM serial interface. I happened to have one, so it was very simple to do. You could also use a PIC. Any cheap microcontroller will do.