Page 206 - The Unofficial Guide to Lego Mindstorms Robots
P. 206

195


          lcd_clock(t)
          This macro simulates showing a digital clock on the  display. The supplied number is shown as a time, with the decimal point
          between th e first two and last two digits.

          lcd_digit(d)
          U se this macro to display a single digit on the right side of the display.

          T he RCX's display contains many symbols, as well— indicators for the outputs, inputs, datalog, battery level, download status,
          and others. Each display segment can be c ontrolled individually:

          void lcd_show(lcd_segment segment)
          Show a single display segment with this function. T he lcd_segment enumeration is defined inrom/lcd.h; the comments in
             fil
          that  e describe each segment type. To show the low battery indicator, for example, you would do this:

              lcd _show(battery_x);
              lcd_refresh();

          v oid lcd_hide(lcd_segment segment)
          This function hides a specific display segment.
          F inally, to clean up when you're done playing, use lcd_clear():

          v oid lcd_clear(void)
          This functi on clears the entire display. (You still have to call lcd_refresh() afterwards.)

          As your pr ogram is running, legOS will try to animate the running man. Keep this in mind as it may modify your display
          u nexpectedly.

          Text, kind of (conio.h )

          The conio.h file defines several functions that are handy for display ing text on the RCX:

          void cputs(char ∗s)
          T his function displays the supplied string, as nearly as possible. Only the first five characters of the string are shown. Letters
          like "w" and "m" don't come out very well, but  overall this is a great function for debugging.

          void cputc(char c, int pos)
          U se this method to display a character at the given position. Valid positions are 0 through 4, where 0 is the right-most position
          (the single digit at the right of the display) and 4 is the  left-most position.

          void cputw(unsigned word)
          T his function displays the supplied value as four hexadecimal digits.
   201   202   203   204   205   206   207   208   209   210   211