Re: Does any RCX firmware allow a variable to survice shutdown?

"John Hansen" <[email protected]>
Newsgroups gmane.comp.hardware.lego.robotics
Organization None
Message-ID <[email protected]>
In lugnet.robotics, Justin Fisher wrote:
> I program in NQC, using Bricx Command Centre as the dev tools. I currently use
> the Lego firmware 2.0. Is this possible with my current set-up? Is it possible
> with any set-up?

Here's a very simple NQC example using the standard LEGO firmware.

#pragma noinit

int a;

task main()
{
  a++;
}

This simple NQC program will increment global variable zero by one each time it
is run.  You can turn off the RCX and turn it back on as many times as you want.
The value in global variable zero will be retained.

You can use the Watch window in BricxCC to verify that the value is retained and
incremented each time you run this program.  You can use the Direct Control
window to initialize the value of this global variable to whatever you want.
Then turn off the RCX and turn it back on.  Run this program.  Poll the variable
using the Watch window.  It will be incremented by one.

Hope this helps,

John Hansen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.