Connect XC-1a to 16x2 alphanumeric LCD display

XCore Project reviews, ideas, videos and proposals.
User avatar
mjcross
Member++
Posts: 16
Joined: Wed Jun 29, 2011 5:39 pm

Connect XC-1a to 16x2 alphanumeric LCD display

Postby mjcross » Sun Jul 03, 2011 10:19 pm

Version: 1.01
Status: Complete
License: BSD
Download: /files/project_builds/LCD driver.zip

Use XC ports to talk to a cheap (£8 / $10) 16x2 LCD display via a widely used industry interface.
Developed to use one of the expansion ports on the XC-1a, but should work on most hardware. Uses three one bit ouput ports (control lines) and one eight bit bi-directional port (data bus).

The project comprises: (1) a driver that implements basic API functions to send commands to the device (clear screen, move cursor, etc), write characters and scroll the display (vertically); (2) a simple interconnect board to connect the expansion port to the display via 16 pin header cable.
I used Newhaven Devices' NHD-0216K1Z-NSW-BBW-L display, available from Digikey in one-off quantities (http://search.digikey.com/scripts/DkSea ... -NSW-BBW-L), but many others should work too (the timing parameters in the header file are clearly identified, and you might need to tweak them for different kit). The NHD display uses either the S6A0069, ST7066 or SPLC780D drivers, all of which have very similar characteristics.
The API and the implementation could probably be tidied up in some areas, but basically I'm happy with this for what I need just now. Very pleased to receive suggestions/contributions however :-)
Images:
User avatar
phalt
Respected Member
Posts: 298
Joined: Thu May 12, 2011 11:14 am

Postby phalt » Mon Jul 04, 2011 9:16 am

Brilliant project, is this your first one? I can see a lot of new XMOS users downloading this to help them understand output to LCD's
User avatar
mjcross
Member++
Posts: 16
Joined: Wed Jun 29, 2011 5:39 pm

Postby mjcross » Mon Jul 04, 2011 10:58 am

Thanks! Yes, it's my first project - I thought it would be good to start with something simple :-)

I would certainly like to think that other beginners could find this useful. In that sense, perhaps I'd better add a parts list and a pinout for the patch lead.
User avatar
mjcross
Member++
Posts: 16
Joined: Wed Jun 29, 2011 5:39 pm

Postby mjcross » Sat Jul 09, 2011 10:39 pm

In case you want to know what commands can be sent to an LCD display, check its datasheet to see what controller chip it uses - then find the datasheet for that chip.

Typically most small alphanumeric LCDs use the same command set though. See, for example, page twelve onward of the datasheet for Samsung's S6A0069: http://www.digchip.com/datasheets/parts ... 69-pdf.php
User avatar
mjcross
Member++
Posts: 16
Joined: Wed Jun 29, 2011 5:39 pm

Postby mjcross » Sat Jul 09, 2011 10:44 pm

I got all the bits and bobs I wanted from Digikey, because that was the only place I could find to source the XC-1A. I did find their service was very good. NB: pricing shown below is approx (due to volume discounts on some items) and does not include VAT.

1 x LCD Display, digikey part number NHD-0216K1Z-NSW-BBW-L-ND (£7.85)
1 x XC-1A, digikey part number XCARD XC-1A-ND (£66.43)
2 x 16 pin (male) header connectors, digikey part number 609-3228-ND-ND (£0.40 each)
1 x 6 inch, 16 way header cable (female connectors), digikey part number H3AAH-1606G-ND (£0.85)

Additionally I used a small square of prototyping board to make the patch between the header cable and the LCD display (pinout details to follow), and to carry a 10k variable resistor for the contrast adjustment.

I think that using a small PCB to make a patch between the port pinout and whatever you want to connect it to, is neater than soldering multiple different wires to the XC board. It means you can use plain 16-way header cables - and therefore you can swap easily between different "peripherals" without having to keep track of loads of custom cables.
User avatar
mjcross
Member++
Posts: 16
Joined: Wed Jun 29, 2011 5:39 pm

Postby mjcross » Wed Jul 13, 2011 10:39 pm

The interconnection between the XC-1A extension port and the LCD module (for the NHD-0216K1Z part, anyway) is as shown below.
.
As discussed in one of the other notes, I implemented this using a small square of protoyping board and a 16x2 header plug, so that I could use a 'straight' 16way header cable to connect to the XC-1A.
LCD pin 01 (Vss) = Xport pin 08 (Gnd)
LCD pin 02 (Vdd) = Xport pin 15 (+5v)
LCD pin 03 (Vo ) = wiper of 10k pot. between Vdd and Vss
LCD pin 04 (RS ) = Xport pin 01 (P1A0)
LCD pin 05 (R/W) = Xport pin 02 (P1B0)
LCD pin 06 ( E ) = Xport pin 13 (P1C0)
LCD pin 07 (DB0) = Xport pin 03 (P8A bit 0)
LCD pin 08 (DB1) = Xport pin 04 (P8A bit 1)
LCD pin 09 (DB2) = Xport pin 05 (P8A bit 2)
LCD pin 10 (DB3) = Xport pin 06 (P8A bit 3)
LCD pin 11 (DB4) = Xport pin 09 (P8A bit 4)
LCD pin 12 (DB5) = Xport pin 10 (P8A bit 5)
LCD pin 13 (DB6) = Xport pin 11 (P8A bit 6)
LCD pin 14 (DB7) = Xport pin 12 (P8A bit 7)
LCD pin 15 (backlight anode) = Xport pin 15 (+5v)
LCD pin 16 (backlight cathode) = Xport pin 08 (Gnd)

"Xport pin xx" refers to pin xx of extention port X1PortA (or X2PortA) on the XC-1A board.
.
NB: the actual mapping between XC ports and the LCD control lines is defined in LCDdriver.h It can be adjusted to whatever is convenient for you. What is shown below corresponds to the default configuration that is used in the project file.
User avatar
phalt
Respected Member
Posts: 298
Joined: Thu May 12, 2011 11:14 am

Postby phalt » Fri Jul 22, 2011 10:21 am

Thanks for such a detailed list of items and pins.
I feel like you explained it well enough for anyone to just grab the components, stick it together and make it work!

Good job - any ideas on your next project?
prettysia
New User
Posts: 3
Joined: Fri May 22, 2015 7:17 am

Postby prettysia » Wed Aug 05, 2015 9:39 am

Have you programmed anything else with your setup? Like flashing traffic LED's or something like that.
Beth McClure

web design switzerland
 

Who is online

Users browsing this forum: No registered users and 2 guests