STM32F10x library
Macros | Functions | Variables
lcd.c File Reference

HD44780 LCD routines (high level) More...

#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include "itoa.h"


#define LCD_WIDTH   20
 LCD width.
#define LCD_HEIGHT   2
 LCD height (number of lines)
#define LCD_USE_FB
 Define to use framebuffer. Skips unnecessary LCD writes. Recommended.


void lcd_clear (void)
 Clear LCD.
void lcd_init (void)
 Init LCD.
void lcd_goto (uint8_t x, uint8_t y)
 Position LCD cursor. More...
void lcd_line (const uint8_t y)
 Position LCD cursor to the beginning of line y. More...
void lcd_putc (const char c)
 Write a char. More...
void lcd_endl (void)
 Emulate endl by printing spaces until LCD width is reached.
uint8_t lcd_puts (const char *s)
 Write a string. More...
void lcd_putsn (const char *s, uint8_t n)
 Write n chars of string. More...
void lcd_puti_lc (const uint32_t a, uint8_t r, uint8_t l, char c)
 Write int in the specified radix r of minlen w prepended by char c. More...
void lcd_putf (float f, uint8_t prec)
 Write float with specified precision. More...


uint8_t lcd_busw

Detailed Description

HD44780 LCD routines (high level)

This is the high level part of HD44780 control. Low level driver is implemented elsewhere.

Matej Kogovsek (
This file is part of mat-stm32f1-lib

Function Documentation

void lcd_goto ( uint8_t  x,
uint8_t  y 

Position LCD cursor.

[in]xcharacter (0 based)
[in]yline (0 based)
void lcd_line ( const uint8_t  y)

Position LCD cursor to the beginning of line y.

[in]yline (1 based)
void lcd_putc ( const char  c)

Write a char.

[in]ccharacter to write
void lcd_putf ( float  f,
uint8_t  prec 

Write float with specified precision.

[in]precNumber of decimals
void lcd_puti_lc ( const uint32_t  a,
uint8_t  r,
uint8_t  l,
char  c 

Write int in the specified radix r of minlen w prepended by char c.

[in]lMin length
[in]cPrepending char
uint8_t lcd_puts ( const char *  s)

Write a string.

[in]sZero terminated string
Number of chars written.
void lcd_putsn ( const char *  s,
uint8_t  n 

Write n chars of string.

[in]sString (zeros are printed as spaces)
[in]nNumber of characters to write

Variable Documentation

uint8_t lcd_busw

Extern variable defined by "driver" specifying used LCD bus width (0 = 4 bit, 0x10 = 8 bit)

Actual LCD bus width = 4 bit