possible to output PWM to speed controller from PC parallel port ?

Translate This Thread From English to

Threaded View
Is it possible to provide PWM output to a speed controller ( such as the
Devantech MD03 ) using a PC parallel port ? If possible, I would think there
would need to be a background process running to keep telling some
controller on the motherboard to output the PWM.)

Has anyone done it ? Any comments ?



Re: possible to output PWM to speed controller from PC parallel port ?



You can do it with some circuitry, for instance, I am using a Velleman K8000
I/O board. I wire the D/A converter output of the I/O board into a
comparator. The other input of the comparator is the ourput of a ramp
generator. This produces a PWM signal.

Typically, though, you wouldn't want to drive the PWM directly from the
parallel port because you will spend a lot of time in I/O and the frequency
will be pretty low.

Re: possible to output PWM to speed controller from PC parallel port ?


That tells me exactly what I wanted to know. I didn't really think it would
be worth the effort since my thoughts on doing this were to simply reduce
the number of extra components / controllers for a PC / mini-ITX based
robot.

Thanks !



Re: possible to output PWM to speed controller from PC parallel port ?


I have done it using RT Linux.  A real time kernel module generates the
PWM and a user space program controls it.

Ed


Re: possible to output PWM to speed controller from PC parallel port ?


About 10 years ago I wrote some experimental code to do servo control
all in software on a PC without any buffer circuitry needed.  It is
very crude and may need some tuning to get the pulses the correct
spacing, but it moved a servo to different positions using the UP/DOWN
keys....

I now use a Mini SSC RS232 controller (http://www.seetron.com/ssc.htm )
to make my servo signals (with a USB to RS232 converter).

-howy

this was compiled using borland C.

/////// start of SEROV1.CPP //////
#include <stdlib.h>
#include <bios.h>

#define ESCAPE_KEY 0x011b
#define UP_KEY     0x4800
#define DOWN_KEY   0x5000
#define LEFT_KEY   0x4b00
#define RITE_KEY   0x4d00

// parallell port address you want to talk to
#define PPORT1_DATA 0x03bc

void quit_pgm (void);

void main(void)
{
   int  i,j,w=1;
   long x;

   for(;;)
      {
      if(w<0) w=0;

      outportb(PPORT1_DATA,0x00);   delay(10);
      outportb(PPORT1_DATA,0xff);   for(x=0;x<1000L*(w+1);x++);
      outportb(PPORT1_DATA,0x00);   delay(10);

      for(j=0;j<10;j++)
         {
         if(bioskey(1))
            {
            switch(bioskey(0))
               {
               case ESCAPE_KEY: quit_pgm();
               case UP_KEY:   w+=1; printf("\rw=%03d",w); break;
               case DOWN_KEY: w-=1; printf("\rw=%03d",w); break;
               default: break;
               }
            }
         }
      }

   quit_pgm();
} // end of main

void quit_pgm(void)
{
   exit(0);
}


Re: possible to output PWM to speed controller from PC parallel port ?


About 10 years ago I wrote some experimental code to do it all in
software on a PC without any buffer circuitry needed.  It is very crude
and needs tuning to get the pulses the correct spacing, but it moved a
servo to different positions using the UP/DOWN keys....

-howy

this was compiled using borland C.

/////// start of SEROV1.CPP //////
#include <stdlib.h>
#include <bios.h>

#define ESCAPE_KEY 0x011b
#define UP_KEY     0x4800
#define DOWN_KEY   0x5000
#define LEFT_KEY   0x4b00
#define RITE_KEY   0x4d00

// parallell port address you want to talk to
#define PPORT1_DATA 0x03bc

void quit_pgm (void);

void main(void)
{
   int  i,j,w=1;
   long x;

   for(;;)
      {
      if(w<0) w=0;

      outportb(PPORT1_DATA,0x00);   delay(10);
      outportb(PPORT1_DATA,0xff);   for(x=0;x<1000L*(w+1);x++);
      outportb(PPORT1_DATA,0x00);   delay(10);

      for(j=0;j<10;j++)
         {
         if(bioskey(1))
            {
            switch(bioskey(0))
               {
               case ESCAPE_KEY: quit_pgm();
               case UP_KEY:   w+=1; printf("\rw=%03d",w); break;
               case DOWN_KEY: w-=1; printf("\rw=%03d",w); break;
               default: break;
               }
            }
         }
      }

   quit_pgm();
} // end of main

void quit_pgm(void)
{
   exit(0);
}


Re: possible to output PWM to speed controller from PC parallel port ?


This will not work with todays PCs anymore because WIndows messes up
your timing in the 'for' loop. Actually, a good compiler will remove the
'fro' loop entirely when optimizing. And last but not least, there is no
outportb command on WIn2k/XP anymore. The parallelport can only be
talked to via drivers.

Re: possible to output PWM to speed controller from PC parallel port ?


I don't run Windoze on my modern PC.  Under other operating systems this
is not so difficult.


Site Timeline