当前位置:网站首页>ZigBee learning in simple terms lesson 3 external interruption
ZigBee learning in simple terms lesson 3 external interruption
2022-06-26 05:24:00 【Super cute sandwich kids】
Configuration of external interrupts
1. initialization IO Mouth work in ordinary IO、 Pull up input status . PxSEL PxDIR PxINP
2. First of all IO Port group interrupt , from P0IE=1(P0 Port interrupt ) P1IE P2IE decision ( Group enable )
3. For a specific in the group IO Mouth interruption , from P0IEN P1IEN P2IEN decision ( Terminal enable )
4 Rising edge or falling edge triggers ,PICTL Registers determine ,0 Represents the rising edge ,1 Represents the falling edge
D7 D6 D5 D4 D3 D2 D1 D0
I/O Driving ability Unused Unused Unused P2_0~P2_4 P1_3~P1_7 P1_0~P1_3 P0_0~P0_7
notes :D0 Position one , namely PICTL&=0x01;//0000 0001, indicate P0 Group (P0_0~P0_7) Both are falling edges .
5. open CPU Total interruption EA=1 ( Total interrupt enable )
Interrupt function :
#pragma vector=PxINT_VECTOR
__interrupt void fn()
{
PxIFG=0;// Zero clearing
PxIF=0;
}
Code With P0_5 Example , Falling edge trigger
#include<iocc2530.h>
void delay()
{
int i,j;
for(i=0;i<1000;i++)
for(j=0;j<30;j++);
}
void main()
{
P0SEL&=0xDF ;//1101 1111 Ordinary IO mouth
P0DIR&=0xDF ;//1101 1111 Output
P0INP&=0xDF ;//1101 1111 Up and down mode
P2INP&=0xDF ; //1101 1111 Pull up mode
EA=1; //
P0IE=1; // If P1IE To set up for 1, Then we can't just use P1IE=1,IEN2 |=0x10;//0001 0000 8 Bit divisible can be directly set to one ,8 If a bit cannot be divided by an integer, add
IEN2 |=0x10;// amount to P1IE=1
P0IEN|= 0x20; //0010 0000 Set three interrupt enable flag bits , Turn on the corresponding interrupt switch , When the switch is closed, it means that the interrupt is on
PICLE&=0x01;//0000 0001 hold P0 This group is configured to trigger the falling edge
while(1)
}
#pragma vector=P0INT_VECTOR
__interrupt void Function name ()
{
if(P0IFG & 0x20)//0010 0000
{//P0 Fifth place of the group P0_5 Caused an external interrupt
delay() ; // The delay function is used to eliminate chattering
if(0==P0_5)
{// The description is really connected to P0_5 The button of triggers an external interrupt
P1_0^=1;// Exclusive or operation Turned out to be 0 become 1, Turned out to be 1 become 0
}
}
P0IFG=0;
P0IF=0;
}
边栏推荐
- First day of deep learning and tensorflow learning
- Data storage: the difference between MySQL InnoDB and MyISAM
- 创建 SSH 秘钥对 配置步骤
- [unity3d] human computer interaction input
- Chapter 9 setting up structured logging (I)
- Technical problems to be faced in mobile terminal im development
- Introduction to alluxio
- Uni app ceiling fixed style
- Thoughts triggered by the fact that app applications are installed on mobile phones and do not display icons
- cartographer_local_trajectory_builder_2d
猜你喜欢

AutowiredAnnotationBeanPostProcessor什么时候被实例化的?

递归遍历目录结构和树状展现

apktool 工具使用文档

Apktool tool usage document
![[unity3d] human computer interaction input](/img/4d/47f6d40bb82400fe9c6d624c8892f7.png)
[unity3d] human computer interaction input

Tp5.0框架 PDO连接mysql 报错:Too many connections 解决方法

Could not get unknown property ‘*‘ for SigningConfig container of type org. gradle. api. internal

cartographer_ backend_ constraint

Create SSH key pair configuration steps

The State Council issued a document to improve the application of identity authentication and electronic seals, and strengthen the construction of Digital Government
随机推荐
Replacing domestic image sources in openwrt for soft routing (take Alibaba cloud as an example)
CMakeLists. txt Template
AD教程系列 | 4 - 创建集成库文件
cartographer_ optimization_ problem_ 2d
Excellent learning ability is your only sustainable competitive advantage
Practical cases | getting started and mastering tkinter+pyinstaller
As promised: Mars, the mobile terminal IM network layer cross platform component library used by wechat, has been officially open source
【ARM】讯为rk3568开发板buildroot添加桌面应用
RESNET in tensorflow_ Train actual combat
cartographer_ local_ trajectory_ builder_ 2d
慢慢学JVM之缓存行和伪共享
[arm] build boa based embedded web server on nuc977
Beidou navigation technology and industrial application of "chasing dreams in space and feeling for Beidou"
Could not get unknown property ‘*‘ for SigningConfig container of type org.gradle.api.internal
First day of deep learning and tensorflow learning
[upsampling method opencv interpolation]
Mongodb image configuration method
How to make your big file upload stable and fast?
递归遍历目录结构和树状展现
Command line interface of alluxio