3910 views|9 replies

4

Posts

0

Resources
The OP
 

51 MCU falling edge trigger [Copy link]

I need help from all the experts. I have this 51 series, but there is no hardware interrupt. I want to realize that when my sensor signal disappears, my contactor is powered on for 2S and then powered off.
This post is from 51mcu

Latest reply

The fact that it is not implemented does not mean that the microcontroller has no interrupt function.  Details Published on 2019-3-1 10:38
 

216

Posts

0

Resources
2
 
What brand and model of MCU? How come there is no interruption? It would be best if you can attach the datasheet.
This post is from 51mcu
 
 
 

4

Posts

0

Resources
3
 
This is my circuit diagram

新版两路_看图王.pdf

396.25 KB, downloads: 11

This post is from 51mcu
 
 
 

29

Posts

0

Resources
4
 
Is the P1 terminal connected to a sensor? Please explain the working process in detail.
This post is from 51mcu
 
 
 

1w

Posts

16

Resources
5
 
Check the high and low level changes of the pin, and you can also simulate interrupts
This post is from 51mcu
 
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 

6366

Posts

4936

Resources
6
 
The 51 microcontroller has port interrupts. Unless you occupy two ports that can generate interrupts, you can use those two interrupt ports to achieve
This post is from 51mcu
 
 
 

1w

Posts

142

Resources
7
 
If there is no interrupt function, you can only use the query method, or replace it with a suitable model. The standard 51 has two external interrupt resources.
This post is from 51mcu
 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 

4005

Posts

0

Resources
8
 
The owner disappeared
This post is from 51mcu
 
 
 

4

Posts

0

Resources
9
 
#include

#define uchar unsigned char #define uint unsigned int char count1=40,count2=40; sbit IN_1=P3^4; sbit IN_2=P3^5; sbit OUT_1=P3^3; sbit OUT_2=P3^2; void main() { TMOD = 0x01; //Set timer mode TL0 = 0xaf; //Set initial timer value TH0 = 0x3c; //Set initial timer value TF0 = 0; //Clear TF0 flag TR0 = 1; //Timer 0 starts timing EA = 1; ET0 = 1; OUT_1=1; IN_1=0; while(1) { if((IN_1==1) && (OUT_1==1)) OUT_1=0; if(count1==0) { OUT_1=1; IN_1=1; count1=40; } } } void Time0() interrupt 1 { TL0 = 0xaf; //Timer manual reload TH0 = 0x3c; if(OUT_1==0) { count1--; } } This is the program I wrote, but it still does not implement the falling edge trigger
This post is from 51mcu

Comments

The fact that it is not implemented does not mean that the microcontroller does not have an interrupt function.  Details Published on 2019-3-1 10:38
 
 
 

931

Posts

3

Resources
10
 
clock Feitian published on 2019-2-24 17:27 #include #define uchar unsigned char #define uint unsigned int char count1=40,count2=40; ...
The fact that it is not implemented does not mean that the microcontroller has no interrupt function.
This post is from 51mcu
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list