当前位置:网站首页>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 .
边栏推荐
- BiLSTM-CRF代码实现
- Global and Chinese markets for distributed generation and energy storage in telecommunications networks 2022-2028: Research Report on technology, participants, trends, market size and share
- 教你白嫖Amazon rds一年并搭建MySQL云数据库(只需10分钟,真香)
- AIX存储管理之卷组属性的查看和修改(二)
- Basic usage of three JS high-order functions --filter---map---reduce
- [conference resources] the Third International Conference on Automation Science and Engineering in 2022 (jcase 2022)
- How does schedulerx help users solve the problem of distributed task scheduling?
- Random avatar encyclopedia, multi category wechat applet source code with history_ Support traffic master
- Part 29 supplement (XXIX) basis of ECMAScript
- LeetCode、3无重复最长子序列
猜你喜欢

工作中非常重要的测试策略,你大概没注意过吧

Recommend an online interface mock tool usemock

首场“移动云杯”空宣会,期待与开发者一起共创算网新世界!

Weather forecast applet source code weather wechat applet source code

Powerful calendar wechat applet source code - support the main mode of doing more traffic

How does schedulerx help users solve the problem of distributed task scheduling?

Source code of Qiwei automatic card issuing system

Minimize the error

SSO single sign on implementation.

"C zero foundation introduction hundred knowledge hundred examples" (73) anonymous function -- lambda expression
随机推荐
Recommend an online interface mock tool usemock
The 8-year salary change of testers makes netizens envy it: you pay me one year's salary per month
Excel PivotTable
New version of free mobile phone, PC, tablet, notebook four terminal Website thumbnail display diagram online one click to generate website source code
XMIND mind map
gradle
Datawhale community blackboard newspaper (issue 1)
Sql--- related transactions
Excel search and reference function
How can programmers better plan their career development?
Global and Chinese markets for power over Ethernet (POE) solutions 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for maritime services 2022-2028: Research Report on technology, participants, trends, market size and share
Bilstm CRF code implementation
2022 operation of simulated examination platform for melting welding and thermal cutting work license
AIX存储管理之卷组的创建(一)
Cat Party (Easy Edition)
XMind思维导图
Tensorflow tensor convolution, input and convolution kernel dimension understanding
Recently, three articles in the nature sub Journal of protein and its omics knowledge map have solved the core problems of biology
UDS bootloader of s32kxxx bootloader