2291|4

441

帖子

3

TA的资源

纯净的硅(高级)

楼主
 

【 HC32F4A0开发板】TFT-LCD驱动显示 [复制链接]

  本帖最后由 TL-LED 于 2023-2-19 12:08 编辑

HC32F4A0开发板通过EXMC总线的SMC方式来驱动TFT-LCD显示屏。

 

EXMC总线框图

显示屏硬件接口电路图

显示屏的接口和ATK-MD0430模块的接口是兼容的,手上正好有这款屏幕,下面用这个屏幕测试

程序部分

总线初始化部分:

static int32_t LCD_SMC_Init(void)
{
    __IO uint32_t u32To = 0UL;
    int32_t i32Ret = LL_OK;
    stc_exmc_smc_init_t stcSmcInit;
    stc_exmc_smc_chip_config_t stcChipConfig;
    stc_exmc_smc_timing_config_t stcTimingConfig;
    en_flag_status_t enChipStatus = RESET;
    en_flag_status_t enTimingStatus = RESET;

    LCD_Port_Init();

    /* Enable SMC clock */
    FCG_Fcg3PeriphClockCmd(FCG3_PERIPH_SMC, ENABLE);

    /* Enable SMC. */
    EXMC_SMC_Cmd(ENABLE);

    EXMC_SMC_ExitLowPower();

    while (EXMC_SMC_READY != EXMC_SMC_GetStatus()) {
        if (u32To > SMC_MAX_TIMEOUT) {
            i32Ret = LL_ERR;
            break;
        }
        u32To++;
    }

    if (LL_OK == i32Ret) {
        /* Configure SMC width && CS &chip & timing. */
        (void)EXMC_SMC_StructInit(&stcSmcInit);
        stcSmcInit.stcChipConfig.u32AddrMatch = BSP_NT35510_MATCH_ADDR;
        stcSmcInit.stcChipConfig.u32AddrMask  = BSP_NT35510_MASK_ADDR;
        stcSmcInit.stcChipConfig.u32MemoryWidth  = EXMC_SMC_MEMORY_WIDTH_16BIT;
        stcSmcInit.stcChipConfig.u32BAA  = EXMC_SMC_BAA_PORT_DISABLE;
        stcSmcInit.stcChipConfig.u32ADV  = EXMC_SMC_ADV_PORT_DISABLE;
        stcSmcInit.stcChipConfig.u32BLS  = EXMC_SMC_BLS_SYNC_CS;
        stcSmcInit.stcChipConfig.u32ReadBurstLen  = EXMC_SMC_READ_BURST_4BEAT;
        stcSmcInit.stcChipConfig.u32WriteBurstLen  = EXMC_SMC_WRITE_BURST_4BEAT;
        stcSmcInit.stcChipConfig.u32ReadMode  = EXMC_SMC_READ_SYNC;
        stcSmcInit.stcChipConfig.u32WriteMode  = EXMC_SMC_WRITE_SYNC;
        stcSmcInit.stcTimingConfig.u8RC = 8U;
        stcSmcInit.stcTimingConfig.u8WC = 4U;
        stcSmcInit.stcTimingConfig.u8CEOE = 1U;
        stcSmcInit.stcTimingConfig.u8WP = 2U;
        stcSmcInit.stcTimingConfig.u8PC = 4U;
        stcSmcInit.stcTimingConfig.u8TR = 1U;
        (void)EXMC_SMC_Init(BSP_NT35510_CHIP, &stcSmcInit);

        /* Set command: updateregs */
        EXMC_SMC_SetCommand(BSP_NT35510_CHIP, EXMC_SMC_CMD_UPDATEREGS, 0UL, 0UL);

        /* Check timing status */
        u32To = 0UL;
        while ((enChipStatus != SET) || (enTimingStatus != SET)) {
            (void)EXMC_SMC_GetTimingConfig(BSP_NT35510_CHIP, &stcTimingConfig);
            if (0 == memcmp(&stcTimingConfig, &stcSmcInit.stcTimingConfig, sizeof(stcTimingConfig))) {
                enTimingStatus = SET;
            }

            (void)EXMC_SMC_GetChipConfig(BSP_NT35510_CHIP, &stcChipConfig);
            if (0 == memcmp(&stcChipConfig, &stcSmcInit.stcChipConfig, sizeof(stcChipConfig))) {
                enChipStatus = SET;
            }

            if (u32To > SMC_MAX_TIMEOUT) {
                i32Ret = LL_ERR;
                break;
            }
            u32To++;
        }
    }

    return i32Ret;
}

lcd初始化部分

