- Liquid Crystal function
- Begin function
- Set Cursor function
- Print function
- Display function
- Blink function
- Home function
- Clear function
This discourse contains brief explanation of the commonly used function of the liquid crystal display
Liquid Crystal function
To initialize the pins of Arduino on which the LCD display will be connected and some other pins like register selection and enable pin the LiquidCrystal() function is used. The display can be used in both 4-bit and 8-bit mode. In 8-bit mode the 8 data pins will be used whereas in 4-bit mode only four data pins are used. In the 8 bit mode the display will work faster than 4 bit mode. This LiquidCrystal() function can be used by using the following syntax.
Begin function
Another library function that is used to specify the number of rows and columns required for displaying the data is the lcd.begin() function. Since the most commonly used size of the LCD is the 16*2 which means 16 columns and 2 rows. The lcd.begin() in other words initializes the dimensions of the display and for that the following syntax should be followed:
For 16×2 LCD display:
Set Cursor function
To display the data on LCD the location on the LCD can be specified by using the lcd.setCursor() function. This function takes two arguments, one is the rows on which the data is displayed and second the columns from which the data will start displaying.
For example, if we are using the display having the dimensions of 16×2 so we have only 2 lines for displaying the data and the data can be started to display from any column. Similarly, this function can be used if more than one line of data is to be displayed. To use the set cursor function the following syntax should be followed:
Print function
When the data is to be printed onto the LCD the lcd.print() function is used. Any type of the data can be printed on the display either as a character or a number. The syntax for the lcd.print() function is given as:
Display function
To turn on and off the liquid crystal module the function used is the display function. Similarly, to turn on the display the lcd.Display() function is used and to turn off the display during the program the lcd.noDisplay() function is used. This display function has no arguments in it, and it can be used by using the following syntax:
And for no display use:
Blink function
The blink function is mostly used when the display is also interfaced with the keypad. This blink function just blinks the cursor and lets the user know where the data will be displayed on the LCD. To blink the cursor the function lcd.Blink() is used and to stop the cursor from blinking the function lcd.noBlink() is used. To use this function in Arduino the following syntax can be used, and these functions also have no arguments.
And:
Home Function
To move the cursor on the top left position of the display the function lcd.home() function is used. This function just moves the cursor. The syntax for the respective function is given as:
Clear Function
When the data displayed is to be removed or cleared from the display the lcd.clear() function is used. This function can be used if a series of data is to be displayed on the LCD as a large amount of data cannot be displayed collectively. The clear function can be used by following the given syntax:
Conclusion
The liquid crystal displays are most widely used for displaying the output of Arduino programs as they are easy to interface with Arduino. To interface the LCD with Arduino its library is defined as LiquidCrystal.h. There are a large number of functions or some extra functionalities of the display module that can make the display of data easier. This write-up explains the most commonly used functions of the liquid crystal library briefly.