Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - sli25

Pages: [1]

I am working on NHD‐2.4‐240320SF‐CTXL#‐FTN1, and it doesn't show anything I want it to show.
I don't know the problem comes from the initialization or the display function.
I would like to ask how to tell this LED has been initialized successfully?


I meet with a problem bringing up this LCD on RL78/G14 platform.
I am trying to use GPIO port 0, bit 1 to bit4 to transmit control signals, and use GPIO port 5, bit 0 to bit 7 to work as 8-bit data bus.
The following codes are port initialization, TFT initialization, testing code (draw a pixel on the screen). If anyone could think of any potential reasons why it can't be brought up, please let me know. Thanks.

1. Port Initialization Code:
P0 = _01_Pn0_OUTPUT_1 | _00_Pn1_OUTPUT_0 | _00_Pn2_OUTPUT_0 | _00_Pn3_OUTPUT_0 | _00_Pn4_OUTPUT_0 |
         _20_Pn5_OUTPUT_1 | _40_Pn6_OUTPUT_1;
P5 = _00_Pn0_OUTPUT_0 | _00_Pn1_OUTPUT_0 | _00_Pn2_OUTPUT_0 | _00_Pn3_OUTPUT_0 | _00_Pn4_OUTPUT_0 |
         _00_Pn5_OUTPUT_0 | _00_Pn6_OUTPUT_0 | _00_Pn7_OUTPUT_0;
          _00_PMn4_MODE_OUTPUT | _00_PMn5_MODE_OUTPUT | _00_PMn6_MODE_OUTPUT | _80_PM0_DEFAULT;
          _00_PMn4_MODE_OUTPUT | _00_PMn5_MODE_OUTPUT | _00_PMn6_MODE_OUTPUT | _00_PMn7_MODE_OUTPUT;

2. LCD initialization code:

/* Write one byte as a command to the TFT LCD controller. */
void TFT_24S_Write_Command(uint8_t command)

/* Write one byte as data to the TFT LCD Controller. */
void TFT_24S_Write_Data(uint8_t data)

/* Initialize the relevant peripherals (GPIO, TPM, ADC) and the display
components (TFT LCD controller, touch screen and backlight controller). */
void TFT_Init(void)
        TFT_24S_Write_Command(0x0028); //display OFF
   TFT_24S_Write_Command(0x0011); //exit SLEEP mode
   TFT_24S_Write_Command(0x00CB); //Power Control A
   TFT_24S_Write_Data(0x0039); //always 0x39
   TFT_24S_Write_Data(0x002C); //always 0x2C
   TFT_24S_Write_Data(0x0000); //always 0x00
   TFT_24S_Write_Data(0x0034); //Vcore = 1.6V
   TFT_24S_Write_Data(0x0002); //DDVDH = 5.6V
        TFT_24S_Write_Command(0x00CF); //Power Control B
   TFT_24S_Write_Data(0x0000); //always 0x00
   TFT_24S_Write_Data(0x0081); //PCEQ off
   TFT_24S_Write_Data(0x0030); //ESD protection
        TFT_24S_Write_Command(0x00E8); //Driver timing control A
   TFT_24S_Write_Data(0x0085); //non-overlap
   TFT_24S_Write_Data(0x0001); //EQ timing
   TFT_24S_Write_Data(0x0079); //Pre-charge timing
        TFT_24S_Write_Command(0x00EA); //Driver timing control B
   TFT_24S_Write_Data(0x0000); //Gate driver timing
   TFT_24S_Write_Data(0x0000); //always 0x00
   TFT_24S_Write_Command(0x00ED); //Power-On sequence control
   TFT_24S_Write_Data(0x0064); //soft start
   TFT_24S_Write_Data(0x0003); //power on sequence
   TFT_24S_Write_Data(0x0012); //power on sequence
   TFT_24S_Write_Data(0x0081); //DDVDH enhance on
        TFT_24S_Write_Command(0x00F7); //Pump ratio control
   TFT_24S_Write_Data(0x0020); //DDVDH=2xVCI
        TFT_24S_Write_Command(0x00C0); //power control 1
   TFT_24S_Write_Data(0x0004); //second parameter for ILI9340 (ignored by ILI9341)
        TFT_24S_Write_Command(0x00C1); //power control 2
        TFT_24S_Write_Command(0x00C5); //VCOM control 1
        TFT_24S_Write_Command(0x00C7); //VCOM control 2
   TFT_24S_Write_Command(0x0036); //memory access control = BGR
#if 1
   TFT_24S_Write_Data(0x0008); // Portrait mode
   TFT_24S_Write_Data(0x00A8); // Landscape mode
   TFT_24S_Write_Command(0x00B1); //frame rate control
   TFT_24S_Write_Command(0x00B6); //display function control
   TFT_24S_Write_Command(0x003A); //pixel format = 16 bit per pixel
   TFT_24S_Write_Command(0x00F2); //3G Gamma control
   TFT_24S_Write_Data(0x0002); //off
   TFT_24S_Write_Command(0x0026); //Gamma curve 3
   TFT_24S_Write_Command(0x002A); //column address set
   TFT_24S_Write_Data(0x0000); //start 0x0000
   TFT_24S_Write_Data(0x00EF); //end 0x00EF
   TFT_24S_Write_Command(0x002B); //page address set
   TFT_24S_Write_Data(0x0000); //start 0x0000
   TFT_24S_Write_Data(0x003F); //end 0x013F
   TFT_24S_Write_Command(0x0029); //Display ON

3. pixel drawing code:
/* Set the pixel at pos to the given color. */
void TFT_Plot_Pixel(PT_T * pos, COLOR_T * color) { //240*320 for the PT_T
   uint8_t b1, b2;

   // Column address set 0x2a
   TFT_24S_Write_Command(0x002A); //column address set
   TFT_24S_Write_Data(pos->X & 0xff); //start
   TFT_24S_Write_Data(0x00EF); //end 0x00EF
   // Page (row) address set 0x2b
   TFT_24S_Write_Command(0x002B); //page address set
   TFT_24S_Write_Data(pos->Y >> 8);
   TFT_24S_Write_Data(pos->Y & 0xff); //start
   TFT_24S_Write_Data(0x003F); //end 0x013F   
   // Memory Write 0x2c
   // 16 bpp, 5-6-5. Assume color channel data is left-aligned
   b1 = (color->R&0xf8) | ((color->G&0xe0)>>5);
   b2 = ((color->G&0x1c)<<3) | ((color->B&0xf8)>>3);


Pages: [1]