static void LCD_NT35310_Config(stc_lcd_controller_t *pstcLCD)
{
    NT35510_WriteReg(pstcLCD, 0xED);
    NT35510_WriteData(pstcLCD, 0x01);
    NT35510_WriteData(pstcLCD, 0xFE);

    NT35510_WriteReg(pstcLCD, 0xEE);
    NT35510_WriteData(pstcLCD, 0xDE);
    NT35510_WriteData(pstcLCD, 0x21);

    NT35510_WriteReg(pstcLCD, 0xF1);
    NT35510_WriteData(pstcLCD, 0x01);
    NT35510_WriteReg(pstcLCD, 0xDF);
    NT35510_WriteData(pstcLCD, 0x10);

    //VCOMvoltage//
    NT35510_WriteReg(pstcLCD, 0xC4);
    NT35510_WriteData(pstcLCD, 0x8F);

    NT35510_WriteReg(pstcLCD, 0xC6);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xE2);
    NT35510_WriteData(pstcLCD, 0xE2);
    NT35510_WriteData(pstcLCD, 0xE2);
    NT35510_WriteReg(pstcLCD, 0xBF);
    NT35510_WriteData(pstcLCD, 0xAA);

    NT35510_WriteReg(pstcLCD, 0xB0);
    NT35510_WriteData(pstcLCD, 0x0D);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x0D);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x11);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x19);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x21);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x2D);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x3D);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x5D);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x5D);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB1);
    NT35510_WriteData(pstcLCD, 0x80);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x8B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x96);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB2);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x02);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x03);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB4);
    NT35510_WriteData(pstcLCD, 0x8B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x96);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA1);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB5);
    NT35510_WriteData(pstcLCD, 0x02);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x03);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x04);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB6);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB7);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x3F);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x5E);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x64);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x8C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xAC);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xDC);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x70);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x90);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xEB);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xDC);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xB8);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xBA);
    NT35510_WriteData(pstcLCD, 0x24);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC1);
    NT35510_WriteData(pstcLCD, 0x20);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x54);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xFF);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC2);
    NT35510_WriteData(pstcLCD, 0x0A);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x04);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC3);
    NT35510_WriteData(pstcLCD, 0x3C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x3A);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x39);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x37);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x3C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x36);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x32);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x2F);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x2C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x29);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x26);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x24);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x24);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x23);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x3C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x36);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x32);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x2F);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x2C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x29);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x26);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x24);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x24);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x23);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC4);
    NT35510_WriteData(pstcLCD, 0x62);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x05);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x84);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF0);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x18);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA4);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x18);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x50);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x0C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x17);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x95);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xE6);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC5);
    NT35510_WriteData(pstcLCD, 0x32);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x44);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x65);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x76);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x88);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC6);
    NT35510_WriteData(pstcLCD, 0x20);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x17);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x01);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC7);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC8);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xC9);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE0);
    NT35510_WriteData(pstcLCD, 0x16);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x1C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x21);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x36);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x46);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x52);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x64);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x7A);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x8B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA8);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xB9);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC4);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xCA);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD2);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD9);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xE0);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE1);
    NT35510_WriteData(pstcLCD, 0x16);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x1C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x22);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x36);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x45);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x52);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x64);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x7A);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x8B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA8);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xB9);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC4);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xCA);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD2);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD8);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xE0);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE2);
    NT35510_WriteData(pstcLCD, 0x05);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x0B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x1B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x34);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x44);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x4F);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x61);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x79);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x88);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x97);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA6);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xB7);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC2);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC7);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD1);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD6);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xDD);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteReg(pstcLCD, 0xE3);
    NT35510_WriteData(pstcLCD, 0x05);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x1C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x33);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x44);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x50);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x62);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x78);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x88);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x97);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA6);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xB7);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC2);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC7);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD1);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD5);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xDD);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE4);
    NT35510_WriteData(pstcLCD, 0x01);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x01);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x02);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x2A);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x3C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x4B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x5D);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x74);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x84);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x93);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA2);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xB3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xBE);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC4);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xCD);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xDD);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteReg(pstcLCD, 0xE5);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x02);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x29);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x3C);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x4B);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x5D);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x74);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x84);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x93);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xA2);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xB3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xBE);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xC4);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xCD);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xD3);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xDC);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE6);
    NT35510_WriteData(pstcLCD, 0x11);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x34);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x56);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x76);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x77);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x66);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x88);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xBB);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x66);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x55);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x55);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x45);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x43);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x44);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE7);
    NT35510_WriteData(pstcLCD, 0x32);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x55);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x76);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x66);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x67);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x67);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x87);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xBB);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x77);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x44);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x56);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x23);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x33);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x45);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE8);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x87);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x88);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x77);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x66);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x88);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xAA);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xBB);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x99);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x66);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x55);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x55);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x44);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x44);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x55);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xE9);
    NT35510_WriteData(pstcLCD, 0xAA);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0xAA);

    NT35510_WriteReg(pstcLCD, 0xCF);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xF0);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x50);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xF3);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0xF9);
    NT35510_WriteData(pstcLCD, 0x06);
    NT35510_WriteData(pstcLCD, 0x10);
    NT35510_WriteData(pstcLCD, 0x29);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0x3A);
    NT35510_WriteData(pstcLCD, 0x55);

    NT35510_WriteReg(pstcLCD, 0x11);
    LCD_Delay(100);
    NT35510_WriteReg(pstcLCD, 0x29);
    NT35510_WriteReg(pstcLCD, 0x35);
    NT35510_WriteData(pstcLCD, 0x00);

    NT35510_WriteReg(pstcLCD, 0x51);
    NT35510_WriteData(pstcLCD, 0xFF);
    NT35510_WriteReg(pstcLCD, 0x53);
    NT35510_WriteData(pstcLCD, 0x2C);
    NT35510_WriteReg(pstcLCD, 0x55);
    NT35510_WriteData(pstcLCD, 0x82);
    NT35510_WriteReg(pstcLCD, 0x2c);
}

