当前位置:网站首页>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;
}
边栏推荐
- 【上采样方式-OpenCV插值】
- 使用Jenkins执行TestNg+Selenium+Jsoup自动化测试和生成ExtentReport测试报告
- Codeforces Round #800 (Div. 2)
- Mysql 源码阅读(二)登录连接调试
- [greedy college] Figure neural network advanced training camp
- Could not get unknown property ‘*‘ for SigningConfig container of type org. gradle. api. internal
- Introduction to GUI programming to game practice (I)
- Excellent learning ability is your only sustainable competitive advantage
- Learn cache lines and pseudo sharing of JVM slowly
- Leetcode513.找出树的左下角的值
猜你喜欢

Red team scoring method statistics

AutowiredAnnotationBeanPostProcessor什么时候被实例化的?
![[upsampling method opencv interpolation]](/img/6b/5e8f3c2844f0cbbbf03022e0efd5f0.png)
[upsampling method opencv interpolation]

How does P2P technology reduce the bandwidth of live video by 75%?

Introduction to GUI programming to game practice (I)

红队得分方法统计

慢慢学JVM之缓存行和伪共享

基于SDN的DDoS攻击缓解

Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing

Fedora alicloud source
随机推荐
Tensorflow visualization tensorboard "no graph definition files were found." error
The best Chinese open source class of vision transformer, ten hours of on-site coding to play with the popular model of Vit!
[arm] build boa based embedded web server on nuc977
递归遍历目录结构和树状展现
无线网络存在的安全问题及现代化解决方案
Ad tutorial series | 4 - creating an integration library file
GD32F3x0 官方PWM驱动正频宽偏小(定时不准)的问题
Decipher the AI black technology behind sports: figure skating action recognition, multi-mode video classification and wonderful clip editing
Redis installation on Linux
CMakeLists. txt Template
Technical problems to be faced in mobile terminal im development
Setting pseudo static under fastadmin Apache
Tensorflow and deep learning day 3
【ARM】在NUC977上搭建基于boa的嵌入式web服务器
tensorlow:cifar100_ train
线程优先级
Chapter 9 setting up structured logging (I)
How to make your big file upload stable and fast?
Briefly describe the pitfalls of mobile IM development: architecture design, communication protocol and client
Secondary bootloader about boot28 Precautions for ASM application, 28035