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 / 1876
1875  |  1877
Subject: 
Re: Watching Arrays
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Thu, 17 Aug 2006 17:09:01 GMT
Viewed: 
10474 times
  
In lugnet.robotics.rcx.nqc, Rob Antonishen wrote:
How can I view the contents of the array at run time?  "Watch the Brick"
shows me Var0 to Var 31 but these don't seem to relate/contain the
values I initially entered into the array.


The way to do this is to find out the variable number assigned by NQC to your
array variable and then watch that variable number plus all the ones up through
the size of your array.  You can find out the variable number by viewing the
code listing (F12) after you compile your program in BricxCC.  At the top of the
listing will be a section which maps variable names to their assigned numeric
value.

Here's a sample program:

int aaa;
int bbb,ccc;
int values[10];

task main()
{
  aaa = 10;
  bbb = 20 * 5;
  ccc = bbb;
  ccc /= aaa;
  ccc -= 5;
  aaa = 10 * (ccc + 3);
  values[0] = aaa;
  values[1] = bbb;
  values[2] = aaa*bbb;
  values[3] = ccc;
}

And here is its listing:

*** Var 0 = aaa
*** Var 1 = bbb
*** Var 2 = ccc
*** Var 3 = values

*** Task 0 = main, size: 76 bytes
000 pwr      ABC, 7                            13 07 02 07
004 dir      ABC, Fwd                          e1 87
006 setv     var[0], 10                        14 00 02 0a 00
011 setv     var[1], 100                       14 01 02 64 00
016 setv     var[2], var[1]                    14 02 00 01 00
021 divv     var[2], var[0]                    44 02 00 00 00
026 subv     var[2], 5                         34 02 02 05 00
031 setv     var[0], 10                        14 00 02 0a 00
036 setv     var[47], var[2]                   14 2f 00 02 00
041 sumv     var[47], 3                        24 2f 02 03 00
046 mulv     var[0], var[47]                   54 00 00 2f 00
051 setv     var[3], var[0]                    14 03 00 00 00
056 setv     var[4], var[1]                    14 04 00 01 00
061 setv     var[5], var[0]                    14 05 00 00 00
066 mulv     var[5], var[1]                    54 05 00 01 00
071 setv     var[6], var[2]                    14 06 00 02 00

Total size: 76 bytes

You would want to watch variables 3 - 12 in order to watch all 10 elements in
the values array.

John Hansen



Message has 1 Reply:
  Re: Watching Arrays
 
(...) Thanks John! I never knew about that F12 thing :) -Rob A> (18 years ago, 17-Aug-06, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  Watching Arrays
 
I have a program (RCX2 target) that uses a couple of global arrays. I am using BricxCC 3.3 How can I view the contents of the array at run time? "Watch the Brick" shows me Var0 to Var 31 but these don't seem to relate/contain the values I initially (...) (18 years ago, 17-Aug-06, to lugnet.robotics.rcx.nqc)

3 Messages in This Thread:

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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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