16 BY 2 LCD display blank

sayalispathak

Newbie
Joined
Sep 29, 2017
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
30
Hello,
I am interface 16 by 2 lcd display with TMS320F280025C controller. I have attached a circuit for your reference. supply voltage given to LCD is +5VDC. But the LCD is totally blank. The back light is working fine. Pot used for contrast adjustment is 1k. Any help please.
.
 

The schematic is fine but the LCD will not display anything at all if it isn't initialized properly. That is a software issue, you must send it the correct sequence of bytes to configure the on-board processor (probably a HD44780).

Brian.
 

here is my code.
Code:
#include "F28x_Project.h"
#include "common.h"
#include "extern.h"
#include "math.h"

void main(void)
{
    //
    // Initialize device clock and peripherals
    //
    InitSysCtrl();

    //
    // Initialize GPIO
    //
    InitGpio();

     //
    // Disable CPU interrupts
    //
    DINT;

    //
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    //
    InitPieCtrl();

    //
    // Disable CPU interrupts and clear all CPU interrupt flags:
    //
    IER = 0x0000;
    IFR = 0x0000;

    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    //
    InitPieVectTable();
 
   lcd_init();

    EALLOW;

    //
    // Enable PIE interrupt
    //
    PieCtrlRegs.PIEIER1.bit.INTx1 = 1;

    //
    // Enable global Interrupts and higher priority real-time debug events:
    //
    IER |= M_INT1;  // Enable group 1 interrupts

    EINT;           // Enable Global interrupt INTM
    ERTM;           // Enable Global realtime interrupt DBGM


    while(1)
    {
        send_string("Hello, LCD!");
        DELAY_US(1000); // Delay for 1 second
    }
}

void lcd_init(void)
{
    GpioCtrlRegs.GPBMUX1.bit.GPIO40 = 0;
    GpioCtrlRegs.GPBDIR.bit.GPIO40 = 1;
    GpioCtrlRegs.GPBMUX1.bit.GPIO41 = 0;
    GpioCtrlRegs.GPBDIR.bit.GPIO41 = 1;
    GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO23 = 1;
    GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO22 = 1;
    // Configure LCD control pins as outputs
    GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0;   // RS
    GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;   // EN
    GpioCtrlRegs.GPADIR.bit.GPIO1 = 1;    // RS
    GpioCtrlRegs.GPADIR.bit.GPIO0 = 1;    // EN

    DELAY_US(15000);      // 15000us...0.015 seconds
    DELAY_US(4100);       // 4100us
    DELAY_US(100);
    send_command(0x33);       // 4 bit mode
    send_command(0x32);       // 4 bit mode
    DELAY_US(4100);
    send_command(0x28);       // 4 bit mode
    DELAY_US(40);
    send_command(0x0E);       // display on cursor on
    DELAY_US(40);
    send_command(0x01);       // clear the screen
    DELAY_US(40);
    send_command(0x06);       // increment cursor
    DELAY_US(1640);
    send_command(0x80);       // row 1 column 1
    DELAY_US(4100);
}

void send_command(unsigned char cmd)
{
    GpioDataRegs.GPACLEAR.bit.GPIO1 = 1; // RS = 0 (command mode)

    GpioDataRegs.GPASET.bit.GPIO0 = 1;  // EN = 1 (enable high)
    GpioDataRegs.GPBDAT.bit.GPIO40 = (cmd >> 4) & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO23 = (cmd >> 5) & 0x01;
    GpioDataRegs.GPBDAT.bit.GPIO41 = (cmd >> 6) & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO22 = (cmd >> 7) & 0x01;
    GpioDataRegs.GPACLEAR.bit.GPIO0 = 1; // EN = 0 (enable low)

    DELAY_US(2000);   // Delay required for command execution

    GpioDataRegs.GPASET.bit.GPIO0 = 1;   // EN = 1 (enable high)
    GpioDataRegs.GPBDAT.bit.GPIO40 = cmd & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO23 = (cmd >> 1) & 0x01;
    GpioDataRegs.GPBDAT.bit.GPIO41 = (cmd >> 2) & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO22 = (cmd >> 3) & 0x01;
    GpioDataRegs.GPACLEAR.bit.GPIO0 = 1; // EN = 0 (enable low)
    DELAY_US(2000);
}


void send_string(char *s)
{
    while(*s)
      {
        send_data(*s);
        s++;
      }
}

void send_data(unsigned char data)
{
    GpioDataRegs.GPASET.bit.GPIO1 = 1;     // RS = 1 (Data mode)

    GpioDataRegs.GPASET.bit.GPIO0 = 1;  // EN = 1 (enable high)
    GpioDataRegs.GPBDAT.bit.GPIO40 = (data >> 4) & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO23 = (data >> 5) & 0x01;
    GpioDataRegs.GPBDAT.bit.GPIO41 = (data >> 6) & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO22 = (data >> 7) & 0x01;
    GpioDataRegs.GPACLEAR.bit.GPIO0 = 1; // EN = 0 (enable low)

    DELAY_US(2000);   // Delay required for command execution

    GpioDataRegs.GPASET.bit.GPIO0 = 1;   // EN = 1 (enable high)
    GpioDataRegs.GPBDAT.bit.GPIO40 = data & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO23 = (data >> 1) & 0x01;
    GpioDataRegs.GPBDAT.bit.GPIO41 = (data >> 2) & 0x01;
    GpioDataRegs.GPADAT.bit.GPIO22 = (data >> 3) & 0x01;
    GpioDataRegs.GPACLEAR.bit.GPIO0 = 1; // EN = 0 (enable low)

    DELAY_US(2000);
}

please check and let me know.

[code tags added by moderator]
 
Last edited by a moderator:

If you want to show any text on the LCD screen, you have to ground the R/W pin too. Also, you may need to vary the variable resistor connected to V0 pin. Sometimes texts appear after you adjust the brightness with this variable resistor.


 

What are you using as a 'delay' function - if you are writing your own 'busy wait' style function then the chances are it is not working.
As is often the case. the problem may be in the code you don't show.
Susan
 

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…