Solved

Borland C V3.1 embedded design

Posted on 2002-07-03
4
242 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
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 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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 and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now