当前位置:网站首页>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 .
边栏推荐
- keepalived安装使用与快速入门
- 深度学习分类网络--Network in Network
- Zzuli:1065 count the number of numeric characters
- STC8H8K系列汇编和C51实战——按键允许按键计数(利用下降沿中断控制)
- php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
- 数据挖掘方向研究生常用网站
- How to write good code - Defensive Programming Guide
- Summary of MySQL constraints
- Software testing - concept
- Reading notes of cgnf: conditional graph neural fields
猜你喜欢

Vite打包后的dist不能直接在浏览器打开吗

PHP development and testing WebService (soap) -win

Reading notes of cgnf: conditional graph neural fields

mysql的约束总结

ESP8266与STC8H8K单片机联动——天气时钟

Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?

脑与认知神经科学Matlab Psytoolbox认知科学实验设计——实验设计四
![Redis key value database [primary]](/img/47/10461d12720a9dd801f80ed1d3ad23.jpg)
Redis key value database [primary]

【C语言】简单实现扫雷游戏

CNN可视化技术 -- CAM & Grad-CAM详解及pytorch简洁实现
随机推荐
c语言中的几个关键字
Regular expression summary
Win10 copy files, save files... All need administrator permission, solution
Vscode paste image plugin saves image path settings
How to write good code - Defensive Programming Guide
LCD之MIPI协议的一些说明
深度学习分类网络--Network in Network
A collection of commonly used plug-ins for idea development tools
Lantern Festival gift - plant vs zombie game (realized by Matlab)
[paper translation] gcnet: non local networks meet squeeze exception networks and beyond
Zzuli:1066 character classification statistics
RGB 无限立方体(高级版)
【LeetCode】Day92-盛最多水的容器
Practice C language advanced address book design
Oled12864 LCD screen
Thread pool overview
Fundamentals of software testing
Minimum value ruler method for the length of continuous subsequences whose sum is not less than s
vite如何兼容低版本浏览器
Zzuli:1060 numbers in reverse order