Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need 1us clock period over parallel port

Status
Not open for further replies.

foofi22

Newbie level 3
Joined
Jun 18, 2009
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,299
parallel port clock

Hi,
I am trying to write some C++ code to write data out over a SPI link using the parallel port.

I can write the data as expected, however the throughput is just not fast enough. The time between clock cycles is 8us this need to be 1us, is there any way to improve this?

If I just add a section of code to toggle the clock line 1,0,1,0 etc... the quickest it gets is still an 8us clock period. Is it even possible to write at 1MBs serially using the parallel port?
 

toggle parallel port bits fast

from Wikipedia

An LPT port has an 8-bit data bus and four pins for control output (Strobe, Linefeed, Initialize, and Select In), and five more for control input (ACK, Busy, Select, Error, and Paper Out). Its data transfer speed is at 12,000 kbit/s.

and from another site

Although, there are some keen differences between ECP and EPP, both essentially support the higher throughput of today's variety of devices via the parallel ports. B&B Electronics carries a line of parallel cards to meet your different peripherals need:

ISAPP1 - ISA Parallel Single Port Card with SPP/BPP/EPP/ECP 2 MBps maximum
PCIPP1 - PCI Parallel Single Port Card with SPP/BPP/EPP 5.5-6 MBps maximum
PCIPP2 - PCI Parallel Dual Port Card with SPP/BPP/EPP 5.5-6 MBps maximum

All of the above support SPP and BPP modes to guarantee the basic compatibility with older peripherals and printers. SPP provides the forward direction only of data transfer, and BPP provides the bi-directional function, each with a maximum data transfer rate of 150 KBps. The overall maximum rate for ISA is up to 2 MBps and 5.5-6 MBps for PCI.
 

portout parallel port

Ok, given that the quickest I can toggle a single line is every 8us, any suggestions how this can be sped up? (I'm using C++ and IO.DLL to control the parallel port)
 

loadiodll

can you post the code so someone can check that...
 

maximum data rate parallel port

Code:
#include "io.h"
#include <iostream>
using namespace std;

PORTOUT PortOut;
PORTWORDOUT PortWordOut;
PORTDWORDOUT PortDWordOut;
PORTIN PortIn;
PORTWORDIN PortWordIn;
PORTDWORDIN PortDWordIn;
SETPORTBIT SetPortBit;
CLRPORTBIT ClrPortBit;
NOTPORTBIT NotPortBit;
GETPORTBIT GetPortBit;
RIGHTPORTSHIFT RightPortShift;
LEFTPORTSHIFT LeftPortShift;
ISDRIVERINSTALLED IsDriverInstalled;

HMODULE hio;

void UnloadIODLL() {
	FreeLibrary(hio);
}

int LoadIODLL() {
	hio = LoadLibrary("io");
	if (hio == NULL) return 1;

	PortOut = (PORTOUT)GetProcAddress(hio, "PortOut");
	PortWordOut = (PORTWORDOUT)GetProcAddress(hio, "PortWordOut");
	PortDWordOut = (PORTDWORDOUT)GetProcAddress(hio, "PortDWordOut");
	PortIn = (PORTIN)GetProcAddress(hio, "PortIn");
	PortWordIn = (PORTWORDIN)GetProcAddress(hio, "PortWordIn");
	PortDWordIn = (PORTDWORDIN)GetProcAddress(hio, "PortDWordIn");
	SetPortBit = (SETPORTBIT)GetProcAddress(hio, "SetPortBit");
	ClrPortBit = (CLRPORTBIT)GetProcAddress(hio, "ClrPortBit");
	NotPortBit = (NOTPORTBIT)GetProcAddress(hio, "NotPortBit");
	GetPortBit = (GETPORTBIT)GetProcAddress(hio, "GetPortBit");
	RightPortShift = (RIGHTPORTSHIFT)GetProcAddress(hio, "RightPortShift");
	LeftPortShift = (LEFTPORTSHIFT)GetProcAddress(hio, "LeftPortShift");
	IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled");

	atexit(UnloadIODLL);

	return 0;
}

void main(){

int a;
a = LoadIODLL();

ClrPortBit(890, 5);  //set data port to output

//now toggle bit 0 on data bus
SetPortBit(888, 0);
ClrPortBit(888, 0);
SetPortBit(888, 0);
ClrPortBit(888, 0);
SetPortBit(888, 0);
ClrPortBit(888, 0);
SetPortBit(888, 0);
ClrPortBit(888, 0);
SetPortBit(888, 0);
ClrPortBit(888, 0);
SetPortBit(888, 0);
ClrPortBit(888, 0);
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top