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.

code for sensor HC-SR04 with pic 16f877a using mikroc language

Status
Not open for further replies.

NadaF

Newbie level 6
Joined
May 1, 2013
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,364
now i'm make a project that when i press a push button for a Time then when i leave this push button , i need to make a led on for the same time that i pressed the push button by using timer 1 on pic 16f877a how to do that ?!
my code :

int Duration;
int TimeValue;
void main()
{
TRISB.B7=1; // i/p for pic --> push button
TRISB.B6=0; // o/p for pic --> led
while (1)
{
if (PORTB.B7=1)
{
T1CON=0001001; // timer1 on
if (PORTB.B7=0)
{
T1CON=00000000; // timer1 off
}
Time= TMR1L;
PORTB.B6=1;
// here how to delay led on the same time that i pressed the button???
}
}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top