Description

This EEPROM programmer reads, writes and erases I²C 24C EEPROM devices. It has a PC serial port interface. The programmer needs 5VDC power supply. It can read or write one page (16 bytes) at a time by programming the page with a terminal program such as hyperterminal, no external software is needed to read or write to the EEPROM. At the moment only the 24C32 is tested with the programmer but it might work also with other I2C EEPROM devices. The 24C32 has 4096 bytes, that are 256 pages.

The programmer contains the AT2313 microcontroller which connects to the RS232 serial port of the PC through the MAX232 line driver. The microcontroller has software configured I2C bus which is connected to the I2C EEPROM device. The software inside the AT2313 receives commands and data from the terminal program through the RS232 port. The software translates the commands and data into serial datastreams for the I2C bus and sends it to the EEPROM. The commands contain read or write instruction for the I2C EEPROM. The target device is placed in a DIP8 socket.

The software for the microcontroller is made with the BASCOM AVR compiler. You can find more information how to interface a I2C EEPROM to a microcontroller at:

Usage

BASCOM AVR project file

' *****************************************************************************
' * Title : EEPROM programmer.bas
' * Last Updated : 05.03.2006
' * Target device: At90s2313, 24C32
' * Author : www.avrprojects.net
' * Program code : BASCOM-AVR
' * Hardware req. :
' * Description :
' * This application reads and writes one page at a time to an 24c32 EEPROM connected to an
' * AT2313 microcontroller.
' *****************************************************************************
Dim D_w As Byte , D_r As Byte , Adress As Byte , E_adr As Byte , E_dat As Byte , I As Byte , Count As Byte

Dim Rw As String * 1 , Datastr As String * 32
Dim E_data(16) As Byte

Config Scl = Portb.0                                        'assign the SCl line to PORTD.0
Config Sda = Portb.1                                        'assign the SDA line to PORTD.1

'Declare Sub Byteread
'Declare Sub Bytewrite
Declare Sub Pagewrite
Declare Sub Pageread

Main:
Do
Input "(R)ead page / (W)rite page?" , Rw
If Rw = "R" Or Rw = "r" Then Goto Read_eeprom
If Rw = "W" Or Rw = "w" Then Goto Write_eeprom
Loop
End                                                         'end program

Read_eeprom:
Do
Input "Read EEPROM page :" , Adress
Print Adress ; ":" ;
E_adr = Adress * 16
Call Pageread
For I = 1 To 16
Print E_data(i) ; ",";
Next I
Print
Loop

Write_eeprom:
Do
Input "Write EEPROM page :" , Adress
For I = 1 To 16
Input "Input byte ";i;" :" , E_data(i)
Next I
Print Adress ; ":"
For I = 1 To 16
Print E_data(i) ; ",";
Next I

E_adr = Adress * 16
Call Pagewrite

Print

Loop

'********** page write to EEPROM ***************************************************
Sub Pagewrite
I2cstart                                                    'generate start
I2cwbyte &B1010_0000                                        'send device address
I2cwbyte &H00                                               'H adress of EEPROM
I2cwbyte &H00                                               'L adress of EEPROM
For I = 1 To 16
D_w = E_data(i)
I2cwbyte D_w                                                'data to EEPROM
Next Adress
I2cstop                                                     'stop condition
Waitms 10
End Sub Pagewrite

'********** page read from EEPROM **************************************************
Sub Pageread
I2cstart                                                    'generate start
I2cwbyte &B1010_0000                                        'send device adsress
I2cwbyte &H00                                               'H address of EEPROM
I2cwbyte E_adr                                              'L address of EEPROM
I2cstart                                                    'repeated start
I2cwbyte &B1010_0001                                        'slave address (read)
For I = 1 To 16
I2crbyte D_r , Ack                                          'data to EEPROM
E_data(i) = D_r
Next I
I2crbyte D_r , Nack                                         'read byte from EEPROM
I2cstop
End Sub Pageread                                            'generate stop


'********** byte write to EEPROM ***************************************************
'Sub Bytewrite
'I2cstart                                                    'generate start
'I2cwbyte &B1010_0000                                        'send device address
'I2cwbyte 0                                                  'H adress of EEPROM
'I2cwbyte 0                                                  'L adress of EEPROM
'I2cwbyte D_w                                                'data to EEPROM
'I2cstop                                                     'stop condition
'Waitms 10
'End Sub


'********** byte read from EEPROM **************************************************
'Sub Byteread
'I2cstart                                                    'generate start
'I2cwbyte &B1010_0000                                        'send device adsress
'I2cwbyte &H00                                               'H address of EEPROM
'I2cwbyte &H00                                               'L address of EEPROM
'I2cstart                                                    'repeated start
'I2cwbyte &B1010_0001                                        'slave address (read)
'I2crbyte D_r , Nack                                         'read byte from EEPROM
' I2cstop                                                     'generate stop
'End Sub Byteread