HCS12 LCD with 74HC164 or 74HC595

Started by hc08jb8 January 8, 2004
Hi All,

I have seen some schematics where a HD44780 based LCD is hooked up
using 74HC164 or 74HC595 (serial shifter chips, I guess), this mode
only uses a few pin resource on the MCU. I did look at the datasheets
of the 164/595 but couldnt figure out much on the software part.

1.) How does the MCU talk to these chips and effectively control the
LCD?
2.) Is it using SPI protocol?
3.) If I need to initialise the LCD and start sending strings to
display, where should I start?

Thanks in advance
Jay



These are serial shift registers, indeed, and they would work with the SPI
port on the '12. Suspect it would be easier to use the 595 because of its
internal buffer structure that makes it more suitable for SPI. You would
hook up MOSI to the SHIFT CLOCK input of the 74HC595, SCLK to the SHIFT
CLOCK input of the shift register, and SS# (or any convenient port pin, set
up as an output) to the LATCH CLOCK input of the shift register. The minimal
hardware version would be to run the LCD in 4-bit mode, so the shift
register would output the 4 data bits, plus the three control signals
typically needed by the LCD-R/W#, A0 (register select), and E. The data
sheets for the LCD panel (which basically echo the HD44780 data sheet) show
you the signal sequence needed to drive the LCD. The software required is
not theoretically difficult but a little laborious because you're
effectively emulating an old 6800 parallel bus interface, using the SPI bus,
one bus state at a time. Each 8-bit SPI bus transfer must set the three
control signals appropriately, and the four data bits. You could also run
the LCD in 8-bit mode, but then you would need to cascade two 74HC595's in
series, so that you can build the three control signals.
Hope this is helpful.

Best regards,

Kerry Berland

Silicon Engines
2101 Oxford Road
847-803-6860
Fax 847-803-6870
Des Plaines, IL 60018 USA

-----Original Message-----
From: hc08jb8 [mailto:]
Sent: Thursday, January 08, 2004 11:30 AM
To:
Subject: [68HC12] HCS12 LCD with 74HC164 or 74HC595
Hi All,

I have seen some schematics where a HD44780 based LCD is hooked up
using 74HC164 or 74HC595 (serial shifter chips, I guess), this mode
only uses a few pin resource on the MCU. I did look at the datasheets
of the 164/595 but couldnt figure out much on the software part.

1.) How does the MCU talk to these chips and effectively control the
LCD?
2.) Is it using SPI protocol?
3.) If I need to initialise the LCD and start sending strings to
display, where should I start?

Thanks in advance
Jay
--------------------To learn more about
Motorola Microcontrollers, please visit
http://www.motorola.com/mcu
o learn more about Motorola Microcontrollers, please visit
http://www.motorola.com/mcu

_____

> Service.


Jay --

See below

--- Avoid computer viruses, Practice safe hex ---

-- Specializing in small, cost effective
embedded control systems --

http://www.smithmachineworks.com/embedprod.html Robert L. (Bob) Smith
Smith Machine Works, Inc.
9900 Lumlay Road
Richmond, VA 23236 804/745-1065
----- Original Message -----
From: "hc08jb8" <>
To: <>
Sent: Thursday, January 08, 2004 12:30 PM
Subject: [68HC12] HCS12 LCD with 74HC164 or 74HC595 > Hi All,
>
> I have seen some schematics where a HD44780 based LCD is hooked up
> using 74HC164

The 164 is a simple, serial-in / parallel-out, shift register. It does not
have latched outputs or an asynchronous output register clear.

> or 74HC595 (serial shifter chips, I guess),

The 595 is also a serial-in / parallel-out shif register. It does have
latched output registers, but does not have an asynchronous output register
clear.

The preferred device for your application is the 594 which replaces the
Output Enable function of the 595 with an asynchronous reset that clears the
output latches.

> this mode
> only uses a few pin resource on the MCU. I did look at the datasheets
> of the 164/595 but couldnt figure out much on the software part.

You can easily drive the 594 more or less directly with the SPI port. The
general idea is that you shift in an eight bit word and then strobe it into
the output registers using the latch clock. You change the data on the
output bus each SPI sequence to step the 44780 LCD driver through its
required sequence of commands and data transfers.

>
> 1.) How does the MCU talk to these chips and effectively control the
> LCD?

By sending command words to the 44780 via the SPI port, using the 594 as a
registered latch to emulate a bus sequence.

> 2.) Is it using SPI protocol?

Yes.

> 3.) If I need to initialise the LCD and start sending strings to
> display, where should I start?

Start at the beginning of the initialization command sequence. As I recall
the first command declares your intent to operate in 4 or 8 bit transfer
mode. You use the 4 bit mode by connecting 4 of the output data bits of the
594 to matching data bits of the 44780. You also connect other output bits
of the 594 to the register select pin and the R/W pins of the 44780.

Finally, you have to connect the enable pin of the 44780. You can use one
of the 594 pins, but it is best if you can spare a direct output port pin of
the HC12 to run the enable. This saves you from having to grind through 2
complete SPI cycles to toggle the data into the 44780. Finally, in a
similar manner, if you can afford 2 or 3 output pins on the HC12 you can
directly connect and bit bang the RS and Enable pins. Since you can drive
the 44780 in the Write Only mode, the R/W pin can be hard wired. This all
enables you to run the 44780 in the 8-bit mode which saves many, many SPI
cycles.

If my memory serves me well, there was an example of running LCDs off of the
SPI interface at

http://www.eio.com

Best wishes, Bob Smith >
> Thanks in advance
> Jay > --------------------To learn more
about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu
> o learn more about Motorola Microcontrollers, please visit
> http://www.motorola.com/mcu >


--- In , "hc08jb8" <hc08jb8@y...> wrote:

Hi Jay,
See http://www.ezl.com/~rsch/projects.htm#SPI
for hardware & software.
Roger
> Hi All,
>
> I have seen some schematics where a HD44780 based LCD is hooked up
> using 74HC164 or 74HC595 (serial shifter chips, I guess), this
mode
> only uses a few pin resource on the MCU. I did look at the
datasheets
> of the 164/595 but couldnt figure out much on the software part.
>
> 1.) How does the MCU talk to these chips and effectively control
the
> LCD?
> 2.) Is it using SPI protocol?
> 3.) If I need to initialise the LCD and start sending strings to
> display, where should I start?
>
> Thanks in advance
> Jay