LCD_INTERFACE_ADVANCE_PART2 USE OF DIFFERENT FUNCTIONS OF LCD LIBRARY - LCD CURSOR RELOCATE - LCD DISPLAY CLEAR - LCD DATA PRINT TARGET : NUCLEO-64 PLATFORM : MBED ONLINE CREATED BY : JAYDEEP SHAH -- radhey04ec@gmail.com

Dependencies:   TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* LCD INTERFACING ADVANCE PART2  -- TEXT DISPLAY
00002 
00003 NOTE : AGAIN YOU NEED TO IMPORT TEXTLCD.H LIBRARY FOR USING LCD INTERFACING FUNCTIONS
00004 
00005 NOTE : ALL THE CONNECTION FROM ARDUINO SOCKET INTERFACE (YOU CAN USE ANY)
00006 D4 TO D7 = PA3,PA2,PA10,PB3    === PORT PINS ====
00007 RS = PC0
00008 E = PC1
00009 R/W = GND
00010 
00011 PLATFORM :MBED ARM ONLINE
00012 HARDWARE : NUCLEO-64 / STM32\
00013 LCD : 20 *4 DISPLAY   MODULE RG2004A
00014 
00015 CREATED BY :JAYDEEP SHAH -- radhey04ec@gmail.com
00016 */
00017 
00018 //NOTE YOU NEED TO IMPORT LIBRARY - TextLCD.h for using class  (4-bit interface)
00019 
00020 //Link : https://os.mbed.com/components/HD44780-Text-LCD/
00021 
00022 /* LCD PANNEL SUPPORT -- CHANGE ACCORDING IN TextLCD object
00023 Credit goes to : Simon Ford  //CREATOR OF THIS LIBRARY 
00024 TextLCD::LCD16x2     16x2 LCD panel (default) 
00025 TextLCD::LCD16x2B    16x2 LCD panel alternate addressing 
00026 TextLCD::LCD20x2     20x2 LCD panel 
00027 TextLCD::LCD20x4     20x4 LCD panel
00028 TextLCD::LCD8x1    8x1 LCD panel
00029 TextLCD::LCD8x2    8x2 LCD panel
00030 TextLCD::LCD16x1  16x1 LCD panel
00031 TextLCD::LCD16x4  16x4 LCD panel
00032 TextLCD::LCD24x2  24x2 LCD panel
00033 TextLCD::LCD24x4  24x4 LCD panel (for KS0078 controller)
00034 TextLCD::LCD40x2  40x2 LCD panel
00035 TextLCD::LCD40x4  40x4 LCD panel (two controllers)
00036 */
00037 
00038 
00039 /* AVAILABLE FUNCTIONS & IT'S USE CASE
00040 
00041 1) TextLCD -- class need to create object first
00042 Object contains RS,E,D4-D7 Data pins related information + LCD panel size (Default : 16 *2 )
00043 
00044 
00045 2)obj_name.cls() : For clear the LCD Display
00046 
00047 3)obj_name.printf("")  : Print the data on LCD Display
00048 
00049 4)obj_name.locate(Column ,ROW) : Set Cursor on different position
00050 
00051 For more -- Try to fatch .cpp and .h file of TextLCD library
00052 
00053 */
00054 
00055 
00056 #include "mbed.h"  //MBED LIBRARY
00057 #include "TextLCD.h"  // LCD LIBRARY
00058  
00059 TextLCD lcd(PC_0, PC_1, PB_4, PB_5, PB_3, PA_10, TextLCD::LCD20x4); // rs, e, d4-d7  -- REGISTER SELECT / ENABLE / AND DATA-PIN
00060  
00061 int main() {  // MAIN THREAD START
00062 
00063     lcd.printf("Jaydeep Shah!\n");  // PRINT COMMAND -- TXT ON LCD
00064     
00065     lcd.locate(0,1);  //CURSOR RELOCATE
00066     
00067     lcd.printf("KEPL!\n");  //LCD_PRINT
00068     
00069     ThisThread::sleep_for(8000);  //8-SEC DELAY  -- THREAD SLEEP FOR 8 SEC
00070     
00071     lcd.cls();  // CLEAR THE LCD DISPLAY
00072 }