AN4032 Application note



Similar documents
AN3332 Application note

AN3265 Application note

AN3252 Application note

AN3354 Application note

AN4108 Application note

AN3110 Application note

EVL185W-LEDTV. 185 W power supply with PFC and standby supply for LED TV based on the L6564, L6599A and Viper27L. Features.

AN3998 Application note

AN2824 Application note

AN2680 Application note

UM1676 User manual. Getting started with.net Micro Framework on the STM32F429 Discovery kit. Introduction

2STBN15D100. Low voltage NPN power Darlington transistor. Features. Application. Description

AN4156 Application note

SPC5-FLASHER. Flash management tool for SPC56xx family. Description. Features

UM1613 User manual. 16-pin smartcard interface ST8034P demonstration board. Introduction

AN2389 Application note

AN2557 Application note

AN4128 Application note

UM0985 User manual. Developing your STM32VLDISCOVERY application using the IAR Embedded Workbench software. Introduction

AN3353 Application note

Single LNB supply and control IC DiSEqC 1.X compliant with EXTM based on the LNBH29 in a QFN16 (4x4) Description

AN3990 Application note

ESDLIN1524BJ. Transil, transient voltage surge suppressor diode for ESD protection. Features. Description SOD323

TN0023 Technical note

DDSL01. Secondary protection for DSL lines. Features. Description

ULN2801A, ULN2802A, ULN2803A, ULN2804A

BD238. Low voltage PNP power transistor. Features. Applications. Description. Low saturation voltage PNP transistor

ST High voltage fast-switching NPN power transistor. Features. Applications. Description

ULN2001, ULN2002 ULN2003, ULN2004

AN2604 Application note

M24LRxx/CR95HF application software installation guide

UM1680 User manual. Getting started with STM32F429 Discovery software development tools. Introduction

BD135 - BD136 BD139 - BD140

BD241A BD241C. NPN power transistors. Features. Applications. Description. NPN transistors. Audio, general purpose switching and amplifier transistors

Getting started with DfuSe USB device firmware upgrade STMicroelectronics extension

Order code Temperature range Package Packaging

AN3270 Application note

ETP01-xx21. Protection for Ethernet lines. Features. Description. Applications. Benefits. Complies with the following standards

UM1727 User manual. Getting started with STM32 Nucleo board software development tools. Introduction

STEVAL-IEG001V2. Smart real-time vehicle tracking system. Features

ST19NP18-TPM-I2C. Trusted Platform Module (TPM) with I²C Interface. Features

MC Low noise quad operational amplifier. Features. Description

UM1790 User manual. Getting started with STM32L053 discovery kit software development tools. Introduction

LM135-LM235-LM335. Precision temperature sensors. Features. Description

Description. Table 1. Device summary. Order code Temperature range Package Packaging Marking

AN974 APPLICATION NOTE

LM337. Three-terminal adjustable negative voltage regulators. Features. Description

AN3359 Application note

DSL01-xxxSC5. Secondary protection for DSL lines. Features. Description. Applications. Benefits. Complies with the following standards

How To Write To An Eeprom Memory On A Flash Memory On An Iphone Or Ipro Memory On Microsoft Flash Memory (Eeprom) On A Microsoft Microsoft Powerbook (Ai) 2.2.2

EN: This Datasheet is presented by the m anufacturer. Please v isit our website for pricing and availability at ore.hu.

AN3155 Application note

L78MxxAB L78MxxAC. Precision 500 ma regulators. Features. Description

BZW50. Transil, transient voltage surge suppressor (TVS) Features. Description

UA741. General-purpose single operational amplifier. Features. Applications. Description. N DIP8 (plastic package)

AN2866 Application note

SPC5-CRYP-LIB. SPC5 Software Cryptography Library. Description. Features. SHA-512 Random engine based on DRBG-AES-128

Description SO-8. series. Furthermore, in the 8-pin configuration Very low-dropout voltage (0.2 V typ.)

Description. Table 1. Device summary

UM0834 User manual. Developing and debugging your STM8S-DISCOVERY application code. Introduction. Reference documents

AN2760 Application note

Description. IO and RF AGC. ASIC controller and power management. Carrier recovery loop. GPIO switch matrix. Lock indicator and monitoring DVBS2 FEC

STP60NF06. N-channel 60V Ω - 60A TO-220 STripFET II Power MOSFET. General features. Description. Internal schematic diagram.

Figure 1. STM32F429 Discovery board: STM32F429I-DISCO

LM134-LM234-LM334. Three terminal adjustable current sources. Features. Description

L6234. Three phase motor driver. Features. Description

STP60NF06FP. N-channel 60V Ω - 30A TO-220FP STripFET II Power MOSFET. General features. Description. Internal schematic diagram.

STTH2R06. High efficiency ultrafast diode. Features. Description

STN3NF06L. N-channel 60 V, 0.07 Ω, 4 A, SOT-223 STripFET II Power MOSFET. Features. Application. Description

AN3997 Application note

AN2658 Application note

AN1754 APPLICATION NOTE

Table 1. Absolute maximum ratings (T amb = 25 C) Symbol Parameter Value Unit. ISO C = 330 pf, R = 330 Ω : Contact discharge Air discharge

UM1075 User manual. ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32. Introduction

Description. Table 1. Device summary. Order codes. TO-220 (single gauge) TO-220 (double gauge) D²PAK (tape and reel) TO-220FP

TDA W CAR RADIO AUDIO AMPLIFIER

STCS A max constant current LED driver. Features. Applications. Description

P6KE. Transil, transient voltage surge suppressor (TVS) Features. Description. Complies with the following standards

STTH1R04-Y. Automotive ultrafast recovery diode. Features. Description

STDP2690. Advanced DisplayPort to DisplayPort (dual mode) converter. Features. Applications

TDA2004R W stereo amplifier for car radio. Features. Description

UM0462 User manual. STM32 and STM8 Flash loader demonstrator. Introduction

STCS1A. 1.5 A max constant current LED driver. Features. Applications. Description

AN4368 Application note

STGB10NB37LZ STGP10NB37LZ

TN0072 Technical note

AN3969 Application note

LM2901. Low-power quad voltage comparator. Features. Description

VN05N. High side smart power solid state relay PENTAWATT. Features. Description

AN2703 Application note

STCS2A. 2 A max constant current LED driver. Features. Applications. Description

STDP4328. DisplayPort 1.2a concentrator. Features. Applications

AN1819 APPLICATION NOTE Bad Block Management in Single Level Cell NAND Flash Memories

NE555 SA555 - SE555. General-purpose single bipolar timers. Features. Description

AN438 APPLICATION NOTE SAFETY PRECAUTIONS FOR DEVELOPMENT TOOL TRIAC + MICROCONTROLLER

STP55NF06L STB55NF06L - STB55NF06L-1

STLM20. Ultra-low current 2.4 V precision analog temperature sensor. Features. Applications

HANDLING SUSPEND MODE ON A USB MOUSE

STDP4320. DisplayPort 1.2a splitter. Features. Applications

Transcription:

Application note Interfacing an HD44780 2-line LCD display with the STM8SVLDISCOVERY Introduction This application note describes how to use a firmware example that drives a standard HD44780 2-line LCD display with the STM8SVLDISCOVERY. The example uses an LCD display driver that has been developed to be as generic as possible, so it can be reused with any STM8 device. The firmware package associated to this application note includes a pre-configured project template which facilitates development of your own application to use an HD44780 LCD display module. The LCD interface offers many ways to easily create a user interface to display text messages and other application related information, whilst using very few internal hardware resources. The HD44780 is a common LCD controller and is very widespread through various formats, 1 X 8, 2 x 16, 2 x 20, 4 x 20 and others. This example uses the very popular 2 x 16 format (2 lines of 16 characters) which is now offered at a very reasonable price. Other LCD display modules based on compatible ST7066 or KS0066U controllers could also be used. This application example intentionally uses the least possible microcontroller pins as the interface bus to the LCD module is 4-bits wide. This application example requires additional hardware: LCD module HD44780 Potentiometer to adjust LCD contrast. Reference documents STM8SVLDISCOVERY STM8S value line discovery (UM1482). STM8SVLDISCOVERY quick start guide (UM1480) All these documents are available at http://www.st.com. February 2012 Doc ID 022651 Rev 1 1/19 www.st.com

