当前位置:网站首页>External interrupts cannot be accessed. Just delete the code and restore it Record this unexpected bug
External interrupts cannot be accessed. Just delete the code and restore it Record this unexpected bug
2022-07-02 05:55:00 【I don't know who】
51 SCM configuration external interrupt 0/1 Nothing more than the following lines of code .
IT0=1; // External interrupt 0 Falling edge trigger
EX0=1; // Allow the interrupt 0
IT1=1; // External interrupt 1 Falling edge trigger
EX1=1;// Allow the interrupt 1
EA=1; // Open total interrupt
But I spent the whole night debugging , Still can't press the key ( External interrupt 0/1 The buttons INT0/INT1) Enter external interrupt 0/1.
Finally, I put the main function and external interrupt 0/1 All codes in are deleted , Only the lighting code is left in the interrupt , then ctrl+z Undo delete , After restoring all , recompile , Not a single line of code has been changed , But I found the key ( External interrupt 0/1 The buttons INT0/INT1) It can trigger an external interrupt .
I have met this situation once before , But I don't know what the problem is , Change it the next day and you can use it , Meet again today , Got my attention .
I guess it's because keil of use C, Every time you compile C There are some differences in language optimization , Resulting in this inexplicable bug, If you use assembly or add volatile Keywords should not encounter this situation .
volatile keyword , Because the speed of memory access is far less than CPU Of , To speed up , By default , The compiler will optimize for you , For example, the data that should be fetched from the memory unit ,for Recycle 10 Time , For convenience , It will be optimized into registers , You can get the register every time , No need to access memory units again and again . And such optimization sometimes makes unexpected mistakes .
边栏推荐
猜你喜欢

Vscode paste image plugin saves image path settings

Conglin environmental protection rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, with an annual profit of more than 200million yuan

15 C language advanced dynamic memory management

脑与认知神经科学Matlab Psytoolbox认知科学实验设计——实验设计四

Lingyunguang rushes to the scientific innovation board: the annual accounts receivable reaches 800million. Dachen and Xiaomi are shareholders

Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea

Matplotlib double Y axis + adjust legend position

Redis Key-Value数据库【初级】
![[paper translation] gcnet: non local networks meet squeeze exception networks and beyond](/img/7a/718162d08796f70251511101b3a61b.png)
[paper translation] gcnet: non local networks meet squeeze exception networks and beyond

深度学习分类网络--Network in Network
随机推荐
CNN可视化技术 -- CAM & Grad-CAM详解及pytorch简洁实现
Win10 copy files, save files... All need administrator permission, solution
Software testing Q & A
我所理解的DRM显示框架
Web页面用户分步操作引导插件driver.js
Generics and generic constraints of typescript
[leetcode] day92 container with the most water
PHP development and testing WebService (soap) -win
PHP array to XML
How vite is compatible with lower version browsers
死磕大屏UI,FineReport开发日记
PHP 开发与测试 Webservice(SOAP)-Win
Zzuli: maximum Convention and minimum common multiple
Zzuli:1060 numbers in reverse order
Some experience of exercise and fitness
Nacos 启动报错 Error creating bean with name ‘instanceOperatorClientImpl‘ defined in URL
idea開發工具常用的插件合集匯總
PHP extensions
1035 Password
500. 键盘行