How STM32 Realizes W25X16 Chinese Character Word Store

The use of too many Chinese characters in the system will result in insufficient chip capacity. The data can be stored in an external FLASH and can be called when needed. This article is to store W25X16 Chinese character words through STM32 serial port 1. At the software level, the serial port 1 and SPI1 can be configured. After the program is initialized, before writing to the W25X16, it must be erased, and it can be erased by one byte, one page, one sector, one block, and whole chip. Before writing the font, we use the entire chip erase method as follows:

How STM32 Realizes W25X16 Chinese Character Word Store

The key to the entire program is the serial port receive interrupt function, as follows:

U32 WriteAddress=0;

Void USART1_IRQHandler(void)

{

U8 Res;

If(USART_GeTITStatus(USART1,USART_IT_RXNE)!=RESET)

{

USART_ClearITPendingBit(USART1, USART_IT_RXNE);

Res=USART_ReceiveData(USART1);

SPI_Flash_Write_NoCheck(&Res,WriteAddress,1);

WriteAddress++;

}

}

That is, starting from address 0, one byte by one byte is written.

The code is the simplest communication code, but say more, then open the serial assistant, configure, check the enable file data source, select to download or self-made font file; check the send in hexadecimal, wipe the chip completely Divide before sending:

How STM32 Realizes W25X16 Chinese Character Word Store

After several tens of seconds of waiting, the font will be sent. By comparing the number of bytes sent with the number of bytes in the font, you can know whether the sending is completed. (The number of bytes sent in the above figure is not the number of bytes in the font.) The previous article has a method of writing Chinese character dot matrix, which will not be repeated here. In this way, you can access the external FLASH through the SPI to call the Chinese characters and display them on the display. The same as for the asic code can be written to a block, and then calculate the corresponding character by the offset of the address.

For the storage of pictures is also the same principle, based on the previous display of Chinese characters, the author tested the display of the picture, and get the correct display. I use the display screen for TFT1.44, 128*128, occupying 32768 bytes, two pictures just occupied 65536 bytes, which is 64Kb, and a block of W25X16 is 64Kb, after block erase, each block Two pictures can be loaded, perfect. The basic program is the same, except that at this time, because the font is written, instead of using a slice erase instruction, Block Erase is used to erase the unused block area:

How STM32 Realizes W25X16 Chinese Character Word Store

In the calculation below, the font occupies 3 blocks and more points, so completely avoid this area + in:

You can open the font file and then edit the captured image file. Post the code shown in the picture you wrote:

Void ShowImage_W25X16(u32 WriteAddr)

{

Int i;

U32 j;

Unsigned char picH,picL;

U8 datatemp[2];

Lcd_Clear(WHITE);

Lcd_SetRegion(0,0,127,127);

For(j=0;j<<1024;j++)

For(i=0;i<<16;i++)

{

SPI_Flash_Read(datatemp,WriteAddr,2);

picL=datatemp[0];

picH=datatemp[1];

WriteAddr=WriteAddr+2;

LCD_WriteData_16Bit(picH "8|picL")

}

}

Incremental Encoder

Incremental encoders provide speed, direction and relative position feedback by generating a stream of binary pulses proportional to the rotation of a motor or driven shaft. Lander offers both optical and magnetic incremental encoders in 4 mounting options: shafted with coupling, hollow-shaft, hub-shaft or bearingless. Single channel incremental encoders can measure speed which dual channel or quadrature encoders (AB) can interpret direction based on the phase relationship between the 2 channels. Indexed quadrature encoders (ABZ) are also available for homing location are startup.

Incremental Encoder,6Mm Solid Shaft Encoder,Hollow Rotary Encoder,Elevator Door Encoder

Jilin Lander Intelligent Technology Co., Ltd , https://www.jllandertech.com

Posted on