Contents AN4032 Contents 1 Application description...................................... 5 1.1 Hardware required........................................... 5 1.2 STM8SVLDISCOVERY hardware settings......................... 5 1.3 HD44780 LCD display module description......................... 5 1.4 Hardware interface application schematics........................ 6 1.5 Application principle.......................................... 8 1.5.1 Overview................................................. 8 1.5.2 LCD interface.............................................. 8 1.5.3 Custom characters definition.................................. 9 2 Software description........................................ 11 2.1 STM8S peripherals used by the application....................... 11 2.2 Configuring STM8S/A standard peripherals library................. 12 2.2.1 For use with this application.................................. 12 2.2.2 For other uses of the HD44780 LCD display driver................ 12 2.3 Application software description................................ 13 2.3.1 Main application flowchart................................... 13 2.3.2 HD44780 LCD display module library description................. 15 3 Conclusion................................................ 17 4 Revision history........................................... 18 2/19 Doc ID 022651 Rev 1

List of tables List of tables Table 1. LCD display module connector pin assignments................................. 6 Table 2. HD44780.c functions relevant to LCD display.................................. 15 Table 3. Document revision history................................................. 18 Doc ID 022651 Rev 1 3/19

List of figures AN4032 List of figures Figure 1. HD44780 LCD display module.............................................. 5 Figure 2. Hardware interface of the LCD display and the STM8SVLDISCOVERY............... 7 Figure 3. HD44780 LCD display demonstration......................................... 8 Figure 4. Example of A character definition............................................ 9 Figure 5. Custom characters of application example.................................... 10 Figure 6. Main application flowchart................................................. 14 4/19 Doc ID 022651 Rev 1

Application description 1 Application description 1.1 Hardware required This application uses the STM8SVLDISCOVERY on-board LED LD1, an HD44780 or equivalent 2-line LCD display and a 10 kω to 20 kω potentiometer to adjust LCD contrast. Some LCD models include an LCD backlight feature but this application note does not deal with this implementation. The LCD display module used in this example is a WINTEK WD- C1602R which is fully compliant with an HD44780 controller, it has 16 characters X 2 lines and a character format of 5 X 8 dots. The LCD current consumption for logic is typically 2mA. 1.2 STM8SVLDISCOVERY hardware settings JP1 (power supply jumper) must be put in the 5V position, to provide the correct VDD for LCD module operation. There are no other specific settings for the STM8SVLDISCOVERY. The LCD can be: Connected directly with extra wires to the STM8SVLDISCOVERY CN1, CN2 and CN3 connectors. Interfaced with a daughterboard (connected via these same connectors, plus CN4 for mechanical support) that receives the LCD module and the potentiometer with a proper PCB layout (not detailed here). 1.3 HD44780 LCD display module description The LCD display module includes 2 16-character lines and a 16-pin connector. Each character position is identified by its row number (1 or 2), and its column number (from 1 to 16). For example, when used in the software library: Location (2, 10) refers to the 10 th character of the 2 nd line. See Table 1 on page 6 for connector details. Figure 1. HD44780 LCD display module Doc ID 022651 Rev 1 5/19

Application description AN4032 Table 1. LCD display module connector pin assignments 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 GND VCC VEE or V0 RS R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 NC NC 0V +5V LCD power supply Register Select 0: Command 1: Data Read/Write 0: Write 1: Read Enable LCD module 4-bit low order data bus 4-bit high order data bus - - 1.4 Hardware interface application schematics The LCD display module can easily be interfaced with the STM8SVLDISCOVERY using the application schematics (Figure 2). On the STM8SVLDISCOVERY side, the application uses 7 microcontroller I/Os, see the proposed hardware configuration in Figure 2. When required, users can easily modify the pin selection in the application software by editing the LCD port declarations in the HD44780.h header file. The only considerations to take into account are the pins compatibility according to their function: For example, PE5 supplies LCD drive current due to its high sink capability (can drive more current than a standard port). If you change the MCU I/O which powers the LCD module, you must ensure that it features high sink capability. Some pins of the STM8S003K3 have no internal push-pull capability so they cannot be selected for the LCD port, control or power pins. Please read the pins description in the STM8S003K3 datasheet carefully if hardware configuration change is required. On the LCD display side: In order to display a character or send a command to the LCD, a byte corresponding to the character ASCII code or to the command byte value must be sent. Data can be sent from the MCU to the LCD in 4-bit or 8-bit operation. In 8-bit mode, this operation is done in one send. In 4-bit mode, this operation requires two sends of 4-bit data. This application uses 4-bit operation, so only DB4 to DB7 need to be connected (LCD 4-bit data bus) and DB0 to DB3 are not connected. If the LCD port is changed, the user must assign the lower nibble of a new MCU port to the LCD data bus. For example, in this application example MCU port B is the LCD port with PB0 to PB3 pins. If a different MCU port was chosen, the choice of possible LCD port pins is limited to Px0 to Px3 (due to firmware management), where x can be A, B, C, etc according to the pins availability on the device. The R/W pin of the LCD display module is connected to GND (Write is active). Only Write operations to LCD memory are performed in this example. Data are exclusively written into LCD and the firmware provides adequate timing needed for each command without polling the internal LCD busy flag. A potentiometer is connected to VEE/V0. Contrast can be adjusted accordingly. 6/19 Doc ID 022651 Rev 1

