Tuesday 21 August 2012

PC1602F LCD driven by a Raspberry Pi

Pinching all the ideas from Raspberry Pi plus Hitachi HD44780-compatible LCD using GPIO, here is my Pi driving an LCD display.


I did have to make some changes. My LCD Pin layout was different, see datasheet.pdf and schematic from alldatasheet. My Pins 15 and 16 actually come before Pin 1, otherwise it's exactly the same order.


But I still used LCD Pins DB4..DB7 to send data to the LCD in 4-bit mode.

Pin no. Symbol Function
1 Vss Power supply(GND)
2 Vdd Power supply(+)
3 Vo Contrast Adjust
4 RS Register select signal
5 R/W Data read / write
6 E Enable signal
7 DB0 Data bus line
8 DB1 Data bus line
9 DB2 Data bus line
10 DB3 Data bus line
11 DB4 Data bus line
12 DB5 Data bus line
13 DB6 Data bus line
14 DB7 Data bus line
15 A Power supply for LED B/L (+)
16 K Power supply for LED B/L ( )




So to build and run:

pi@raspberrypi ~/dev/lcd $ make
gcc -O2 -o lcdinfo main.c lcd.c rpi.c
pi@raspberrypi ~/dev/lcd $ sudo ./lcdinfo


And here's a vid.


The only modification I did to the source code (main.c) was to alter the "ifname" passed to the get_addr() function. I changed it from "eth0" to "wlan0" as I was using WIFI, not ethernet.

No comments:

Post a Comment