当前位置:网站首页>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;
}
边栏推荐
- SDN based DDoS attack mitigation
- 【红队】要想加入红队,需要做好哪些准备?
- cartographer_ backend_ constraint
- The first gift of the project, the flying oar contract!
- Second day of deep learning and tensorfow
- Tp5.0框架 PDO连接mysql 报错:Too many connections 解决方法
- 《财富自由之路》读书之一点体会
- SOFA Weekly | 开源人—于雨、本周 QA、本周 Contributor
- data = self._ data_ queue. get(timeout=timeout)
- The localstorage browser stores locally to limit the number of forms submitted when tourists do not log in.
猜你喜欢

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

cartographer_backend_constraint

《财富自由之路》读书之一点体会

PHP二维/多维数组按照指定的键值来进行升序和降序

Supplementary course on basic knowledge of IM development (II): how to design a server-side storage architecture for a large number of image files?

As promised: Mars, the mobile terminal IM network layer cross platform component library used by wechat, has been officially open source

How to rewrite a pseudo static URL created by zenpart

How to ensure the efficiency and real-time of pushing large-scale group messages in mobile IM?

Tensorflow and deep learning day 3

Setting pseudo static under fastadmin Apache
随机推荐
Pytorch forecast house price
Red team scoring method statistics
RESNET practice in tensorflow
cartographer_ backend_ constraint
cartographer_pose_graph_2d
AD教程系列 | 4 - 创建集成库文件
C# 39. string类型和byte[]类型相互转换(实测)
关于支付接口回调地址参数字段是“notify_url”,签名过后的特殊字符url编码以后再解码后出现错误(¬ , ¢, ¤, £)
Douban top250
Recursively traverse directory structure and tree presentation
Owasp-top10 in 2021
Redis discovery bloom filter
cartographer_ optimization_ problem_ 2d
Implementation of IM message delivery guarantee mechanism (II): ensure reliable delivery of offline messages
Technical past: tcp/ip protocol that has changed the world (precious pictures, caution for mobile phones)
Practical cases | getting started and mastering tkinter+pyinstaller
Classic theory: detailed explanation of three handshakes and four waves of TCP protocol
Codeforces Round #800 (Div. 2)
SSH connected to win10 and reported an error: permission denied (publickey, keyboard interactive)
Technical problems to be faced in mobile terminal im development