Electrical – Use LCD 1602A with F28027

dsplcdmicrocontrollertexas instrumentsti-ccstudio

I want to connect C2000 Piccolo LAUNCHXL-F28027 and LCD 1602A. And I already found this example: http://embedjournal.com/interfacing-16×2-character-lcd-with-c2000-launchpad/. I downloaded the source code and connected pins as shown in the example, after that I used exactly the same code:

#define RS  GPIO_Number_12
#define E   GPIO_Number_19

#define D0  GPIO_Number_0
#define D1  GPIO_Number_1
#define D2  GPIO_Number_2
#define D3  GPIO_Number_3
#define D4  GPIO_Number_4
#define D5  GPIO_Number_5
#define D6  GPIO_Number_16
#define D7  GPIO_Number_17
GPIO_Handle myGpio;


/* Initializes LCD */
void InitializeLCD(void)
{

    GPIO_setHigh(myGpio, E);
    LCDDelay1600();
    LCDDelay1600();
    LCDDelay1600();
    LCDDelay1600();

    WriteCommandLCD(0x38);          //Command to select 8 bit interface
    LCDDelay1600();

    WriteCommandLCD(0x38);          //Command to select 8 bit interface
    LCDDelay();                     //Small delay

    WriteCommandLCD(0x38);          //Command to select 8 bit interface
    LCDDelay();


    WriteCommandLCD(0x08);          //Command to off cursor,display off
    WriteCommandLCD(0x01);          //Command to Clear LCD
    LCDDelay1600();
    WriteCommandLCD(0x06);          //Command for setting entry mode

    WriteCommandLCD(0x0f);          //Command to on cursor,blink cursor
    WriteCommandLCD(0x02);          //Command return the cursor to home
    LCDDelay1600();
    DisplayLCD(1, "hello");

}


/* Writes a command byte to LCD */
void WriteCommandLCD(unsigned char CommandByte)
{
    GPIO_setLow(myGpio, RS);        //Clear RS pin to write command
    SendByte(CommandByte);
    LCDDelay();                     //Small delay
}


/* Send a byte of data to LCD */
void SendByte(unsigned char Value)
{
    unsigned char temp;


    if((Value & 0x01) == 0x01)
        GPIO_setHigh(myGpio, D0);
    else
        GPIO_setLow(myGpio, D0);


    if((Value & 0x02) == 0x02)
        GPIO_setHigh(myGpio, D1);
    else
        GPIO_setLow(myGpio, D1);


    if((Value & 0x04) == 0x04)
        GPIO_setHigh(myGpio, D2);
    else
        GPIO_setLow(myGpio, D2);

    if((Value & 0x08) == 0x08)
        GPIO_setHigh(myGpio, D3);
    else
        GPIO_setLow(myGpio, D3);

    if((Value & 0x10) == 0x10)
        GPIO_setHigh(myGpio, D4);
    else
        GPIO_setLow(myGpio, D4);


    if((Value & 0x20) == 0x20)
        GPIO_setHigh(myGpio, D5);
    else
        GPIO_setLow(myGpio, D5);


    if((Value & 0x40) == 0x40)
        GPIO_setHigh(myGpio, D6);
    else
        GPIO_setLow(myGpio, D6);


    if((Value & 0x80) == 0x80)
        GPIO_setHigh(myGpio, D7);
    else
        GPIO_setLow(myGpio, D7);


    GPIO_setHigh(myGpio, E);            //Set E pin to select LCD
    for(temp=0;temp<5; temp++);
    GPIO_setLow(myGpio, E);             //Clear E pin to deselect LCD
    LCDDelay();                         //Small delay

}

/* Writes a Data byte to LCD */
void WriteDataLCD(unsigned char DataByte)
{
    GPIO_setHigh(myGpio, RS);           //Set RS pin to 1 to write Data
    SendByte(DataByte);
    LCDDelay();                         //Small delay
}


/* Small delay */
void LCDDelay(void)
{
    DELAY_US(500);
}

/* Big delay */
void LCDDelay1600(void)
{
    DELAY_US(16000);
}


/* Makes cursor visible */
void CursorON(void)
{
    WriteCommandLCD(0x0f);          //Command to switch on cursor
}



/* Makes cursor invisible */
void CursorOFF(void)
{
    WriteCommandLCD(0x0c);          //Command to switch off cursor
}


