eibwen has asked for the wisdom of the Perl Monks concerning the following question:

I'd like to use the serial port to control three stepper motors, two pins each (one for the direction, one for the duration). I took a look at Device::SerialPort, but it seemed to treat the serial port as a serial port as opposed to individual pins.

I've Super Searched for "Serial Port" and the like, but haven't found any nodes which discuss directly setting voltages on the pins. The closest I've found is Kludging the serial port, but I can't seem to extrapolate the content to suit my needs.

Should I be looking at a different module, or does Device::SerialPort suit my needs in some unexpected fashion?

  • Comment on Directly Setting Individual Serial Port Pins

Replies are listed 'Best First'.
Re: Directly Setting Individual Serial Port Pins
by GrandFather (Saint) on Sep 22, 2005 at 22:02 UTC

    Are you sure you really want to use the serial port? It's outputs generally provide +/- 12V and the only pins that you could use for this sort of purpose are the handshake pin, and there are only two or three of those available. Using the parallel printer port would be much more common for this sort of exercise.


    Perl is Huffman encoded by design.
Re: Directly Setting Individual Serial Port Pins
by spiritway (Vicar) on Sep 23, 2005 at 05:57 UTC

    To the best of my knowledge, the voltage on the pins is fixed. You can turn them on or off, but you don't get to say what the voltage is. Anyway, stepper motors aren't driven by variations in voltage.

    I'm wondering whether you'd need to use something closer to the bare metal, like C. You would otherwise likely have some problems getting the timing right, which is critical.

    From what you're saying, I'm thinking you aren't talking about stepper motors, but rather ordinary servo motors.