当前位置:网站首页>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 .
边栏推荐
- The concept and application of Cartland number
- Global and Chinese market of ancillary software 2022-2028: Research Report on technology, participants, trends, market size and share
- Weather forecast applet source code weather wechat applet source code
- Global and Chinese markets for the application of artificial intelligence in security, public security and national security 2022-2028: Research Report on technology, participants, trends, market size
- AIX存储管理之总结篇
- To meet the needs of consumers in technological upgrading, Angel water purifier's competitive way of "value war"
- CEPH buffer yyds dry inventory
- 笔者更加愿意将产业互联网看成是一个比消费互联网要丰富得多的概念
- [WesternCTF2018]shrine writeup
- How to determine whether the current script is in the node environment or the browser environment?
猜你喜欢

Day 13 of hcip (relevant contents of BGP agreement)

【八大排序④】归并排序、不基于比较的排序(计数排序、基数排序、桶排序)

XMIND mind map

The concept and application of Cartland number
![[disease detection] realize lung cancer detection system based on BP neural network, including GUI interface](/img/c9/3fe8693629a8452dcfdb4349ddee0d.png)
[disease detection] realize lung cancer detection system based on BP neural network, including GUI interface

gradle

Design and control of multi rotor aircraft (VII) -- sensor calibration and measurement model

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

Synthetic watermelon game wechat applet source code / wechat game applet source code

学习笔记3--高精度地图关键技术(上)
随机推荐
Comprehensive broadcast of global and Chinese markets 2022-2028: Research Report on technology, participants, trends, market size and share
AIX存储管理之总结篇
Error creating bean with name ‘stringRedisTemplate‘ defined in class path re
Exclusive delivery of secret script move disassembly (the first time)
2022 low voltage electrician examination questions and answers
学习笔记2--高精度地图定义及价值
LeetCode、3无重复最长子序列
Global and Chinese markets of digital crosspoint switches and mux/demux 2022-2028: Research Report on technology, participants, trends, market size and share
SQL injection for Web Security (2)
SAP ui5 beginner tutorial XXI - trial version of custom formatter of SAP ui5
Two TVs
Study note 2 -- definition and value of high-precision map
Daily work and study notes
970 golang realizes the communication between multithreaded server and client
【图像增强】基于Frangi滤波器实现血管图像增强附matlab代码
Deb file installation
GL Studio 5 安装与体验
Global and Chinese market of ancillary software 2022-2028: Research Report on technology, participants, trends, market size and share
【疾病检测】基于BP神经网络实现肺癌检测系统含GUI界面
Load and domcontentloaded in JS