Systems Problem Support

  1. The RCX 2 can only hold 32 "global" variables and 16 "local" variables (Where "global" and "local" refer to the SCOPE of the variables):
    • ----------------- PROGRAM START -------------------
    • .....procedure LegoRover is
    • .......Floor : array (1 .. 25) of Integer; ;---------------------Uses 25 global
    • .......Left_Wheel : constant Output_Port := Output_A;-----Uses NO variables
    • .......White : Integer;------------------------------------Uses 1 global
    •  
    • .......procedure DoSomething is
    • .........TestCase : Boolean;-------------------------------Uses 1 local
    • .......begin
    • ......... code here
    • .......end
    •  
    • .....begin
    • ......... code here
    • .....end
    • ----------------- PROGRAM START -------------------
  2. Do NOT use the word "Matrix" as a variable name. It is used in the Ada2NQC translation process.

 

  1. Do NOT use the following syntax in defining your array type, there is a bug with Ada Minstorms / Ada2NQC translator.
    • type Grid is array (1..25) of Integer;
    • Floor : Grid;
    •  
    • USE:
    • Floor : array (1..25) of Integer; -- Like in the above short program example.

 

  1. The Ada/Mindstorms translator only supports a nesting level of 1. (This is a limitation stated in the Ada/Mindstorms manual) This means:

   procedure MainRoverCode is

        procedure Nested1 is

                procedure Nested2 is -- I AM ILLEGAL IN ADA/MINDSTORMS!

                begin

                end;

        begin

        end;

   begin

   end;

  1. There is no reason to put variables declared constant anywhere else but in the 'MainRoverCode' procedure.

 

  1. The translator is rather inefficient about translating for loops. When using the code:

   for I in 1..25 loop

   end loop;

 

The translator will create 2 global variables: one called "I" equal to 1 and another called "I_STOP" equal to 25. You can FORCE a reduction in the number of global variables used by replacing the above for loop code with while loop code:

 

   procedure MainRoverCode is

        I : Integer : = 1;

   begin

        while (I<25) loop

                -- your code

                I:=I+1;

        end loop;

   end