Application description Figure 2. Hardware interface of the LCD display and the STM8SVLDISCOVERY Note: After power ON, the LCD display must be initialized once only. During a debug session, user can be led to reset the MCU and then to force a second initialization while the LCD has not been powered OFF. To prevent the LCD display from an unexpected initialization, the LCD pin VCC is connected to the MCU pin PE5 to manage by software the LCD power. This ensures that an LCD power OFF is performed before any LCD initialization attempt. Once your code has been completely developed and debugged, it is possible to fix the LCD pin VCC by connecting it permanently to the +5V power supply and by removing PE5 pin management in software. This will free-up one more pin on the microcontroller side. Doc ID 022651 Rev 1 7/19

Application description AN4032 1.5 Application principle 1.5.1 Overview This application note demonstrates some of the LCD functions provided in the library and explains how they can be combined to create your own menus for the final application. Once the hardware has been connected to the STM8SVLDISCOVERY and the software example loaded in the STM8S device memory, a welcome message STM8SVLDISCOVERY is displayed on the LCD screen. The user is then invited to press the on-board push-button to continue the demonstration. This brief LCD demonstration simultaneously refreshes 4 changing items such as shown in Figure 3: an 8-character bar graph using custom characters defined in the LCD s memory a time counter that counts minutes, seconds and hundredths of seconds the square value of an incrementing variable a rolling text message that is updated every second Figure 3. HD44780 LCD display demonstration This firmware example uses some of the basic functions available in the HD44780 driver (initializing the LCD, printing characters strings to the LCD, using LCD display ON/OFF, setting cursor position, clearing the LCD display, etc ). Up to 8 user characters (5 x 8 dots each) can be managed to create special characters or even limited graphics by combining them, as for instance, on a 4 x 2 characters matrix displayed on 2 lines. Section 1.5.3 describes how to create your own characters. 1.5.2 LCD interface MS30017V1 This LCD interface allows users to control the HD44780 module to display text, messages or other information related to the needs of the application. The LCD port 4-bit wide data bus is 8/19 Doc ID 022651 Rev 1

Application description managed by 4 lines connected to PB0 to PB3 microcontroller pins. In addition, there are 3 control pins RS, R/W and E. R/W is set to write mode (0) as data is always sent from the microcontroller to the LCD module and not in the opposite direction. RS is the register select pin. This pin allows the LCD module to decide if data coming from the microcontroller must be interpreted as an LCD command, or if it must be treated as text data to be displayed on the LCD screen. E enables LCD access for each MCU to LCD transaction. As soon as a communication starts from the microcontroller side, this pin must be put high to enable the LCD. It returns to low level once the procedure is completed. 1.5.3 Custom characters definition This section describes how users can create their own custom characters. Each custom character must be defined in the LCD display module CGRAM (Character Generator RAM) of the HD44780 device. For 5 X 8 pixel based LCD characters, up to 8 characters can be stored in the CGRAM. A character is defined by 8 bytes (only 5 bits are considered, the others are not set) representing the character pattern for each row. A displayed dot is stored as 1 in the character bytes, otherwise it is 0. These 8 bytes can be stored in a character table that will be transferred in the CGRAM memory of the HD44780 controller. Figure 4. Example of A character definition To define the application custom characters related to the bar graph used in our example, we created the following 6 characters stored in a single tab. Doc ID 022651 Rev 1 9/19

Application description AN4032 Figure 5. Custom characters of application example These characters are then written into the HD44780 LCD display module at the start address of CGRAM @0x40. These characters are defined from number 0 to 5 and can be called directly by printing their hexadecimal code. For instance, the C instruction LCD_printstring( \3\n ) displays Character 3 at the current cursor position. Displaying the bar graph prints a string containing the characters numbers (progressively changing from Character 0 to Character 5) at the same LCD display location. 10/19 Doc ID 022651 Rev 1

