Typically LCDs are operated using the 4 bit interface to save pins. However, most modern LCDs don't need any initialization if you are using 8 bits. Simply put the character on the data lines and toggle the enable line. For four bits you do need to go through some convoluted initialization. The LCD has the ability to tell you when it is done, but most folks tie the R/W line low and simply wait long enough. The mistake most people then make is not waiting long enough. The LCD will only go so fast, but it can go as slow as you want. There used to be some pretty good stuff on the Internet about LCDs, but most of that is pretty old now. It is a pretty simple problem. I've never been that thrilled with the Microchip libraries, especially for 8 bit. Usually it is a lot simpler just to do it yourself, although for an LCD, I'm sure there are plenty of good libraries out there. Beware, though. There is a wide difference in speed between different LCDs. If you have code written against the HD44780 datasheet it ought to work with pretty much any LCD. But code someone wrote for some random LCD might not work with the one you happen to have. Also, some LCDs have some extra features that aren't in the HD44780. A library written against these can cause confusing results. I was surprised to find some of these in the LCD on my Explorer 16. Microchip apparently uses a number of different displays on this board, but the one I have has multiple addresses for some positions on the display. This can actually be convenient sometimes, but can also be a real pain. So I would suggest get the HD44780 datasheet, do what it says, but start out real slow. Once you get things working, then adjust to the times in the datasheet. It isn't a very hard problem, and over the longer term, you will be better off understanding what you have. You can probably learn a lot from other people's code. I wouldn't put too much time into Microchip's, tho. Their code tends to be conditionalized for a number of PICs and demo boards, and wading through all the #ifdef's can be a real challenge. --McD On Tue, 2015-03-17 at 12:09 +0000, Matt Rhys-Roberts wrote: > Hi, I'm right at the start of trying to drive a generic ST7066U-based=20 > 2x16 LCD character display, compatible with HD44780/KS0066/KS0070B etc. >=20 > Talking to the display can be done using 4 or 8 bits. I'm using 8 bits=20 > for now until I can prove any advantage to using 4. Pin count costs,=20 > perhaps? Any opinions on this please? >=20 > It seems logical to use the pre-written LCD library code provided by=20 > Microchip, rather than write my own, at this stage. So I think I need to= =20 > include xlcd.h, but then I'm not too clear about getting the job done. I= =20 > can see a number of .c files under=20 > /opt/microchip/xc8/v1.33/sources/pic18/plib/XLCD which I guess I'd call,= =20 > and pass parameters accordingly. >=20 > So my question is, has anyone seen a good user guide to setting all this= =20 > up? I seem to have found the details before finding any kind of manual. >=20 > Many thanks, > Matt. --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .