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 ...
随机推荐
- Spark官方文档翻译(一)~Overview
Spark官方文档翻译,有问题请及时指正,谢谢. Overview页 http://spark.apache.org/docs/latest/index.html Spark概述 Apache Spa ...
- node.js中 koa 框架的基本使用方法
一.安装 koa npm install koa --save 二.简单使用 const koa = require('koa'); //注意使用koa需要new,跟express有点不同 let a ...
- Javascript组成--ECMAScript,DOM,BOM
ECMAScript 部分 ECMAScript是一个标准,JS只是它的一个实现,其他实现包括ActionScript; “ECMAScript可以为不同种类的宿主环境提供核心的脚本编程能力”,即EC ...
- MYSQL库,表,记录的基本操作
数据库操作 1.显示数据库 show databases; 默认数据库: mysql - 用户权限相关数据 test - 用于用户测试数据 information_schema - MySQL本身架构 ...
- idea环境配置
Idea 下载 https://www.jetbrains.com/idea/download/#section=windows idea安装(略) idea破解 window配置hosts文件:0. ...
- python_paramiko
目录: paramiko模块介绍 paramiko模块安装 paramiko模块使用 一.paramiko模块介绍 paramiko是一个用于做远程控制的模块,使用该模块可以对远程服务器进行命令或文件 ...
- Zookeeper Client基础操作和Java调用
## Zookeeper > Zookeeper目前用来做数据同步,再各个服务之前同步关键信息 i.客户端操作 1. 创建 create [-s] [-e] path data acl -s 为 ...
- Spring 的属性注入
一.注入方式 (1)set方法注入 (2)构造函数注入 (3)p名称空间注入 (4)spel注入 二.复杂类型注入
- lombok(@Getter&@Setter)
Lombok是一个可以通过简单的注解形式来帮助我们简化消除一些必须有但显得很臃肿的Java代码的工具,通过使用对应的注解,可以在编译源码的时候生成对应的方法. 官方地址:https://project ...
- ReSharper 10.0.0.1 Ultimate 完美破解补丁使用方法
转自:http://www.leavescn.com/Page/Content.aspx?id=94 ReSharper 10.0.0.1 Ultimate 完美破解补丁使用方法,本资源来自互联网,感 ...