Need 1us clock period over parallel port

Status
Not open for further replies.

foofi22

Newbie level 3
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?

sau_sol

Full Member level 5
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.

foofi22

Newbie level 3
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)

sau_sol

Full Member level 5

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

foofi22

Newbie level 3
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;

FreeLibrary(hio);
}

if (hio == NULL) return 1;

return 0;
}

void main(){

int a;

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.