ls027b7dh01_print ls027b7dh01_set_character navigation bar

Table of Contents

ls027b7dh01_wprint

Prints to the Sharp LS027B7DH01 LCD display using wide characters.

Description

The ls027b7dh01_wprint function prints text to the Sharp LS027B7DH01 LCD display using wide characters. 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_wprint(display, 0, 0, L"Hello world", 12);
        

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

Prototype

t_int
ls027b7dh01_wprint(t_ls027b7dh01 display, t_uint line, t_uint column, const wchar_t* 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 wchar_t * message

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

A newline, L'\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, L'\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 L'\020' to L'\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 wchar_t message[] = L"Hello amigo!\nCiao for now!";
    ls027b7dh01_wprint(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