PDA

View Full Version : Eeprom question



karenhornby
- 18th April 2008, 16:22
I know lots will say use the search button and google it, but the answers I've come across are too complex and not in simple simple enough words.

My question is:

How do you attach an Eeprom to a Pic and store parts of the program in it and then call that when running the program in the Pic

for example If I was to play with "Roman Black Sound" program/examples it needs way more space than is in the Pic, i.e. needs an eeprom, how would I connect the eeprom and address it while writing and reading

Hope I've explained my question enough for people to understand what I'm asking.

skimask
- 18th April 2008, 16:31
Depends on how much data you want to store off chip.

Standard serial eeprom (i.e. 24LC256 type) - easily done, 32K (or more depending on chips used) off PIC storage, PBP supports it directly (thru I2CRead/I2CWrite commands), and so on...(and you could program the chip directly using the PICKIT2)

ATMEL Dataflash chip - not as easy as a 24LC256 type, only uses a few pins, can use PBP's ShiftIn/ShiftOut instructions to access the memory. But you have to learn how to access it first (not sure if the PICKIT2 can program those directly, I don't think so, but I could be wrong)

SD card - not so easily done, a few more pins than a 24LC256, have to write your own software/shifting code to access the card, but you can store a load of data on it obviously. Could load the files onto the card and then plug it in but you still have to write the software to access the FAT16/FAT32 data on it.

Hard drive/Compact Flash card - again, not so easily done, cheap, but uses a lot more pins than either of the above methods. And again, have to write your own routines to access the drive in IDE mode.

Probably a few more methods I've forgotten....

EDIT: and there is...
You could get a large PIC such as a PIC18F8722 and use it in the 'Microprocessor' mode where all of your program and data is stored off the PIC and accessed thru an Address and a Data bus (like the old school Z-80/6809E/6502/etc but with more memory and a lot more options and speed).

xnihilo
- 18th April 2008, 23:29
I will be using the same stuff.

PIC16F684 and 24LC08B EEPROM from Microchip

I will use:

counter VAR BYTE
counter = 25
getcounter VAR BYTE
getcounter = 0

'datapin PORTC.4
'clockpin PORTC.5
'block 0 from 4, address 0 of the 256bytes block

I2CWRITE PORTC.4,PORT5,%10100000,0,[counter]
PAUSE 10
I2CREAD PORTC.4,PORT5,%10100000,0,[getcounter]

and getcounter will obtain the value of 25, right?

Connect pins 1 - 4 and 7 to GND.
Connect pin 8 to VDD
Connect pins 5 and 6 to VDD thru 4.7K wpu
Connect pin 5 to PORTC.4
Connect pin 6 to PORTC.5

Right?

mister_e
- 18th April 2008, 23:38
In theory YES, in in reality no. You should read the following link carefully.

I2CRead & I2CWrite not working as expected
http://www.picbasic.co.uk/forum/showthread.php?t=587

AND THEN read also carefully your datasheet, cause you'll need to modify the way to write your ControlByte AND the Address variable to follow the exact requirement. (ie. how to access all 4 different 256 Bytes block of your EEPROM)

Page 6 of this PDF
http://ww1.microchip.com/downloads/en/devicedoc/21710c.pdf

rmteo
- 18th April 2008, 23:55
My question is:

How do you attach an Eeprom to a Pic and store parts of the program in it and then call that when running the program in the Pic

Hope I've explained my question enough for people to understand what I'm asking.

I don't think you can do that with serial EEPROM.

mister_e
- 18th April 2008, 23:59
I think he meant the Audio File, 'cause Romans's Black software is not that big.

Even if it's true, i have some doubt of the sound quality at the end, should be longer to access the EEPROM than the code space huh?. Never tested it though.

xnihilo
- 20th April 2008, 20:21
In theory YES, in in reality no. You should read the following link carefully.

I2CRead & I2CWrite not working as expected
http://www.picbasic.co.uk/forum/showthread.php?t=587

AND THEN read also carefully your datasheet, cause you'll need to modify the way to write your ControlByte AND the Address variable to follow the exact requirement. (ie. how to access all 4 different 256 Bytes block of your EEPROM)

Page 6 of this PDF
http://ww1.microchip.com/downloads/en/devicedoc/21710c.pdf

Thank you!