Using Hitachi LCDs With The PIC 16X84


There are any number of sites out there that describe using LCDs based upon the Hitachi HD44780 with various microcontrollers. My intention is not to repeat what has been presented elsewhere, but to discuss the specific case of using these LCDs with the PIC 16X84 and to show the interface I currently use with them.Using LCDs based upon the Hitachi HD44780 with the PIC 16X84 is not difficult, but there is one thing that needs to be considered; the number of I/O lines required to interface to the LCD. LCDs using the HD44780 will operate using either a 4 or an 8 bit bus. However, this is only part of the story. These LCDs also require register select, read/write, and chip select lines. For microcontrollers using exteral memory, these control lines are normally generated by the controller separate from the data bus. However, the PIC 16X84 must simulate them using the PIC I/O lines. This means you actually need as many as 11 I/O lines (for an 8 bit bus) to communicate with the LCD. Given the fact that the PIC 16X84 has only 13 I/O lines to begin with, you can see the difficulty.

The way I chose to get around this problem is to forget about the 8 bit interface and use the 4 bit one. The circuit shown below that does just that. The DTMF decoder circuit located elsewhere on this site uses this circuit. The PIC routines used to access the LCD using this interface are available here.

The upper 4 bits of PORTB on the PIC are used as the data bus. Bits 2 and 3 of PORTB provide the register select and read/write control signals, while bit 1 of PORTA provides the chip select. The chip select is controlled using a PORTA rather than one of the lines available on PORTB since this allows you to connect other chips to PORTB in parallel with the LCD. By using the remaining bits of PORTA as chip select signals for these additional chips and addressing them only as required, a number of chips can share PORTB with no problems. The DTMF Decoder circuit and software mentioned above shows how this can be done.


Comments are closed.

Tabula Candida

Doodles of a distracted historian

A blog about RTL-SDR (RTL2832) and cheap software defined radio

DuWayne's Place

Computers, Electronics, and Amateur Radio from KC3XM

QRP HomeBuilder - QRPHB -

Computers, Electronics, and Amateur Radio from KC3XM

Open Emitter

Computers, Electronics, and Amateur Radio from KC3XM

Ripples in the Ether

Emanations from Amateur Radio Station NT7S

m0xpd's 'Shack Nasties'

Computers, Electronics, and Amateur Radio from KC3XM

%d bloggers like this: