Print

Syntax:

    Print string
    Print byte
    Print word
    Print long
    Print integer

Command Availability:

Available on all microcontrollers.

Explanation:

The Print command will show the contents of a variable on the LCD. It can display string, word, byte, long or integer variables.

Example:

    'A Light Meter program.

    'General hardware configuration
    #chip 16F877A, 20
    #define LIGHTSENSOR AN0

    'LCD connection settings
    #define LCD_IO 8
    #define LCD_WIDTH 20                ;specified lcd width for clarity only.  20 is the default width
    #define LCD_DATA_PORT PORTC
    #define LCD_RS PORTD.0
    #define LCD_RW PORTD.1
    #define LCD_ENABLE PORTD.2

    CLS
    Print "Light Meter"
    Locate 1,2
    Print "A GCBASIC Demo"
    Wait 2 s

    Do
        CLS
        Print "Light Level: "
        Print ReadAD(LIGHTSENSOR)          ' <<< Print with a numeric expression -- the syntax variant this page documents
        Wait 250 ms
    Loop

Key line: Print ReadAD(LIGHTSENSOR) — Print accepts the numeric result of ReadAD directly; no string conversion is needed.

See Also:

  • LCD Overview — LCD wiring and configuration background
  • Locate — positioning the cursor before printing, as used above
  • CLS — clearing the display before printing, as used above
  • ReadAD — reading the light level printed in the example above
  • Wait — pausing between readings, as used above

Supported in <LCD.H>