All rights to this documentation and to the product(s) described herein are reserved by taskit GmbH.
This document was written with care, but errors cannot be excluded. Neither the company named above nor the seller assumes legal liability
for mistakes, resulting operational errors or the consequences thereof. Trademarks, company names and product names may be protected
by law. This document may not be reproduced, edited, copied or distributed in part or in whole without written permission.
This document was generated on 2016-02-25T12:31:54+01:00.
3.3. Activate bootloader from a Linux shell .................................................................. 10
4.1. Setting IO03 to low level. ...................................................................................... 12
vi
Overview
1. Overview
The LCD-Term is a ready to use black-white display including VT100 support, three builtin fonts, matrix keyboard support, simple IO functionality and graphic routines such as
drawing primitives, GIF images as well as blitting from and to multiple back-buffers. It is
available in four physical display sizes from 1.2" to 3.5".
Any headless hardware that shall be extended by some output capabilities or full user
interaction can be connected to LCD-Term. Requirements are kept low due to the
utilisation of standard peripherals like USB or a serial port which should be readily
available on many platforms.
The design is made to be used in an easy manner: Four wires are sufficient to provide full
display functionality, all further IO pins can be configured to be used as matrix keyboard or
IO pin. Configuration is done via a built-in setup shell accessible through a simple terminal
program. There is no need for any configuration software running on a host PC. Thus
testing, configuration and development is independent from any specific OS platform.
Adding LCD-Term support to existing software projects is simple, too. There is no library
that has to be used to interact with the firmware; all commands are text messages to
be sent directly via the serial connection. Developers are not limited to any specific
programming language - simple string manipulation and access to the serial port or USB
is all you need. Therefore, most of the samples are either messages typed into a serial
terminal or short LUA code1.
1
LUA is a small and simple scripting language. See: http://www.lua.org
1
Commissioning
2. Commissioning
Power is either be supplied via a 5V USB unit which is connected to micro USB port or via
the side connectors using the 3.3V or 5V pin if available.
Figure2.1.Pin-out LCDTerm12
Figure2.2.Pin-out LCDTerm15
Figure2.3.Pin-out LCDTerm25
Figure2.4.Pin-out LCDTerm35
2
Commissioning
2.1. USB
When plugging a USB cable using the micro USB port X3, the device is enumerated as
USB CDC device. Modern operating systems such as Windows 10, MAC OS X or Linux
come with appropriate drivers pre-installed.
After initialisation, a new communication device is added to the system. On Windows this
is called //./COMx where x is a decimal number. Linux and UNIX-like systems in general
use either /dev/ttyACMx or /dev/ttyUSBx as naming scheme.
Simple text output can be done from almost every shell in a similar way.
echo "Hello world !" > //./COM5
Example2.1.Hello world on a Windows shell
2.2. UART
The UART interface is designed to be used in embedded circuits keeping costs as
low as possible. According to this, no RS232-LVTTL level shifters are used. Most
microprocessors/microcontrollers used in such an environment can be connected directly
to the LCD-Term.
Caution
Using the UART as a connection to a common PC requires RS232-LVTTL level
shifters. As an alternative, LVTTL to USB converters such as an FTDI cable or
chip can be used. This solution is already covered by LCD-Term's USB connector.
However, USB driver support can be easier on older OS when using FTDI chips/
cables.
2.3. Configuration
LCD-Term offers a built-in setup dialog for configuration. It can be entered by either short
circuiting GND and PA00 during power-up or by an escape sequence typed into a serial
terminal program. The sequence is ESC[Q. See Table3.4, “Additional functions” for details.
The setup dialog can be attended via a terminal program. You are free to use USB or the
UART connection. Follow the menue to configure backlight, display contrast and IO pins.
Don't forget to save before exiting the setup to make your changes persistent. By delivery,
LCD-Term is configured with reasonable values.
LCD-Term is capable of displaying GIF images from its internal Flash memory. At the
moment this documentation is written, uploading images requires a third party tool from
the manufacturer of the microcontroller that is used. Since we are going to simplify this
procedure in the future, it is not covered here. Please see: http://www.taskit.de/LCD-
Term_en.html
3
Instruction set
3. Instruction set
All instructions follow a basic scheme compatible with ANSI escape sequences. A sequence
starts with an introductory character (hexcode 0x1B), in the following written as ESC,
and is completed by either a upper- or lowercase basic latin letter (A-Z, a-z) representing
a function code. Arguments to these functions are written as decimal integer numbers,
separated by semi-colon, between ESC and the function code.
All printable ASCII codes that are not part of an active escape sequence are shown on the
display. The text cursor advances automatically.
3.1. Text functions
Text functions are used to control the output position of characters to be printed, erase the
display or parts of it, scroll the display's content and toggle different modes of operation
such as inverse presentation. Here is a list of all textual functions.
Command DescriptionExampleLUA string
Text cursor functions
AMove text cursor n lines up. If n is
omitted, one line is moved up.
BMove text cursor n lines down. If n is
omitted, one line is moved down.
CMove text cursor n columns left. If n is
omitted, one column is moved left.
DMove text cursor n columns right. If n
is omitted, one column is moved right.
aSet text cursor to line n. If n is
omitted, cursor is set to the first line.
bSet text cursor to column n. If n is
omitted, cursor is set to the first
column.
H, fSet cursor to position [y; x]. If
parameters are omitted, cursor is set
to [1; 1].
sSave current cursor position.ESC[s"\27[s"
uRestore previously saved cursor
position
Mode settings
lDisable mode n. Supported modes
are: 1, 2, 3, 8, 25, 75. See Table3.2,
“Options” for details.
hEnable mode n. Supported modes
are: 1, 2, 3, 8, 25, 75. See Table3.2,
“Options” for details.
Display clear functions
ESC[A ESC[2A"\27[2A"
ESC[B ESC[2B"\27[2B"
ESC[C ESC[12C"\27[12C"
ESC[D ESC[20D"\27[20D"
ESC[a ESC[2a"\27[2a"
ESC[b ESC[5b"\27[5b"
ESC[H ESC[2;12f"\27[2;12H"
ESC[u"\27[u"
ESC[?2l ESC[?25l"\27[?2l"
ESC[?2h ESC[?25h"\27[?2h"
4
Instruction set
Command DescriptionExampleLUA string
JErase display content according to
option n. Options are: 0 = from cursor
to end, 1 = from start to cursor, 2
= full display. Omitting n erases the
whole display.
KErase line content according to option
n. Options are: 0 = from cursor to line
end, 1 = from line start to cursor, 2 =
full line. Omitting n erases the current
line from cursor to end.
PDelete n characters right to the
cursor. The character at the cursor
position is also cleared. If n is omitted,
one character is erased.
MDelete n characters left to the cursor.
The character at the cursor position
is also cleared. If n is omitted, one
character is erased.
Scroll functions
SScroll display content n text lines up.
If n is omitted, one line is scrolled.
TScroll display content n text lines
down. If n is omitted, one line is
scrolled.
ESC[2J ESC[J"\27[2J"
ESC[2K ESC[K"\27[2K"
ESC[P ESC[4P"\27[4P"
ESC[M ESC[4M"\27[4M"
ESC[S ESC[1S"\27[2S"
ESC[T ESC[1T"\27[2T"
Table3.1.Text functions
Commands l and h are used to dis/enable several options that influence the textual
representation. The description of these options are collected in Table3.2, “Options”.
Optionh: enablel: disable
1If cursor presentation is also enabled, the
cursor is drawn as a large block.
2Cursor presentation is turned on.Cursor presentation is turned off.
25Cursor blink is switched on.Cursor blink is switched off.
3Text is drawn in inverse mode. Background
is dark.
8Automatic wrap on end of line is on. Display
will scroll when last line is wrapped.
If cursor presentation is also enabled, the
cursor is drawn as a thin line.
Text is drawn in normal mode. Background
is clear.
Automatic wrap at end of line is off.
Table3.2.Options
This LUA sample code displays some text and the current time and date on top of the
screen in two different modes.
5
Instruction set
-- All commands will be sent using standard file IO
-- on the USB CDC port my LCD-Term is connected to.
-- On Linux it will be either "/dev/ttyACMx" or "/dev/ttyUSBx";
-- on Windows the device is "//./COMx".
f = io.open("/dev/ttyACM0", "wb")
function wait(seconds)
local start = os.clock()
repeat until os.clock() > start + seconds
end
function clear_display(f)
f:write("\27[2J")
f:flush()
wait(0.01)
end
function clear_line(f)
f:write("\27[2K")
f:flush()
wait(0.01)
end
function gotoYX(f, y, x)
-- insert y and x at their appropriate positions
-- format: ESC[y;xH
f:write(string.format("\27[%d;%dH", y, x))
f:flush()
wait(0.01)
end
-- disable inverse mode
f:write("\27[?3l")
-- enable automatic line wrap
f:write("\27[?8h")
clear_display(f)
gotoYX(f, 4, 1)
f:write("\nSome text here...\nand here...\n\nand there.")
-- enable inverse mode
f:write("\27[?3h")
-- disable automatic line wrap
f:write("\27[?8l")
-- clear first three lines
for y = 1, 3, 1 do
gotoYX(f, y, 1)
clear_line(f)
end
date_format = "%H:%M:%S %Y/%m/%d"
while true do
-- output current time
gotoYX(f, 2, 2)
f:write(os.date(date_format))
f:flush()
end
-- never reach this because of loop for infinity
f:close()
Example3.1.example1.lua
6
Instruction set
3.2. Graphic functions
Besides textual functionality, LCD-Term offers a set of sequences that can be used for
drawing. Simple forms such as lines, rectangles and circles can be filled with different
patterns, text can be positioned on a per pixel basis instead of a per character one, a
screen can be prepared in a back buffer page and being blit to the front buffer. Icons and
special symbols are supported through the GIF feature.
Most of the functions are not shown on screen directly but rendered into one of the two
back buffers. This allows to set a screen up without bothering the user with multiple
updates of the same region (e.g. when drawing something on top of an image). There is
a function controlling and forcing the screen update which can be called after rendering
the back buffer is finished.
Command DescriptionExampleLUA string
Graphic primitives
xSets or clears a pixel at position [y; x].
The third parameter c decides wheter
the pixel is set (c > 0) or cleared (c =
0).
yDraw a line from [y0; x0] to [y1;
x1]. The last parameter p specifies
a repeating pattern where each bit
corresponds with a pixel. A set bit
results in a set pixel.
vDraw a rectangle from [y0; x0] to [y1;
x1]. The last parameter p specifies a
repeating pattern to be used for the
rectangle's outlines.
wFill a rectangle from [y0; x0] to [y1;
x1]. The last parameter p (0-15) is the
number of one of sixteen fill pattern.
kDraw/fill a circle with center [y; x]
and radius r. Parameter fill selects
wheter p is a fill (fill = 1) or an
outline pattern.
Graphic cursor
GSet graphic cursor to pixel coordinates
[y; x]. GIFs and text functions as well
as printing strings work relative to
this position.
GIF support
YDisplay GIF num at current graphic
cursor position.
Buffers and blitting
VSwitch to buffer num. All further
drawing is done in the selected buffer.
ESC[y;x;cx
ESC[10;40;1x
ESC[y0;x0;y1;x1;py
ESC[0;0;63;127;255y
ESC[y0;x0;y1;x1;pv
ESC[0;0;63;127;15v
ESC[y0;x0;y1;x1;pw
ESC[0;0;63;127;7w
ESC[y;x;r;fill;pk
ESC[32;64;20;1;7k
ESC[y;xG ESC[10;30G"\27[57;100G"
ESC[numY ESC[1Y"\27[3Y"
ESC[numV ESC[0V"\27[1V"
"\27[10;20;1x"
"\27[63;0;0;127;85y"
"\27[63;0;0;
127;111v"
"\27[62;1;1;126;3w"
"\27[32;64;30;0;
111k"
7
Instruction set
Command DescriptionExampleLUA string
UUpdate screen: Depending on mode
the function automatic update is
ESC[modeU ESC[0U
ESC[1U ESC[2U
"\27[U"
disabled (mode = 0) or enabled (mode
= 1). When mode is equal to 2 or
omitted, the currently selected buffer
is copied onto screen.
WBlit source rectangle at [x0; y0] with
size [dx; dy] to [x1; y1]. Source buffer
is src, target buffer is dst.
ESC[src;x0;y0;dx;dy;
dst;x1;y1W
ESC[1;0;0;32;32;
"\27[1;10;20;16;16;
0;0;0W"
0;10;15W
Table3.3.Graphic functions
Here is a more complex example using graphic functions to draw an animated random
graph.
-- All commands will be sent using standard file IO
-- on the USB CDC port my LCD-Term is connected to.
-- On Linux it will be either "/dev/ttyACMx" or "/dev/ttyUSBx";
-- on Windows the device is "//./COMx".
f = io.open("/dev/ttyACM0", "wb")
function wait(seconds)
local start = os.clock()
repeat until os.clock() > start + seconds
end
function calc_value(old_y)
y = old_y + (math.random() - 0.5) * variance, graph_dy
-- shrink value to graph size
y = math.max(math.min(y, graph_dy - 1), 0)
return y
end
function calc_graph(start_x, end_x)
for x = start_x + 1, end_x, 1 do
-- round value to the nearest integer
y = math.floor(calc_value(values[x - 1]) + 0.5)
values[x] = y
old_y = y
end
end
function draw_graph(f, start_x, end_x)
for x = start_x, end_x - 1, 1 do
-- draw a line between the two points
f:write(string.format("\27[%d;%d;%d;%d;%dy",
graph_y + values[x], graph_x + x,
graph_y + values[x + 1], graph_x + x + 1,
pattern))
f:flush()
-- here we don't use XON/XOFF, so make a little pause after
A few things should be kept in mind regarding the power supply. When connecting the
USB device port, LCD-Term uses the +5V line from the connected host. In this case, it
also generates the +3.3V from that source.
Caution
None of the pins described as 5V shall be connected to a second power source
when USB is used!
If USB is not used - neither to supply power nor as communication port - one is free to
use any 5V pin as power input.
Alternatively, power can also be supplied via one of the 3.3V pins. Using a 3.3V pin as
power source does not collide with any of the prior options. However, combining the 5V
and 3.3V supply is not recommended.
11
Technical data
4.2. General pin-out
All pins labeled PAxx / IOyy can be used as IO pins. They are referenced in LCD-Term's
setup and IO functions as IOyy. The pin-out tables contain the mapping between a
connector's pin number and the IOyy pins for the different LCD-Term boards.
echo -e -n "\033[3;0O" > /dev/ttyACM0
Example4.1.Setting IO031 to low level.
4.2.1. Left connector
This connector basically contains the serial interface and power supply.