View previous topic :: View next topic |
Author |
Message |
fadeout
Joined: 28 Jan 2004 Posts: 15
|
I2C Beetwen PIC16F8676 and PC Open Collector Problem |
Posted: Fri Feb 20, 2004 8:37 am |
|
|
Hi,
I have a discussion with my elettoronic-designer and I need your help.
In a previous post ("Does I2c has a minimun clock freq") I asked something about I2C and in the replies Ttelmah and a Guest tolds me about an "open collector driver" I need to have on the LPT port of my PC to make all working. I told this to my elettronic designer but he said that it's all ok.
At the moment I have a code on c# (PC - I2C Master) and a code on PICC (16F876 - I2C Slave) that can write from PC to PIC but never read nothing including ACK. I can test this because I "hackered" the ACK signal and I can see that PIC can read what I send from the PC. I think it means that the code can work well.
On the LPT port I have lines (SDA and SCL) on PIN0 (Control Register Bit 0 - Strobe signal) and PIN14 (Control register Bit 1 Signal nAuto-Linefeed). This are "open collectors" pins, but I think that they are only output pins.
I can mesaure that the pic outputs (that have the pull-up resistor) goes low when is the right moment (for example for an ACK) but from PC I always read high. I also made a simple test program only forcing 0 to pins C4 an C3 tryng to read from PC: if PC says high I read high even if PIC is forcing low.
I think that to make all works I need to use data lines adding an Open Collector driver, but my elettronic designer "don't care" about this.
Can someone help me ?
Thanks,
Best Regards. |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Fri Feb 20, 2004 9:52 am |
|
|
I did something once using one line as an output through a diode that allowed the output to act as a pull down only and had another line reading the state on the other side of the diode. Your hardware guy should be able to make this work. You only need add 1 diode and attach an aditional line from the PC. Is it actually posiable to read one pin and write to another at the same time on the parrallel port? |
|
|
fadeout
Joined: 28 Jan 2004 Posts: 15
|
|
Posted: Fri Feb 20, 2004 10:00 am |
|
|
Dear Neutone,
first of all thank you for your reply.
Secondly yes, is possible to read and write: parallel port is seen as a "normal" register that you read and write. So I can read and immediatly after write. |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Fri Feb 20, 2004 11:48 am |
|
|
So you can have some pins as input and some as outputs? I assumed it was all in or all out at any given time. |
|
|
fadeout
Joined: 28 Jan 2004 Posts: 15
|
|
Posted: Fri Feb 20, 2004 12:04 pm |
|
|
Well... maybe I'm in wrong. I'm not so sure. I think that some pins are input, some output and some I/O. I read Microsoft ECP Register implementation spec. from http://www.fapo.com/ieee1284.htm .
But at this moment I can't understand whats happening !
I found a lot of stuff in Internet about people using LPT and I2C and every one has a (different) circuit: how can I am the only one that do this without everything ?!? |
|
|
|