Capture Module in 16f877

Status
Not open for further replies.

bing2005

Junior Member level 2
Joined
Feb 21, 2005
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,486
I want to capture signal from the 40KHz ultrasonic transducer with the capture module.
But, i cannot capture the signal from the ultrasonic transmitter.
The capture part source code is shown as below:
Code:
void capture(void)
{

	if(RC2==0)
	{	
		RB4 = 1;
		CCP1CON	= 0x04;
		TMR1ON	= 0;
	}

	if(RC2==1)
	{
		RB5 = 1;
		CCP1CON	= 0x05;
		TMR1ON	= 1;	
	}

}

I try to capture the falling edge and rising edge then store the time, and use the time to calculate the distance.
Thanks guys!!![/code]
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…