pic LM032

18,106

Circuit Image

This document discusses an older LM032L LCD module from Hitachi. It details the process of making the module operational with a PIC 16F84A microcontroller. The module is capable of displaying two lines with 20 characters each. The initial step involved locating the datasheet for the LM032L LCD, which provides the necessary connection information. The LM032L has 14 connections: 8 data lines (DB0 to DB7), power supply lines (Vss, Vdd, Vo), and additional control lines (RS, RW, E). The module can operate in both 8-bit and 4-bit modes, with the latter conserving I/O lines on the PIC microcontroller. The PIC16F84A features only 13 I/O pins, making it impractical to allocate 11 pins solely for LCD control. The LM032L does not include control instructions in its datasheet, as it relies on the HD44780 chip for LCD control, which has a separate, extensive datasheet. The LM032L's connections are arranged in two vertical rows of seven soldering contacts each. Basic circuit implementation requires powering the PIC16F84A with a 5 VDC supply between the VDD and VSS pins. A capacitor (C3) is used to filter high-frequency noise, and the PIC is clocked by an external 4 MHz crystal with accompanying capacitors (C1 and C2). The LCD module connects via connector J2, with the PIC's ports RB7:RB4 driving the data pins and RB3:RB1 controlling E, RW, and RS. The Vo pin, which adjusts the module's contrast, is connected to ground for a fixed contrast setting. The circuit should be supplied with a stabilized 5 VDC voltage, necessitating a voltage regulator (7805) and additional capacitors if needed. The software for the PIC is written in High-Tech C Lite (free version) and initializes the LCD to display "Hello World!" by defining a character array and using a function to transmit the bytes to the module.

The LM032L LCD module is an alphanumeric display capable of showing two lines of text, each containing 20 characters. It utilizes a parallel data interface, allowing for flexible communication modes with microcontrollers like the PIC16F84A. The dual operation modes (4-bit and 8-bit) enable the user to optimize pin usage according to the application requirements.

In 4-bit mode, only four data lines are used for communication, with each byte being sent in two stages—first the upper four bits, followed by the lower four bits. This method is particularly advantageous for microcontrollers with limited I/O pins, such as the PIC16F84A, which has only 13 available I/O pins.

The control of the LM032L is primarily managed by the HD44780 controller, which is a well-documented and widely used chip in various LCD applications. The datasheet for the HD44780 provides detailed information on command sequences, timing diagrams, and electrical characteristics essential for successful integration.

The physical connections of the LM032L are arranged in two rows, facilitating easy soldering to a PCB or breadboard. The pinout includes essential connections for power, data, and control signals, with a specific emphasis on the proper configuration to ensure correct functionality.

The circuit design requires a stable 5 VDC power supply, which can be achieved using a voltage regulator such as the 7805, ensuring that the microcontroller and LCD module operate within their specified voltage ranges. Capacitors are used for decoupling and noise reduction, which is critical in maintaining stable operation, especially in environments with electrical interference.

The programming aspect involves initializing the LCD module through a series of commands sent via the defined data and control lines. The software initializes the display in 4-bit mode and configures it for operation without a cursor. The display is cleared, and a simple message is transmitted, demonstrating the basic functionality of the setup. This process highlights the importance of careful timing and control signal management when interfacing with LCD modules.

Overall, the integration of the LM032L LCD module with the PIC16F84A microcontroller exemplifies a fundamental application of embedded systems, showcasing the interplay between hardware configuration and software control in achieving desired display outcomes.This page is about an old LM032L LCD module from Hitachi. I found an old one and tried to make it work. The module can display 2 lines with 20 characters each. This page will describe how I got the module to work on a PIC 16F84A microcontroller. First I had to find the datasheet for the LM032L LCD, which is no big deal when you use Google. The dat asheet will show you how to connect the LCD module. It turned out the LM032L has 14 connections: 8 data lines (DB0. DB7), the power supply (Vss, Vdd, Vo) and some additional control lines (RS, RW, E). So our module uses 8 parallel lines to send data to it. We can also use it with only 4 lines of data, this saves us some I/O lines on the PIC microcontroller. In this 4-bit mode each byte is transmitted in two phases: first the 4 upper bits are transmitted, then the the 4 lower bits.

THIS is the approach I will use for my LCD controller: the PIC16F84A only has 13 I/O pins. We can`t afford to use 11 of them just to control an LCD module. The datasheet of the LM032L does not tell us how to control the LCD module. This is because the LM032L uses another chip to do the actual controlling of the LCD module: the HD44780. This HD44780 has its own datasheet and counts no less than 59 pages! The information in this datasheet applies to the LM032L module as well. The LM032L module has 14 connections that can be soldered. The connections are not numbered but you can find the numbering in the datasheet of the LM032L. The image is not very clear but at the left of the module there are 14 soldering contacts, formed by 2 vertical rows with 7 connections each.

The numbering #1 starts with the right connection of the last row. The used circuit is very easy. It is the basic implementation of the PIC16F84A: the chip is powered by applying 5 VDC between the VDD and VSS pins. The capacitor C3 will filter out the high frequency noise. The PIC is driven by an external 4 MHz crystal. C1 and C2 are needed to work properly. The LCD module is connected to the connector J2. The PIC`s Ports RB7:RB4 will drive the DB data pins. The ports RB3:RB1 will drive E (Enable), RW (Read/Write) and RS (Instruction/Data). The Vo connection, to regulate the contrast of the module, is connected to the GND (fixed contrast). The circuit should be powered by a 5 VDC stabilized voltage. You need to add a voltage regulator (7805) and some capacitors if you don`t have a stabilized voltage.

My software for the PIC is written in High-Tech C Lite (free version). The software will just initialize the LCD and show you the words "Hello World!". My application defines an array of characters containing the String to show on the LCD. A pointer to this array is then passed to the writeString function. This function will transmit the bytes to the LCD module. /* * This sample application for the PIC 16F84A drives * the LM032L LCD module. * * The application uses a 4-bit data bus */ #include ; // define crystal speed #define _XTAL_FREQ 4000000 // define names #define RS RB1 // RS word. 0=Instr, 1=Data #define RW RB2 // RW word. 0=write, 1=read #define CE RB3 // CE word. 0=disabled, 1=enabled #define busy RB7 #define MODE_DATA 1 #define MODE_CMD 0 // function prototypes //void write (char data, char mode); void writeFourbits(char data); void writeData(char data); void writeString(char *pMsg); void writeCommand(char data); void LCDbusy(); void LCDinitialize(); void main(); // Initialize the LCD module // Set to 4-bit operation, no cursor void LCDinitialize() { writeCommand(0x28); // busy flag & address writeCommand(0x28); // busy flag & address writeCommand(0x28); // busy flag & address writeCommand(0x06); // cursor move direction writeCommand(0x0C); // LCD enable, cursor off writeCommand(0x01); // clear LCD } // LCDbusy() will wait until the LCD isn`t busy void LCDbusy() { TRISB7=1; // put port into input mode RS=0; RW=1; CE=1; while (busy=1); CE=0; TRISB7=0; // put port into out 🔗 External reference