Software Overview

The PIC CPU contains software that performs the following functions:

Startup and Settings Screens

On startup, the following screen will be shown for 5 seconds:

When the escape key is pressed, the settings screen is opened, which looks like this:

# Description
1 Display alignment guides. To be used to calibrate the alignment of the image within the display. The outer box is on the last pixel of the display in every direction and should be entirely visible. The inner box is there to help alignment if the image is scaled incorrectly and none of the outer box is visible.
2 Title, software version and copyright notice.
3 G0 character set. These rows display all the symbols for the G0 ASCII set in normal rendering mode. Symbols from 0x00-0x20 are not displayed, because they are control codes.
4 G1 character set. This row displays all the alternate symbols for the G1 ASCII set in normal rendering mode. Only symbols from 0xC0-0xFF are displayed, which are the standard substituted characters.
5 Colour pallette. When using the ANSI SGR codes, the colours numbered 0-7 map to codes 30-37 and those numbered 8-15 are the bright equivalents.
6 System settings. Each possible setting can be cycled through with the underlined key and is saved when Enter is pressed. See the table below for details about each setting.
7 Instructions
Setting Available Options Default Value Description
Baud rate 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400 115200 Serial connection baud rate. Note that higher rates may be problematic without flow control.
Flow control None, XON/XOFF, RTS/CTS XON/XOFF Type of flow control used for serial data port. Should be used at higher baud rates.
Line wrap (initial) Wrap, No Wrap Wrap Defines the default behaviour when the cursor is at the end of a line and another character is displayed. In 'Wrap' mode the cursor moves to the start of the next line. In 'No Wrap' mode the cursor remains in place at the end of the current line. This is only the default line wrap setting, and can be changed with the escape sequences "ESC [ ? 7 h" (wrap) and "ESC [ ? 7 l" (no wrap).
Keyboard layout UK, US UK Layout of PS/2 keyboard currently inserted.
Sleep timeout Never, 30 secs, 1 mins, 5 mins, 10 mins, 30 mins, 60 mins Never Idle time before the monitor is put into standby. Received characters or keyboard input will wake the monitor. Monitor power can also be controlled with the escape sequence "ESC [ ? 999 h/l" regardless of this setting.

Flow Control

The software supports two types of flow control over RS232: RTS/CTS and XON/XOFF. For higher baud rates, having some form of flow control enabled is recommended as the terminal may slow down in displaying characters when performing actions like scrolling causing a buffer overflow.

Note that flow control is only supported for the display data direction. Keyboard data being transmitted on the serial line has no flow control. This is because the amount of keyboard data sent is very low and there is no CTS line.

If you want to use XON/XOFF but don't need a keyboard, the RX line is still required. This is because the XON and XOFF characters still need to be received by the connected serial device.

The flow control settings must also be set at the other end of the interface and, if using RTS/CTS, the RTS line must also be connected (many serial cables do not have all the pins wired).

Supported Control Codes and Escape Codes

The software supports many commonly used control and escape codes including the ones used by Linux terminals. For more information on ANSI escape sequences, read the following wikipedia article.

ASCII Control Codes

The following codes are supported. All other codes below 0x20 are ignored.

Hex ASCII Name Description
0x08 BS Backspace
0x09 TAB Tab (every 8th column)
0x0A LF Newline (line feed)
0x0C FF Clear screen (form feed)
0x0D CR Carriage return
0x0E SO Select character set G1 (shift out)
0x0F SI Select character set G0 (shift in)
0x11 DC1 XON (ignored on reception, transmitted when buffer space becomes available)
0x13 DC3 XOFF (ignored on reception, transmitted when buffer becomes full)
0x1B ESC Escape, starts the ANSI sequences listed below

Standard Escape Sequences (all start with "ESC")

Escape code Description
c Reset to power-on state
7 Save current cursor/drawing state
8 Restore saved cursor/drawing state
D Scroll window up one line
M Scroll window down one line
n ( Set G0 character set to n
n ) Set G1 character set to n


CSI Sequences (all start with "ESC[")

