To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1364
1363  |  1365
Subject: 
Re: maximum number of variables in RCX2 ?
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 20 Feb 2002 09:23:56 GMT
Viewed: 
3475 times
  
Hi John,

In lugnet.robotics.rcx.nqc, John Guerquin writes:
When using the RCX2 target, the NQC manual (Section 2.2.4) states that 32
global variables, and 16 local variables (per task) are allowed.  Does this
mean that the whole program can only have 48 variables total when using only
one task, ie. "main" , and several functions?

Yes ! Using more tasks you will get more local space (for each task 16). So
maximum number of variables is 32+(16*10) = 192

The reason I ask this question, is that my understanding of local variables
is that space is allocated only when the function has been called.  Once the
function is complete, the memory that was used to store those local
variables is returned back to the ‘memory pool’.

That's how NQC is handling memory for local variables in functions,
subroutines, tasks. Local has a different meaning for RCX storage location
versus NQC. The firmware handels the memory in the task manner, but the NQC
compiler in the 'normal local variable' manner.

If anyone could clarify
the limitations of NQC variables, as well as how the limitations apply to
arrays, I would greatly appreciate it.

Arrays are handled as normal variables having one name and an index. Array
size is limited to 32 when using it global (no global variable left !) and
16 if using it local. The size of the array must be fixed at compile time.

Hope that helps,

Rainer



Message is in Reply To:
  maximum number of variables in RCX2 ?
 
When using the RCX2 target, the NQC manual (Section 2.2.4) states that 32 global variables, and 16 local variables (per task) are allowed. Does this mean that the whole program can only have 48 variables total when using only one task, ie. "main" , (...) (23 years ago, 20-Feb-02, to lugnet.robotics.rcx.nqc)

5 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