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
Solved

Borland C V3.1 embedded design

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adjust Mfcapp 29 172
SQL handling single and double quotes 3 97
An API detour question 7 93
Memory going from 12gb to 64gb or 96gb. worth it? 15 203
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 how to create, access, and change arrays in the C programming language.

839 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