This is a very simplistic, but working unit to drive the Parallel
Port <-> I2C Interface with a 7405 hex open-collector inverter chip.
It doesn't get much easier than that to test I2C circuits from a PC.

The unit defines an object of type i2c_port, which can either be
used directly or new object can be derived to add specialized functionality,
such as in the example program i2c_test.pas. The new object adds a
few things to use a 24xx65-type EEprom.

The program/unit should compile without problems using Turbo Pascal.
Free Pascal Compiler users may have to edit the port accesses. I haven't
tried that yet. If there's interest, mail me.


More info on the website:

http://www.jcoppens.com


Before use of the object, it's necessary to instantiate it... I realize
that object oriented program may not be your thing, but believe me, it
does make things easier!

Eg:

var
  i2c: i2c_port;


These are the publicly available methods:

procedure i2c_port.Initialize(P: word);

	Initializes the object, and defines P as the base address of the
	LPT port used (eg. $378 if you use LPT1)	

procedure i2c_port.Start_Cond;
procedure i2c_port.Stop_Cond);

	Each packet transmitted on the bus should be 'bracketed' with
	calls to Start_Cond, and Stop_Cond. Some peripherals, as
	for eg. the 24LC65, may need extra calls to Start_Cond to
	change the direction of the data.


function i2c_port.Byte_sent(B: byte): boolean;

	Send byte 'b'. Returns TRUE or FALSE, if the peripheral 
	acknowledged the transfer or not.


function i2c_port.Receive_Byte(MustAck: boolean): byte;

	(Try to) receive a byte from the bus. If 'MustAck' is set to
	TRUE, the function will send an acknowledge at the end.


function i2c_port.Poll_Available: boolean;

	Interrogate if the device is responding, or even exists.


procedure i2c_port.Set_Debug(D: boolean);

	Enables (or disables) debug information printing. This may
	help to determine the cause of problems.


NOTE:

I release this packege under the GNU GPL license. Please consult the
COPYING file in this package for more details.


John
