Homepage Wiki Forum Buy

Display

From GNUBLIN

severity (level) requirement Gnublin family
Gnublin logo advanced.png Kernel compile, Toolchain All


Contents

Control a Display via SPI

This article explains how to connect a display to the Gnublin-board and how to control it with a program. You just have to wire up the display, the program to control the display already exists.

Displaymodul (Online-Shop)

Bild komplett.jpg

We choosed the DOGM162L-A display which uses the ST7036 Controller. You can find the data sheet here.

Quickstart

You can write something to the display with the following command:

root@gnublin:~# gnublin-dogm -i -w "Hello GNUBLIN"


On RaspberryPi there are two spi connectors.

You find a label on the board: /dev/spi0.0 and /dev/spi0.1


For /dev/spi0.0 this command is good:

pi@raspberrypi ~ $ sudo gnublin-dogm -g 4 -c 0 -i
pi@raspberrypi ~ $ sudo gnublin-dogm -n -w "Hello"

This is /dev/spi0.0 as connector

Raspberry display.JPG

For Beginners

Initialisation

root@gnublin:~# gnublin-dogm -i

This parameter will initialize the display

Reset the display

root@gnublin:~# gnublin-dogm -n

With this parameter the screen will be erased and the courser is set to the start of the first line.

==Delete the Display

root@gnublin:~# gnublin-dogm -d

This command will delete the text on the display without reset other display parameters like shift.

Write

root@gnublin:~# gnublin-dogm -w "Hallo Gnublin"

Writes a normal string on the display.

Note: If you want to write a exclamation mark (!) or something like that you have to set a back slash before if not the Shell would abort the command on this position.

root@gnublin:~# gnublin-dogm -w "Hallo Gnublin\!"

Cursor Offset

Every line of the display exists out of a few segments. You have the possibility to set the courser to one specific segment. The first segment in the first line has the offset 0. The first segment in the second line has the offset 16.

root@gnublin:~# gnublin-dogm -o "192" -w "Hallo"

This command writes the string in the second line.

Write in a specific line

There is the possibility to write the text in a specific line. All other operations like offset will then count from the start of the line.

root@gnublin:~# gnublin-dogm -l 2 -w "Hallo GNUBLIN"

The text is written in the second line.

Display shift

If you write strings on the display which needs more segments as the display has in every line you have the possibility to do a display-shift. By this operation every segment of the display will be shifted by n positions. Every shift affects the addresses of the segments too! The segment which was once on the address 192 is now shifted by +/- n.

gnublin-dogm -s "-5"

This will shift the display by 5 segments.

Other commands

There are even more commands to control the display. You will get an overview by using the help command:

root@gnublin:~# gnublin-dogm -h
This program was designed to easily interact with the dogm display.
-h Show this Help
-w <STRING> write string to display
-l <line> set string on line (1 = line 1; 2 = line 2)
-j Convert Output to json Format
-b Convert Output to bare format
-o <column> Set cursor to position(Start of line 1= 0; Start of line 2= 16)
-n reset the display
-d delet the display
-s <X> shift display <X> times(left shift = - ; right shift= +
-g <X> Use GPIO Pin X instead default GPIO Pin 14 (For RS Pin on DOGM Display)
-i initialize the display
-c <Y> Only initialize the spidev module with <Y> as Chipselect Pin.(default:<Y>=11)
Examples:
Write Hello to the Display:\ngnublin-dogm -n -w "Hello"
Write Hello to the Display connected with CS-Pin=18\ngnublin-dogm -n -w "Hello" -c 18
Jump to the second Line with Cursor\ngnublin-dogm -l 2

For Advanced Users

Wire up the display

You can use the following sketch to wire up the circuit:

Schaltung display klein.jpeg


  • CS -> GPIO11
  • RS -> GPIO14

Schaltplan display klein.jpg

Display Software

You can find the software in the GNUBLIN Git Repository for cloning:

root@gnublin:~# git clone http://code.google.com/p/gnublin

You will find the source code in the directory gnublin_packages/std.

Is the display is the only device on the SPI interface you can connect Chip Select to ground.

Use other GPIO Pin as RS

You can now set the GPIO pin on the GNUBLIN for the RS on the dispay in the software (without app2.sh or start1.sh). This parameter has to be set by every program call. If you don't set the parameter the default GPIO14.

root@gnublin:~# gnublin-dogm -g 14

Potential Errors

can't open device

If you start the program like that:

root@gnublin:~# gnublin-dogm -n -w "hallo"

and it returns following error:

14
can't open device: No such device or address
Aborted

it is possible the needed SPI devicefile isn't set yet.

root@gnublin:~# mknod /dev/spi0 c 153 0

Other SPI Drivers are loaded

Note: All SPI drivers like can, ENC28J60, etc. have to be de-loaded first! (e.g. modprobe -r enc28j60)

root@gnublin:~# modprobe spidev
In other languages