/* Displays a message on LCD */
void DisplayLCD(char LineNumber,char *Message)
{
    int a;
    if(LineNumber ==1)
    {   //First Line
        WriteCommandLCD(0x80);      //Select the first line
    }
    else
    {   //Second line
        WriteCommandLCD(0xc0);      //Select the second line
    }
    for(a=0;a<16;a++)
    {
        WriteDataLCD(*Message);     //Display a character
        Message++;                  //Increment pointer
    }
    return;
}

void main(){
    InitializeLCD();
}

But after execution of this code absolutely nothing has changed on the LCD – I see only a several rectangles in the first line(just like the after power up). I think that is because lm016l used in the example, but I use 1602A. Could it be? If yes then which functions I need to change and how exactly I need to change them? Please give me comprehensive information if you can, because I am a novice at this and it's very hard to understand what I exactly need.

Thanks!

UPD:

I found microcontroller for the 1602A LCD, it's KS0066U. Am I right? So, if yes, then I also found KS0066U datasheet with the "INITIALIZING BY INSTRUCTION. 1) 8-bit interface mode…", please check it (page 26).

Using this instruction I created this code:

#define RS  GPIO_Number_12
#define E   GPIO_Number_19

#define D0  GPIO_Number_0
#define D1  GPIO_Number_1
#define D2  GPIO_Number_2
#define D3  GPIO_Number_3
#define D4  GPIO_Number_4
#define D5  GPIO_Number_5
#define D6  GPIO_Number_16
#define D7  GPIO_Number_17

    GPIO_Handle myGpio1;

    //...

     void function_set(){
        GPIO_setLow(myGpio1, RS);
        GPIO_setLow(myGpio1, D7);
        GPIO_setLow(myGpio1, D6);
        GPIO_setHigh(myGpio1, D5);
        GPIO_setHigh(myGpio1, D4);
        GPIO_setHigh(myGpio1, D3);
        GPIO_setHigh(myGpio1, D2);
    }

    void display_control(){
        GPIO_setLow(myGpio1, RS);
        GPIO_setLow(myGpio1, D7);
        GPIO_setLow(myGpio1, D6);
        GPIO_setLow(myGpio1, D5);
        GPIO_setLow(myGpio1, D4);
        GPIO_setHigh(myGpio1, D3);
        GPIO_setHigh(myGpio1, D2);
        GPIO_setHigh(myGpio1, D1);
        GPIO_setHigh(myGpio1, D0);
    }

    void display_clear(){
        GPIO_setLow(myGpio1, RS);
        GPIO_setLow(myGpio1, D7);
        GPIO_setLow(myGpio1, D6);
        GPIO_setLow(myGpio1, D5);
        GPIO_setLow(myGpio1, D4);
        GPIO_setLow(myGpio1, D3);
        GPIO_setLow(myGpio1, D2);
        GPIO_setLow(myGpio1, D1);
        GPIO_setHigh(myGpio1, D0);
    }

    void entry_mode(){
        GPIO_setLow(myGpio1, RS);
        GPIO_setLow(myGpio1, D7);
        GPIO_setLow(myGpio1, D6);
        GPIO_setLow(myGpio1, D5);
        GPIO_setLow(myGpio1, D4);
        GPIO_setLow(myGpio1, D3);
        GPIO_setHigh(myGpio1, D2);
        GPIO_setHigh(myGpio1, D1);
        GPIO_setHigh(myGpio1, D0);
    }
    void main(void) {
        myGpio1 = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));//default initialization

            DELAY_US(31000);
            function_set();
            DELAY_US(1500);
            display_control();
            DELAY_US(1500);
            display_clear();
            DELAY_US(20300);
    }

But it also does not change anything.

