标题: ESK32-360开发板的MX25L64字库构建与验证 [打印本页]

作者: jinglixixi    时间: 2020-9-2 12:35
标题: ESK32-360开发板的MX25L64字库构建与验证
本帖最后由 jinglixixi 于 2020-9-2 12:40 编辑

1.将字模存入字库
按下F2键,读取数组内字模并写入W25Q64内。

图1 将字模存入字库

功能程序为:
  1.         /* Read KEY1 and then output to LED2           */
  2.         TmpStatus = HT32F_DVB_PBGetState(BUTTON_KEY1);
  3.         if(! TmpStatus)
  4.         {
  5.                         result = SPI_FLASH_Init();
  6.                         if (result == TRUE)
  7.                         {
  8.                              LCD_StringLineDisplay8(Line1, "          W25Q64 TEST OK");
  9.                         }
  10.                         else
  11.                         {
  12.                              LCD_StringLineDisplay8(Line1, "          W25Q64 TEST NO");
  13.                         }
  14.                         /* Clear the Block Protection bit      */
  15.                          SPI_FLASH_SectorErase(0x1000);
  16.                         for (i = 0; i < 320; i++)
  17.                         {
  18.                             gHelloString[i]= Hzk[i/16][i%16];
  19.                             Tx_Buffer[i]= gHelloString[i];                                
  20.                         }
  21.                         SPI_FLASH_BufferWrite(Tx_Buffer, 0x1000,320 ); //256
  22.                         
  23.                         HT32F_DVB_LEDOn(HT_LED2);
  24.                         LCD_BackColorSet(Black);
  25.                         LCD_TextColorSet(Yellow);                        
  26.                         LCD_StringLineDisplay8(Line8, "Write");
  27.                         LCD_BackColorSet(Black);
  28.                         LCD_TextColorSet(Yellow);        
  29.         
  30.                         SPI_FLASH_BufferDualRead((u16*)Tx_Buffer,0x1000, 8);
  31.                         for (i = 0; i < 16; i++)
  32.                         {
  33.                            gHelloString[i]= Tx_Buffer[i];
  34.                         }
  35.                         l=0;
  36.                         for(i=0;i<8;i++)
  37.                         {
  38.                            u=gHelloString[i];
  39.                            HEX1();
  40.                         }
  41.                         l=0;
  42.                         for(i=0;i<8;i++)
  43.                         {
  44.                           u=gHelloString[8+i];
  45.                           HEX2();
  46.                         }
  47.                         
  48.                         LCD_StringLineDisplay8(Line8, "OK___");
  49.                  }
  50.                  else
  51.                  {
  52.                     HT32F_DVB_LEDOff(HT_LED2);
  53.                  }
复制代码

2.显示验证效果
按下F3键,读取字模并显示其内容

图2 显示验证效果

功能程序为:
  1.          /* Read KEY2 and then output to LED3    */
  2.          TmpStatus = HT32F_DVB_PBGetState(BUTTON_KEY2);
  3.          if(! TmpStatus)
  4.          {
  5.                     LCD_StringLineDisplay8(Line8, "dispL");        
  6.                     SPI_FLASH_BufferRead(Rx_Buffer, 0x1000,320);
  7.                     for (i = 0; i < 320; i++)
  8.                     {
  9.                              gHelloString[i]= Rx_Buffer[i];
  10.                     }
  11.                         
  12.                     for(i=0;i<10;i++)
  13.                     {
  14.                              if(i>4)  LCD_CharDrawHk(Line5, 176+(i-5)*16, i);
  15.                              else    LCD_CharDrawHk(Line4, 176+i*16, i);
  16.                     }
  17.             
  18.                     LCD_BackColorSet(Black);
  19.                     LCD_TextColorSet(Yellow);
  20.                  }
复制代码

3.字库内容读取与验证
按下F1键,读取字库内容以供验证,每次16个字节

图3 审核字库内容

功能程序为:
  1.                    /* Read WEAKUP and then output to LED1           */
  2.                    TmpStatus = HT32F_DVB_PBGetState(BUTTON_WAKEUP);
  3.                    if(TmpStatus)
  4.                    {
  5.                            HT32F_DVB_LEDOn(HT_LED1);
  6.                            LCD_BackColorSet(Black);
  7.                            LCD_TextColorSet(Yellow);     
  8.                            LCD_StringLineDisplay8(Line8, "Read_");
  9.                            L=0;
  10.                            //SPI_FLASH_WriteStatus(0x00);
  11.                            LCD_BackColorSet(Black);
  12.                            LCD_TextColorSet(Yellow);     
  13.                            for(i=0;i<8;i++)
  14.                            {
  15.                                 H=(u8) (ReadDZ>>((7-i)*4)&0x0000000f);
  16.                                 if(H<10)
  17.                                 {
  18.                                    LCD_CharDraw8(Line6, L, H+'0');
  19.                                 }
  20.                                 else
  21.                                 {
  22.                                    LCD_CharDraw8(Line6, L, H-10+'A');
  23.                                 }
  24.                                 L=L+8;
  25.                            }
  26.                            
  27.                            SPI_FLASH_BufferRead(Rx_Buffer, 0x1000,320);  // 256
  28.                            for (i = 0; i <320; i++)
  29.                            {
  30.                                gHelloString[i]= Rx_Buffer[i];
  31.                            }
  32.                            LCD_BackColorSet(Black);
  33.                            LCD_TextColorSet(Yellow);
  34.                            l=0;
  35.                            for(i=0;i<8;i++)
  36.                            {
  37.                                u=gHelloString[i+j];
  38.                                HEX1();
  39.                            }
  40.                            l=0;
  41.                            for(i=0;i<8;i++)
  42.                            {
  43.                                u=gHelloString[8+i+j];
  44.                                HEX2();
  45.                            }
  46.                     }
复制代码









欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1