• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I2C parallel port Interface

Status
Not open for further replies.

coma

New Member
Ive been writing a program in VB that uses the I2C protocol to write to eeproms and other microcontrollers via the parallel port on a PC. i was wondering if there is any one out there that can help me get started in designing a interface for my program. i really dont know much about designing Pcb or schematics but i have built many project and i study engineering at uni.

for this one ill need all the help i can get
 

Nigel Goodwin

Super Moderator
Most Helpful Member
coma said:
Ive been writing a program in VB that uses the I2C protocol to write to eeproms and other microcontrollers via the parallel port on a PC. i was wondering if there is any one out there that can help me get started in designing a interface for my program. i really dont know much about designing Pcb or schematics but i have built many project and i study engineering at uni.

for this one ill need all the help i can get
It's basically very similar to a PIC programmer, you can use three of the open collector buffers in a 7407 or similar. Use one to feed the SCL line, the second to feed the SDA line, and the third from the SDA line back into the port. Don't forget the pullup resistors on all three buffers. If you look at the P16PRO40 circuit, and ignore the HT switching, that's pretty well what you need.

If I can find it, I have a circuit somewhere!.

I've also got Delphi code for reading and writing EEPROM's.
 

coma

New Member
VB for me

ive been programing under VB, i got asked to program it in VB and all i had was a 21 day crash course. its working well but i really need help with my read function, im still trying things and testing so hopefuly soon... agian if anyone could help me there, i really it. thanks
 

coma

New Member
baby engineer

Is all that really needed? i mean as far as i knew all i need where 2 lines.
it is a nice schematic though and im considering it. still to do so i would have to modify it.

my program uses pin 2 as the SCL line and pin 3 as the SDA line, but both pins are input and output. Ive noticed that alot of circuits use 4 pins, 2 for input and 2 for output, why? the protocol was meant for just 2 wasnt it?

lets say i want to use that schematic, how would i adjust it to suit me? i noticed that he sets all his data pins (pins 2-9) high to power the circuit, my program uses those pins and i would need a external 5v power supply, thats easy. but im not farmilliar with the square and circle components. could you help me?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Re: baby engineer

coma said:
Is all that really needed? i mean as far as i knew all i need where 2 lines.
it is a nice schematic though and im considering it. still to do so i would have to modify it.

my program uses pin 2 as the SCL line and pin 3 as the SDA line, but both pins are input and output. Ive noticed that alot of circuits use 4 pins, 2 for input and 2 for output, why? the protocol was meant for just 2 wasnt it?

lets say i want to use that schematic, how would i adjust it to suit me? i noticed that he sets all his data pins (pins 2-9) high to power the circuit, my program uses those pins and i would need a external 5v power supply, thats easy. but im not farmilliar with the square and circle components. could you help me?
I2C requires a bi-directional SDA line, so you normally use two pins on the parallel port for it - one in, one out. For most purposes the SCL doesn't need to be bi-directional, unless you want to do slave as well as master.

The reason the circuit on the link is complicated is that it's opto-isolated, the 'squares' are the opto-couplers, and the 'circles' are FET's. If you don't need isolation, it can be a LOT! simpler. For a nice simple circuit try http://www.lancos.com/e2p/easyI2Cbus.gif.
 

Exo

Active Member
SCL needs to be be-directional too...
A slave device can hold SCL low if it needs more time to process a command. The master should wait until slave releases SCL
If your SCL is not bi-directional how are you going to detect this ?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Exo said:
SCL needs to be be-directional too...
A slave device can hold SCL low if it needs more time to process a command. The master should wait until slave releases SCL
If your SCL is not bi-directional how are you going to detect this ?
Pretty rare though! - and the original question was to "write to eeproms and other microcontrollers".
 

coma

New Member
programing it in VB

Ok so its not nessary but its better to seperate the lines into outout and input independant lines (ie 4 pins rather than 2)

how do i porgram in VB so that i can get the state of the register pins on the parallel port? (pins 10 - 17)
i noticed that most people are using pin 10(Ack), 11(Busy), 12(Paper end) or pin 13(Selected) as their input pins.

Exo your Circuit looks simple and just what i need, but you havent given me any resister nor transistor values. could you also pass them on please.

thanks for the help so far guys
 

Exo

Active Member
I use BC547 for the transistors, but any NPN that can sink a little current can be used.

I use 10K for the base resistors, seem to work well with the '547

The pull-up resistor values are open for debate. The lower these values are (philips uses 330 ohm in some devices i have here) the less propagation delay the lines will have, but the more current you have to sink (and waste) when pulling a line low
I currently use 1K as pull-ups. Does the trick for me.
If you use this setup to connect the I²C bus of a existing device (a VCR, for example) to your pc then there's no need for pull-ups, as they are already in the device.

about the parallel port in VB... I don't know about it, i made my software in dos, wich allows free access to the parallel port.
But i've seen other posts on this forum covering that very subject.
 

Exo

Active Member
Nigel Goodwin said:
Exo said:
SCL needs to be be-directional too...
A slave device can hold SCL low if it needs more time to process a command. The master should wait until slave releases SCL
If your SCL is not bi-directional how are you going to detect this ?
Pretty rare though! - and the original question was to "write to eeproms and other microcontrollers".
maybe rare, but i've seen devices pulling SCL low because they needed more time to process a command.

I says so in the I²C specification. Incorporating it into the software is easy and makes it closer to the 'real' thing
 

Nigel Goodwin

Super Moderator
Most Helpful Member
coma said:
How would i go about adding a buffer to the circuit that Exo gave me(above)?
It's already got buffers on the output lines (which are the ones likely to be damaged), you could add similar transistor buffers on the input lines as well if you wanted - but you would have to account for the inversion in the software. The circuit is essentially identical to that on the Lancos site I posted the link for above.

The selection of the input pin is mainly down to the fact that very few of the port pins can be inputs, and it's tended to become common practice to use the ones which almost everybody uses. I've always used the one which David Tait used in his original PIC programmer.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top