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.

Setting EEPROM in ASM30

Status
Not open for further replies.

Diver300

Well-Known Member
Most Helpful Member
I'm using MPLAB to program a PIC24F16KA101, and the assembler is ASM30.

I can program data into the program space by setting a location with a .org directive and .pword directives, like this:-
Code:
.org   0xA5FC - 0x204
.pword 0xFF6577,0xFF7562,0xFF2e6b,0xFF756d

Is there some equivalent way of putting data into the eeprom?
 
If I remember right, for the 16 bit PICs, you set the origin at 0xF00000 to assign data to the EEPROM

As far as I know that works for PIC24 and DSPIC etc., if the particular device includes EEPROM - not all do.


Edit - there again, looking at the data sheet, it could be 0x7FFE00h
I may be getting mixed up between PIC families..
 
I've managed to set the .org command to set program memory as follows:-

.org 0x2BF0 - 0x204
.word 0x6577;

That sets program location 0x2BF0 to be 0x006577

However, when I try
.org 0x7FFEA0 - 0x204
.word 0x6577;

it doesn't compile, with or without the -0x204, and it gives the following error message:-

lin_step_01.o: Link Error: Could not allocate section .text, size = 8388258 PC units, attributes = code Link Error: Could not allocate program memory

It seems to be trying to zero all the locations from 0 to 0x7FFEA0.

When I inlcude
.org 0x2BF0 - 0x204
.word 0x6577;
all the memory locations from the end of my code to 0x2BF0 become zero, and that is what makes me think that setting .org to a higher address will try to make all the locations below it equal to zero, which isn't possible and causes the error.
 
Could you write to EEPROM in code and then download the whole chip. The hex file should contain the address to use to write EEPROM.

Mike.
 
Ok I did that, but either it didn't help or I couldn't see how to use it.
The .hex file contained
:020000040000FA
:1000000004020400000000010002000100020001DF
........
:0200000400FFFB
:10FC0000ABAB0000FFFF0000FFFF0000FFFF0000A4

The "40204" is what is at the start of memory, and the "ABAB" is what I put at the start of EEPROM

That seems to have an offset of 0xFF but any variation of that still gives the same error.
 
Long time since I've looked at a hex file but if you lookup the format you should be able to work it out.

Mike.
 
I've not used ASM30, but in the older 14 bit assemblers the assembler instructions told you how to include EEPROM data in the source code, I'd like to think that ASM30 does as well?.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top