mikroLAB kits are 25% OFF - discount is valid until March 19, 12:00 CET

Use your forum account to login.


TOP Contributors

  1. MikroElektronika Team (514 codes)
  2. Shawon Shahryiar (248 codes)
  3. Alcides Ramos (99 codes)
  4. Dany (66 codes)
  5. O B (62 codes)
  6. MikroBUS.NET Team (35 codes)
  7. NART SCHINACKOW (34 codes)
  8. Alberto Trasimeni (25 codes)
  9. Roman Toropov (25 codes)
  10. Arezki YOUYOU (24 codes)

Most Downloaded

  1. Timer Calculator (81700 times)
  2. Network Ethernet Library (39347 times)
  3. FAT32 Library (39024 times)
  4. USB Device Library (29940 times)
  5. Network WiFi Library (28397 times)
  6. FT800 Library (21408 times)
  7. PID Library (19653 times)
  8. GSM click (19324 times)
  9. microSD click - Example (16420 times)
  10. GPS click - Example (13128 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back

ULCD display library (HD44780U/OLED for AVR)


Author: trengtor

Last Updated: 2017-01-21

Category: LCD

Downloaded: 570 times

Not followed.

HD44780U/OLED display library, 4‐bit, non‐R/W, arbitrary pins. PDF doc inside.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "ULCD display library (HD44780U/OLED for AVR)" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "ULCD display library (HD44780U/OLED for AVR)" changes.

Do you want to report abuse regarding "ULCD display library (HD44780U/OLED for AVR)".

  • Information
  • Comments (2)

Download Library [54.96KB]


mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

Library Blog

// Project Name: ULCD display library
// Unite Name: ULCD
// Description: HD44780U/OLED display library, 4-bit, non-R/W, arbitrary pins
// NOTES: v.0.3
// © trengtor, 2017

unit ULCD;

// LCD module connections ------------------------------------------------------
ULCD_RS : sbit; sfr; external;
ULCD_EN : sbit; sfr; external;
ULCD_D7 : sbit; sfr; external;
ULCD_D6 : sbit; sfr; external;
ULCD_D5 : sbit; sfr; external;
ULCD_D4 : sbit; sfr; external;
ULCD_RS_Direction : sbit; sfr; external;
ULCD_EN_Direction : sbit; sfr; external;
ULCD_D7_Direction : sbit; sfr; external;
ULCD_D6_Direction : sbit; sfr; external;
ULCD_D5_Direction : sbit; sfr; external;
ULCD_D4_Direction : sbit; sfr; external;
// End LCD module connections --------------------------------------------------

// HD44780U compatible commands ----------------------------------------------
_ULCD_CLEAR : byte = 0x01; // Clear display
_ULCD_RETURN_HOME : byte = 0x02; // Return cursor to home position, returns a shifted display to its original position. Display data RAM is unaffected.
_ULCD_CURSOR_OFF : byte = 0x0C; // Turn off cursor
_ULCD_UNDERLINE_ON : byte = 0x0E; // Underline cursor on
_ULCD_BLINK_CURSOR_ON : byte = 0x0F; // Blink cursor on
_ULCD_MOVE_CURSOR_LEFT : byte = 0x10; // Move cursor left without changing display data RAM
_ULCD_MOVE_CURSOR_RIGHT : byte = 0x14; // Move cursor right without changing display data RAM
_ULCD_FIRST_ROW : byte = 0x80; // Move cursor to the 1st row
_ULCD_SECOND_ROW : byte = 0xC0; // Move cursor to the 2nd row
_ULCD_THIRD_ROW : byte = 0x94; // Move cursor to the 3rd row
_ULCD_FOURTH_ROW : byte = 0xD4; // Move cursor to the 4th row
_ULCD_TURN_ON : byte = 0x0C; // Turn Lcd display on
_ULCD_TURN_OFF : byte = 0x08; // Turn Lcd display off
_ULCD_SHIFT_LEFT : byte = 0x18; // Shift display left without changing display data RAM
_ULCD_SHIFT_RIGHT : byte = 0x1C; // Shift display right without changing display data RAM
// Set cursor position as DDRAM address
_ULCD_SET_CURSOR_POSITION : byte = 0x80; // DDRAM address = _ULCD_SET_CURSOR_POSITION + address
// End set cursor position as DDRAM address
// End HD44780U compatible commands ------------------------------------------

ULCD_String_Limit : byte = 40;

ULCD_String = string[ULCD_String_Limit]; // Limited string type, prevents RAM overwiting


// Display initialization ------------------------------------------------------
procedure ULCD_Init; // For HD44780U-comp. LCD/OLED/VFD dislpays
procedure ULCD_OLED_Init; // For Winstar WEH001602ALPP5N OLED displays

// mikroPascal Pro AVR Lcd compatible functions --------------------------------
procedure ULCD_Out(Y,X: byte; var text: ULCD_String);
procedure ULCD_Out_CP(var text: ULCD_String);
procedure ULCD_Chr(row: byte; column: byte; out_char: byte);
procedure ULCD_Chr_CP(out_char: byte);
procedure ULCD_Cmd(out_char: byte);

// Extended functions ----------------------------------------------------------
procedure ULCD_GoTo(x,y:byte);



This program implements a 12H digital clock and displays it on a 2x16LCD. It uses the internal OSC and will not be as accurate over time as with using an external crystal or a real time clock (RTC) I.C. This is more for beginners, like me, starting to learn the C programming language and MikroC Pro.*RE0,RE1,RE2 have to use the pull-down resistors.

[Learn More]

Port Expander LCD

4-bit alphanumeric LCD done via i2c based Port Expander (MCP23017).

[Learn More]


button and lcd interface

[Learn More]