?
Solved

Borland C V3.1 embedded design

Posted on 2002-07-03
4
Medium Priority
?
250 Views
Last Modified: 2010-04-15
Can anyone assist with a Borland C V3.1 problem. I am using battery backed up ram in an embedded system and have some variables I do not want initialized on reset or power up. How do I overcome this problem ?

Thank you
CarlB
0
Comment
Question by:carlbeck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:havman56
ID: 7126440
declare those variables as local in stack.. dont initialise it!

see if it is global then it will be in .bss section  so during ur startup routine dont initailse to zero.
0
 
LVL 11

Accepted Solution

by:
dimitry earned 150 total points
ID: 7130298
If it is your embedded system maybe you can simply use some constant physical address for your variables that is not part of DATA segment. In order to access some physical address in real mode you can do next:
#include <dos.h>
#define MY_VAR_SEG    0xHHHH
#define MY_VAR_OFF    0xOOOO

/* for "int" variable */
int far *myVar = (int far *)MK_FP(MY_VAR_SEG,MY_VAR_OFF);

int foo()
{
  *myVar = 25; /* Set 25 to address [0xHHHH:0xOOOO] */
}

0
 
LVL 20

Expert Comment

by:jmcg
ID: 10052530
Nothing has happened on this question in more than 18 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by dimitr [grade B] (only partial answer).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question