Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2c pic18f4420 eeprom

Status
Not open for further replies.

howidam

Junior Member level 2
Joined
Apr 23, 2009
Messages
22
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,403
Iam using hitech compiler to connectan eeprom 24C512 to a microcontroller PIC18F4420 and i use your code
https://www.edaboard.com/threads/137641/
i attach the schematic and the modified code , and i don't know why it doesn't work , i change the ports and fix any errors,
wait ur reply:-(
 

Attachments

  • EepromCode.rar
    51.1 KB · Views: 65
  • eeprom_schematic.pdf
    21.6 KB · Views: 65

If it's using I2C shouldn't you be using the SDO, SDI and SCK pins of the microcontroller?
 

i don't know , i thought that the code build he protocol itself , so i don't need to use the dedicated pins for i2c bus , i will use any pins.
as we make it for atmel family without i2c protocol,
wait ur reply
 

Hello!

I2C involves 2 lines only. SDA and SCK.
SPI involves 3 lines usually called MISO (M = Master I = In S = Slave O =Out), MOSI and clk.

But you're right in the sense that according to the schemacits, the PIC device has an I2C (pins 18 and 23)
and it would be clearly easier to use the built-in I2C.

Dora.
 

kindly , advice either by fixing the code or either by how to use built-in I2C
 

Hello!

I'm not a PIC programmer, I use mostly MSP430 and ARM, so setting the I2C module
is probably different. However, this is basic programming and for sure there are myriads
of examples on how to do that. Did you try to google "pic 24C"? I would be surprised
if you don't find working sample code. You can even try to be more accurate with the
exact model for your pic and memory "pic18f4420 24C512".
If you don't find anything, then you can set earlier models, for example 24C128 or even
24C16, it's the same.

Dora.
 

I have done this using 18F452 my program is working if u require i upload it,
why are not u using Hardware MSSP Module i have done this using that.
 

PLZ , give me ur code using 18F452 and i will adjust it to my pic if it required, thanks,
engreem@yahoo.com
 

the code quoted by the original poster is a bit-bang software-based i2c routine. it works on chips without the mssp hardware, but has higher overhead.

---------- Post added at 01:31 PM ---------- Previous post was at 01:30 PM ----------

i don't know why it doesn't work

you may not know why it doesn't work but hopefully you know how it doesn't work.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top