Escape code Description
n @ Insert n blank characters (pushing characters on line to the right)
n A Cursor up n spaces
n B Cursor down n spaces
n C Cursor right n spaces
n D Cursor left n spaces
n E Move cursor to the start of the line n lines down
n F Move cursor to the start of the line n lines up
n G Move cursor to column n
n;m H Move cursor to position n,m
n;m f Same as above
n J Erase in display, for different values of n: when 0 (or missing), clear from cursor to the bottom of the display; when 1, clear from cursor to the top of the display; when 2, clear the entire display
n K Erase in line, for different values of n: when 0 (or missing), clear from cursor to the end of the line; when 1, clear from cursor to the start of the line; when 2, clear the entire line
n L Insert n blank lines below (pushing lines below down)
n M Delete n lines below (pulling up lines below that)
n P Delete n characters at the cursor (pulling the rest of the characters on the line in)
n S Scroll up n lines
n T Scroll down n lines
n X Delete n characters from the cursor position
n d Move cursor to row n
n h Set mode: only supported n is 4, insert mode on
n l Reset mode: only supported n is 4, insert mode off
n;m;... m Set graphic rendition - see SGR section
n;m r Set top and bottom lines of the drawing window
s Save current cursor drawing state
u Restore saved cursor drawing state
n ~ Keyboard keys, for different values of n: 1 = 'home', 2 = 'insert', 3 = 'delete', 4 = 'end'


Set Graphic Rendition (SGR) Sequence

The following sequence "ESC [ n;m;... m" lets the user set how the characters are rendered when displayed. It can take many parameters, each seperated by a semicolon. Each parameter sets one aspect of the rendering for the characters drawn after this point. For example, the sequence "ESC [ 1;4;31 m" sets the current style to bright (1) red (31) underlined (4). Characters sent to the terminal after this point will be displayed in the new style.

The following parameters are supported.

Parameter Description
0 Reset style
1 Bold (bright text colours)
2 Faint (dark text colours)
4 Underline on
7 Reverse video on
24 Underline off
27 Reverse video off
30-37 Set Foreground colour (black, red, green, yellow, blue, magenta, cyan, white)
39 Default foreground colour
40-47 Set Foreground colour (black, red, green, yellow, blue, magenta, cyan, white)
49 Default background colour


CSI Private Sequences (all start with "ESC[?" and end with either "h" or "l")

Escape code h Description l Description
7 h/l Enable wrap-around mode (cursor moves to start of next line when it reaches the end of the current line) Disable wrap-around mode (cursor stays at the end of the current line when it reaches the end of the line)
25 h/l Show cursor Hide cursor
999 h/l Turn monitor on (exit standby) Turn monitor off (enter standby)
1049 h/l Use alternate screen buffer Use main screen buffer
9049 h/l Use alternate screen buffer while displaying the main screen buffer Use main screen buffer while displaying the alternate screen buffer
1111;n h/l Load custom character bitmap to slot in the G1 character set in the font RAM - see Custom Characters section below Same as h

Custom Characters

This design supports up to 64 custom character bitmaps through a custom ANSI command which can be accessed with ASCII codes 32-95 (0x20-0x5F) in the G1 character set.

The example image below shows how an 8x16 image (in this case a lower case Greek 'phi') can be converted into an series of 16 bytes representing it - taking each white pixel as a 0 and each black pixel as a 1.

The private CSI sequence "CSI?1111;nh" (where n is the ASCII code) can be used to start loading the character to the selected ASCII position. The next 16 bytes are received as raw data, and then loaded into the font RAM slot. The sequence for loading the example image into the first custom ASCII position (32) looks like this:

ESC [ ? 1111 ; 32 h 0x00 0x00 0x00 0x2C 0x4A 0x4A 0x4A 0x4A 0x4A 0x6A 0x3C 0x08 0x08 0x08 0x00 0x00
Escape 1111 is the custom character loading code, 32 is the ASCII code that will be used to access this character. Literal binary. Each byte is one row of the bitmap to load from top to bottom.

We now have a new character bitmap loaded into the font RAM. Switching into the G1 character set and printing ASCII code 32 will result in our new character being displayed.