Fill an EEPROM with data from a computer

#1
I have developed a couple of complementary programmes that will transfer date onto an EEPROM via a picaxe. Rather than clogging up the forum with loads of downloads, I have loaded the programmes and the supporting instructions onto a web page as follows.

http://www.eglin.plus.com/PC2EEPROM/PC2EEPROM.htm

I would welcome any comments anyone has to make.

Hope this is of use to someone

eggie
 
#2
I have developed a couple of complementary programmes that will transfer date onto an EEPROM via a picaxe. Rather than clogging up the forum with loads of downloads, I have loaded the programmes and the supporting instructions onto a web page as follows.

http://www.eglin.plus.com/PC2EEPROM/PC2EEPROM.htm

I would welcome any comments anyone has to make.

Hope this is of use to someone

eggie
I am hoping to use your application to load 24LC16B and 24LC256 EEPROMs (AXE110) with text strings, but I expect some modification will be necessary to cater for the different (?) EEPROM page structure and the fact that the AXE110 board uses an 18M2 rather than a 40X2. I've not got to grips with this yet, but appreciate your posting.
 
#3
I have developed a couple of complementary programmes that will transfer date onto an EEPROM via a picaxe. Rather than clogging up the forum with loads of downloads, I have loaded the programmes and the supporting instructions onto a web page as follows.

http://www.eglin.plus.com/PC2EEPROM/PC2EEPROM.htm

I would welcome any comments anyone has to make.

Hope this is of use to someone

eggie
While folks set up external web pages with all good intentions, there are many cases where likes on this PICAXE forum have become broken and the information lost.
This section of the forum is intended for people to post their finished project.
I recommend that you post a copy of the details and PICAXE BASIC program listing directly to this thread for posterity -just in case your website is shut down in 2, 5 or 10 years from now.
 
#4
Noting that eggie is not a high frequency forum visitor I have taken the opportunity/initiative and copied the data from the web page directly here:
(copied verbatim from the external website).
===================================
PC to EEPROM communication via a Picaxe.


This project was inspired by Dr_Acula’s instructables project on how to control real world devices with your PC. This is a development of that project and involves the filling of the complete memory of an eeprom, checking the accuracy of the information and logging any errors. The eeprom can then be used for displaying numerous messages from an index on the Picaxe without using valuable on-chip storage space or programme space for text messages. It will fill an eeprom in the following times using an AXE027 download cable:


Size Time in seconds
64 K 61
128 K 100


The programme is more unreliable at the speed of M16. However with times like the above, who is bothered? – Certainly not me !!


EEPROM Structure.

Eeproms work by having a set number of pages with a set number of bytes in those pages. For development I used an AT24C64B – datasheet here and an AT24C128B – datasheet here. These are structured with 256 pages of 32 and 64 Bytes respectively (the “K” refers to bits, not bytes – but that is still over 8000/16000 characters), so the addresses all start at a multiple of 32/64 and there are 256 entries of 32/64 characters. It is important not to exceed either the number of bytes or the number of pages otherwise the data will start overwriting from the beginning of the respective parts. You can start writing the page at any point but never exceed the maximum page address. e.g. you can start writing the 64K at location 16 on the first page, but can only write a further 16 bytes before it rolls back to the start of the page and overwrites the data at location 0 – location 32 is on the second page


Information File

The base information to be placed on an eeprom is prepared in a comma separated text file using the following format:


<Memory address>,<data>
<Memory address>,<data>
<Memory address>,<data>
&#8230;&#8230;&#8230;&#8230;.etc

An example is found here &#8211; I found it convenient to prepare the data on a spreadsheet and copy it into the text file, especially as the test data was automatically generated. This text file does not download very well &#8211; open the file in the browser and copy and paste into a new text document if you want to use this.



It is important that the text file does not contain anything other than the address and the data &#8211; and this includes spare carriage returns at the start and finish. Do make sure that the data is clean of all other information or you will receive error messages when it is read.

Computer Programme

At the computer end there is a programme that reads the text file a line at a time and transmits this to the picaxe via a download cable attached to the hserin and hserout pins. To install this programme on your computer, Download The Executable File Here &#8211; Unzip the file and run setup.

I am not sure what level of DotNet this requires but it has been created on Windows 7 with the latest update and I have not tried it on any earlier versions of windows. If it does not work then you will need to update your system to the latest DotNet version from Microsoft and it should work.

It has been written with the Visual Basic Express Edition. If you want to look at the full coding; Download The Full Visual Basic Code Here &#8211; This is a solution file that will, once extracted, open in VB Express but you will need to have some VB programming knowledge to make it work.

To run the programme:

  1. select the COM port with the download cable connected to the hserin and hserout pins,
  2. select a file containing the data
  3. amend the data length if it is not 32 bytes
  4. transmit the information to the picaxe


Picaxe Programme

At the other end of the cable is a Picaxe &#8211; Here are the downloads:
  1. Schematic
  2. BAS file for copying into the Programming Editor

How it works:

  1. The picaxe constantly sends out a &#8220;waiting&#8221; code (5)
  2. The computer reads the code and sends a &#8220;ready&#8221; code (6)
  3. The picaxe responds with a &#8220;ready&#8221; code (6)
  4. The computer reads, formats and sends the first line of information followed by an &#8220;end of text&#8221; code (10)
  5. The picaxe reads the incoming data, separates out the address and saves the text to the eeprom at that address
  6. The picaxe then reads back the text from the eeprom and sends it back to the computer followed by a &#8220;line feed&#8221; (10)
  7. The computer reads the line back and compares it with what it has sent, logs success or failure in log files and moves onto the next line
  8. Then back to 4 to repeat the process until the data file is exhausted

Inspecting The Loaded Eeprom

If you want to inspect the data loaded onto the eeprom, copy this programme into the programming editor and run it.
Code:
#no_table
#picaxe40x2
#terminal 9600
setfreq m8

symbol counter = b4 ' general counter
symbol counter2 = b5 ' temporary counter
symbol sendByte = b6 ' data byte for sending
symbol addressTemp = w11 ' temporary storage of address
Symbol TrueAddress = w12
hi2csetup i2cmaster, %10100000, i2cfast_8, i2cword

;for counter2 = 0 to 256
counter = 0
for addresstemp = 0 to 1000 			'loop for number of characters received
	'Addresstemp = counter + counter2	'calculate the position to be read from
	hi2cin addresstemp,(sendByte)		'get the byte from the address
	sertxd (sendByte) 			'display data  on screen
	counter = counter + 1
	if counter = 32 then gosub endofline
next							'loop back to next character
'sertxd (cr,lf)					'send next line instruction to screen
;Next	
end

endofline:
counter = 0
TrueAddress = addresstemp - 31
sertxd(",  ", #trueaddress,cr,lf)
return
Picaxe Forum

I have linked this page to the Picaxe Forum&#8211; if you need to ask any questions, please do so on the forum and I will respond there. However, I am not able to get on the Forum that often, so please be patient !!
 

Attachments

Top