Software description 2 Software description 2.1 STM8S peripherals used by the application This application example uses the following STM8S peripherals and settings: TIM4: generates a 1 ms time base, used for precise delays and other timing necessary for LCD display and menu display management. TIM4 input clock is set to 16 MHz, and the prescaler to 128 (f= 125 khz) TIM4 period is set to124 thus producing a time base of 1 ms. GPIOs: STM8SVLDISCOVERY standard resources: Port C (PC4) set as input floating (push-button B1) Port D (PD0) set as output push-pull (LED LD1) HD44780 interface control resources: The LCD display module needs a port dedicated to the data bus (4-bit wide), a port dedicated to LCD control (E, RS) and a port to supply the LCD power (VCC pin): Port B (PB0 to PB3) set as output push-pull is the LCDPort (data bus) (a) Port C (PC1 and PC2) set as output push-pull is the LCDControlPort (RS and E pins) (a) Port E (PE5) set as output push-pull is the LCDPwrPort (VCC of LCD) (a)(b) The MCU I/Os selected to drive the HD44780 interface are configured through #define statements in the HD44780.h file as follows: #define LCDPort GPIOB LCD data bus assigned to PB #define LCDControlPort GPIOC #define LCDPwrPort GPIOE #define LCDPwrPin GPIO_PIN_5 #define LCD_Enable GPIO_PIN_1 #define LCD_RS GPIO_PIN_2 LCD control pins E & RS assigned to PC LCD power supply pin assigned to PE LCD power supply pin assigned to Px5 LCD enable pin assigned to Px1 LCD RS pin assigned to Px2 CLK (clock control): HSI (high speed internal 16 MHz) is selected as the main clock source. The SYSCLK prescaler is set to 1 so that CPU frequency is equal to 16 MHz. a. If the user wants to use other pins than the proposed ones, they must be configurable as output push-pull. b. If another power pin is used instead, it must have a high sink capability. Doc ID 022651 Rev 1 11/19

Software description AN4032 2.2 Configuring STM8S/A standard peripherals library 2.2.1 For use with this application The stm8s_conf.h file of the STM8S/A standard peripherals library configures the library by enabling the peripheral functions used by the application. The following define statements must be present: #include «stm8s_clk.h» #include «stm8s_tim4.h» #include «stm8s_gpio.h» 2.2.2 For other uses of the HD44780 LCD display driver To reuse the HD44780 LCD display module files outside of this application project, especially for any other STM8x family project, the following files should be imported in the new project: HD44780.c, HD44780.h, delay.c, delay.h. TIM4 and GPIO libraries should also be imported unless other resources are selected: As all delays are managed by the TIM4 peripheral, the TIM4 peripheral resource or other available timer should also be included in the project and initialized with the parameters of this application note example. Similarly, ports of STM8x microcontroller must be managed with the GPIO standard library of the selected device. Please refer to the product datasheets to verify if the required peripherals or resources are available on the microcontroller being used in the new project. This application software includes a pre-configured project template in the \Projects folder of the application note resources named HD44780_template. This provides an easy starting point to develop an HD44780 LCD based application. It includes HD44780 LCD display management and contains all the necessary software resources to drive an LCD display module with the minimum starting configuration. 12/19 Doc ID 022651 Rev 1

Software description 2.3 Application software description 2.3.1 Main application flowchart The main application initializes the peripherals that are used in this LCD display module demonstration in the following sequence: 1. Configures CLK (clock control), GPIO and TIM4 peripherals. 2. Enables the LCD power pin via the dedicated LCD power I/O (PE5 here). 3. After LCD power ON, a 100 ms delay is respected to guarantee proper LCD operation. 4. Initializes HD44780 LCD. Clears LCD screen. 5. Loads custom characters into the CGRAM of the LCD display device. 6. Displays welcome menu. Waits until B1 push-button is pressed to enter LCD demo. 7. Once the LCD demo is entered, the application remains in this state until STM8SVLDISCOVERY start-up. a) On the top left, an 8-character bar graph (Figure 3) is progressively filled then cleared. b) On the top right, the square value of a variable varying from 0 to 128 is permanently updated. c) On the bottom left, a time counter including minutes, seconds, tenths and hundredths of seconds is refreshed. This time counter is updated every 1 ms interrupt of TIM4. The total duration of this time counter is one hour maximum but it can be reset at any time by pressing B1. d) On the bottom right, the 5 words STM8S, Value, Line, 8-Bit and Micro are displayed successively at a rate of 1 word per second. e) The display is turned ON and OFF periodically. There is no particular connection between these 4 displayed items. This example demonstrates the performance of the STM8SVLDISCOVERY. It shows that the LCD display module can be driven in different ways and that the STM8SVLDISCOVERY has the capability to refresh different kinds of information at the same time. Doc ID 022651 Rev 1 13/19

