Page 142 - The Unofficial Guide to Lego Mindstorms Robots
P. 142
131
(table continued from previous page)
Table 6-7. LCD Segment Numbers (continued)
S egment Number (hex) Sequence? Description
301D no Long range download indicator
3 020 no All segment (LCD_SHOW only)
Conveniently, you can clear the entire display with a single word:
LCD_CLEAR ( -- )
Th is word clears the RCX's display so that no segments are lit.
In put Control Words
B efore you configure inputs or read values from them, you should initialize pbFORTH's inpu t system with the following word:
S ENSOR_INIT ( -- )
This word initializes pbFOR TH's input system. Call it once before working with inputs.
Configuring inputs
You probably remember that the RCX's inputs may be powered. The light sensor, for example, is powered from an input.
T hese types of sensors are called active, all others are passive. In pbFORTH, the following words determine whether an input
is active or passive:
SENSOR_ACTIVE (in dex -- )
SENSOR_PASSIVE (index -- )
These words set the input described by index to be active (powered ) or passive. The index value should be 0, 1, or 2,
c orresponding to input 1, 2 or 3.
You can configure an input for a particular type and mode, just as in NQC:
SENSOR_TYPE (type index -- )
T his word sets the type of an input, which describes the electrical characteristics of the sensor you. plan to attach. The values
for type are shown in Table 6-8. As before, index should be 0, 1, or 2.
T able 6-8. Input Type Values
Value Description
0 Raw
1 Touch senso
2 Temperature sensor
(table continued on next page)