I have never used external RAM before (beleive it or not :-o ) . Now I am using an NVRAM from Dallas so that in case of power failure the value of some variables is retained. My question is how do I declare the 'Non Volatile External' variable and how do I retreive the previous (pre-power fail) value ?
Hi! - Declare your "nonvolatile"-variables to be placed into the xdata-space - do not use any initial-values - use a function to initialize these variables on demand (first time the system is started, but not on power-up) - the rest will Andy
Suppose I declare an XDATA variable in my program , would it be automatically intialised as zero , for example :
int XDATA non_vol _at_0x0010; //variable at 0010h . . . if(some_event_occured) { non_vol++; //increment var on some event }
Review this thread: http://www.keil.com/forum/msgpage.asp?MsgID=4719 BTW: note that the Keil C51 xdata keyword is lowercase, and you need a space between the _at_ and the address value. (just typos in your post?) BTW2: note that applying bold seems to defeat the <pre> and </pre> tags - the font is no longer monospaced :-(
View all questions in Keil forum