Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] how to detect rising edge on 8051

Status
Not open for further replies.

ud23

Advanced Member level 3
Advanced Member level 3
Joined
Apr 20, 2011
Messages
926
Helped
185
Reputation
370
Reaction score
180
Trophy points
1,323
Activity points
6,138
hi all i want to detect proxy output any pin of 8051 but i want to detect on rising edge only. i know with external interrupts its possible only falling edge
 

Do you need interrupt or not?
IF not then i think it is very simple.
when your pin goes from "0" to "1" it is your rising edge.

regards
 

no i don't need interrupts. as you said it is rising edge but how to detect in c i know "0" to "1" also consider as state change for that pin i need to take action only while perticular pin goes from"0" to towards "1" not when its become after complete "1".
 

What i understand that u want to take action in time between a particulate pin start changing its state from "0" to "1".
If yes then i think that is not possible using a digital input. You can use an analog input for this purpose. When ADC goes from low value to high value you can take action.

Regards
 

you make that pin in a while loop.. i mean
for eg,
Code:
sbit input=P2^0;
main()
{
   while(input==0);//wait till rising edge
    
  // next action

}
 


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
sbit input=P2^0;
bit flag;
main()
if(!input)
flag=1;
if(flag&&input)
{//this is for rising edge 
//do action on rising edge
flag=0;
}



---------- Post added at 10:55 ---------- Previous post was at 10:27 ----------

hi all i want to detect proxy output any pin of 8051 but i want to detect on rising edge only. i know with external interrupts its possible only falling edge
try this

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<reg51.h>
sbit in=P2^0; //input for rising edge
sbit led=P2^1;//led toggle on rising edge
bit flag; //for lavel chang on input pin 
void main()
{
led=0;
in=1;//for input
while(1)
{
if(!in)
flag=1; //flage set on input pin is low
if(flag&&in)//for pin state change low to high
{
led^=1;
flag=0;//flag reset while pin is high
}
}
}

 
Last edited:
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top