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/TM4C1294NCPDT: COMMUNICATION WITH TFT DISPLAY (k430wqc-v3-ff) USING TM4C1294NCPDT

Part Number: TM4C1294NCPDT

Tool/software: Code Composer Studio

i cant enable this tft display with interface with tm4c1294ncpdt board 

this display is k430wqc-v3-ff (ssd1963) 480x272x16

i m transmit 8 bit dat via gpio port 

i need to sample code for this display for ssd1963 8 bit 

i am attach my code but still is it not work in that some issue i want simple color in display red blue green 

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/timer.h"
#include "driverlib/rom.h"
#include "grlib/grlib.h"
#include "Kentec480x272x16_SSD1963_8bit.h"




#if ! defined(PORTRAIT) && ! defined(PORTRAIT_FLIP) && \
    ! defined(LANDSCAPE) && ! defined(LANDSCAPE_FLIP)
#define LANDSCAPE
//#define PORTRAIT
#endif
#define LCD_HEIGHT  272
#define LCD_WIDTH   480

//*****************************************************************************
//
// Various definitions controlling coordinate space mapping and drawing
// direction in the four supported orientations.
//
//*****************************************************************************
#ifdef PORTRAIT
#define HORIZ_DIRECTION 0xa0
#define VERT_DIRECTION 0x80
#define MAPPED_X(x, y) (LCD_WIDTH-1- (y))
#define MAPPED_Y(x, y) (x)
#endif
#ifdef LANDSCAPE
#define HORIZ_DIRECTION 0x00
#define VERT_DIRECTION  0x20
#define MAPPED_X(x, y) (x)
#define MAPPED_Y(x, y) (y)

#endif
#ifdef PORTRAIT_FLIP
#define HORIZ_DIRECTION 0xa2
#define VERT_DIRECTION 0x81
#define MAPPED_X(x, y) (y)
#define MAPPED_Y(x, y) (LCD_HEIGHT-1 - (x))
#endif
#ifdef LANDSCAPE_FLIP
#define HORIZ_DIRECTION 0x02
#define VERT_DIRECTION  0x01
#define MAPPED_X(x, y) (LCD_WIDTH- (x))
#define MAPPED_Y(x, y) (LCD_HEIGHT- (y))
#endif

//*****************************************************************************
//
// Defines for the pins that are used to communicate with the SSD1963.
//
//*****************************************************************************

#define LCD_DATAH_PERIPH        SYSCTL_PERIPH_GPIOD
#define LCD_DATAH_BASE          GPIO_PORTD_BASE
#define LCD_DATAH_PINS          0xFF

//
// LCD control line GPIO definitions.
//
#define LCD_CS_PERIPH           SYSCTL_PERIPH_GPIOA
#define LCD_CS_BASE             GPIO_PORTA_BASE
#define LCD_CS_PIN              GPIO_PIN_3

 #define LCD_DC_PERIPH           SYSCTL_PERIPH_GPIOA
 #define LCD_DC_BASE             GPIO_PORTA_BASE
 #define LCD_DC_PIN              GPIO_PIN_2

 #define LCD_WR_PERIPH           SYSCTL_PERIPH_GPIOA
 #define LCD_WR_BASE             GPIO_PORTA_BASE
 #define LCD_WR_PIN              GPIO_PIN_5

 #define LCD_RD_PERIPH           SYSCTL_PERIPH_GPIOA
 #define LCD_RD_BASE             GPIO_PORTA_BASE
 #define LCD_RD_PIN              GPIO_PIN_4

 #define LCD_RST_PERIPH           SYSCTL_PERIPH_GPIOA
 #define LCD_RST_BASE             GPIO_PORTA_BASE
 #define LCD_RST_PIN              GPIO_PIN_7


//*****************************************************************************
//
// Macro used to set the LCD data bus in preparation for writing a byte to the
// device.
//
//*****************************************************************************
#define SET_LCD_DATA(ucByte)                                                  \
{                                                                             \
     GPIOPinWrite( LCD_DATAH_BASE, LCD_DATAH_PINS, ucByte);                      \
}

//*****************************************************************************
//
// Various internal SSD1963 registers name labels
//
//*****************************************************************************

#define ENTRY_MODE_DEFAULT 0x6830
#define MAKE_ENTRY_MODE(x) ((ENTRY_MODE_DEFAULT & 0xFF00) | (x))

//*****************************************************************************
//
// The dimensions of the LCD panel.
//
//*****************************************************************************
#define LCD_VERTICAL_MAX 272
#define LCD_HORIZONTAL_MAX 480

//*****************************************************************************
//
// Translates a 24-bit RGB color to a display driver-specific color.
//
// \param c is the 24-bit RGB color.  The least-significant byte is the blue
// channel, the next byte is the green channel, and the third byte is the red
// channel.
//
// This macro translates a 24-bit RGB color into a value that can be written
// into the display's frame buffer in order to reproduce that color, or the
// closest possible approximation of that color.
//
// \return Returns the display-driver specific color.
//
//*****************************************************************************
#define DPYCOLORTRANSLATE(c)    ((((c) & 0x00f80000) >> 8) |               \
                                 (((c) & 0x0000fc00) >> 5) |               \
                                 (((c) & 0x000000f8) >> 3))

