Programming eeprom with data

Texy

Senior Member
Hi folks,
now that the X2 range is about to hit us, I,m back onto my project;)

This is slightly off topic.....
I need to load a lookup table into an eeprom - 1024 words long. Before I used an 'axe to load 256 words(or bytes, can't remember) at a time, modified the program for the next batch, etc, etc, but was a pain to do frankly. I have the data in excell - would I be able to cut n paste into MPLAB somehow to program the chip that way? I have a picstart+, ICD2 and a (new, clone) pickit2 at my disposal.
Any idea's?
Cheers,
Texy
 

hippy

Ex-Staff (retired)
I believe the PICkit 2 supports download into I2C Eeprom and that should be described in the user documentation. A simple download board to support it and an assembled file with your data pasted into it would probably be the mechanism they suggest. I don't know what your clone 'PICkit 2' or other Microchip products would support. The Microchip forum may be the best place to ask and there may be more information on doing that via Google.
 

Texy

Senior Member
Cheers for the reply hippy. I believe that all three of my programmers are capable of programming eeproms. The pickit2 hardware/software has been open-sourced by microchip, so I,m assuming that its as 'real' as possible.
(Incidently it took less than a week from china via fleabay - very impressive, for all of £27 all in!!). My problem as such is how to generate the hex file - how do I format the source file, if it is one? I read on the microchip forum that someone previously used icprog and entered the individual bytes. I,d rather not do that if I can copy from my spreadsheet.

Texy
 

Texy

Senior Member
The 'table' command

Doesn't time fly...only now have I plugged in my new 28X2 chip and begun experimenting!
The thought occured to me that with the increased program memory of the 28X2 chip that I could now do away with the external eeprom altogether
and store the lookup table internally. Recap - I need to store 1024 words of
data, ie 2048 bytes. Looking at the picaxe manual, it seems to suggest that only 256 byes can be stored using the 'table' command, or am I understanding this incorrectly?

Cheers,

Texy
 
Last edited:

BeanieBots

Moderator
Quite clearly explained in the manual.

Only 256 bytes of EEPROM.
256 bytes of 'Table'.

Even the (volatile) scratchpad which has a massive 1024 bytes would not be enough for your needs.
Program space is a massive 4096 PER SLOT, but you would not be able to "address" it like you can an external EEPROM.

Don't see any way around having the external EEPROM even with an X2 but that really depends on how/what you are doing with that data.
 

Texy

Senior Member
OK thanks BB. I thought I,d double check with you guys as I know you have been known to have work arounds for this type of thing. Perhaps Rev-Ed could take a look at the Table command. With the much increased program memory available with the later picaxe chips, perhaps the 256 byte limit could be increased?

Cheers,
Texy
 

AlC

Member
if its just a lookup table with fixed values you could perhaps have said data written down inside your code, and in this way make use of the 4Kbyte program memory.
 

Texy

Senior Member
Well thats what I would like to do, and the 'table' command is just the thing, but it is restricted to only 256 byte of data. I,ll have to go the external eeprom route, which isn't a problem, it would of been easier if I didn't have too.

....then again, if I could work out how to do natural logs then I wouldn't need a lookup table at all......

Texy
 
Last edited:

Andrew Cowan

Senior Member
My project requires natural logs too!

I'm resigned to using a lookup table, as I don't need that many different values.

Unless anyone has any better ideas?

A
 

hippy

Ex-Staff (retired)
Variable Scope

Interesting link, and especially the comments. The idea of variable scope made me sit up and wonder if there was something missing in the manual; there isn't. There is no variable scope.

GetRange:
{
Symbol range = w0
range = 1
Return
}

Range is still defined as w0 and usable in other routines and a second attempt to 'Symbol range' gives an "already defined" error.

All symbols have global scope after they have been defined and can only be defined once. Braces are simply an editing aid, not anything else.

I suspect what happened to give the illusion of variable scoping is 'GetRange:' appeared towards the end of code and using 'range' gives an error earlier in the code. That's correct, Symbol defined names can only be used after the Symbol.
 

Texy

Senior Member
Thanksnfor the link but I've had a good read through it and can't find anything to help? Were you refering to natural logs or storing a large lookup table within the program code?

Texy
 
Last edited:
Top