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.

How to write in 24C512 EEPROM??........................

Status
Not open for further replies.

hassanmd

Member level 1
Joined
May 31, 2007
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,554
24c512

hi fellows
i have data in my comuter , i want to save this data in 24C512 EEPROM.
how can i do this?
does it nead µC or PIC ?
actually i have sound data ,which is aquired through matlab. and now i have its matrix. actually i want to bulid embeded system ,without computer ,which can use data from EEPROM and through D2A i can hear voice from speaker.

any piece of infromation you know plz share!!!!!!!!!!!:!:
 

i2c 24c512

Hi,
There could be some methods but u need to use PIC or any other MCU that can work on I²C and UART .
Data you made it MATLAB is in double format you need to store data in 8-bit structure , do proper conversion.
send data through UART and MCU is going to receive that and will save it into an EEPROM.
 

how to write eeprom

Hi,

the simplest way to program the 24C512 is via the parallel port, if you have one, of your computer. The program can be done with Visual Basic to read the data file and serialise each byte into bits and then clock out each bit using a second line of the port. You will need to read the 24C512 datasheet very thoroughly to understand its addressing and timing requirements, it's quite a demanding project if you are not very familiar with VB or interfacing but should be fun.

It should be possible to make a system to play your sound file through a D2A without using a micro but I'd be tempted to use a parallel EEPROM, imagine a crystal which clocks a counter - the counter is attached to the address bus of the EEPROM and at switch-on starts from 0 and the output of the EEPROM is applied to the D2A, the counter increments to the next address and so on...

I think the important thing is that the crystal frequency should match the notional sampling rate of the original data.

Best of Luck
 

    hassanmd

    Points: 2
    Helpful Answer Positive Rating
24c512 eeprom

AndromedaStrain said:
Hi,

the simplest way to program the 24C512 is via the parallel port, if you have one, of your computer. The program can be done with Visual Basic to read the data file and serialise each byte into bits and then clock out each bit using a second line of the port. You will need to read the 24C512 datasheet very thoroughly to understand its addressing and timing requirements, it's quite a demanding project if you are not very familiar with VB or interfacing but should be fun.

It should be possible to make a system to play your sound file through a D2A without using a micro but I'd be tempted to use a parallel EEPROM, imagine a crystal which clocks a counter - the counter is attached to the address bus of the EEPROM and at switch-on starts from 0 and the output of the EEPROM is applied to the D2A, the counter increments to the next address and so on...

I think the important thing is that the crystal frequency should match the notional sampling rate of the original data.

Best of Luck
very very helpful ,and we are working with parallel 2764 eeprom . thanks:D:D

Added after 11 minutes:

saeed_pk said:
Hi,
There could be some methods but u need to use PIC or any other MCU that can work on I²C and UART .
Data you made it MATLAB is in double format you need to store data in 8-bit structure , do proper conversion.
send data through UART and MCU is going to receive that and will save it into an EEPROM.
tnkx for telling abt coversion.
 

24c512 byte write problem

rss
 

vb6 reading eeprom data

Hi,

Thanks for the feedback - glad to help, will be interesting to hear the results of your work.

Best of luck
 

microchip 24c512 datasheet

24xx512.h


#include "i2c.h" /* Need i2c bus */

#define EEPROMS_ID 0xA0 /* Microchip 24xx512 */

unsigned char EEPROM_get(unsigned int addr)
{
unsigned char dat;

I2C_start(); /* Start i2c bus */

I2C_write(EEPROMS_ID); /* Connect to EEPROM */
I2C_write(addr&0xF0); /* Request RAM address (Hight byte) */
I2C_write(addr&0x0F); /* Request RAM address (Low byte) */

I2C_start(); /* Start i2c bus */

I2C_write(EEPROMS_ID+1);/* Connect to EEPROM for Read */
dat = I2C_read(); /* Receive data */

I2C_noack();

I2C_stop(); /* Stop i2c bus */

return dat;
}

void EEPROM_set(unsigned int addr, unsigned char val)
{
I2C_start();

I2C_write(EEPROMS_ID); /* Connect to EEPROM */
I2C_write(addr&0xF0); /* Request RAM address (Hight byte) */
I2C_write(addr&0x0F); /* Request RAM address (Low byte) */

I2C_write(val); /* Write sec on RAM specified address */

I2C_stop(); /* Stop i2c bus */
}

Added after 52 seconds:

i2c.h

#define SDA P2_2 /* Set P2.7 = SDA */
#define SCL P2_3 /* Set P2.6 = SCL */
#define I2C_DELAY 0x0F /* For delay i2c bus */

void I2C_delay(void)
{
unsigned char i;

for(i=0; i<I2C_DELAY; i++);
}

void I2C_clock(void)
{
I2C_delay();

SCL = 1; /* Start clock */

I2C_delay();

SCL = 0; /* Clear SCL */
}

void I2C_start(void)
{
if(SCL)
SCL = 0; /* Clear SCL */

SDA = 1; /* Set SDA */
SCL = 1; /* Set SCL */

I2C_delay();

SDA = 0; /* Clear SDA */

I2C_delay();

SCL = 0; /* Clear SCL */
}

void I2C_stop(void)
{
if(SCL)
SCL = 0; /* Clear SCL */

SDA = 0; /* Clear SDA */
I2C_delay();

SCL = 1; /* Set SCL */

I2C_delay();

SDA = 1; /* Set SDA */
}

bit I2C_write(unsigned char dat)
{
bit data_bit;
unsigned char i;

for(i=0;i<8;i++) /* For loop 8 time(send data 1 byte) */
{
data_bit = dat & 0x80; /* Filter MSB bit keep to data_bit */
SDA = data_bit; /* Send data_bit to SDA */

I2C_clock(); /* Call for send data to i2c bus */

dat = dat<<1;
}

SDA = 1; /* Set SDA */

I2C_delay();

SCL = 1; /* Set SCL */

I2C_delay();

data_bit = SDA; /* Check acknowledge */
SCL = 0; /* Clear SCL */

I2C_delay();

return data_bit; /* If send_bit = 0 i2c is valid */
}

unsigned char I2C_read(void)
{
bit rd_bit;
unsigned char i, dat;

dat = 0x00;

for(i=0;i<8;i++) /* For loop read data 1 byte */
{
I2C_delay();

SCL = 1; /* Set SCL */

I2C_delay();

rd_bit = SDA; /* Keep for check acknowledge */
dat = dat<<1;
dat = dat | rd_bit; /* Keep bit data in dat */

SCL = 0; /* Clear SCL */
}

return dat;
}

void I2C_ack()
{
SDA = 0; /* Clear SDA */

I2C_delay();

I2C_clock(); /* Call for send data to i2c bus */

SDA = 1; /* Set SDA */
}

void I2C_noack()
{
SDA = 1; /* Set SDA */

I2C_delay();

I2C_clock(); /* Call for send data to i2c bus */

SCL = 1; /* Set SCL */
}

Added after 1 minutes:

EEPROM_set (Position,Data) // for writing

EEPROM_get(Position) //for Reading

*** Position is the index or location
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top