This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS570LS0432: lcd display

Part Number: TMS570LS0432

Tool/software: Code Composer Studio

Hi,

Can GPIO port function be used to send data directly to LCD or should I use any communication protocol as you mentioned before?

This is my code...

#include "driverlib.h"
#include "device.h"
#include "lcd.h"
#include "stdlib.h"
#include "stdlibf.h"
//#define Port_A GPIO_PORT_A
int Hex_data;
unsigned char Cmd;
uint16_t i;
void LCD_init(void);
void LCD_cmd(unsigned char Cmd);
void LCD_disp(const char *Msg);
char *Msg = "Hello World!";
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();

//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
Device_initGPIO();
GPIO_setPortPins(GPIO_PORT_A,0x0101003F);
GPIO_setDirectionMode(GPIO_PORT_A,GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(52, GPIO_PIN_TYPE_PULLUP); // Enable pullup on GPIO52
GPIO_setPadConfig(97, GPIO_PIN_TYPE_PULLUP); // Enable pullup on GPIO97
GPIO_setPinConfig(GPIO_52_GPIO52);
GPIO_setPinConfig(GPIO_97_GPIO97);
GPIO_setDirectionMode(52, GPIO_DIR_MODE_OUT);
GPIO_setDirectionMode(97, GPIO_DIR_MODE_OUT);

while(*Msg != '\0')
{
LCD_disp(Msg);
DEVICE_DELAY_US(200);
Msg++;

}

}
void LCD_init(void)
{
DEVICE_DELAY_US(2000);
LCD_cmd(0x30);
DEVICE_DELAY_US(1000);
LCD_cmd(0x30);
DEVICE_DELAY_US(100);
LCD_cmd(0x30);
LCD_cmd(0x38); // 8-bit mode 2 lines display
LCD_cmd(0x10); // Shift cursor position to left
LCD_cmd(0x01); // clear display
LCD_cmd(0x06); // shift cursor to right
LCD_cmd(0x0f); // display on cursor blinking
}
void LCD_cmd(unsigned char Cmd)
{
GPIO_writePin(52, 0);
GPIO_writePortData(GPIO_PORT_A,Cmd);
GPIO_writePin(97, 1);
DEVICE_DELAY_US(200);
GPIO_writePin(97, 0);
}
void LCD_disp(const char *Msg)
{

Hex_data=atoi(Msg);
GPIO_writePin(52, 1);
GPIO_writePortData(GPIO_PORT_A,Hex_data);
GPIO_writePin(97, 1);
DEVICE_DELAY_US(46000);
GPIO_writePin(97, 0);
}

there is no error in the program but I am not getting the output. I know there will be a mistake.

Please help me out in this.

  • Hello,
    In the original question you could find drivers shared by community members. This driver is using Hercules GIOs to communicate with LCD controller. Drivers, shared in the links from original question, implements communication protocol used by LCD controller (driver is written for Hitachi 44780 controller or compatible). If you are using LCD display module different than the one in LCD driver posts, than connection could be different.For example on some display modules you have to use Data Bus 4..Data Bus 7 lines for sending data in 4 bit mode. You should check LCD display Datasheet for details.

    Best regards,
    Miro