主程序

#include "main.h"
#include "lcd.h"

/* LED_G Port/Pin definition */
#define LED_G_PORT          (GPIO_PORT_C)
#define LED_G_PIN           (GPIO_PIN_09)
/* LED toggle definition */
#define LED_G_TOGGLE()      (GPIO_TogglePins(LED_G_PORT, LED_G_PIN))

#define DLY_MS              (2000UL)

static void LED_Init(void)
{
    stc_gpio_init_t stcGpioInit;

    (void)GPIO_StructInit(&stcGpioInit);
    stcGpioInit.u16PinState = PIN_STAT_RST;
    stcGpioInit.u16PinDir = PIN_DIR_OUT;
    (void)GPIO_Init(LED_G_PORT, LED_G_PIN, &stcGpioInit);
}


void init_lcd(void)
{
	BSP_LCD_RSTCmd(EIO_PIN_RESET); /* RST# to low */
	DDL_DelayMS(50UL);
	BSP_LCD_RSTCmd(EIO_PIN_SET);  /* RST# to high */
	DDL_DelayMS(50UL);

	BSP_NT35510_Init();

	/* Clear LCD screen */
	BSP_NT35510_Clear(LCD_COLOR_BLACK);
	BSP_LCD_BKLCmd(EIO_PIN_SET);

	/* Set LCD cursor */
	BSP_NT35510_SetCursor(0U, 0U);
}

int32_t main(void)
{
	uint16_t u=0;
	uint16_t cord[6]={WHITE, BLUE, BRED, GBLUE, RED, YELLOW};
    /* Register write enable for some required peripherals. */
    LL_PERIPH_WE(LL_PERIPH_GPIO | LL_PERIPH_FCG | LL_PERIPH_PWC_CLK_RMU | LL_PERIPH_EFM | LL_PERIPH_SRAM);
	
		BSP_CLK_Init();
		DDL_PrintfInit(BSP_PRINTF_DEVICE, BSP_PRINTF_BAUDRATE, BSP_PRINTF_Preinit);
		BSP_IO_Init();
    BSP_LCD_IO_Init();
		BSP_GT9XX_Init();
	
		init_lcd();
	
		LL_PERIPH_WP(LL_PERIPH_GPIO | LL_PERIPH_FCG | LL_PERIPH_PWC_CLK_RMU | LL_PERIPH_EFM | LL_PERIPH_SRAM);
		POINT_COLOR=RED;       
		LCD_Clear(WHITE);
	
	
    for (;;) 
		{
			LCD_Clear(cord[u]);
			LCD_ShowString(20,400,210,24,24,"HC32F4A0 LCD TEST");	
			LCD_ShowxNum(20,430,u,5,24,0);
			DDL_DelayMS(500UL);
			u++;
			if(u>6)
			{
				u=0;
			}
    }
}

 

运行视频

20230219120506

 

最新回复

老师,分享一下,超级好的字库呀!  详情 回复 发表于 2023-2-22 18:26
点赞 关注
 
 

回复
举报

1703

帖子

0

TA的资源

五彩晶圆(初级)

沙发
 

有时不知道显示屏的接口和ATK-MD0430模块的接口是否兼容,怎么整

点评

一模一样的,我亲测可以。就得得自己写字符串的驱动。  详情 回复 发表于 2023-2-22 18:26
看电路图上的接口功能定义和硬件的针脚方向对应,就可以。  详情 回复 发表于 2023-2-20 08:17
 
 
 

回复

441

帖子

3

TA的资源

纯净的硅(高级)

板凳
 
火辣西米秀 发表于 2023-2-20 07:32 有时不知道显示屏的接口和ATK-MD0430模块的接口是否兼容,怎么整

看电路图上的接口功能定义和硬件的针脚方向对应,就可以。

 
 
 

回复

6972

帖子

11

TA的资源

版主

4
 
火辣西米秀 发表于 2023-2-20 07:32 有时不知道显示屏的接口和ATK-MD0430模块的接口是否兼容,怎么整

一模一样的,我亲测可以。就得得自己写字符串的驱动。

 
 
 

回复

6972

帖子

11

TA的资源

版主

5
 
老师,分享一下,超级好的字库呀!
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表