please dont rip this site

IEEE-1284 / Centronix / Parallel Port

C code for ECP mode interface on a Windows 95 PC

Simon Nield [simon.nield at quantel.com] says:

one thing to bear in mind when accessing the parallel port in epp mode is that it _does_ drop back into spp mode between reads / writes, so make sure you set up the spp mode correctly first.

I have pasted a small code snippet below that worked fine in Win95.

The hardware end of this code was an Altera 7k128 in case you were wondering.

unsigned short PORT=0x378;  // parallel base port

typedef struct FooCtrl
{
     short position;
} FooCtrl;

void TalkToFooCtrl( FooCtrl *testboard, unsigned short base, short pwm)
{
     unsigned short address_port, data_port, control_port;
     short position_delta;

     control_port = base + 2; // SPP control port
     address_port = base + 3; // EPP address port
     data_port    = base + 4; // EPP data port

     _outp(control_port, 0x00);    // ensure strobes deasserted in between EPP transfers
     _outp(address_port, pwm);
     _outp(data_port, pwm >> 8);
     position_delta = _inp(data_port);
     position_delta = position_delta << 8;
     position_delta += _inp(address_port);

     testboard->position = position_delta;
}



file: /Techref/io/parallel/1284/ecp-ccode-sn.htm, 1KB, , updated: 2002/9/24 06:03, local time: 2024/10/12 01:55,
TOP NEW HELP FIND: 
3.237.15.145:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://www.piclist.com/techref/io/parallel/1284/ecp-ccode-sn.htm"> IEEE-1284 / Centronix / Parallel Port </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .