当前位置:网站首页>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 .
边栏推荐
- 正则表达式总结
- 数理统计与机器学习
- 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
- DRM display framework as I understand it
- Can't the dist packaged by vite be opened directly in the browser
- Keepalived installation, use and quick start
- 数据挖掘方向研究生常用网站
- Zzuli:1069 learn from classmate Z
- php数组转化为xml
- 【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
猜你喜欢
随机推荐
【LeetCode】Day92-盛最多水的容器
页面打印插件print.js
keepalived安装使用与快速入门
[whether PHP has soap extensions installed] a common problem for PHP to implement soap proxy: how to handle class' SoapClient 'not found in PHP
460. LFU cache bidirectional linked list
PHP read file (read JSON file, convert to array)
数据库学习总结5
Pytorch Chinese document
File contains vulnerability (I)
Software testing - concept
Zzuli:1064 encrypted characters
php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
PHP gets CPU usage, hard disk usage, and memory usage
图片裁剪插件cropper.js
运动健身的一些心得经验
Zzuli:1066 character classification statistics
TypeScript的泛型和泛型约束
Test case
数理统计与机器学习
Web页面用户分步操作引导插件driver.js