Adding an LCD Module

This self-assembly kit adds a 1 line x 16 character LCD to the AVR Development Board. These instructions detail how to wire the module to the board.

Parts Supplied

Before you start, check that you have the correct parts.

Hardware Description
lcd1x16.jpg 1×16 LCD Display
14way-ribbon.jpg 14-way Ribbon cable
14-way IDC male and female

Assembling the cable

Start by connecting the IDC header to the ribbon cable. Remove the cable grip from the top of the IDC connector. Open the top of the IDC connector and slide in the ribbon cable. Ensure that the arrow on the IDC connector (pin 1) aligns with the red stripe on the ribbon cable. Push down on the top of the IDC connector until the cable is gripped. Now, place the connector into a vise and tighten until the connector is completely closed. If your vise has a serrated face, use a thin piece of card to protect the connector.

IDC crimped

Now, we will prepare the other end of the cable. This will be soldered onto the LCD module. Starting with the red striped connector, separate the strands of the cable and use the wire cutters to remove the insulation to expose about 1/32“ of conductor. Using your soldering iron, tin each conductor.

Ribbon Stripped

Place the LCD module face down on your workbench (ensure that there is nothing on the bench which might scratch the front face of the LCD). Locate Pin 1 on the LCD module (marked on the PCB).

The wiring of the LCD needs to be carried out according to the following table. Solder each connection in turn, checking each solder joint as you proceed.

Ribbon cable conductor LCD module connector
1 2
2 1
3 4
4 3
5 6
6 5
7 8
8 7
9 10
10 9
11 12
12 11
13 14
14 13

So, the conductor with the red stripe actually goes to pin 2 on the LCD module.

Your finished wiring job should look something like this…

LCD Wired

Testing the LCD

Load the following BASCOM code onto your AVR board.

'--------------------------------------------------------------
' (c) 1999-2003 MCS Electronics
'--------------------------------------------------------------
' file: LCD.BAS
' demo: LCD, CLS, LOWERLINE, SHIFTLCD, SHIFTCURSOR, HOME
' CURSOR, DISPLAY
' Modified by DK to suit the 2313 AVR Board
'--------------------------------------------------------------
$regfile = "2313def.dat"
$crystal = 8000000
$baud = 9600

'note : tested in PIN mode with 4-bit

Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2

Rem with the config lcdpin statement you can override the compiler settings

Config Lcd = 16 * 1 'configure lcd screen
'other options are 16 * 4 and 20 * 4, 20 * 2 , 16 * 1a
'When you dont include this option 16 * 2 is assumed
'16 * 1a is intended for 16 character displays with split addresses over 2 lines

Cls 'clear the LCD display
Lcd "Hello world -AVR" 'display this on the LCD

End

lcd1x16.jpg

2313 Development Usage

The LCD shares some of the lines used by the download cable, so the LCD must not be connected whilst loading the program.

Power down the board. Remove the download cable.

Now, plug your newly wired LCD module onto the connector marked 'LCD'. The red stripe on the ribbon cable aligns with Pin 1 on the connector (Pin 1 is nearer the edge of the board).

Now power up the board - it should display a test message.

You can adjust the contrast of the LCD display by turning variable resistor (marked on the development board as 'VR').