//*****************************************************************************
//
// Function pointer types for low level LCD controller access functions.
//
//*****************************************************************************
typedef void (*pfnWriteData)(unsigned short usData);
typedef void (*pfnWriteSetting)(unsigned short usData);
typedef void (*pfnWriteCommand)(unsigned short ucData);

//*****************************************************************************
//
// Function pointers for low level LCD controller access functions.
//
//*****************************************************************************
static void WriteDataGPIO(unsigned short usData);
static void WriteSettingGPIO(unsigned short usData);
static void WriteCommandGPIO(unsigned short ucData);

pfnWriteData WriteData = WriteDataGPIO;
pfnWriteData WriteSetting = WriteSettingGPIO;
pfnWriteCommand WriteCommand = WriteCommandGPIO;

//*****************************************************************************
//
// Writes a data word to the SSD2119.  This function implements the basic GPIO
// interface to the LCD display.
//
//*****************************************************************************

static void
WriteDataGPIO(unsigned short usData)
{
    GPIOPinWrite( LCD_DATAH_BASE, LCD_DATAH_PINS, 0x00);

    SET_LCD_DATA(usData & 0xE0);


    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);

    //
    // Deassert the write enable signal.

    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN); // /WR=1


    // Write the mid byte of the data to the bus.
    //
    //GPIO_setOutputLowOnPin(LCD_DATAH_BASE,0xFF); //check please
    //SET_LCD_DATA((usData >> 5)<<2);
    SET_LCD_DATA(usData & 0x18);
    //
    // Assert the write enable signal.  We need to do this 2 times to ensure
    // that we don't violate the timing requirements for the display.
    //
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);

    //
    // Deassert the write enable signal.
    //
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //GPIO_setOutpuHighOnPin(LCD_WR_BASE ,LCD_WR_PIN);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN); // /WR=1

    //
    // Write the least significant byte of the data to the bus.
    //
   // SET_LCD_DATA(usData<<3);
    SET_LCD_DATA(usData & 0x07);
    //
    // Assert the write enable signal.
    //
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);

    //
    // Deassert the write enable signal.
    //
   // HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
   // GPIO_setOutpuHighOnPin(LCD_WR_BASE ,LCD_WR_PIN);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN); // /WR=1
 }

static void
WriteSettingGPIO(unsigned short usData)
{
//  HWREG(LCD_CS_BASE + GPIO_O_DATA + (LCD_CS_PIN << 2)) = 0;

    //
    // Write the least significant byte of the data to the bus.
    //
    //SET_LCD_DATA(usData);
    GPIOPinWrite(LCD_DATAH_BASE, LCD_DATAH_PINS , 0x00); // Data Bus OUT

    SET_LCD_DATA(usData & 0x07);
    //
    // Assert the write enable signal.
    //
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);

    //
    // Deassert the write enable signal.
    //
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //GPIO_setOutpuHighOnPin(LCD_WR_BASE ,LCD_WR_PIN);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN); // /WR=1
}


//*****************************************************************************
//
// Writes a command to the SSD2119.  This function implements the basic GPIO
// interface to the LCD display.
//
//*****************************************************************************
static void
WriteCommandGPIO(unsigned short ucData)
{
//  HWREG(LCD_CS_BASE + GPIO_O_DATA + (LCD_CS_PIN << 2)) = 0;
    //
    // Write the most significant byte of the data to the bus.  This is always
    // 0 since commands are no more than 8 bits.
    //
    GPIOPinWrite(LCD_DATAH_BASE, LCD_DATAH_PINS , 0x00); // Data Bus OUT
    SET_LCD_DATA(0);

    //
    // Assert DC
    GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, 0x00); // D/C=0
    //
    // Assert the write enable signal.  We need to do this 2 times to ensure
    // that we don't violate the timing requirements for the display.

    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);

    //
    // Deassert the write enable signal.
    //
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //GPIO_setOutpuHighOnPin(LCD_WR_BASE ,LCD_WR_PIN);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN); // /WR=1
 // Write the least significant byte of the data to the bus.
   // SET_LCD_DATA(ucData);
    SET_LCD_DATA(ucData & 0x07);

    //
    // Assert the write enable signal.
    //
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = 0;
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, 0x00);

    //
    // Deassert the write enable signal.
    //
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
    //HWREG(LCD_WR_BASE + GPIO_O_DATA + (LCD_WR_PIN << 2)) = LCD_WR_PIN;
   // GPIO_setOutpuHighOnPin(LCD_WR_BASE ,LCD_WR_PIN);
    GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN); // /WR=1

    //
    // Set the DC signal high, indicating that following writes are data.
    //
   // HWREG(LCD_DC_BASE + GPIO_O_DATA + (LCD_DC_PIN << 2)) = LCD_DC_PIN;
     GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, LCD_DC_PIN);
     }

//*****************************************************************************
//
// Initializes the pins required for the GPIO-based LCD interface.
//
// This function configures the GPIO pins used to control the LCD display
// when the basic GPIO interface is in use.  On exit, the LCD controller
// has been reset and is ready to receive command and data writes.
//
// \return None.
//
//*****************************************************************************
/*
static void
InitGPIOLCDInterface()
{


    //
    // Configure the pins that connect to the LCD as GPIO outputs.
    //
            GPIOPinTypeGPIOOutput(LCD_DATAH_BASE, LCD_DATAH_PINS);
            GPIOPinTypeGPIOOutput(LCD_DC_BASE, LCD_DC_PIN);
            GPIOPinTypeGPIOOutput(LCD_RD_BASE, LCD_RD_PIN);
            GPIOPinTypeGPIOOutput(LCD_WR_BASE, LCD_WR_PIN);
            GPIOPinTypeGPIOOutput(LCD_CS_BASE, LCD_CS_PIN);
            GPIOPinTypeGPIOOutput(LCD_RST_BASE, LCD_RST_PIN);

            GPIOPadConfigSet(LCD_DATAH_BASE, LCD_DATAH_PINS, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU );
            GPIOPadConfigSet(LCD_DC_BASE, LCD_DC_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
            GPIOPadConfigSet(LCD_RD_BASE, LCD_RD_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
            GPIOPadConfigSet(LCD_WR_BASE, LCD_WR_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
            GPIOPadConfigSet(LCD_CS_BASE, LCD_CS_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
            GPIOPadConfigSet(LCD_RST_BASE, LCD_RST_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);

      GPIOPinWrite(LCD_DATAH_BASE, LCD_DATAH_PINS, 0xff);
      GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, 0x00);
      GPIOPinWrite(LCD_RD_BASE, LCD_RD_PIN, LCD_RD_PIN);
      GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN);
      GPIOPinWrite(LCD_CS_BASE, LCD_CS_PIN, 0X00);


    //
    // Delay for 1ms.
    //
     //SysCtlDelay(ulClockMS);
      SysCtlDelay(SysCtlClockGet()/4);


    //
    // Deassert the LCD reset signal.
    //
//    GPIOPinWrite(LCD_RST_BASE, LCD_RST_PIN, LCD_RST_PIN);

    //
    // Delay for 1ms while the LCD comes out of reset.
    //
    //SysCtlDelay(ulClockMS);
    SysCtlDelay(SysCtlClockGet()/4);

}

*/
//*****************************************************************************
//
//! Initializes the display driver.
//!
//! This function initializes the SSD2119 display controller on the panel,
//! preparing it to display data.
//!
//! \return None.
//
//*****************************************************************************


void
Kentec480x272x16_SSD1963Init()
{
    unsigned long ulCount;

    SysCtlPeripheralEnable(LCD_DATAH_PERIPH);
    SysCtlPeripheralEnable(LCD_DC_PERIPH);
    SysCtlPeripheralEnable(LCD_RD_PERIPH);
    SysCtlPeripheralEnable(LCD_WR_PERIPH);
    SysCtlPeripheralEnable(LCD_CS_PERIPH);
    SysCtlPeripheralEnable(LCD_RST_PERIPH);


    GPIOPinTypeGPIOOutput(LCD_DATAH_BASE, LCD_DATAH_PINS);
    GPIOPinTypeGPIOOutput(LCD_DC_BASE, LCD_DC_PIN);
    GPIOPinTypeGPIOOutput(LCD_RD_BASE, LCD_RD_PIN);
    GPIOPinTypeGPIOOutput(LCD_WR_BASE, LCD_WR_PIN);
    GPIOPinTypeGPIOOutput(LCD_CS_BASE, LCD_CS_PIN);
    GPIOPinTypeGPIOOutput(LCD_RST_BASE, LCD_RST_PIN);

    GPIOPadConfigSet(LCD_DATAH_BASE, LCD_DATAH_PINS, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU );
    GPIOPadConfigSet(LCD_DC_BASE, LCD_DC_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
    GPIOPadConfigSet(LCD_RD_BASE, LCD_RD_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
    GPIOPadConfigSet(LCD_WR_BASE, LCD_WR_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
    GPIOPadConfigSet(LCD_CS_BASE, LCD_CS_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
    GPIOPadConfigSet(LCD_RST_BASE, LCD_RST_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);

GPIOPinWrite(LCD_DATAH_BASE, LCD_DATAH_PINS, 0xff);
GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, 0x00);
GPIOPinWrite(LCD_RD_BASE, LCD_RD_PIN, LCD_RD_PIN);
GPIOPinWrite(LCD_WR_BASE, LCD_WR_PIN, LCD_WR_PIN);
GPIOPinWrite(LCD_CS_BASE, LCD_CS_PIN, 0X00);



    WriteCommand(0x0001);   // software reset

    WriteCommand(0x00E2);   //PLL multiplier, set PLL clock to 120M
    WriteSetting(0x0014);//29
    WriteSetting(0x0003);
    WriteSetting(0x0004);

    WriteCommand(0x00E0);  // PLL enable
    WriteSetting(0x0001);

    WriteCommand(0x00E0);
    WriteSetting(0x0003);


    WriteCommand(0x00E6);   //PLL setting for PCLK, depends on resolution
    WriteSetting(0x0003);//04
    WriteSetting(0x00A0);//B9
    WriteSetting(0x0000);//38

    WriteCommand(0x00B0);   //LCD SPECIFICATION
    WriteSetting(0x0020);//24
    WriteSetting(0x0000);
    WriteSetting(0x01);  //Set HDP
    WriteSetting(0xDF);
    WriteSetting(0x01);
    WriteSetting(0x0F);
    WriteSetting(0x00);

    WriteCommand(0x00B4);   //HSYNC
    WriteSetting(0x02);
    WriteSetting(0x0D);
    WriteSetting(0x00);
    WriteSetting(0x25);
    WriteSetting(0x02);
    WriteSetting(0x00);
    WriteSetting(0x00);
    WriteSetting(0x00);

    WriteCommand(0x00B6);   //VSYNC
    WriteSetting(0x01);
    WriteSetting(0x1E);
    WriteSetting(0x00);
    WriteSetting(0x08);
    WriteSetting(0x01);
    WriteSetting(0x00);
    WriteSetting(0x00);

    WriteCommand(0xB8);
    WriteSetting(0x0007);//GPIO3=input, GPIO[2:0]=output
    WriteSetting(0x0001);//GPIO0 normal

    WriteCommand(0xBA);
    WriteSetting(0x000D);//GPIO[3:0] out 1 //GPIO[1]=0, RESET G2452

    WriteCommand(0x36);//rotation
    WriteSetting(0x0000);

    WriteCommand(0x00F0); //pixel data interface
//  WriteSetting(0x0003);
    WriteSetting(0x0000);

    WriteCommand(0x00BE); //set PWM for B/L
    WriteSetting(0x0001);//06 frequency
    WriteSetting(0x00FF);//C0 duty
    WriteSetting(0x0009);//bit[3]DBC enable,bit[0]PWM enable
    WriteSetting(0x00FF);//C0 DBC manual brightness
    WriteSetting(0x0088);//10 DBC minimum brightness
    WriteSetting(0x0000);//08 Brightness prescaler

    WriteCommand(0x00d4);
    WriteSetting(0x0000);
    WriteSetting(0x001C);
    WriteSetting(0x0020);
    WriteSetting(0x0000);
    WriteSetting(0x0046);
    WriteSetting(0x0050);
    WriteSetting(0x0000);
    WriteSetting(0x00A8);
    WriteSetting(0x00C0);

    WriteCommand(0x00d0);
    //WriteSetting(0x000D);//DBC Aggressive mode
    WriteSetting(0x0001);//DBC disable

    //WriteCommand(0x0021); //Enter Invert Mode

    WriteCommand(0x0029); //display on

    //
    // Clear the contents of the display buffer.
    //
    WriteCommand(0x002A);
    WriteSetting(0);
    WriteSetting(0);
    WriteSetting(479>>8);
    WriteSetting(479&0x00ff);
    WriteCommand(0x002b);
    WriteSetting(0);
    WriteSetting(0);
    WriteSetting(271>>8);
    WriteSetting(271&0x00ff);

    WriteCommand(0x002c);

    for(ulCount = 0; ulCount < (480 * 272); ulCount++)
    {
        WriteData(0x0000);
    }
}

//*****************************************************************************
//
//! Draws a pixel on the screen.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the pixel.
//! \param lY is the Y coordinate of the pixel.
//! \param ulValue is the color of the pixel.
//!
//! This function sets the given pixel to a particular color.  The coordinates
//! of the pixel are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
static void
Kentec480x272x16_SSD1963PixelDraw(void *pvDisplayData, int32_t lX, int32_t lY,
                                   uint32_t ulValue)
{
    //
    // Set the X address of the display cursor.
    //
    WriteCommand(0x2A);
    WriteSetting(MAPPED_X(lX, lY)>>8);
    WriteSetting(MAPPED_X(lX, lY)&0xff);
    WriteSetting((LCD_WIDTH-1)>>8);
    WriteSetting((LCD_WIDTH-1)&0xff);

    //
    // Set the Y address of the display cursor.
    //
    WriteCommand(0x2B);
    WriteSetting(MAPPED_Y(lX, lY)>>8);
    WriteSetting(MAPPED_Y(lX, lY)&0xff);
    WriteSetting((LCD_HEIGHT-1)>>8);
    WriteSetting((LCD_HEIGHT-1)&0xff);

    //
    // Write the pixel value.
    //
    WriteCommand(0x2C);
    WriteData(ulValue);
}

void
Kentec480x272x16_SSD1963PixelDraw_x(long lX, long lY,
                                   unsigned long ulValue)
{
    //
    // Set the X address of the display cursor.
    //
    WriteCommand(0x2A);
    WriteSetting(MAPPED_X(lX, lY)>>8);
    WriteSetting(MAPPED_X(lX, lY)&0xff);
    WriteSetting((LCD_WIDTH-1)>>8);
    WriteSetting((LCD_WIDTH-1)&0xff);

    //
    // Set the Y address of the display cursor.
    //
    WriteCommand(0x2B);
    WriteSetting(MAPPED_Y(lX, lY)>>8);
    WriteSetting(MAPPED_Y(lX, lY)&0xff);
    WriteSetting((LCD_HEIGHT-1)>>8);
    WriteSetting((LCD_HEIGHT-1)&0xff);

    //
    // Write the pixel value.
    //
    WriteCommand(0x2C);
    WriteData(ulValue);
}


//*****************************************************************************
//
//! Draws a horizontal sequence of pixels on the screen.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the first pixel.
//! \param lY is the Y coordinate of the first pixel.
//! \param lX0 is sub-pixel offset within the pixel data, which is valid for 1
//! or 4 bit per pixel formats.
//! \param lCount is the number of pixels to draw.
//! \param lBPP is the number of bits per pixel; must be 1, 4, or 8.
//! \param pucData is a pointer to the pixel data.  For 1 and 4 bit per pixel
//! formats, the most significant bit(s) represent the left-most pixel.
//! \param pucPalette is a pointer to the palette used to draw the pixels.
//!
//! This function draws a horizontal sequence of pixels on the screen, using
//! the supplied palette.  For 1 bit per pixel format, the palette contains
//! pre-translated colors; for 4 and 8 bit per pixel formats, the palette
//! contains 24-bit RGB values that must be translated before being written to
//! the display.
//!
//! \return None.
//
//*****************************************************************************
static void
Kentec480x272x16_SSD1963PixelDrawMultiple(void *pvDisplayData, int32_t lX,
                                           int32_t lY, int32_t lX0, int32_t lCount,
                                           int32_t lBPP,
                                           const unsigned char *pucData,
                                           const unsigned char *pucPalette)
{
    unsigned long ulByte;

    //
    // Set the cursor increment to left to right, followed by top to bottom.
    //
    WriteCommand(0x36);
    WriteSetting(MAKE_ENTRY_MODE(HORIZ_DIRECTION));

    //
    // Set the X address of the display cursor.
    //
    WriteCommand(0x2A);
    WriteSetting(MAPPED_X(lX, lY)>>8);
    WriteSetting(MAPPED_X(lX, lY)&0xff);
    WriteSetting((LCD_WIDTH-1)>>8);
    WriteSetting((LCD_WIDTH-1)&0xff);

    //
    // Set the Y address of the display cursor.
    //
    WriteCommand(0x2B);
    WriteSetting(MAPPED_Y(lX, lY)>>8);
    WriteSetting(MAPPED_Y(lX, lY)&0xff);
    WriteSetting((LCD_HEIGHT-1)>>8);
    WriteSetting((LCD_HEIGHT-1)&0xff);


    //
    // Write the data RAM write command.
    //
    WriteCommand(0x2C);

    //
    // Determine how to interpret the pixel data based on the number of bits
    // per pixel.
    //
    switch(lBPP)
    {
        //
        // The pixel data is in 1 bit per pixel format.
        //
        case 1:
        {
            //
            // Loop while there are more pixels to draw.
            //
            while(lCount)
            {
                //
                // Get the next byte of image data.
                //
                ulByte = *pucData++;

                //
                // Loop through the pixels in this byte of image data.
                //
                for(; (lX0 < 8) && lCount; lX0++, lCount--)
                {
                    //
                    // Draw this pixel in the appropriate color.
                    //
                    WriteData(((unsigned long *)pucPalette)[(ulByte >>
                                                             (7 - lX0)) & 1]);
                }

                //
                // Start at the beginning of the next byte of image data.
                //
                lX0 = 0;
            }

            //
            // The image data has been drawn.
            //
            break;
        }

        //
        // The pixel data is in 4 bit per pixel format.
        //
        case 4:
        {
            //
            // Loop while there are more pixels to draw.  "Duff's device" is
            // used to jump into the middle of the loop if the first nibble of
            // the pixel data should not be used.  Duff's device makes use of
            // the fact that a case statement is legal anywhere within a
            // sub-block of a switch statement.  See
            // http://en.wikipedia.org/wiki/Duff's_device for detailed
            // information about Duff's device.
            //
            switch(lX0 & 1)
            {
                case 0:
                    while(lCount)
                    {
                        //
                        // Get the upper nibble of the next byte of pixel data
                        // and extract the corresponding entry from the
                        // palette.
                        //
                        ulByte = (*pucData >> 4) * 3;
                        ulByte = (*(unsigned long *)(pucPalette + ulByte) &
                                  0x00ffffff);

                        //
                        // Translate this palette entry and write it to the
                        // screen.
                        //
                        WriteData(DPYCOLORTRANSLATE(ulByte));

                        //
                        // Decrement the count of pixels to draw.
                        //
                        lCount--;

                        //
                        // See if there is another pixel to draw.
                        //
                        if(lCount)
                        {
                case 1:
                            //
                            // Get the lower nibble of the next byte of pixel
                            // data and extract the corresponding entry from
                            // the palette.
                            //
                            ulByte = (*pucData++ & 15) * 3;
                            ulByte = (*(unsigned long *)(pucPalette + ulByte) &
                                      0x00ffffff);

                            //
                            // Translate this palette entry and write it to the
                            // screen.
                            //
                            WriteData(DPYCOLORTRANSLATE(ulByte));

                            //
                            // Decrement the count of pixels to draw.
                            //
                            lCount--;
                        }
                    }
            }

            //
            // The image data has been drawn.
            //
            break;
        }

        //
        // The pixel data is in 8 bit per pixel format.
        //
        case 8:
        {
            //
            // Loop while there are more pixels to draw.
            //
            while(lCount--)
            {
                //
                // Get the next byte of pixel data and extract the
                // corresponding entry from the palette.
                //
                ulByte = *pucData++ * 3;
                ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff;

                //
                // Translate this palette entry and write it to the screen.
                //
                WriteData(DPYCOLORTRANSLATE(ulByte));
            }

            //
            // The image data has been drawn.
            //
            break;
        }
    }

//  UARTprintf("\n\Draw Multi Pixel finish \n");
}

//*****************************************************************************
//
//! Draws a horizontal line.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX1 is the X coordinate of the start of the line.
//! \param lX2 is the X coordinate of the end of the line.
//! \param lY is the Y coordinate of the line.
//! \param ulValue is the color of the line.
//!
//! This function draws a horizontal line on the display.  The coordinates of
//! the line are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
static void
Kentec480x272x16_SSD1963LineDrawH(void *pvDisplayData, int32_t lX1, int32_t lX2,
                                   int32_t lY, uint32_t ulValue)
{
    //
    // Set the cursor increment to left to right, followed by top to bottom.
    //
    WriteCommand(0x36);
    WriteSetting(MAKE_ENTRY_MODE(HORIZ_DIRECTION));

    //
    // Set the X address of the display cursor.
    //
    WriteCommand(0x2A);
    WriteSetting(MAPPED_X(lX1, lY)>>8);
    WriteSetting(MAPPED_X(lX1, lY)&0xff);
    WriteSetting((LCD_WIDTH-1)>>8);
    WriteSetting((LCD_WIDTH-1)&0xff);

    //
    // Set the Y address of the display cursor.
    //
    WriteCommand(0x2B);
    WriteSetting(MAPPED_Y(lX1, lY)>>8);
    WriteSetting(MAPPED_Y(lX1, lY)&0xff);
    WriteSetting((LCD_HEIGHT-1)>>8);
    WriteSetting((LCD_HEIGHT-1)&0xff);


    //
    // Write the data RAM write command.
    //
    WriteCommand(0x2C);

    //
    // Loop through the pixels of this horizontal line.
    //
    while(lX1++ <= lX2)
    {
        //
        // Write the pixel value.
        //
        WriteData(ulValue);
    }
    //UARTprintf("\n\Draw Horiz finish %d \n",MAKE_ENTRY_MODE(HORIZ_DIRECTION));
}

//*****************************************************************************
//
//! Draws a vertical line.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param lX is the X coordinate of the line.
//! \param lY1 is the Y coordinate of the start of the line.
//! \param lY2 is the Y coordinate of the end of the line.
//! \param ulValue is the color of the line.
//!
//! This function draws a vertical line on the display.  The coordinates of the
//! line are assumed to be within the extents of the display.
//!
//! \return None.
//
//*****************************************************************************
static void
Kentec480x272x16_SSD1963LineDrawV(void *pvDisplayData, int32_t lX, int32_t lY1,
                                   int32_t lY2, uint32_t ulValue)
{
    //
    // Set the cursor increment to top to bottom, followed by left to right.
    //
    WriteCommand(0x36);
    WriteSetting(MAKE_ENTRY_MODE(VERT_DIRECTION));

    //
    // Set the X address of the display cursor.
    //
    WriteCommand(0x2A);
    WriteSetting(MAPPED_X(lX, lY1)>>8);
    WriteSetting(MAPPED_X(lX, lY1)&0xff);
    WriteSetting((LCD_WIDTH-1)>>8);
    WriteSetting((LCD_WIDTH-1)&0xff);

    //
    // Set the Y address of the display cursor.
    //
    WriteCommand(0x2B);
    WriteSetting(MAPPED_Y(lX, lY1)>>8);
    WriteSetting(MAPPED_Y(lX, lY1)&0xff);
    WriteSetting((LCD_HEIGHT-1)>>8);
    WriteSetting((LCD_HEIGHT-1)&0xff);


    //
    // Write the data RAM write command.
    //
    WriteCommand(0x2C);

    //
    // Loop through the pixels of this vertical line.
    //
    while(lY1++ <= lY2)
    {
        //
        // Write the pixel value.
        //
        WriteData(ulValue);
    }
    //UARTprintf("\n\Draw Vertical over \n");
}

//*****************************************************************************
//
//! Fills a rectangle.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param pRect is a pointer to the structure describing the rectangle.
//! \param ulValue is the color of the rectangle.
//!
//! This function fills a rectangle on the display.  The coordinates of the
//! rectangle are assumed to be within the extents of the display, and the
//! rectangle specification is fully inclusive (in other words, both sXMin and
//! sXMax are drawn, along with sYMin and sYMax).
//!
//! \return None.
//
//*****************************************************************************
static void
Kentec480x272x16_SSD1963RectFill(void *pvDisplayData, const tRectangle *pRect,
                                  uint32_t ulValue)
{
    long lCount_x, lCount_y;
//  unsigned int HDP_S=799;
//  unsigned int VDP_S=479;

    //
    // / Set the cursor increment to top to bottom, followed by left to right.
    //
    WriteCommand(0x36);
    WriteSetting(MAKE_ENTRY_MODE(HORIZ_DIRECTION));


    //
    // Set the display cursor to the upper left of the rectangle (in application
    // coordinate space).
    //
    WriteCommand(0x2A);
    WriteSetting(MAPPED_X(pRect->i16XMin, pRect->i16YMin)>>8);
    WriteSetting(MAPPED_X(pRect->i16XMin, pRect->i16YMin)&0xff);
#if (defined PORTRAIT) || (defined LANDSCAPE)
        WriteSetting(MAPPED_X(pRect->i16XMax, pRect->i16YMax)>>8);
        WriteSetting(MAPPED_X(pRect->i16XMax, pRect->i16YMax)&0xff);

#else
        WriteSetting(MAPPED_X(pRect->i16XMin, pRect->i16YMin)>>8);
        WriteSetting(MAPPED_X(pRect->i16XMin, pRect->i16YMin)&0xff);

#endif




    WriteCommand(0x2B);
    WriteSetting(MAPPED_Y(pRect->i16XMin, pRect->i16YMin)>>8);
    WriteSetting(MAPPED_Y(pRect->i16XMin, pRect->i16YMin)&0xff);
#if (defined LANDSCAPE_FLIP) || (defined PORTRAIT)
        WriteSetting((MAPPED_Y(pRect->i16XMin, pRect->i16YMin) |
                 (MAPPED_Y(pRect->i16XMax, pRect->i16YMax) << 8))>>8);
        WriteSetting((MAPPED_Y(pRect->i16XMin, pRect->i16YMin) |
                (MAPPED_Y(pRect->i16XMax, pRect->i16YMax) << 8))&0xff);

#else
        WriteSetting((MAPPED_Y(pRect->i16XMax, pRect->i16YMax) |
                 (MAPPED_Y(pRect->i16XMin, pRect->i16YMin) << 8))>>8);
        WriteSetting((MAPPED_Y(pRect->i16XMax, pRect->i16YMax) |
                (MAPPED_Y(pRect->i16XMin, pRect->i16YMin) << 8))&0xff);

#endif

    //
    // Tell the controller we are about to write data into its RAM.
    //
    WriteCommand(0x2C);

    for(lCount_y =(pRect->i16YMax - pRect->i16YMin);lCount_y >= 0; lCount_y--)
    {   for(lCount_x =(pRect->i16XMax - pRect->i16XMin);lCount_x >= 0; lCount_x--)
        //
        // Write the pixel value.
        //
        WriteData(ulValue);
    }
}

//*****************************************************************************
//
//! Translates a 24-bit RGB color to a display driver-specific color.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//! \param ulValue is the 24-bit RGB color.  The least-significant byte is the
//! blue channel, the next byte is the green channel, and the third byte is the
//! red channel.
//!
//! This function translates a 24-bit RGB color into a value that can be
//! written into the display's frame buffer in order to reproduce that color,
//! or the closest possible approximation of that color.
//!
//! \return Returns the display-driver specific color.
//
//*****************************************************************************
static uint32_t
Kentec480x272x16_SSD1963ColorTranslate(void *pvDisplayData,
                                        uint32_t ulValue)
{
    //
    // Translate from a 24-bit RGB color to a 5-6-5 RGB color.
    //
    return(DPYCOLORTRANSLATE(ulValue));
}

//*****************************************************************************
//
//! Flushes any cached drawing operations.
//!
//! \param pvDisplayData is a pointer to the driver-specific data for this
//! display driver.
//!
//! This functions flushes any cached drawing operations to the display.  This
//! is useful when a local frame buffer is used for drawing operations, and the
//! flush would copy the local frame buffer to the display.  For the SSD1963
//! driver, the flush is a no operation.
//!
//! \return None.
//
//*****************************************************************************
static void
Kentec480x272x16_SSD1963Flush(void *pvDisplayData)
{
    //
    // There is nothing to be done.
    //
}

//*****************************************************************************
//
//! The display structure that describes the driver for the Kentec Display
//! K430WQC-V3-F TFT panel with an SSD1963 controller.
//
//*****************************************************************************
const tDisplay g_sLcd480x272x16_8bit =
{
    sizeof(tDisplay),
    0,
#if defined(PORTRAIT) || defined(PORTRAIT_FLIP)
    LCD_HEIGHT,
    LCD_WIDTH,
#else
    LCD_WIDTH,
    LCD_HEIGHT,
#endif
    Kentec480x272x16_SSD1963PixelDraw,
    Kentec480x272x16_SSD1963PixelDrawMultiple,
    Kentec480x272x16_SSD1963LineDrawH,
    Kentec480x272x16_SSD1963LineDrawV,
    Kentec480x272x16_SSD1963RectFill,
    Kentec480x272x16_SSD1963ColorTranslate,
    Kentec480x272x16_SSD1963Flush
};

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//********
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/flash.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/uart.h"
#include "driverlib/udma.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "grlib/grlib.h"
#include "utils/ustdlib.h"
#include "Kentec480x272x16_SSD1963_8bit.h"

//extern const uint8_t g_pui8Image[];
volatile uint32_t g_ui32SysClock;
tContext sContext;
tRectangle sRect;


int
main(void)
{

    g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                                SYSCTL_OSC_MAIN |
                                                SYSCTL_USE_PLL |
                                                SYSCTL_CFG_VCO_480), 120000000);



    //
    // Initialize the display driver.
    //
    Kentec480x272x16_SSD1963Init();

    //
    // Initialize the graphics context.
    //
    GrContextInit(&sContext, &g_sLcd480x272x16_8bit);

 while(1)
 {

    //
  /*  // Fill the top 24 rows of the screen with blue to create the banner.
    //
    sRect.i16XMin = 0;
    sRect.i16YMin = 0;
    sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1;
    sRect.i16YMax = 23;
    GrContextForegroundSet(&sContext, ClrDarkBlue);
    GrRectFill(&sContext, &sRect);
*/
       sRect.i16XMin = 0;
       sRect.i16YMin = 0;
       sRect.i16XMax = 319;
       sRect.i16YMax = 239;
       GrContextForegroundSet(&sContext, ClrHotPink );
       GrRectFill(&sContext, &sRect);

       SysCtlDelay(SysCtlClockGet()/4);

       sRect.i16XMin = 0;
       sRect.i16YMin = 0;
       sRect.i16XMax = 319;
       sRect.i16YMax = 239;
       GrContextForegroundSet(&sContext, ClrLightBlue  );
       GrRectFill(&sContext, &sRect);

       SysCtlDelay(SysCtlClockGet());

       sRect.i16XMin = 0;
       sRect.i16YMin = 239;
       sRect.i16XMax = 319;
       sRect.i16YMax = 0;
       GrContextForegroundSet(&sContext, ClrLightGoldenrodYellow  );
       GrRectFill(&sContext, &sRect);

       SysCtlDelay(SysCtlClockGet());

       sRect.i16XMin = 0;
       sRect.i16YMin = 0;
       sRect.i16XMax = 319;
       sRect.i16YMax = 239;
       GrContextForegroundSet(&sContext, ClrOrangeRed   );
       GrRectFill(&sContext, &sRect);

 }
}
Kentec480x272x16_SSD1963_8bit.h

  • Hi,

      We only have example code for K350QVG-S1.  You will need to reference these examples and adapt to your specific LCD display. You can find the example projects in C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl-boostxl-kentec-s1. Please also refer to the TivaWare graphic library user's guide. 

  • i am try this display but i can't properly calibrated. now i am using winstar display 5.7' ssd1963 i need any example code for winstar display ssd1963 controller with any tiva c series board.

  • Hi Govind,

      As I mentioned in my prior reply, we only have example for K350QVG-S1. Did you reference the code in the example I provided? Please reference the TivaWare graphic library at https://www.ti.com/lit/pdf/spmu300. We mainly support the MCU. We don't have the knowledge of every 3rd party display units. 

  • thank you for your responce but k350q is spi mode interface and i want 8 bit data transfer type any example of ssd1963

  • Did you have a chance to go through the ssd1963 datasheet? I took a quick look of it and it needs a MCU interface that is compatible to either 6800 or 8080. 

    The TM4C1294CPDT does have a EPI interface. However, in the Host-Bus mode description it didn't specifically mention 6800 and 8080 modes. You may want to see if the General-Purpose mode of the EPI interface can interface with the ssd1963. Again, as much as I wanted to help, we are not expert in the third party display components. You will need to find out if the timing requirements of the ssd1963 can be met by the TM4C1294CPDT MCU. In the TivaWare library, we only have one example of the EPI usage but that is used to interface with a SDRAM. That example can be found in C:\ti\TivaWare_C_Series-2.1.4.178\examples\peripherals\epi. We do not have any examples that use the Host-mode. With that said, I did some search and found one TI reference design that uses the TM4C129's EPI interface to talk to an external camera. You can find this reference design in www.ti.com/.../TIDM-TM4C129CAMERA

    ■ Host-Bus mode
    – Traditional x8 and x16 MCU bus interface capabilities
    – Similar device compatibility options as PIC, ATmega, 8051, and others
    – Access to SRAM, NOR Flash memory, and other devices, with up to 1 MB of addressing in
    non-multiplexed mode and 256 MB in multiplexed mode (512 MB in Host-Bus 16 mode with
    no byte selects)
    – Support for up to 512 Mb PSRAM in quad chip select mode, with dedicated configuration
    register read and write enable.
    – Support of both muxed and de-muxed address and data
    – Access to a range of devices supporting the non-address FIFO x8 and x16 interface variant,
    with support for external FIFO (XFIFO) EMPTY and FULL signals
    – Speed controlled, with read and write data wait-state counters
    – Support for read/write burst mode to Host Bus
    – Multiple chip select modes including single, dual, and quad chip selects, with and without
    ALE
    – External iRDY signal provided for stall capability of reads and writes
    – Manual chip-enable (or use extra address pins)


    ■ General-Purpose mode
    – Wide parallel interfaces for fast communications with CPLDs and FPGAs
    – Data widths up to 32 bits
    – Data rates up to 150 MB/second
    – Optional "address" sizes from 4 bits to 20 bits
    – Optional clock output, read/write strobes, framing (with counter-based size), and clock-enable
    input