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/TM4C123GH6PGE: Custom Character Generation problem on 16x2 char lcd in tm4c123gh6pge

Part Number: TM4C123GH6PGE

Tool/software: Code Composer Studio

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "driverlib/fpu.h"
#include "driverlib/sysctl.h"
#include "driverlib/rom.h"
#include "driverlib/pin_map.h"
#include "driverlib/uart.h"
#include "grlib/grlib.h"
#include "drivers/cfal96x64x16.h"
#include "utils/uartstdio.h"
#include "driverlib/gpio.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"

char CGRAM_LUT[8]={0x1f,0x11,0x11,0x11,0x11,0x11,0x1f,0x00};


/////////////////////LCD_CMD()////////////////////
LCD_CMD(unsigned char cmd)
{
GPIOPinWrite(GPIO_PORTF_BASE, (GPIO_PIN_0 | GPIO_PIN_1 |GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 |GPIO_PIN_6 | GPIO_PIN_7) , (cmd));
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_5,0X00); //rs=0;
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_6,0x00); //r/w
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_7,0X80); //en=1
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_7,0x00); //en=0
SysCtlDelay(160000);
}
/////////////////////////LCD_DATA////////////
LCD_DATA(unsigned char data)
{
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_7,0X00);
GPIOPinWrite(GPIO_PORTF_BASE, (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7) , data);

GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_5,0X20); //rs=1;
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_6,0x00); //r/w
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_7,0X80); //en=1
GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_7,0); //en=0
SysCtlDelay(160000);
}
LCD_STR(char *p)
{
while(*p)
{
LCD_DATA(*(p++));
SysCtlDelay(SysCtlClockGet()/11);
}
}

//////////////////////LCd_Init////////////////////////////////
lcd_init()
{
LCD_CMD(0x30);
SysCtlDelay(1500);
LCD_CMD(0x38);
SysCtlDelay(1500);
LCD_CMD(0x10);
SysCtlDelay(150);
LCD_CMD(0x01);
SysCtlDelay(150);
LCD_CMD(0x06);
SysCtlDelay(150);
LCD_CMD(0x0f);
}

//////////******************* STORE_CGRAM ***********************
void Store_CGRAM(void)
{
char i;
LCD_CMD(0x00);
for(i=0;i<8;i++)
{
LCD_CMD(0x40+8*i);
LCD_DATA(CGRAM_LUT[i]);
SysCtlDelay(500);
// LCD_CMD(0x00+8);

}
}


int
main(void)
{

SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN| SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOH);
SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOF);

HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;

HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01;
HWREG(GPIO_PORTF_BASE + GPIO_O_AFSEL) |= 0x000;
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0;

GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_4);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_5);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_6);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_7);
//********************** other pins************************

GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_5); //RS
GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_6); //R/W
GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_7); //En


lcd_init();

SysCtlDelay(1500);


LCD_CMD(0x80);

LCD_STR("Satu");
LCD_CMD(0xC0);

/////////////////////////// CGRAM /////////////////////////////
Store_CGRAM();

LCD_CMD(0xca);
LCD_DATA(0);
while(1)
{
SysCtlDelay(SysCtlClockGet()/11);
//LCD_CMD(0x1C);
}
}

  • Might you care to (somewhat) describe your, "Custom Character Generation Problem" for those here (willing & able) to assist?

    (forcing your "helpers" to "dig thru" that code-dump - in the (effort-laden) attempt to "tease out" your issue - proves (not especially) attractive...