本帖最后由 jinglixixi 于 2020-9-2 12:40 编辑
1.将字模存入字库 按下F2键,读取数组内字模并写入W25Q64内。 图1 将字模存入字库
功能程序为: - /* Read KEY1 and then output to LED2 */
- TmpStatus = HT32F_DVB_PBGetState(BUTTON_KEY1);
- if(! TmpStatus)
- {
- result = SPI_FLASH_Init();
- if (result == TRUE)
- {
- LCD_StringLineDisplay8(Line1, " W25Q64 TEST OK");
- }
- else
- {
- LCD_StringLineDisplay8(Line1, " W25Q64 TEST NO");
- }
- /* Clear the Block Protection bit */
- SPI_FLASH_SectorErase(0x1000);
- for (i = 0; i < 320; i++)
- {
- gHelloString[i]= Hzk[i/16][i%16];
- Tx_Buffer[i]= gHelloString[i];
- }
- SPI_FLASH_BufferWrite(Tx_Buffer, 0x1000,320 ); //256
-
- HT32F_DVB_LEDOn(HT_LED2);
- LCD_BackColorSet(Black);
- LCD_TextColorSet(Yellow);
- LCD_StringLineDisplay8(Line8, "Write");
- LCD_BackColorSet(Black);
- LCD_TextColorSet(Yellow);
-
- SPI_FLASH_BufferDualRead((u16*)Tx_Buffer,0x1000, 8);
- for (i = 0; i < 16; i++)
- {
- gHelloString[i]= Tx_Buffer[i];
- }
- l=0;
- for(i=0;i<8;i++)
- {
- u=gHelloString[i];
- HEX1();
- }
- l=0;
- for(i=0;i<8;i++)
- {
- u=gHelloString[8+i];
- HEX2();
- }
-
- LCD_StringLineDisplay8(Line8, "OK___");
- }
- else
- {
- HT32F_DVB_LEDOff(HT_LED2);
- }
复制代码
2.显示验证效果按下F3键,读取字模并显示其内容。
图2 显示验证效果
功能程序为: - /* Read KEY2 and then output to LED3 */
- TmpStatus = HT32F_DVB_PBGetState(BUTTON_KEY2);
- if(! TmpStatus)
- {
- LCD_StringLineDisplay8(Line8, "dispL");
- SPI_FLASH_BufferRead(Rx_Buffer, 0x1000,320);
- for (i = 0; i < 320; i++)
- {
- gHelloString[i]= Rx_Buffer[i];
- }
-
- for(i=0;i<10;i++)
- {
- if(i>4) LCD_CharDrawHk(Line5, 176+(i-5)*16, i);
- else LCD_CharDrawHk(Line4, 176+i*16, i);
- }
-
- LCD_BackColorSet(Black);
- LCD_TextColorSet(Yellow);
- }
复制代码
3.字库内容读取与验证按下F1键,读取字库内容以供验证,每次16个字节。 图3 审核字库内容
功能程序为: - /* Read WEAKUP and then output to LED1 */
- TmpStatus = HT32F_DVB_PBGetState(BUTTON_WAKEUP);
- if(TmpStatus)
- {
- HT32F_DVB_LEDOn(HT_LED1);
- LCD_BackColorSet(Black);
- LCD_TextColorSet(Yellow);
- LCD_StringLineDisplay8(Line8, "Read_");
- L=0;
- //SPI_FLASH_WriteStatus(0x00);
- LCD_BackColorSet(Black);
- LCD_TextColorSet(Yellow);
- for(i=0;i<8;i++)
- {
- H=(u8) (ReadDZ>>((7-i)*4)&0x0000000f);
- if(H<10)
- {
- LCD_CharDraw8(Line6, L, H+'0');
- }
- else
- {
- LCD_CharDraw8(Line6, L, H-10+'A');
- }
- L=L+8;
- }
-
- SPI_FLASH_BufferRead(Rx_Buffer, 0x1000,320); // 256
- for (i = 0; i <320; i++)
- {
- gHelloString[i]= Rx_Buffer[i];
- }
- LCD_BackColorSet(Black);
- LCD_TextColorSet(Yellow);
- l=0;
- for(i=0;i<8;i++)
- {
- u=gHelloString[i+j];
- HEX1();
- }
- l=0;
- for(i=0;i<8;i++)
- {
- u=gHelloString[8+i+j];
- HEX2();
- }
- }
复制代码
|