Start of trail LED Strip navigation bar

Table of Contents

LCD Display

Prints to an LCD display.

Library

QUARC Targets/Devices/Third-Party/Displays

Description

LCD Display

The LCD Display block prints a string or an image to an LCD display. The LCD display is typically driven by an I2C or SPI line and so the block takes a URI as an argument to identify the communications protocol with which to communicate with the display. Universal Resource Identifiers (URI), such as i2c-cpu://localhost:8?address=0x3E,baud=400000, are used by QUARC for all its communications because it provides a uniform, extensible and flexible means of identifying the communication protocol to use and the associated communication parameters. Refer to Universal Resource Identifiers for more information.

The LCD Display block supports two display modes: text and image. All LCD displays support text mode. Image mode is only supported by graphical LCD displays, like the Sharp LS012B7DD01, LS027B7DH01 and by the Surenoo WS0010, which has a graphics mode.

In text mode, the LCD Display block takes a fixed or variable-size input string to print to the display. Use the QUARC String blocks, such as the String Constant block or String Print block to generate the string. QUARC strings are fixed or variable-sized uint8 signals that represent UTF-8 unicode strings. Refer to Variable-Size Signals for more information on variable-size signals.

The block also takes a line and column input for specifying the line and column of the display at which to start printing the text. Line 0 is the first line and column 0 is the first column. Hence, leaving these inputs unconnected will cause the text to appear in the top, left corner of the display.

To clear the display, add a formfeed character, '\f', to the string being displayed. For example, to clear the display before printing "Hello world!", pass the string "\fHello world!" to the block.

Newlines will result in the text going to the next line. Hence, the string "Hello\nworld will print "Hello" on the starting line and "world" on the next line.

In image mode, the LCD Display block takes an image as an input to draw on the display. The image format is greyscale HxW. Black and white LCDs will treat values from 0..127 as one colour and 128..255 as the other colour. The input is typically a static image or an image produced using an Image Compare block.

The LCD Display block also allows the display to be rotated if the LCD display is graphical, like the Sharp LS012B7DD01 or LS027B7DH01.

Helpful Hints

Black and White Displays

Hint To optimally display grayscale images, like camera feeds, on graphical black-and-white displays, like the LCD display of the Quanser QCar 2, use the Image Transform block with the Dither (1-bit) algorithm to transform grayscale images into black-and-white for display.

Input Ports

str

A fixed or variable-sized uint8 signal containing the text to print to the LCD display. This port is only visible in text display mode.

img

A fixed or variable-sized uint8 two-dimensional signal containing the image to draw on the LCD display. An image of any size may be used but it will be cropped to fit on the display. The Sharp LS012B7DD01 display has a 38x184 pixel (HxW) resolution. The Sharp LS027B7DH01 display has a 240x400 pixel (HxW) resolution. This port is only visible in image display mode.

line

The line number at which to start printing the text, or the pixel row number at which to start drawing the image. Line 0 is the first line at the top of the display and pixel row 0 is the first row. In text mode, the line number is the character line, but in image mode it is the pixel row coordinate.

col

The column number at which to start printing the text, or the pixel column number at which to start drawing the image. Column 0 is the first column at the left edge of the display and pixel column 0 is the first column. In text mode, the column number is the character number, but in image mode it is the pixel column coordinate.

Output Ports

err

Indicates whether an error occurred while printing to the LCD display. If an error occurred, it will be a negative QUARC error code. Otherwise zero will be output.

Data Type Support

The str input only accepts a vector of uint8 values representing Unicode UTF-8 characters. It may be variable-sized. Refer to Variable-Size Signals for more information on variable-size signals. The line and col inputs may take any of the built-in Simulink data types.

The img input only accepts a 2D matrix of uint8 values representing a black and white or greyscale image. It may be variable-sized. The image format is compatible with the greyscale output of the Video Capture block, for example.

Parameters and Dialog Box

LCD Display

Display type

The type of LCD display.

Display mode

The display mode to use: text or image. In text mode, the LCD Display block prints strings to the display. In image mode it draws an image. Not all displays support image mode.

URI (tunable offline)

The URI indicating the protocol with which to communicate with the LCD display. Refer to Universal Resource Identifiers for more information about URIs and the communications protocols supported by QUARC.

Suitable URIs for the built-in LCD displays on the following platforms are listed below:

Platform

Display Type

URI

QCar

ST7032

i2c-cpu://localhost:8?address=0x3E,baud=400000

QBot 3

ST7066U

serial://qbot3:0?baud=921600,device='/dev/qbot3_lcd'

QCar2

LS027B7DH01

spi://localhost:1?word='8',baud='45000000',polarity='on',phase='on',memsize='8192',frame='0'

QDrone2

LS012B7DD01

spi://localhost:2?word=8,baud=1000000,frame=1,memsize=990

QBot Platform

WS0010

lcd://qbot_platform:1

On Windows, with a Quanser QPIDe data acquisition card, for example, the WS0010 display can be used with the URI spi://localhost:0?baud=2e6,word=10,polarity=1,phase=1,frame=56 on the SPI pins of the control header.

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time from the input. The block inherits the sample time by default.

To set the sample time to the fundamental sampling time of the model, use the qc_get_step_size function, which is a QUARC function that returns the fundamental sampling time of the model. The fundamental sampling time of the model is the sampling time entered in the Fixed step size field of the Solver pane of the Configuration parameters dialog.

Use dark mode (tunable offline)

Indicates whether to use "dark mode" i.e., to use white text on a black background instead of black text on a white background. Not all displays support dark mode. Dark mode may be less efficient than normal mode.

Rotate display (tunable offline)

Indicates whether to rotate the display 180 degrees.

Active during normal simulation (tunable offline)

Indicates whether this block should execute during normal simulation. If this option is not checked then the block will not print to the LCD display during normal simulation. Note that the LCD display must be connected to the host PC to drive the display during normal simulation so this option is usually unchecked.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar