lpcware

FTDI FT800 LCD TFT display + LPC1769 - some problems with graphic commands

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by teslabox on Wed May 11 13:07:22 MST 2016
Hi guys,

I am dealing with FT800 FTDI LCD TFT 5 inches display.
I run it via SPI0/SSP0 at 10 MHz with my LPCXpresso LPC1769 Rev. C and I am using FT800.h library with mapped memory of FT800
and I run some ANSI C example code from FTDI website for ARM:
- http://www.ftdichip.com/Support/SoftwareExamples/FT800_Projects.htm#ARM
- http://www.ftdichip.com/Support/SoftwareExamples/EVE/AN_312.zip
- http://www.ftdichip.com/Support/Documents/AppNotes/AN_312%20FT800%20Example%20with%20ARM.pdf

I modified a bit ANSI C code from example to run with my LPC1769 C code libraries and I run example proggram - toggling a point on the backgraound.
It works great but I want more... and I try do display some button.

In according to FT800 Proggraming Guide I composed/wrote some C code to display button (just button)
- http://www.ftdichip.com/Support/Documents/ProgramGuides/FT800%20Programmers%20Guide.pdf
but there is something wrong... the display is not running...

My C code for button displaying is shown below:

There is:
- Header of Display list
- First method of button displaying (does not work),
- Second method of button displaying (does not work),
- Displaying the toggle point (works OK),
- Ending of Display list

// HEADER OF DISPLAY LIST START - BEGIN
ft800memWrite32 (RAM_CMD + cmdOffset, (CMD_DLSTART));// Start the display list
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

ft800memWrite32 (RAM_CMD + cmdOffset, (DL_CLEAR_RGB | BackgroundColor));// Set the default clear color to black
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

ft800memWrite32 (RAM_CMD + cmdOffset, (DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG));// Clear the screen - this and the previous prevent artifacts between lists
// Attributes are the color, stencil and tag buffers
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer
// HEADER OF DISPLAY LIST START - END

#if (CREATE_BUTTON_METHOD_NUMBER == 0)
// BUTTON - BEGIN
// Command Button
// Address 0-3; 4 bytes
ft800memWrite32 (RAM_CMD + cmdOffset, (CMD_BUTTON));
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

// X-coordinate of button top-left, in pixels; Address 4-5; 2 bytes
// Y-coordinate of button top-left, in pixels; Address 6-7; 2 bytes
ft800memWrite32 (RAM_CMD + cmdOffset, ( (100 << 16) | (100) ));
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

// Width of button, in pixels;  Address 8-9; 2 byte
// Height of button, in pixels; Address 10-11; 2 bytes
ft800memWrite32 (RAM_CMD + cmdOffset, ( (50 << 16) | (25) ));
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

// Font of button;    Address 12-13; 2 bytes
// Options of button; Address 14-15; 2 bytes
//
ft800memWrite32 (RAM_CMD + cmdOffset, ( (31 << 16) | (0) ));
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

// Text of button - "OK": "O" + "K" + "NULL"
// Address 16-19; 4 byte
ft800memWrite32 (RAM_CMD + cmdOffset, ( (0x4F << 24) | (0x4B << 16) | (0x00 << 8) | (0x00 << 0)));
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer
// BUTTON - END
#endif

#if (CREATE_BUTTON_METHOD_NUMBER == 1)
// BUTTON - BEGIN
// Command Button
// Address 0-3; 4 bytes
ft800memWrite32 (RAM_CMD + cmdOffset, (CMD_BUTTON));
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

// X-coordinate of button top-left, in pixels
// Address 4-5; 2 bytes
ft800memWrite16 (RAM_CMD + cmdOffset, 100);
cmdOffset = incCMDOffset (cmdOffset, 2);// Update the command pointer

// Y-coordinate of button top-left, in pixels
// Address 6-7; 2 bytes
ft800memWrite16 (RAM_CMD + cmdOffset, 100);
cmdOffset = incCMDOffset (cmdOffset, 2);// Update the command pointer

// Width of button, in pixels
// Address 8-9; 2 byte
ft800memWrite16 (RAM_CMD + cmdOffset, 50);
cmdOffset = incCMDOffset (cmdOffset, 2);// Update the command pointer

// Height of button, in pixels
// Address 10-11; 2 bytes
ft800memWrite16 (RAM_CMD + cmdOffset, 25);
cmdOffset = incCMDOffset (cmdOffset, 2);// Update the command pointer

// Font of button
// Address 12-13; 2 bytes
ft800memWrite16 (RAM_CMD + cmdOffset, 31);
cmdOffset = incCMDOffset (cmdOffset, 2);// Update the command pointer

// Options of button
// Address 14-15; 2 bytes
ft800memWrite16 (RAM_CMD + cmdOffset, 0);
cmdOffset = incCMDOffset (cmdOffset, 2);// Update the command pointer

// Text of button - "OK": "O"
// Address 16; 1 byte
ft800memWrite8 (RAM_CMD + cmdOffset, 0x4F);
cmdOffset = incCMDOffset (cmdOffset, 1);// Update the command pointer

// Text of button - "OK": "K"
// Address 17; 1 byte
ft800memWrite8 (RAM_CMD + cmdOffset, 0x4B);
cmdOffset = incCMDOffset (cmdOffset, 1);// Update the command pointer

// String terminated with null character, i.e. '\0'
ft800memWrite8 (RAM_CMD + cmdOffset, 0x00);
cmdOffset = incCMDOffset (cmdOffset, 1);// Update the command pointer
// BUTTON - END
#endif

#if (CREATE_TOGGLE_POINT == 1)
// DRAW POINT - BEGIN
ft800memWrite32 (RAM_CMD + cmdOffset, (DL_COLOR_RGB | color));// Set the color of the following item(s) - toggle red/white from above
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

ft800memWrite32 (RAM_CMD + cmdOffset, (DL_POINT_SIZE | point_size));// Select the size of the dot to draw
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

ft800memWrite32 (RAM_CMD + cmdOffset, (DL_BEGIN | FTPOINTS));// Indicate to draw a point (dot)
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

ft800memWrite32 (RAM_CMD + cmdOffset, (DL_VERTEX2F | (point_x << 15) | point_y));// Set the point center location
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

ft800memWrite32 (RAM_CMD + cmdOffset, (DL_END));// End the point
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer
// DRAW POINT - END
#endif


// ENDING OF DISPLAY LIST START - BEGIN
ft800memWrite32 (RAM_CMD + cmdOffset, (DL_DISPLAY));// Instruct the graphics processor to show the list
cmdOffset = incCMDOffset(cmdOffset, 4);// Update the command pointer

ft800memWrite32 (RAM_CMD + cmdOffset, (CMD_SWAP));// Make this list active
cmdOffset = incCMDOffset (cmdOffset, 4);// Update the command pointer

ft800memWrite16 (REG_CMD_WRITE, (cmdOffset));// Update the ring buffer pointer so the graphics processor starts executing
// ENDING OF DISPLAY LIST START - END

//////////////////////////////////////////////////////////////////////////////////////
//////////////////////// DISPLAY LIST - END //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////


In the attachements there are full ANSI C code files.

I will be very gratefull for support and help in this case.

Original Attachment has been moved to: main_24.c.zip

Original Attachment has been moved to: ssp_0.h.zip

Original Attachment has been moved to: FT800.h.zip

Original Attachment has been moved to: ssp_1.c.zip

Outcomes