NQC Overview LCD Display Contents | Master Index
 RCX   RCX2 

FUNCTIONS / COMMANDS
 
          SelectDisplay()  Select a display mode.
          SetUserDisplay()  Set the LCD display to continuously monitor the specified value.

VALUES / QUERIES
 

OVERVIEW
 
          The RCX has seven different display modes as shown below. The RCX defaults to DISPLAY_WATCH.
 
Mode LCD Contents
DISPLAY_WATCH show the system "watch"
DISPLAY_SENSOR_1 show value of sensor 1
DISPLAY_SENSOR_2 show value of sensor 2
DISPLAY_SENSOR_3 show value of sensor 3
DISPLAY_OUT_A show setting for output A
DISPLAY_OUT_B show setting for output B
DISPLAY_OUT_C show setting for output C

 
          The RCX2 adds an eighth display mode - DISPLAY_USER. User display mode continuously reads a source value and updates the display. It can optionally display a decimal point at any position within the number. This allows the display to give the illusion of working with fractions even though all values are stored internally as integers. For example, the following call will set the user display to show the value 1234 with two digits appearing after the decimal point, resulting in "12.34" appearing on the LCD.
   SetUserDisplay(1234, 2);
The following short program illustrates the update of the user display:
   task main()
   {
      ClearTimer(0);
      SetUserDisplay(Timer(0), 0);
      until(false);
   }
Because the user display mode continuously updates the LCD, there are certain restrictions on the source value. If a variable is used it must be assigned to a global storage location. The best way to ensure this is to make the variable a global one. There can also be some strange side effects. For example, if a variable is being displayed and later used as the target of a calculation, it is possible for the display to show some intermediate results of the calculation:
   int x;
   task main()
   {
      SetUserDisplay(x, 0);
      while(true)
      {
         // display may briefly show 1!
         x = 1 + Timer(0);
      }
   }

 
FUNCTIONS / COMMANDS
 RCX   RCX2 

         SelectDisplay(mode) Overview | Top
         
Select a display mode.
SelectDisplay(DISPLAY_SENSOR_1);	// view sensor 1 


         SetUserDisplay(value, precision) Overview | Top
         
Set the LCD display to continuously monitor the specified value. Precision specifies the number of digits to the right of the decimal point. A precision of zero shows no decimal point.
SetUserDisplay(Timer(0), 0); // view timer 0 



 
VALUES / QUERIES
 RCX   RCX2 

Comments