which compiler to use? (new in PIC)

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

Re: which compiler to use? (new in PIC)

Postby fitri » Sun Jun 05, 2011 10:42 am

hi all,
i got a problem here with my program, i create 2 toggle light. but i cannot control the light 2 at the same time. if i want to control the other light, i need to reset the pic first. can somebody help me so i can control both my light so i dont need to reset my pic anymore. below are my program.
thanks...

#include <16f877A.h>
#fuses HS,NOLVP,NOWDT
#use delay (clock=20000000)


void wait_for_one_press1() {
while(!input(PIN_B1)) ;
delay_ms (100);
while(input(PIN_B1)) ;
}

void wait_for_one_press2() {
while(!input(PIN_B0)) ;
delay_ms (100);
while(input(PIN_B0)) ;
}

void main () {
while (TRUE) {
if (!input (PIN_B1))
{
wait_for_one_press1();
output_toggle(PIN_B7);
}
else if (!input (PIN_B0))
{
wait_for_one_press2();
output_toggle(PIN_B6);
}
}
}
fitri
Apprentice
 
Posts: 42
Joined: Mon May 02, 2011 8:20 pm

Re: which compiler to use? (new in PIC)

Postby robosang » Tue Jun 07, 2011 9:13 pm

You on the LED but din off it.... how to get the thing work? Remember this, the thing works as you asked it to work..... :lol: Is you that write the program, no one else. 8-)
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Previous

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 4 guests