C51 玄学问题,magic
0x00 问题代码
void int0_isr(void) interrupt 0
{
num++;
if (num%2 == 1)
{
uint k;
for(k=0;k<3;k++)
{
P1=0x0f;
delay(500);
P1=0xf0;
delay(500);
}
}
else if (num%2 == 0)
{
uint m;
uint n;
temp=0xfe;
P1=temp; //IO口无法直接参与运算,先赋值给字符串再用cror进行二进制移位运算
for (n=0;n<2;n++)
{
for (m=0;m<7;m++)
{
delay(300);
temp = _crol_(temp,1);
P1=temp;
}
for (m=0;m<7;m++)
{
delay(300);
temp = _cror_(temp,1);
P1=temp;
}
}
}
}
void int1_isr (void) interrupt 2
{
P1=0xff;
delay(3000);
}
0x01 问题剖析
手动分配using 0,using 1导致无法退出中断
手动分配using 1,using 2正常退出并返回主函数
自动分配正常退出并返回主函数
以下纯属猜测,毕竟跟使用哪组寄存器没啥关系
代码中使用电平中断(可能也和使用全局变量有关系?)
在没有清中断标志位的情况下,开启中断后,会产生多个中断信号
每个中断程序都在把他们清零,相互影响,导致很难达到计数终点,程序难以终止
又发现一个问题:using 0,using 1是手动分配中断使用哪组寄存器
但缺省情况下系统自动分配寄存器也是using 0,using 1,正常退出中断
using 0使用第0组寄存器(RS1=0,RS0=0),实际地址R0(00H) - R7(07H)
using 1使用第1组寄存器(RS1=0,RS0=1),实际地址R0(08H) - R7(0FH)
C51 玄学问题,magic的更多相关文章
- Magic Line
Magic Line 玄学过题系列,随机选在所有点左下方的点,然后对其他点斜率排序,取斜率在中间两个点之间 比赛时,左下方点不够随机==,导致没卡过去 #include<bits/stdc++. ...
- Codeforces CF#628 Education 8 D. Magic Numbers
D. Magic Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- [8.3] Magic Index
A magic index in an array A[0...n-1] is defined to be an index such that A[i] = i. Given a sorted ar ...
- Python魔术方法-Magic Method
介绍 在Python中,所有以"__"双下划线包起来的方法,都统称为"Magic Method",例如类的初始化方法 __init__ ,Python中所有的魔 ...
- 【Codeforces717F】Heroes of Making Magic III 线段树 + 找规律
F. Heroes of Making Magic III time limit per test:3 seconds memory limit per test:256 megabytes inpu ...
- 2016中国大学生程序设计竞赛 - 网络选拔赛 C. Magic boy Bi Luo with his excited tree
Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migi ...
- 一个快速double转int的方法(利用magic number)
代码: int i = *reinterpret_cast<int*>(&(d += 6755399441055744.0)); 知识点: 1.reinterpret_cast&l ...
- MAGIC XPA最新版本Magic xpa 2.4c Release Notes
New Features, Feature Enhancements and Behavior ChangesSubforms – Behavior Change for Unsupported Ta ...
- Magic xpa 2.5发布 Magic xpa 2.5 Release Notes
Magic xpa 2.5發佈 Magic xpa 2.5 Release Notes Magic xpa 2.5 Release NotesNew Features, Feature Enhance ...
随机推荐
- [leetcode]2. Add Two Numbers两数相加
You are given two non-empty linked lists representing two non-negative integers. The digits are stor ...
- thinkphp 视图(一)
视图 View <?php namespace app\index\controller; class Index{ public function index(){ return view() ...
- protobuff 编译注意事项
把protoc.exe增加到环境变量path,这样方便运行protoc 生成C++代码 protoc -I=Proto文件路径 –cpp_out=指定输出.h和.cc的目录 Proto文件 具体参数 ...
- 201621123002《Java程序设计》第六周学习总结
1. 本周学习总结 1.1 面向对象学习暂告一段落,请使用思维导图,以封装.继承.多态为核心概念画一张思维导图或相关笔记,对面向对象思想进行一个总结. 注1:关键词与内容不求多,但概念之间的联系要清晰 ...
- linux就该这么学,第六天了
今天学了第六天了,主要讲计划任务了,,at,命令,单次有效,一次性的,crontd服务(周期性)计划任务,crontab -e创建,编辑计划任务.crontab -l查看计划任务,crontaab - ...
- Netsharp总体介绍
作者:秋时 日期:2014年02月05日 转载须说明出处 Netsharp交流群:338963050(请有详细的请求说明) Netsharp系列文章目录结构 Netsharp是一款免费的基于 ...
- java多线程系列7 高级同步工具(1)信号量Semaphore
Semaphore叫做信号量 可以控制某个资源可被同时访问的个数, acquire() 获取一个许可,得到许可才能执行后面的代码,如果没有就等待. release() 释放一个许可. 当信号量的只允许 ...
- AX_HelpGenerator
HelpGenerator helpGenerator; ; helpGenerator = infolog.helpGenerator(); helpGenerator.showURL(" ...
- 201771010142 张燕《面向对象程序设计(java)》第一周学习总结
201771010142 张燕<面向对象程序设计(java)>第一周学习总结 第一部分:课程准备部分 填写课程学习 平台注册账号, 平台名称 注册账号 博客园:www.cnblogs.co ...
- JS 的execCommand 方法 做的一个简单富文本
execCommand 当一个 HTML 文档切换到设计模式(designMode)时,文档对象暴露 execCommand 方法,该方法允许运行命令来操纵可编辑区域的内容.大多数命令影响文档的选择( ...