Skip to content

lcd daemon.8

Manvendra Bhangui edited this page Jan 17, 2025 · 1 revision

NAME

lcd-daemon - Daemon for controlling LCD Displays with Hitachi 44780 controller

SYNOPSYS

lcd-daemon [-v] [-f fifo] [-m mode] [-b bits] [-c cols] [-r rows]

  [-t readtimeout] [-p port]
  [-d scroll_delay] [-i startup_message] [-s shutdown_message]

DESCRIPTION

lcd-daemon(1) reads a named pipe fifo or listens on a UDP socket to read messages from clients to be printed on 20x4 or 16x2 LCD Displays with Hitachi 44780 controller. lcd-daemon(8) creates the directory for the named pipe fifo, if it doesn't exist. The file mode for fifo can be provided by mode. cols and rows depends on the LCD display connected - either a 20x4 display which has 20 colums and 4 rows or a 16x2 display which has 16 columns and 2 rows. You can operate these displays in 4 bit mode or 8 bit mode. In 4 bit mode 4 terminals of the LCD data pins are connected (pins D4 to D7). In 8 bit mode, all 8 data pins of the LCD display are connected (pins D0 to D7).

lcd-daemon(8) is generally started through supervise(8) using /service/lcd-daemon service. You can however use your own method to start lcd-daemon(8). lcd-daemon(8) uses the wiringPi library, which needs write access to /dev/mem and /dev/gpiomem and needs to run with uid 0.

By default, lcd-daemon(8) creates rundir/lcd-daemon/lcdfifo named pipe and listens on UDP port 1806.

You can use nc(1) command or any TCP applciation to write a message to the UDP port 1806. You can use any any client that writes to the named pipe rundir/lcd-daemon/lcdfifo, created by lcd-daemon(8). pilcd(1) is one client that writes to the named pipe created by lcd-daemon(8).

Any client has to write the message by following format below (<sp> stands for the white space character).

rownum<sp>scroll<sp>clear:message

where

rownum
value can be 0 or 1 for 16x2 display or 0, 1, 2 or 3 for 20x4 display.

scroll
value can be 0 or 1. 1 turns on scrolling

clear
The following values are supported for clear

1 clear the screen
2 clear and initialize
3 initializing LCD display
4 clear screen without displaying text
5 clear and initialize screen without displaying text
6 initialize screen without displaying text

message
Here message is any string consisting of one or more words.

OPTIONS

-v
Turn on verbose output

-f fifo
Path to fifo

-m mode
File mode to set for fifo on startup.

-b bits
This is either the value 8 or 4 to specify 8 bit or 4 bit operation.

-c cols
This is either the value 20 or 16 to specify 20 character or 16 character display

-r rows
This is either the value 4 or 2 to specify 4 rows or 2 rows display

-d delay
This can be used to change the default delay period in milliseconds of 200ms for scrolling.

-p port
UDP port on which lcd-daemon(8) listens. If not provided this is 1806.

-t readtimeout
No of milliseconds lcd-daemon(8) will read a message from a client before timing out. Default is 300 milliseconds.

-i startup_msg
Startup message to be displayed on LCD on lcd-daemon(8) startup

-s shutdown_msg
Shutdown message to be displayed on LCD on lcd-daemon(8) startup

Environment Variables

lcd-daemon(8) uses the following environment variables.

LCDFIFO
If the -f option is not provided, lcd-daemon(8) reads rundir/lcd-daemon/lcdfifo, where rundir is /run, /var/run or /tmp depending on your system. The fifo can be changed by setting LCDFIFO environment variable.

FIFO_MODE
if the -m option is not provided, lcd-daemon(8) sets 0666 as the file mode for fifo. The mode can be changed by setting FIFO_MODE environment variable.

VERBOSE
If -v option is not provided the value of VERBOSE environment is used. Setting VERBOSE=1 turns on verbose output and VERBOSE=0 turns of verbose output.

SCROLL_DELAY
Delay in milliseconds. Default 200 milliseconds

DATA_TIMEOUT
If -t is not provided, the env variable DATA_TIMEOUT is used. This is timeout in seconds after which lcd-daemon(8) will timeout when reading from the named pipe or from the socket. Default is 300 seconds.

PORT
If -p is not provided, the env variable PORT is used. This is the UDP port on which lcd-daemon(8) listens for UDP packets. Default port is 1806.

BIT_MODE
If -b is not specifed, the value of this environment variable is used. There is no default. You have to either use the -b option or set BIT_MODE environment variable.

LCD_WIDTH
If -c is not specifed, the value of this environment variable is used to specify the columns that the LCD display supports. There is no default. You have to either use the -c option or set LCD_WIDTH environment variable.

LCD_ROWS
If -r is not specifed, the value of this environment variable is used to specify the rows that the LCD display supports. There is no default. You have to either use the -r option or set LCD_ROWS environment variable.

PIN_RS
The pin on Raspberry Pi / Banana Pi which is connected to the RS pin on the LCD display.

PIN_EN
The pin on Raspberry Pi / Banana Pi which is connected to the EN pin on the LCD display

PIN_D0
The pin on Raspberry Pi / Banana Pi which is connected to the Data 0 pin on the LCD display

PIN_D1
The pin on Raspberry Pi / Banana Pi which is connected to the Data 1 pin on the LCD display

PIN_D2
The pin on Raspberry Pi / Banana Pi which is connected to the Data 2 pin on the LCD display

PIN_D3
The pin on Raspberry Pi / Banana Pi which is connected to the Data 3 pin on the LCD display

PIN_D4
The pin on Raspberry Pi / Banana Pi which is connected to the Data 4 pin on the LCD display

PIN_D5
The pin on Raspberry Pi / Banana Pi which is connected to the Data 5 pin on the LCD display

PIN_D6
The pin on Raspberry Pi / Banana Pi which is connected to the Data 6 pin on the LCD display

PIN_D7
The pin on Raspberry Pi / Banana Pi which is connected to the Data 7 pin on the LCD display

RETURN VALUE

0 if all steps were successful, non-zero otherwise. If any of the steps fail, a diagnostic message is printed. If any systerm error is encountered, the return value will be 111.

AUTHORS

Manvendra Bhangui <[email protected]>

SEE ALSO

supervise(8) svc(8) envdir(8) multilog(8) pilcd(1), notify-daemon(8),

Clone this wiki locally