Documentation
[liquid-crystal-terminal.git] / doc / doc.tex
1 \documentclass[a4paper]{article}
2
3 \usepackage[margin=25mm]{geometry}
4 \usepackage{pdfpages}
5 \usepackage{cleveref}
6 \usepackage[hidelinks]{hyperref}
7 \usepackage{xcolor}
8
9 \title{Liquid Crystal Terminal documentation}
10 \author{Camil Staps}
11
12 \begin{document}
13
14 \pagestyle{empty}
15
16 \makeatletter\section*{\@title}\makeatother
17
18 \subsection*{Usage}
19 Apply 5V to the power jack.
20 The outer switch (S2) should be in `USE' state,
21 or communication with other devices is impossible.
22 Other devices can control the terminal over UART as described below.
23
24 There is a trimmer potentiometer on the LCD board to change the brightness.
25
26 \subsection*{Protocol description}
27 The devices communicates 8-bit characters over a 115,200 baud UART link.
28 All characters are printed directly on the LCD display,
29 with the exception of device control bytes (\verb$0x11$ through \verb$0x14$).
30
31 \subsubsection*{Characters}
32 HD44780-based LCD displays have a character set similar to ASCII,
33 which can be found at \url{http://www.ekenrooi.net/lcd/lcd0.shtml#charset}.
34 Note that bytes \verb$0x00$ through \verb$0x07$ are user-defined characters.
35 They are set-up at compile-time in \verb$lcd.ino$ using \verb$createChar$ calls.
36 In \verb$lcd.h$, some examples of user-defined characters can be found.
37
38 \subsubsection*{LEDs}
39 To change the state of an LED, use device control 1 (\verb$0x11$) with an LED specification.
40 An LED specification is one byte and should look like below.
41 ID1 and ID2 identify the LED, whereas BLINK, RED and GRN indicate its state.
42 It is not possible to change the states of multiple LEDs at once;
43 you need to re-issue device control 1.
44
45 \begin{center}
46 \begin{tabular}{l c c c c c c c c}
47 Bit & 7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\\hline
48 Value & 0 & 0 & ID1 & ID2 & 0 & BLINK & RED & GRN \\
49 \end{tabular}
50 \end{center}
51
52 \subsubsection*{Backlight}
53 To change the state of the LCD backlight, use device control 2 (\verb$0x12$) with the backlight state.
54 The backlight state is one byte and should be 0, 1 or 2 to set the display, off, on or on flash, respectively.
55 When the backlight is set to flash, it turns on for some time and then turns off again.
56
57 \subsubsection*{Button (S1)}
58 It is not possible to get the button state.
59
60 \subsection*{Reprogramming}
61 To reprogram, 5V still has to be applied to the device.
62 \textcolor{red}{%
63 Switch S2 should be in `PGM' state.
64 Connecting the ICSP connector while S2 is in `USE' state \emph{will} break the device.}
65 Remove the Atmega328 chip from an Arduino Uno.
66 Connect the ICSP connector (J2; inside the device) to the Arduino board as below.
67 It should then be possible to reprogram the device from the Arduino IDE.
68
69 \begin{center}
70 \begin{tabular}{l l}
71 ICSP connector & Arduino pin \\\hline
72 Brown & GND \\
73 Yellow & TX \\
74 Green & RX \\
75 Blue & RESET \\
76 \end{tabular}
77 \end{center}
78
79 When communicating through an Arduino (during development), make sure to disable RTS and DTR lines.
80 These reset the device.
81 This is not an issue on the normal interface, where RTS and DTR are ignored.
82 On linux, the right settings can be achieved by using \verb$stty -F <PORT> -crtscts -hupcl$.
83
84 \includepdf[angle=90]{../schematic/schematic.pdf}
85
86 \end{document}