Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Kiran V. Sutar
11/19/14 21:39
Read: 1674 times
Mumbai
India


 
#190378 - How to init a variable in ROM
Dear All,
I am using AT89S52.

The program Length is about 1k.
I need to program the ID of the product.

This ID is to be displayed by the product after Power ON.

I want to give the freedom to my customer to program this ID, But I do NOT want to give the source code. Instead, I will be giving him the HEX file. My customer knows how to download the HEX file into the CPU. I will give him the address of the unused location such as 0xff0, and tell him to program this location with the ID when downloading the program into the CPU.

I have used the following: to read memory location 0xff0:
unsigned char code *Ptr=0xFF0;

ID=*Ptr;

 


This is working fine, no problem.

The problem is:
Whenever I compile the code, this location is initialized to 0xff. I need to initialize this memory location (with a default ID) whenever I compile the source code.

How to initialize an unused ROM location in C?

List of 8 messages in thread
TopicAuthorDate
How to init a variable in ROM      Kiran V. Sutar      11/19/14 21:39      
   You can NOT write to ROM      David Prentice      11/20/14 04:35      
   Hex file      Daniel Contarino      11/20/14 15:18      
   Initialize code      Daniel Contarino      11/20/14 15:27      
   toolchain?      Maarten Brock      11/29/14 01:36      
   Using SDCC...      Oliver Sedlacek      12/11/14 05:50      
   that chip does not have any ROM      Erik Malund      12/12/14 08:50      
   Here is the solution I was looking for      Kiran V. Sutar      12/19/14 08:33      

Back to Subject List