What am I missing(please note that I'm really newbie)?

UPD2:
New full code, but it still gives nothing:

#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
#include "clk.h"
#include "flash.h"
#include "gpio.h"
#include "pie.h"
#include "pll.h"
#include "wdog.h"
#include "LCD.h"
#include "Keypad.h"

#define RS  GPIO_Number_12
#define E   GPIO_Number_19
#define D0  GPIO_Number_0
#define D1  GPIO_Number_1
#define D2  GPIO_Number_2
#define D3  GPIO_Number_3
#define D4  GPIO_Number_4
#define D5  GPIO_Number_5
#define D6  GPIO_Number_16
#define D7  GPIO_Number_17

GPIO_Handle myGpio1;

void enable(void)        //This enable E pin,whenever you send command/data to the pin
{
     GPIO_setLow(myGpio1,E);
     DELAY_US(1000);
     GPIO_setHigh(myGpio1,E);
}
void function_set(void)  //function set as you declared
{
      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setLow(myGpio1, D6);
      GPIO_setHigh(myGpio1, D5);
      GPIO_setHigh(myGpio1, D4);
      GPIO_setHigh(myGpio1, D3);
      GPIO_setHigh(myGpio1, D2);
}
void display_control(void)
{
      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setLow(myGpio1, D6);
      GPIO_setLow(myGpio1, D5);
      GPIO_setLow(myGpio1, D4);
      GPIO_setHigh(myGpio1, D3);
      GPIO_setHigh(myGpio1, D2);
      GPIO_setHigh(myGpio1, D1);
      GPIO_setHigh(myGpio1, D0);
}
void entry_mode(void)     //entry mode to make increment or decrement DDRAM
{
      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setLow(myGpio1, D6);
      GPIO_setLow(myGpio1, D5);
      GPIO_setLow(myGpio1, D4);
      GPIO_setLow(myGpio1, D3);
      GPIO_setHigh(myGpio1, D2);
      GPIO_setHigh(myGpio1, D1);
      GPIO_setHigh(myGpio1, D0);
}
void clear_display(void)  //clear the display
{
       GPIO_setLow(myGpio1, RS);
       GPIO_setLow(myGpio1, D7);
       GPIO_setLow(myGpio1, D6);
       GPIO_setLow(myGpio1, D5);
       GPIO_setLow(myGpio1, D4);
       GPIO_setLow(myGpio1, D3);
       GPIO_setLow(myGpio1, D2);
       GPIO_setLow(myGpio1, D1);
       GPIO_setHigh(myGpio1, D0);
}
void initialization(void){
    GPIO_setPullUp(myGpio1, GPIO_Number_0, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_0);
    GPIO_setMode(myGpio1, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_0, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_1, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_1);
    GPIO_setMode(myGpio1, GPIO_Number_1, GPIO_1_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_1, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_2, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_2);
    GPIO_setMode(myGpio1, GPIO_Number_2, GPIO_2_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_2, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_3, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_3);
    GPIO_setMode(myGpio1, GPIO_Number_3, GPIO_3_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_3, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_4, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_4);
    GPIO_setMode(myGpio1, GPIO_Number_4, GPIO_4_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_4, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_5, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_5);
    GPIO_setMode(myGpio1, GPIO_Number_5, GPIO_5_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_5, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_16, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_16);
    GPIO_setMode(myGpio1, GPIO_Number_16, GPIO_16_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_16, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_17, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_17);
    GPIO_setMode(myGpio1, GPIO_Number_17, GPIO_17_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_17, GPIO_Direction_Output);



    GPIO_setPullUp(myGpio1, GPIO_Number_12, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_12);
    GPIO_setMode(myGpio1, GPIO_Number_12, GPIO_12_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_12, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_19, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_19);
    GPIO_setMode(myGpio1, GPIO_Number_19, GPIO_19_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_19, GPIO_Direction_Output);
}
void main()
{
     InitSysCtrl();

     myGpio1 = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
     initialization();

    GPIO_setLow(myGpio1,E);  //declare the enable pin as HIGH first

      function_set();
      enable();      //set this to enable the LED with given data to the pins
      DELAY_US(50);  //need some delay of 39us,roughly 50us
      display_control(); //to customize the display you need
      enable();
      DELAY_US(50);  //again need 39us ,roughly 50us
      entry_mode();
      enable();    //makes to enable the LED with given data
      DELAY_US(50);
      GPIO_setHigh(myGpio1,RS);  //This displays letter A
      GPIO_setHigh(myGpio1,D7);
      GPIO_setLow(myGpio1,D6);
      GPIO_setLow(myGpio1,D5);
      GPIO_setLow(myGpio1,D4);
      GPIO_setLow(myGpio1,D3);
      GPIO_setLow(myGpio1,D2);
      GPIO_setLow(myGpio1,D1);
      GPIO_setHigh(myGpio1,D0);
      enable();
      DELAY_US(5000000);// letter A stays for 5 seconds in the display
      clear_display(); //clears the display
      DELAY_US(3000);  //need to wait 1.39ms roughly 3ms
}

UPD3:

#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
#include "clk.h"
#include "flash.h"
#include "gpio.h"
#include "pie.h"
#include "pll.h"
#include "wdog.h"
#include "LCD.h"
#include "Keypad.h"

#define RS  GPIO_Number_12
#define E   GPIO_Number_19
#define D0  GPIO_Number_0
#define D1  GPIO_Number_1
#define D2  GPIO_Number_2
#define D3  GPIO_Number_3
#define D4  GPIO_Number_4
#define D5  GPIO_Number_5
#define D6  GPIO_Number_16
#define D7  GPIO_Number_17

GPIO_Handle myGpio1;
interrupt void xint1_isr(void);


void enabl(void)        //This enable E pin,whenever you send command/data to the pin
{
     GPIO_setLow(myGpio1,E);
     DELAY_US(10000);
     GPIO_setHigh(myGpio1,E);
}
void function_set(void)  //function set as you declared
{
      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setLow(myGpio1, D6);
      GPIO_setHigh(myGpio1, D5);
      GPIO_setLow(myGpio1, D4);

        DELAY_US(20000);
        enabl();      //set this to enable the LED with given data to the pins
        DELAY_US(20000);  //need some delay of 39us,roughly 50us

      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setLow(myGpio1, D6);
      GPIO_setHigh(myGpio1, D5);
      GPIO_setLow(myGpio1, D4);

        DELAY_US(20000);
        enabl();      //set this to enable the LED with given data to the pins
        DELAY_US(20000);  //need some delay of 39us,roughly 50us

      GPIO_setLow(myGpio1, RS);
      GPIO_setHigh(myGpio1, D7);
      GPIO_setHigh(myGpio1, D6);

      DELAY_US(20000);
      enabl();      //set this to enable the LED with given data to the pins
      DELAY_US(20000);

}
void display_control(void)
{
      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setLow(myGpio1, D6);
      GPIO_setLow(myGpio1, D5);
      GPIO_setLow(myGpio1, D4);

      DELAY_US(20000);
      enabl();      //set this to enable the LED with given data to the pins
      DELAY_US(20000);

      GPIO_setLow(myGpio1, RS);
      GPIO_setHigh(myGpio1, D7);
      GPIO_setHigh(myGpio1, D6);
      GPIO_setHigh(myGpio1, D5);
      GPIO_setHigh(myGpio1, D4);

      DELAY_US(20000);
      enabl();      //set this to enable the LED with given data to the pins
      DELAY_US(20000);

}

void display_clear(void)  //clear the display
{
       GPIO_setLow(myGpio1, RS);
       GPIO_setLow(myGpio1, D7);
       GPIO_setLow(myGpio1, D6);
       GPIO_setLow(myGpio1, D5);
       GPIO_setLow(myGpio1, D4);

      DELAY_US(20000);
      enabl();      //set this to enable the LED with given data to the pins
      DELAY_US(20000);

       GPIO_setLow(myGpio1, RS);
       GPIO_setLow(myGpio1, D7);
       GPIO_setLow(myGpio1, D6);
       GPIO_setLow(myGpio1, D5);
       GPIO_setHigh(myGpio1, D4);

      DELAY_US(20000);
      enabl();      //set this to enable the LED with given data to the pins
      DELAY_US(20000);
}

void entry_mode(void)     //entry mode to make increment or decrement DDRAM
{
      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setLow(myGpio1, D6);
      GPIO_setLow(myGpio1, D5);
      GPIO_setLow(myGpio1, D4);

      DELAY_US(20000);
      enabl();      //set this to enable the LED with given data to the pins
      DELAY_US(20000);

      GPIO_setLow(myGpio1, RS);
      GPIO_setLow(myGpio1, D7);
      GPIO_setHigh(myGpio1, D6);
      GPIO_setHigh(myGpio1, D5);
      GPIO_setHigh(myGpio1, D4);

      DELAY_US(20000);
      enabl();      //set this to enable the LED with given data to the pins
      DELAY_US(20000);

}

void initialization(void){
    GPIO_setPullUp(myGpio1, GPIO_Number_0, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_0);
    GPIO_setMode(myGpio1, GPIO_Number_0, GPIO_0_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_0, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_1, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_1);
    GPIO_setMode(myGpio1, GPIO_Number_1, GPIO_1_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_1, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_2, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_2);
    GPIO_setMode(myGpio1, GPIO_Number_2, GPIO_2_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_2, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_3, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_3);
    GPIO_setMode(myGpio1, GPIO_Number_3, GPIO_3_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_3, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_4, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_4);
    GPIO_setMode(myGpio1, GPIO_Number_4, GPIO_4_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_4, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_5, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_5);
    GPIO_setMode(myGpio1, GPIO_Number_5, GPIO_5_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_5, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_16, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_16);
    GPIO_setMode(myGpio1, GPIO_Number_16, GPIO_16_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_16, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_17, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_17);
    GPIO_setMode(myGpio1, GPIO_Number_17, GPIO_17_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_17, GPIO_Direction_Output);



    GPIO_setPullUp(myGpio1, GPIO_Number_12, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_12);
    GPIO_setMode(myGpio1, GPIO_Number_12, GPIO_12_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_12, GPIO_Direction_Output);

    GPIO_setPullUp(myGpio1, GPIO_Number_19, GPIO_PullUp_Enable);
    GPIO_setLow(myGpio1, GPIO_Number_19);
    GPIO_setMode(myGpio1, GPIO_Number_19, GPIO_19_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio1, GPIO_Number_19, GPIO_Direction_Output);
}


void main()
{
     InitSysCtrl();

     myGpio1 = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
     initialization();

      DELAY_US(20000);

      GPIO_setHigh(myGpio1,E);  //declare the enable pin as HIGH first
      DELAY_US(20000);

      function_set();

      display_control(); //to customize the display you need

      display_clear();

      entry_mode();

      GPIO_setHigh(myGpio1,RS);  //This displays letter A
      GPIO_setHigh(myGpio1,D7);
      GPIO_setLow(myGpio1,D6);
      GPIO_setLow(myGpio1,D5);
      GPIO_setLow(myGpio1,D4);
      GPIO_setLow(myGpio1,D3);
      GPIO_setLow(myGpio1,D2);
      GPIO_setLow(myGpio1,D1);
      GPIO_setHigh(myGpio1,D0);
      enabl();
      DELAY_US(5000000);// letter A stays for 5 seconds in the display

      display_clear(); //clears the display
      DELAY_US(20000);  //need to wait 1.39ms roughly 3ms
      enabl();

}

Best Answer

Okay,I found the problem where you got struck.It's the Enable pin.You made mistake in enable pin.The Enable pin should be declared HIGH first.Whenever passing commands,you just need to make the Enable pin LOW for just a small time(typically 1 ms) and then you have to make it HIGH.Thus the Enable pin should only go LOW whenever you pass the bits in the pins of LCD.All the time,it should remain HIGH.So I remake your program as

    #define RS  GPIO_Number_12
    #define E   GPIO_Number_19
    #define D0  GPIO_Number_0
    #define D1  GPIO_Number_1
    #define D2  GPIO_Number_2
    #define D3  GPIO_Number_3
    #define D4  GPIO_Number_4
    #define D5  GPIO_Number_5
    #define D6  GPIO_Number_16
    #define D7  GPIO_Number_17
    
    GPIO_Handle myGpio1;
    GPIO_setLow(myGpio1,E);  //declare the enable pin as HIGH first
    
    void enable(void)        //This enable E pin,whenever you send command/data to the pin   
    {
         GPIO_setLow(myGpio1,E);
         dELAY_US(1000);
         GPIO_setHigh(myGpio1,E);
    }
    void function_set(void)  //function set as you declared
    {
          GPIO_setLow(myGpio1, RS);
          GPIO_setLow(myGpio1, D7);
          GPIO_setLow(myGpio1, D6);
          GPIO_setHigh(myGpio1, D5);
          GPIO_setHigh(myGpio1, D4);
          GPIO_setHigh(myGpio1, D3);
          GPIO_setHigh(myGpio1, D2);
    }
    void display_control(void)  
    {
          GPIO_setLow(myGpio1, RS);
          GPIO_setLow(myGpio1, D7);
          GPIO_setLow(myGpio1, D6);
          GPIO_setLow(myGpio1, D5);
          GPIO_setLow(myGpio1, D4);
          GPIO_setHigh(myGpio1, D3);
          GPIO_setHigh(myGpio1, D2);
          GPIO_setHigh(myGpio1, D1);
          GPIO_setHigh(myGpio1, D0);
    }
    void entry_mode(void)     //entry mode to make increment or decrement DDRAM
    {
          GPIO_setLow(myGpio1, RS);
          GPIO_setLow(myGpio1, D7);
          GPIO_setLow(myGpio1, D6);
          GPIO_setLow(myGpio1, D5);
          GPIO_setLow(myGpio1, D4);
          GPIO_setLow(myGpio1, D3);
          GPIO_setHigh(myGpio1, D2);
          GPIO_setHigh(myGpio1, D1);
          GPIO_setHigh(myGpio1, D0);
    }
    void clear_display(void)  //clear the display
    {
           GPIO_setLow(myGpio1, RS);
           GPIO_setLow(myGpio1, D7);
           GPIO_setLow(myGpio1, D6);
           GPIO_setLow(myGpio1, D5);
           GPIO_setLow(myGpio1, D4);
           GPIO_setLow(myGpio1, D3);
           GPIO_setLow(myGpio1, D2);
           GPIO_setLow(myGpio1, D1);
           GPIO_setHigh(myGpio1, D0);
    }
    void main()
    {
          function_set();
          enable();      //set this to enable the LED with given data to the pins
          DELAY_US(50);  //need some delay of 39us,roughly 50us 
          display_control(); //to customize the display you need  
          enable();       
          DELAY_US(50);  //again need 39us ,roughly 50us
          entry_mode();
          enable();    //makes to enable the LED with given data
          DELAY_US(50); 
          GPIO_setHigh(myGpio1,RS);  //This displays letter A
          GPIO_setHigh(myGpio1,D7);
          GPIO_setLow(myGpio1,D6);
          GPIO_setLow(myGpio1,D5);
          GPIO_setLow(myGpio1,D4);
          GPIO_setLow(myGpio1,D3);
          GPIO_setLow(myGpio1,D2);
          GPIO_setLow(myGpio1,D1);
          GPIO_setHIGH(myGpio1,D0);
          enable();
          DELAY_US(5000000);// letter A stays for 5 seconds in the display
          clear_display(); //clears the display
          DELAY_US(3000);  //need to wait 1.39ms roughly 3ms  
    }
    
      The place you made mistake is that,you didn't make the enable pin to go low for instant and then make it HIGH.So this above program will display A for 5 sec and clears the LCD screen.Again the loop starts from main() and goes on.The same I have done in AVR processor.Take a glance on it.If you understand,it's good.
    int rs =12;
    int rw =11;
    int e =10;
    void enabl()   //enable LCD for instant
    {
        digitalWrite(e,LOW);
        delay(1);
        digitalWrite(e,HIGH);
    }
    void setup()
    {
       DDRD=0xFF;   //make the portD as output
       digitalWrite(e,HIGH); //initially E with HIGH
       pinMode(rs,OUTPUT);  //declaring the pins as output
       pinMode(rw,OUTPUT);
       pinMode(e,OUTPUT);
    }
    void loop()
    {
       digitalWrite(rw,LOW);  //function set
       digitalWrite(rs,LOW);
       PORTD=B00111000;
       enabl();
       delayMicroseconds(50);  //display control
       digitalWrite(rw,LOW);
       digitalWrite(rs,LOW);
       PORTD=B00001111;
       enabl();
       delay(50);
       digitalWrite(rs,HIGH);  //Letter A
       PORTD=0x41;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //letter A
       PORTD=0x41;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //letter D
       PORTD=0x44;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //letter A
       PORTD=0x41;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //letter R
       PORTD=0x52;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //letter S
       PORTD=0x53;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //letter H
       PORTD=0x48;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //symbol @
       PORTD=0x40;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //space bar  
       PORTD=0x20;
       enabl();
       delay(1);
       digitalWrite(rs,HIGH);  //symbol delta(may vary with LCD to LCD)
       PORTD=B01111111;
       enabl();
       delay(4000);            //wait for 4 seconds to stay on display
       digitalWrite(rs,LOW);  //clear display()
       PORTD=0x01;
       enabl();
       delay(3000);           
    }
    

    The output of the display is like this

    LCD
    May be I can make this program simple,but when I was learn for first time,I done my program like this to understand in depth of what will happens if I change a small value and moreover I like to program in assembly rather than C.