473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PICC Define a variable

I want to define a variable which value cannot be change even power off the micro controller. So i think the variable must stored in flash memory or EEPROM.
How can I define it?
Jan 24 '12 #1
2 1909
Banfa
9,065 Expert Mod 8TB
My memory of PIC programming is that there is a
Expand|Select|Wrap|Line Numbers
  1. rom
keyword added to C that allows you to define a variable that resides in the flash (program) memory of the device and would be read-only.

Check your compiler documentation.
Jan 24 '12 #2
donbock
2,426 Expert 2GB
Do you seek a constant whose value is set when you write the source code and that never changes after that ... or do you seek a variable that your program can alter at run-time, but whose value is retained while power is off?

The first case can usually be accomplished like this:
Expand|Select|Wrap|Line Numbers
  1. static const int variable = 10;
The C Standard doesn't require it, but most compilers for embedded systems will store a variable such as this in the same place that the program instructions go; and that is usually some sort of read-only memory.

The second case is more idiosyncratic. Your hardware needs to have some sort of NVRAM. You need to study your compiler and linker documentation to learn the compiler-specific method of making use of special memory like that.
Jan 26 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: biner | last post by:
Hello, I have file called PARAMETRES that is used in bourne shell script to define variable. In order to do so I put a ". PARAMETRES" line and the script has acces to all the variable defined in...
4
by: Scuttlejo | last post by:
I'm trying to define variable types within a function (Ex: first:String) and I'm receiving error messages when trying to run the code. Is there anything I'm doing wrong? Is there anything with...
8
by: Alex Murphy | last post by:
The first page have the pre-define variable. How to transfer to next php page? Thanks
13
by: michel | last post by:
Hi, i created a class 'test' with a method 'descrlimit()' (no matter). That method is used in a lot of pages in the application, so i need to put this code a lot of time: "Dim odescr As New...
4
by: venkat | last post by:
I have come across some preprossor statements, such as #define PPTR_int #define PPTR_str #define DDAR_baddr & #define DDAR_caddr & What do they mean, but when i compile the code with these...
1
by: jeffbess | last post by:
Hello, I'm trying to make myself a thing that will let me define a variable from a form or text area, say $x, so i can use that to quickly access a url for a website (http://example.com/pages/$x)....
3
by: well_doing | last post by:
I have something like this in declaration. union allInOne{ struct simple_s { int a; int b; } s; struct complex_s { int a; int b;
2
by: Tark Siala | last post by:
hi i worked with VB6 then i changed to C#. i want define Variable thats i can accessed from any Form or Class in my project. in VB6 you can do that by define as "Global" in Module, but in C# i...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
5
by: SV | last post by:
Hi there, I am using ASP.Net 2.0 with VB.Net. I want to define variables. For example I want to create variable of type TableRow and while defining I don't know how many rows i needed. So...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.