Newsgroups: comp.robotics
Path: brunix!cat.cis.Brown.EDU!agate!howland.reston.ans.net!usenet.ins.cwru.edu!news.csuohio.edu!dpalmer
From: dpalmer@csuohio.edu (Darryl Palmer)
Subject: Re: C and the printer port?
Message-ID: <1994Jul20.191648.6258@news.csuohio.edu>
Sender: news@news.csuohio.edu (USENET News System)
Organization: Cleveland State University
X-Newsreader: TIN [version 1.2 PL2]
References: <1994Jul17.153810.18312@news.vanderbilt.edu> <Ct7Dut.2Fz@armory.com>
Date: Wed, 20 Jul 1994 19:16:48 GMT
Lines: 36


Richard Steven Walz (rstevew@armory.com) wrote:
<deleted tons>
: Here's the code. You'll want to change that delay number to change speed.
: Maybe add a conditional change in the read data address to control
: direction. Add a value entry loop to change the delay while running. Cute
: project.
: -Steve Walz

I don't know if the original poster knows enough about assembly or not, but
using Richard's code will certainly worked if modified a bit.  Note that 
to get a responsible speed for your stepper motor you will have to either
write a nested nop loop to eat up the time.  A better way would be to try
and trap the time interrupt (that is if you want it that slow), or you can
redefine the keyboard timer.  If you do use C, you can use one of the timer
functions or even the C++ Timer Library (Made by one of the programming guru's
on C$erve).  I don't know what actual speed you want, but the C++ Timer Lib,
available at probably tons of places, is able to get at least ms time
resolution.

If you do it in assemble remember some points.
1) Be nice to the computer and don't disable the interrupts for too long,
   you could start losing time. :)
2) It is hard to time the performance of assembly code (Because of the
   multitude of hardware) so just tweak it for one computer or try and use
   one of the timers if you want to use it for multiple computers.
3) If you want to make it really nice, hook up a scope to the computer and
   see how stable the pulses are.
4) Be careful with the computer, you don't want to blow out your port.
   Try to build in some safeguard into the system, so you don't take 
   everything down. (Luckily when a device I had to my serial port blew it
   only reset my computer, but then there are unlucky people)


Darryl Palmer
 
