找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 2526|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

ESK32-360開發(fā)板的MX25L64字庫構(gòu)建與驗(yàn)證

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
本帖最后由 jinglixixi 于 2020-9-2 12:40 編輯

1.將字模存入字庫
按下F2鍵,讀取數(shù)組內(nèi)字模并寫入W25Q64內(nèi)。

圖1 將字模存入字庫

功能程序?yàn)椋?/font>
  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.                  }
復(fù)制代碼

2.顯示驗(yàn)證效果
按下F3鍵,讀取字模并顯示其內(nèi)容。

圖2 顯示驗(yàn)證效果

功能程序?yàn)椋?/font>
  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.                  }
復(fù)制代碼

3.字庫內(nèi)容讀取與驗(yàn)證
按下F1鍵,讀取字庫內(nèi)容以供驗(yàn)證,每次16個(gè)字節(jié)。

圖3 審核字庫內(nèi)容

功能程序?yàn)椋?/font>
  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.                     }
復(fù)制代碼




評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表