Writing/Reading with EEPROMs
By CaptainTuna
2008-08-06 07:25
2008-08-06 07:25
Hi guys!
i would like to write and read this kind of EEPROM http://ww1.microchip.com/downloads/en/DeviceDoc/21711G.pdf
the problem is that i don't really know how to.
My aim is to establish a serial connection with it via my picaxe (it's gonna be one of the "M" series), and of course, once i've done this, to read it and write on it.
does picaxe have some simple code to read/write them?
Another thing: in the pin description it says i have to connect a pin to a "serial clock". What is that? or what pin would it be on the picaxe?

They are I2C devices and you
i won't have the I2C port on
I2C is a serial protocl. If
aah ok i see. But then why
aah ok i see. But then why do some Picaxes have "i2c pins" (as listed in the schematics) and some others just have serial in and serial out pins (the one that go to the stereo jack)?
Anyways say i'll be using bit banging, do you have idea of where i am going to stick those pins from the EEPROM memory? (since my current i2c port only has 3 pins)
PIC vs PICAXE
PICs tend to have a lot of functionality built in which isn't all supported by PICAXE. Also, you know the way a lot of the pins on a PICcan have multiple functions?
The PIC containing the PICAXE bootloader may support I2C natively, but the PICAXE may not. It may use the I2C pins just for digial I/O or whatever.
Even if you don't really understand teh PIC native RISC assembler, it's worth scouring the Microchip website. They have code on there for making a regular I/O port into a I2C port by bit-banging. Be warned: it looks really complicated at first, but once you have some good, solid routines, it will work for you
I can't help you with the PICAXE specific bits, but I've done this in RISC assembly and it was well worth the experience. If you have the patience, a good route mightbe to go with RISC assembler instead of BASIC. That way, you can let the PIC hardware take care of all the hard stuff.
The picaxes with i2c pins
The picaxes with i2c pins has commands to take care of sending the start/stop sequences and handling the timing.
I think you can use any I/O pins, since it's a matter of setting/resetting the pins in the right order. A did a google search and found http://www.phanderson.com/picaxe/ds1624_28x.html. Maybe you can use that as inspiration.
that sounds really hard...
yup! better get an 'X'
i think you are right, only
You can take a look at
Seriously, take a look at
There is something
There is something completely wrong here. Sorry, I do not have the time to get 100% into the case right now, but here are some "I am pretty sure"'s:
From my understanding, the
From my understanding, the eeprom/data command are for the internal eprom....I believe the OP was mentioning an external memory chip.
Not all of the PICAXE chips appear to support the spiin/spiout (aka shiftin/shiftout) commands, hence my reason to point out the manual has documention for sub procedures that should do a similar job for those chips that don't support them. Page 156 of the picaxe manual(commands) mentions this and specificly states spi enabled eeprom memory. I wouldn't say I'm completely wrong.....yes/no?
eeprom and data are only for
eeprom and data are only for internal memory, yes.
i'll check the spi/shift and the other sub procedures, and see if i can get something useful out of it :)