To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1328
1327  |  1329
Subject: 
Re: Persistent globals
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Mon, 31 Jul 2000 23:17:26 GMT
Viewed: 
1340 times
  
#include <unistd.h>
#include <conio.h>

/*
* This is the real definition of __persistent, it could move
* into some header file...
*/
#define __persistent __attribute__ ((__section__ (".strings")))

/*
* This is how you declare the persistent data:
*/
static unsigned int counter __persistent = 0;

int
main(int argc, char **argv)
{
lcd_number(counter++, unsign, e0);
return 0;
}
-- cut here --

Hope this helps,
Eddie C. Dost
ecd@skynet.be


Hi again!

I have found that this works with scalar variables. However, I need to
make an array persistent. More specifically, I have a 100x100 matrix
containing a population for use with genetic programming and I need to be
able to keep this in memory while the RCX is turned off. Is this possible?

Shure:

static unsigned char matrix[100][100] __persistent = { { 0, }, };


Eddie C. Dost
ecd@skynet.be



Message is in Reply To:
  Re: Persistent globals
 
(...) Hi again! I have found that this works with scalar variables. However, I need to make an array persistent. More specifically, I have a 100x100 matrix containing a population for use with genetic programming and I need to be able to keep this (...) (24 years ago, 31-Jul-00, to lugnet.robotics.rcx.legos)

12 Messages in This Thread:






Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR