The KS0108 is a popular controller chip used in GLCD displays but the wiring for these panels is not standardized and it is important to check the datasheet for your panel to confirm how it should be wired. Incorrect connections of the signal lines are the most common cause of problems. Also, it as odd as it sounds ensure that the display is actually a KS0108 display.
Most GLCD panels require an external potiometer to set the LCD working voltage (contrast) and a fixed resistor to limit the current in the backlight. The datasheet for your panel should provide specific information on the wiring and choice of components for this. It is important to note that ks0108 modules do not wire up their contrast pot the same way as a typical hd44780 character lcd. A hd44780 lcd typically hooks its contrast pot legs to +5v and GND. In most cases, on a ks0108, the pot, which is typically between 10-20k, is used to create a varying negative voltage from Vee up to GND that is used to feed to the Vo input signal. In order to do this, one leg of the pot needs to hook to ground, one leg needs to hook to the Vee negative voltage output pin and then the wiper, which is the middle pin of the pot, will have the variable voltage output that can be fed to the Vo contrast control input pin.
The table below summarizes how to wire up the GLCD module. A KS0108 GLCD module will have 20 pins as indicated in the "Pin Function" column. Notice that there are no GLCD module pin numbers in the table. This is because pin locations for the functions is not standardized. The datasheet for the specific GLCD must be consulted to know which function has been connected to which GLCD pin number. Pay close attention to the signals in the table.
KS0108 Pin Function | Comment |
---|---|
GND | Connect to GND |
+5 volts | Connect to +5v |
(Vo) Contrast in | Connect to Wiper (middle pin) of contrast pot |
D_I | Data/Instruction (RS) (see mapping table below) |
R_W | Read/write (see mapping table below) |
EN | Enable (see mapping table below) |
D0 | Data Bit 0 (see mapping table below) |
D1 | Data bit 1 (see mapping table below) |
D2 | Data bit 2 (see mapping table below) |
D3 | Data bit 3 (see mapping table below) |
D4 | Data bit 4 (see mapping table below) |
D5 | Data bit 5 (see mapping table below) |
D6 | Data bit 6 (see mapping table below) |
D7 | Data bit 7 (see mapping table below) |
CSEL1 | Chip 1 select (see mapping table below) |
CSEL2 | Chip 2 select (see mapping table below) |
Reset in | Connect to +5v |
(Vee/Vout) Contrast out | connect to 1 leg of Contrast pot |
Backlight Anode | +5v (See datasheet for resistor value) |
Backlight Cathode | GND |
connect 1 leg of contrast pot to GND |
The table below shows the Arduino pin to KS0108 Pin Function assignments for each Arduino board type. Each row represents the Arduino pin connections for the board type as indicated by the Board Type column. The columns to the right of the Board Type represent KS0108 pin functions.
For example:
Uno analog pin A3 is connected to the GLCD pin function D_I.
Uno digital pin 8 is connected to the GLCD pin function D0 (data bit 0)
Teensy 3.0 pin 3 is connected to the GLCD pin function CSEL1 (chip select 1) - See important Teensy 3.0 warning below
(NOT SUPPORTED) |
CSEL3 is only used on some 192x64 displays
Mega, Mighty1284p, Sanguino, and Teensy boards provide faster performance by allowing all the data pins to be connected to the same port. The configuration files for these boards provided in the library have the data pins assigned to take advantage of this additional performance capability.