fpga4fun.comwhere FPGAs are fun

EPP 2 - The software

EPP software support is very simple. Let's see.

BIOS

First go into your PC's BIOS (accessible at power-up) and enable EPP (in the parallel port properties).

Parallel port address

From the software point of view, EPP transactions require IO reads or writes.

The most common EPP port address is 0x378. Find it in Window's control panel.

C functions

First the EPP_init() function.

#define EPP_port_addr 0x378	// your parallel port address

void EPP_init()
{
	IO_WRITE(EPP_port_addr+2, 0x04);
}

Simple, right?

Actually, you might need to write the IO functions yourself if your compiler doesn't provide them.

void IO_WRITE(WORD addr, BYTE data)
{
	_asm
	{
		mov dx, addr
		mov al, data
		out dx, al
	}	
}

BYTE IO_READ(WORD addr)
{
	_asm
	{
		mov dx, addr
		in al, dx
	}
}

Now we saw that EPP supports four types of transaction. Let's write one function for each.

void EPP_write_addr(BYTE address)
{
	IO_WRITE(EPP_port_addr+3, address);
}

void EPP_write_data(BYTE data)
{
	IO_WRITE(EPP_port_addr+4, data);
}

BYTE EPP_read_addr()
{
	return IO_READ(EPP_port_addr+3);
}

BYTE EPP_read_data()
{
	return IO_READ(EPP_port_addr+4);
}

That's all.
The EPP hardware handles all the EPP protocol details, so that the software doesn't have to do much.