ud23
Advanced Member level 3
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
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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; }
try thishi 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
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 } } }