当前位置:网站首页>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 .
边栏推荐
- 1035 Password
- 1037 Magic Coupon
- servlet的web.xml配置详解(3.0)
- all3dp.com网站中全部Arduino项目(2022.7.1)
- 软件测试基础篇
- Win10 copy files, save files... All need administrator permission, solution
- Some descriptions of Mipi protocol of LCD
- Alibaba: open source and self-developed liquid cooling data center technology
- GRBL 软件:简单解释的基础知识
- Spark概述
猜你喜欢

2022-2-14 learning xiangniuke project - section 23, section 5, development login and exit functions

Grbl software: basic knowledge of simple explanation

CNN可视化技术 -- CAM & Grad-CAM详解及pytorch简洁实现

Software testing - concept

mysql事务和隔离级别

【論文翻譯】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond

Gcnet: non - local Networks meet Squeeze excitation Networks and Beyond

Happy Lantern Festival | Qiming cloud invites you to guess lantern riddles

Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash

正则表达式总结
随机推荐
ESP8266与STC8H8K单片机联动——天气时钟
Unity Shader 学习笔记(3)URP渲染管线带阴影PBR-Shader模板(ASE优化版本)
Opencv LBP features
GRBL 软件:简单解释的基础知识
Zzuli:1065 count the number of numeric characters
MySQL transaction and isolation level
Huawei Hongmeng OS, is it OK?
Addchild() and addattribute() functions in PHP
1036 Boys vs Girls
[golang syntax] be careful with the copy of slices
RGB 无限立方体(高级版)
Here comes a new chapter in the series of data conversion when exporting with easyexcel!
Stc8h8k Series Assembly and c51 Real combat - NIXIE TUBE displays ADC, Key Series port reply Key number and ADC value
PHP 开发与测试 Webservice(SOAP)-Win
“简单”的无限魔方
JWT工具类
PHP development and testing WebService (soap) -win
2022-2-14 learning xiangniuke project - Section 7 account setting
Résumé de la collection de plug - ins couramment utilisée dans les outils de développement idea
数据库学习总结5