I been trying some I2c eeprom if I use pullup from sda to vdd it will error. If I don't use the pullup it reads and writes ok. The data sheet said to use a 10k ohm for 100khz and 4.7 for 400khz
software I2C with a pic16f628a I tried your tutorial 6 . I get Writing.. efg remove the resistor it writes it and reads it. I was thinking maybe a bad chip.
But I don't no much about I2C so I been going over your tutorial 6. I made the circuit on a solderless bread board.
software I2C with a pic16f628a I tried your tutorial 6 . I get Writing.. efg remove the resistor it writes it and reads it. I was thinking maybe a bad chip.
But I don't no much about I2C so I been going over your tutorial 6. I made the circuit on a solderless bread board.
Perhaps you built it wrong? (common on breadboard).
I2C won't work without a pullup on SDA, it's an open-collector system and without the pullup it will be permanently at zero. This is why you use TRISx to switch the pin, and not PORTx.
I think the chip is bad I found 1 more the code is from Nigels tutorial 6 I no it's right the board is just like the 1 he made I2c eeprom I removed the chip from a tv I may have got it to hot.
If you can read and write the I2C memory chip it is not bad. If the code is right and I am quite sure Nigel's is then there must be some thing there that is acting as a pullup.
The way this works is that either the PIC or the I2C device can pull the line low. But instead of driving it high they change to imputs and let the pullup resistor raise the line to +5. That way either of them can lower the line.
You did not say what the chip number was. Could be that you have one with a built in pullup? I have never seen one but it is possible. If you are driving it with a pin on port B there may be an internal pullup enabled on the pic. I think they are off by default.
It has to be something. You could take a ohm meter to it and check the resistance between +5 and the data line.
I have tried a 24C01 24C04 24C08. I.m powering it from the pickit2 thats the only thing different then Nigels tutorial boards. The ICSP is hooked to portb7 and portb6 so is the eeprom SDA on portb7 SDC on portb6
Ha HA man that's it you can't use the pickit2 ICSP to power it and use portb7 and portb6
for the eeprom. I powered it from my power supply and work just like it should thanks for the help Nigel and the great work you did with the tutorials and boards I have to say hands down you cover A to Z on how to use a pic.
And thank you to 3vO
It has to be something. You could take a ohm meter to it and check the resistance between +5 and the data line.
I have tried a 24C01 24C04 24C08. I.m powering it from the pickit2 thats the only thing different then Nigels tutorial boards. The ICSP is hooked to portb7 and portb6 so is the eeprom SDA on portb7 SDC on portb6
Both b6 and b7 are tied to gnd with 4.7K resistors. One more variable in the works.
Having a pullup and pulldown resistor creates a voltage divider. You need to move the ICSP SDA line to another pin like r5. It should be an easy code change.
Hi -
i am using 16f84 with 24lc256 - i have pin 1 to 4 tied to neg. so Addr should = 1010 0000 for writing and 1010 0001 for reading?
I did not have the pullups on sda / scl and had portb.4 = sda and portb.5 = scl
however i cannot get any read/write ? am unable to chk -
I read the values into data(4) array and when complete i do a loop to serout data4 and i only get nulls
any ideas? i am using oshonsoft pic sim. and the sim works fine. I have tried both versions of i2c in the tutorial.
thanks
You MUST have a pullup on SDA, otherwise you can only ever read zeros. For a single master, you can get away without one on SCL - assuming you program it accordingly.