Software description AN4032 Figure 6. Main application flowchart 14/19 Doc ID 022651 Rev 1

Software description 2.3.2 HD44780 LCD display module library description The HD44780 LCD display module library includes 2 files: HD44780.c and HD44780.h. These 2 files are associated with delay.c and delay.h for timings that are necessary for LCD display management. As a reminder, all delays generated are linked to the TIM4 usage and the recommended settings. Table 2 only describes the functions included in the HD44780.c file that make available actions that can be performed with the LCD display. Table 2. HD44780.c functions relevant to LCD display Function Name Description In Parameter(s) Return value void LCD_LOAD_CGRAM (char tab[], u8 charnum) void LCD_PWRON(void) void LCD_PWROFF(void) void LCD_ENABLE(void) void LCD_CMD (unsigned char cmd_data) void LCD_INIT(void) void LCD_printchar (unsigned char ascode) void LCD_printstring (unsigned char *text) void LCD_CLEAR_DISPLAY (void) Load custom characters into HD44780 CGRAM. Preceding this function, an LCD command instruction with CGRAM starting address as argument must be sent (LCD_CMD(address)). Set HIGH the LCD power pin assigned to LCD VCC power line (LCD ON). Set LOW the LCD power pin assigned to LCD VCC power line (LCD OFF). Set HIGH the LCD Enable pin assigned to LCD E line for 2ms (then return to LOW). Send command to LCD (instruction, no text data). Initialize the LCD display module in 4-bit mode. This function can only be called after LCD power ON. Manages mandatory delays between each command. Print 1 character to LCD display module. Print one character string to the LCD display module (string must end by \n terminal). Clear LCD display and set cursor at home position. char tab[]: table containing custom characters data (8 bytes a character). u8 charnum: number of characters that will be loaded unsigned char cmd_data: command value unsigned char ascode: character code unsigned char *text: characters string ended by \n void LCD_2ndROW(void) Set cursor to first column of 2 nd row. void LCD_HOME(void) void LCD_LSHIFT(void) Set cursor to home position, first column of 1 st row. Shift display left. All characters on screen are shifted one position to the left. void LCD_RSHIFT(void) Shift display right. All characters on screen are shifted one position to the right. void LCD_DISP_ON(void) LCD display is turned ON. void LCD_DISP_OFF(void) LCD display is turned OFF. Doc ID 022651 Rev 1 15/19

Software description AN4032 Table 2. HD44780.c functions relevant to LCD display (continued) Function Name Description In Parameter(s) Return value void LCD_LOCATE (u8 row, u8 column) Cursor is set at location defined by row and column. Eg: LCD_LOCATE(1,4) sets cursor on first line in 4 th position. If position is out of range, then no action. Physical address of 1 st line is 0x00; 2 nd line is 0x40 u8 row: ROW number (must be between 1 to 2) u8 column: COLUMN number (must be included between 1 to 16) void LCD_printf (const char *fmt,...) Print characters strings with specified format (does not support all formats depending on compiler limitations). Needs to include stdarg.h library in header file. const char *fmt,...: characters string with specified format 16/19 Doc ID 022651 Rev 1

Conclusion 3 Conclusion LCD character display modules are very common in many 8-bit microcontroller based applications. With a very affordable price and a quick implementation time, they offer the easiest way to realize a simple and efficient interface for various applications in industry, consumer, metering, telecommunications and other domains. This short example includes all the basic functions to drive an HD44780 LCD controller and any other compatible LCD display modules. This brief demo provides STM8SVLDISCOVERY users with many possibilities to quickly create interfaces and menus. This application note can also be tailored for any microcontroller of the STM8 family with slight firmware modifications. Doc ID 022651 Rev 1 17/19

Revision history AN4032 4 Revision history Table 3. Document revision history Date Revision Changes 16-Feb-2012 1 Initial release. 18/19 Doc ID 022651 Rev 1

Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER S OWN RISK. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. 2012 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com Doc ID 022651 Rev 1 19/19