Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pickit 2: downloading data onto 25LC serial eeprom

Status
Not open for further replies.

astronomerroyal

New Member
I'm trying to understand the procedure for getting some data from my PC onto a 25LC512 serial EEPROM chip using Pickit 2.

What I've got thus far: I found the pickit2/25LC pin connections hidden away in the Pickit 2 readme file. I've selected my device (25LC512) in Pickit 2 application.

Do I now simply need to import my data into Pickit 2 software as a hex file? If so, how do I get tabulated data from a text file (each datum is a single byte) into hex format?

Am I supposed to be doing this...
Intel HEX - Wikipedia, the free encyclopedia?

Code:
hypothetical contents of my current .txt file. 
7   4   6
2   9   2
6   8   8
...

Update: As soon as I submitted this post I realised I should check the reference section of the wikipedia article. Lo and behold, a ref to . I was able to get a series of bytes (the digits 1 to 8) to show up in the Pickit 2 'program memory' window.

Code:
:08001000010203040506070800

My question is now; do you have a recommended method for text to hex conversion, one that can turn my example column data into blocks of hex-formatted bytes?
 
Last edited:
I have done this with my junebug but it has been a while.
The easiest way to generat a HEX file is with the assembler. An ORG 0 statment to set the address followed by whatever data definitions you need. Most assembler have a few data directives like define_byte, define_word, and define string. Its easy the man said. :)

Inside the PICkit2 tool you have to do a few clicks to first select EEPROM>25LC and then select the specific device.
After that import the hext and program.

HTH
 
Thanks. I'll look into that. Perhaps also try and just make the hex file directly from the raw data. The data are actually signed floats so I'm sure I'm going to screw this up. Still, 30 minutes ago a hex file was a complete mystery, but now it doesn't seem so intimidating.

A while later ...

I threw a byte datatable written in assembly at MPASM

Code:
org 0
db 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
db 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
db 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
end

and the resultant hex file was

Code:
:020000040000FA
:1000000001020304050607080102030405060708A8
:1000000001020304050607080102030405060708A8
:100000000102030405060708B4
:00000001FF

Which makes sense, although I'm not entirely sure I know what the first and last lines are getting at. Progress, but it doesn't help me much as I still have to break up my datatypes into bytes - which is presumably what 3v0's 'define_byte, define_word, and define_string' comment referred to...
 
Last edited:
My question is now; do you have a recommended method for text to hex conversion, one that can turn my example column data into blocks of hex-formatted bytes?

do you know how to program in any PC based language? VB, C?
If so you can easily make a text to hex file converter.

how is it separated? Need more info.
 
Last edited:
do you know how to program in any PC based language? VB, C?
If so you can easily make a text to hex file converter.

how is it separated? Need more info.

The data are a series of x,y,z coordinates (each ideally a float) that I generated using IDL. In IDL I can write a text file very easily, with any formatting I desire. (In fact I just now see that there's a convenient function that turns an integer number into a Hex string.)

I'm learning C (but only in the context of 18F pics). How would you suggest I attack the problem, given that I can format the txt file however I please?

Dying to know...
 
I have no idea what IDL is.

You may want to give C programming on the PC a try. Try using visual studio C++. It is possible to write pure C in that C++. It is a nice IDE. (Integrated Development Enviroment).

About the only tricky bits will be file handling and even that is not too bad. Execpt for that most of what you learn will be useful on the PIC18.

3v0
 
I normally do things like this in Excel using Visual Basic for Applications. I have routines to convert a decimal number into a 32 bit float. It would be relatively easy to modify them to do 64 bit if needed. It would also be fairly trivial to output a hex file from a list of floating points.

Do you have some sample data?

Mike.
 
IDL is the Interactive Data Language, often used in astronomy and other sciences. Expensive license. Good for high level data manipulation; plots, images, data post-processing etc.

I use a Mac, my PC is barebones, bought it just for MPLAB. No MS Office. since I'm generating the data in IDL I think I should just try and write my blocks of hex there. I think it might be very easy. If I do anything in C I should probably use Mac's Xcode, as I've wanted to learn how to use that.

Thanks for the replies, I'll try and remember to post a progress report.
 
Last edited:
bin2hex

If your application is able to generate raw data, you could use 'bin2hex' to generate an Intel hex file from it. I have done this in the past so that I could dump data onto a serial eeprom using a PICKIT2. IIRC it can be downloaded readily and will run in a DOS window.
 
Here is how I created an INHX32 file that I was able to load onto a 24LC512 i2c eeprom using a PICkit2 from my Mac;

first I took my regular text file and removed all of the newlines using BBEdit (plain text editor, Bare Bones Software | BBEdit 9).

Next I converted the text document to regular HEX file using Hex Fiend (hex editor, Hex Fiend, a fast and clever hex editor for Mac OS X)

Then I added the control character '\x02' at the beginning and '\x03' at the end. The file is now in the 'Ascii Hex' format.

Next I downloaded and installed SRecord (SRecord 1.53) using MacPorts (The MacPorts Project -- Home) Once SRecord is installed I used it to convert the Ascii Hex file into Intel Hex using the command;
Code:
srec_cat [I]<your ascii hex filename>[/I] -ascii_hex -output [I]<your output file>[/I] -intel
 
Status
Not open for further replies.

Latest threads

Back
Top