Newsgroups: comp.robotics
Path: brunix!sgiblab!cs.uoregon.edu!usenet.ee.pdx.edu!fastrac.llnl.gov!lll-winken.llnl.gov!fnnews.fnal.gov!gw1!nntpa!not-for-mail
From: wrb@ccsitn.cb.att.com (Wally Blackburn)
Subject: Re: C and the printer port?
Message-ID: <CtAMsF.x7@nntpa.cb.att.com>
Sender: news@nntpa.cb.att.com (Netnews Administration)
Nntp-Posting-Host: oh/itnntl/ccsitn
Organization: AT&T Columbus
References: <1994Jul17.153810.18312@news.vanderbilt.edu> <Ct79sL.zr@armory.com>
Date: Thu, 21 Jul 1994 13:57:50 GMT
Lines: 49

In article <Ct79sL.zr@armory.com>,
Richard Steven Walz <rstevew@armory.com> wrote:
>In article <1994Jul17.153810.18312@news.vanderbilt.edu>,
> <HEAGYWS@ctrvax.Vanderbilt.Edu> wrote:
>>I am currently using QuickBasic and the OUT 888,xx command to control
>>the parallel printer port of a PC.  The port is connected to a 
>>stepper motor controller.  The whole setup is pretty simple...all I need
>>to do is pulse one or two lines high and low to control the direction
>>and stepping of the motor.  It works fairly well using QB, but I am sure
>>the stepping speed is being limited by the language I am using.  I'm
>>currently running the software on a 386sx, so I'm sure a faster machine
>>would also improve the situation...the problem is that after the software
>>is finished, it will most likely be run on 286 type machines.
>>
>>I was considering porting the software to C or assembly and was wondering
>>if anyone is aware of the commands used to access the printer port (I
>>am particularly interested in the C commands) for this type of work?
>>Also, if you have any other ideas how I could increase the stepping speed,
>>I would be glad to hear them.
>>
>>Thanks...Win
>>heagyws@ctrvax.vanderbilt.edu
>---------------------------------
>The "portable" C has NO input/output ability, it is merely a program flow
>control and math cruncher. Each C for each computer must have libraries for
>I/O which contain the needed functions. Look through your compiler's
>manual for same. Or hunt through the most fundamental libraries' source
>code. The other alternative, which is often faster is the "asm" in-line
>assembler command.
>-Steve Walz
>

I use Turbo C++ 1.5 for control of my CNC drill machine via the parallel
port.  It has an outportb() function that writes directly to the hardware.
I had to change it to use the biosprint() function on a 286 laptop I
acquired.  I'm sure MS C also has something similar.

I don't know if you really need it though.  I would think that, even using
QB, you could put data out of the port much faster than the motor could
step anyway.  I had to put delays in my stepping code.  The fastest I've
been able to reliably run the motors was with 4ms of delay + execution 
time.  Anything less and steps are missed.  See how fast your motors can go
- anything over 200 steps/sec would surprise me.  Good luck.

-- 
   Wally Blackburn		   Clinton-Gore - Socialist Leadership
   wrb@ccsitn.cb.att.com		          for the 90s!
   Amateur Radio Station AA8DX	   I'm the NRA.
   '91 FXR	DoD #1375
