ls027b7dh01_end_draw ls027b7dh01_wprint navigation bar

Table of Contents

ls027b7dh01_print

Prints to the Sharp LS027B7DH01 LCD display.

Description

The ls027b7dh01_print function prints text to the Sharp LS027B7DH01 LCD display. If the display is not in drawing mode then it will be updated immediately. If the display is in drawing mode then it will not be updated until the call to ls027b7dh01_end_draw.

Unrecognized characters are skipped. If more than 25 characters would be printed on a line then the line is truncated. A newline will cause the characters to be displayed on the next line. Up to 12 lines may be displayed.

Printing starts at the given line and column. Line 0 is the first line and column 0 is the first column. For example:

    ls027b7dh01_print(display, 0, 0, "Hello world", 12);
        

will print "Hello world" starting in the top, left corner of the display. The format string is Unicode.

Prototype

t_int
ls027b7dh01_print(t_ls027b7dh01 display, t_uint line, t_uint column, const char* message, size_t length);
    

Parameters

t_ls027b7dh01 display

A handle to the display returned by the ls027b7dh01_open function.

t_uint line

The line number at which to start printing. Line numbers may range from 0 to 11.

t_uint column

The column number at which to start printing. Column numbers may range from 0 to 24. If the text extends beyond the last column it is truncated.

const char * message

The message to print as a Unicode UTF-8 string. Printing will stop if an invalid character is encountered.

A newline, '\n', in the message will cause the output to move to the next line of the display. Hence, the string "Hello\nworld" will print "world" below "Hello".

If a formfeed, '\f', character is encountered in the message it will cause the display to be cleared. Hence, a formfeed is usually only used as the first character in the message text.

A character in the range '\020' to '\027' will use the corresponding user-defined glyph created using the ls027b7dh01_set_character function.

size_t length

The maximum number of code units to print from the message argument.

Return value

The return value is the number of code units printed if the operation is successful. Otherwise a negative error code is returned. Error codes are defined in quanser_errors.h. A suitable error message may be retrieved using msg_get_error_message.

Error codes

QERR_INVALID_ARGUMENT

One of the arguments is invalid.

Requirements

Include Files

Libraries

quanser_lcd_display.h

quanser_devices.lib;quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

Examples

t_ls027b7dh01 display;
t_error result = 
    ls027b7dh01_open("spi-cpu://localhost:1?word='8',baud='45000000',polarity='on',phase='on',memsize='8192',frame='0'", LCD_ACCESS_EXCLUSIVE, &display);
if (result == 0) {
    const char message[] = "Hello amigo!\nCiao for now!";
    ls027b7dh01_print(display, 0, 0, message, ARRAY_LENGTH(message));
    ...
    ls027b7dh01_close(display);
} else {
    TCHAR message[512];
    msg_get_error_message(NULL, result, message, sizeof(message));
    _tprintf(_T("Failed to open LCD display. %s (error %d)\n"), message, -result);
}
    

See Also

 

navigation bar