当前位置:网站首页>Single chip microcomputer -- hlk-w801 transplant NES simulator (III)
Single chip microcomputer -- hlk-w801 transplant NES simulator (III)
2022-07-02 01:13:00 【Fat brother, Miss Wang】
Previous review
Single chip microcomputer —HLK-W801 transplant Nes Simulator ( One )
Single chip microcomputer —HLK-W801 transplant Nes Simulator ( Two )
Key points of this chapter — Optimize the display
After the first two chapters , Tested the refresh rate , It's amazing 3 Frames per second
Increase the main frequency
main Function , There is a position for setting clock frequency division , Try to change to maximum 
modify LCD initial
default ILI9341 It's a vertical screen ,320*240 Words , We write data , It needs to be truncated , Because every line of this simulator is 256 Characters .
So let's do a horizontal screen , And configure the memory of the drawing range , Let's compare it with the line provided by the simulator buf One-to-one correspondence , Many configuration actions are avoided , Just keep writing .
ILI9341_WR_REG(0x36); //set the model of scanning
ILI9341_WR_DATA8((1<<5)|(0<<6)|(1<<7)|(1<<3)); // Left horizontal screen
//ILI9341_WR_DATA8((1<<5)|(1<<6)); Right horizontal screen
//ILI9341_WR_DATA8(0x08); Vertical screen
ILI9341_WR_REG(0x2B); //set the page address Horizontal screen settings Y Axis to 239
ILI9341_WR_DATA8(0x00);
ILI9341_WR_DATA8(0x00);
ILI9341_WR_DATA8(0x00);
ILI9341_WR_DATA8(0xDF);
ILI9341_WR_REG(0x2A); //set the column address X Axis to 319 Change it to 255
ILI9341_WR_DATA8(0x00);
ILI9341_WR_DATA8(0x00);
//ILI9341_WR_DATA8(0x01);
//ILI9341_WR_DATA8(0x3F);
ILI9341_WR_DATA8(0x00);
ILI9341_WR_DATA8(0xFF);
ILI9341_WR_REG(0x2c);// The memory writes
here , We made a left horizontal screen , And the range of horizontal and vertical coordinates is 256*240.
Then our write screen function can be transformed into the simplest write SPI
void ILI9341_DrawLine(u16 y,u16* data)
{
tls_spi_write((uint8_t *)data,512);
}
Then someone will notice , Used in the front Y The axis should be 239, Conversion to hexadecimal should be EF. But why DF, So it's because of the first line address of the game , It's not from 0 Start , And there are only 0xEF That's ok , So in order to draw the picture in the simplest way , Don't set the row and column address , Then directly configure the vertical coordinate of the display position used as 0xDF. otherwise , There will be a problem of scrolling .
Test frame rate
Then we configured a 5 Second timer , Then we draw each frame , Just remember the data once ,5 Seconds to see how many frames are drawn .
extern unsigned int FrameCount;
static void demo_timer_irq2(u8 *arg)
{
printf("%02d fp/5s\n",(FrameCount));
FrameCount=0;
}
void timer_demo(void)
{
u8 timer_id2;
struct tls_timer_cfg timer_cfg2;
timer_cfg2.unit = TLS_TIMER_UNIT_MS;
timer_cfg2.timeout = 5000;
timer_cfg2.is_repeat = 1;
timer_cfg2.callback = (tls_timer_irq_callback)demo_timer_irq2;
timer_cfg2.arg = NULL;
timer_id2 = tls_timer_create(&timer_cfg2);
tls_timer_start(timer_id2);
}
Count at drawing image
void InfoNES_LoadLine()
{
if(PPU_Scanline==100)
{
FrameCount++;
}
ILI9341_DrawLine(PPU_Scanline,WorkLine);
}
Finally tested 
10fps The level of left and right .
After commenting out the drawing operation , The simulator calculates the frame speed as follows 
It's about 28fps. So you can see that drawing is still very time-consuming .
SPI The rate is 20MHZ. Then the maximum transmission per second is about 20 frame .
The calculation per frame is about 0.035 second , The transmission is about 0.05 second , Together, it takes about 0.085 second , So about... Per second 11.7 frame , Remove other operations , About 11 frame /s.
It seems that you still need a parallel port to achieve a high refresh rate .
边栏推荐
- Basic usage of three JS high-order functions --filter---map---reduce
- Study note 2 -- definition and value of high-precision map
- Bilstm CRF code implementation
- Excel search and reference function
- Picture puzzle wechat applet source code_ Support multi template production and traffic master
- Based on Simulink and FlightGear, the dynamic control of multi rotor UAV in equilibrium is modeled and simulated
- 969 interlaced string
- Deb file installation
- The 8-year salary change of testers makes netizens envy it: you pay me one year's salary per month
- Promise and modular programming
猜你喜欢

About asp Net core uses a small detail of datetime date type parameter

SQL injection for Web Security (2)

The 8-year salary change of testers makes netizens envy it: you pay me one year's salary per month

MySQL application day02

Zak's latest "neural information transmission", with slides and videos

Exclusive delivery of secret script move disassembly (the first time)

【八大排序③】快速排序(动图演绎Hoare法、挖坑法、前后指针法)

Tensorflow tensor convolution, input and convolution kernel dimension understanding

Source code of Qiwei automatic card issuing system

Develop a simple login logic based on SSM
随机推荐
Global and Chinese market of avionics systems 2022-2028: Research Report on technology, participants, trends, market size and share
You probably haven't noticed the very important testing strategy in your work
2022 safety officer-b certificate examination practice questions simulated examination platform operation
MySQL application day02
Datawhale community blackboard newspaper (issue 1)
AIX存储管理之卷组属性的查看和修改(二)
[eight sorting ③] quick sorting (dynamic graph deduction Hoare method, digging method, front and back pointer method)
ACM tutorial - quick sort (regular + tail recursion + random benchmark)
2022 high altitude installation, maintenance and removal of test question simulation test platform operation
A problem about function template specialization
Powerful calendar wechat applet source code - support the main mode of doing more traffic
Global and Chinese market of safety detection systems 2022-2028: Research Report on technology, participants, trends, market size and share
XMind思维导图
With the acquisition of Xilinx, AMD is more than "walking on two legs" | Jiazi found
What skills does an excellent software tester need to master?
【八大排序①】插入排序(直接插入排序、希尔排序)
Creating logical volumes and viewing and modifying attributes for AIX storage management
【疾病检测】基于BP神经网络实现肺癌检测系统含GUI界面
教你白嫖Amazon rds一年并搭建MySQL云数据库(只需10分钟,真香)
Global and Chinese markets for supply chain strategy and operation consulting 2022-2028: Research Report on technology, participants, trends, market size and share