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 ...
随机推荐
- easyui Tree树形控件的异步加载
Tree控件 $('#partyOrgTree').tree({ checkbox: false, url: getDataUrl, onClick: function (node) { getDiv ...
- python基础 (编码进阶,文件操作和深浅copy)
1.编码的进阶 字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码. 即先将其他编码的字符串解码(decode)成unicode,再从uni ...
- 判断是否是json
转:https://blog.csdn.net/dy_smile/article/details/46739251 function isJson(obj) { var isjson = typeof ...
- [网络流]Farm Tour(费用流
Farm Tour 题目描述 When FJ's friends visit him on the farm, he likes to show them around. His farm compr ...
- python基础之Day10
一.函数的返回值 1.什么是返回值返回值是一个函数的处理结果, 2.为什么要有返回值如果我们需要在程序中拿到函数的处理结果做进一步的处理,则需要函数必须有返回值 3.函数的返回值的应用函数的返回值用r ...
- 【转】背后的故事之 - 快乐的Lambda表达式(二)
快乐的Lambda表达式 上一篇 背后的故事之 - 快乐的Lambda表达式(一)我们由浅入深的分析了一下Lambda表达式.知道了它和委托以及普通方法的区别,并且通过测试对比他们之间的性能,然后我们 ...
- JavaScript 高阶函数
高阶函数的英文叫Higher-order function ,什么是高阶函数呢>? JavaScript的函数其实都指向某个变量.既然变量可以指向函数,函数的参数能接收变量,那么一个函数就可以接 ...
- VM无法连接到虚拟机
The VMware Authorization Service is not running. 原因 虚拟机服务没有开启 解决方法 1. 我的电脑右击->管理 2. 打开服 ...
- 1.8 新特性之 Lambda Expressions
Lambda expressions are allowed only at source level 1.8 or above The target type of this expression ...
- Python之路(一)-python简介
一.python简介,python2.x与python3.x的区别 Python是著名的“龟叔”Guido van Rossum在1989年圣诞节期间,为了打发无聊的圣诞节而编写的一个编程语言. Py ...