LCD (OP-LIB-012)

From openPicus Wiki
Jump to: navigation, search

Contents

Description

This library allows a Flyport board to Control a LiquidCrystal displays based on the Hitachi HD4478O (or a Compatible) chipset, which is found on most text-based LCDs. The library Works with in either 4 or 8-bit mode.

Content

  • GpenPiCusLCD.c;
  • OpenPicusLCD.h

Download

OP-LIB-012

Connections

  • 4 bits connection

Op-lib-012 4bit.png

  • 8 bits connection

Op-lib-012 8bit.png

Importing into OpenPicus IDE

Once included the files OpenPicusLCD.c and OpenPicusLCD.h, the OpenPicusLCD.h must be included in the files that uses the library With the #include “OpenPicusLCD.h” directive.

How To import external Lib Tutorial

Commands


init

This function is mandatory

Sets the variables used in the other functions

init(int rs, int rw, int enable,int d0, int d1, int d2, int d3, int d4, int d5, int d6, int d7)
Argument Description
int rs the number of the F/yport pin that is connected to the RS pin on the LCD
int rw the number of the pin that is connected to the RW pin on the LCD (optional)
int enable the number of the F/yport pin that is connected to the enable pin on the LCD
int d0, d1, d2, d3, d4, d5, d6, d7 the numbers of the Flyport pins that are connected to the corresponding data pins on the LCD. d0, d1, d2, and d3 are optional (used in 8 bits mode), if setted as 0 (zero), the LCD will be controlled using only the four data lines d4, d5, d6, d7 (4 bits mode).


begin

This function is mandatory and must be called after the init() function.

Specifies the dimensions (width and height) of the display and the dotsize.

This function sets automatically the 4 or 8 bits operation mode of the display.

begin(int cols, int lines, int dotsize);
Argument Description
int cols the number of columns
int lines the number of the rows
int dotsize
  • 0= 5x8 dots font
  • 1= 5x10 dots font


clear

Clears the LCD screen and positions the cursor in the upper-left corner.

clear ();



home

Positions the cursor in the upper-left of the LCD. That is, use that location in outputting subsequent text to the display.

To also Clear the display, use the Clear() function instead.

home();



setCursor

Position the LCD Cursor; that is, set the location at which subsequent text written to the LCD Will be displayed.

setCursor(int col, int row);
Argument Description
int col the column at which to position the cursor (with 0 being the first column).
int row the row at which to position the cursor (with 0 being the first row).


display

Turns on the LCD display, after it's been turned off with noDisp|ay(). This will restore the text (and Cursor) that was on the display.

display();



noDisplay

Turns off the LCD display, Without losing the text Currently shown on it.

noDisplay();



cursor

Display the LCD cursor: an underscore (line) at the position to which the next character will be Written.

cursor();



noCursor

Hides the LCD cursor.

noCursor();



blink

Display the blinking LCD cursor. If used in combination with the Cursor() function, the result will depend on the particular display.

blink();



noBlink

Turns off the blinking LCD Cursor.

noBlink();



scrollDisplayLeft

Scrolls the Contents of the display (text and cursor) one space to the left.

scrollDisplayLeft();


scrollDisplayRight

Scrolls the Contents of the display (text and cursor) one space to the right.

scrollDisplayRight();



leftToRight

Set the direction for text Written to the LCD to left-to-right, the default. This means that subsequent characters written to the display will go from left to right, but does not affect previously-output text.

leftToRight ();



rightToLeft

Set the direction for text written to the LCD to right-to-left (the default is left-to-right). This means that subsequent Characters written to the display will go from right to left, but does not affect previously-output text.

rightToLeft ();



autoscroll

Turns on automatic scrolling of the LCD. This causes each character output to the display to push previous Characters over by one space.

If the Current text direction is left-to-right (the default), the display scrolls to the left; if the current direction is right-to-left, the display scrolls to the right. This has the effect of outputting each new character to the same location on the LCD.

autoscroll ();



noAutoscroll

Turns off automatic scrolling of the LCD.

noAutoscroll ();



write

Write a single character to the LCD.

write (int value);
Argument Description
int value the character to Write to the display


print

print(char text [] , int delay);
Argument Description
char text [] it is a string array with length setted by cols parameter of begin() function.
int delay text can be written with a dela y effect expressed in milliseconds for each character.

Related Resources

Credits

Personal tools
Namespaces

Variants
Actions
START HERE
DEVELOPMENT
HARDWARE INFO
RESOURCES
PHASED OUT
Toolbox