#include <16F877a.h>
#include <def_877a.h>
#FUSES NOWDT, XT, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use Delay(Clock=4000000)
#define led RC0
#define led1 RC1
#int_TIMER1
unsigned int8 dem;
void main()
{
set_tris_c(0x00);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
set_timer1(59286);
enable_interrupts(INT_TIMER1);
enable_interrupts(GlOBAL);
while(true)
{
if(input(PIN_A0)==0)
{
dem=0;
do
{
set_timer1(59286);
dem++;
}
while((dem<5)&&(input(PIN_A0)==0));
if (dem==5)
{
led=!led;
while(input(PIN_A0)==0);
}
else led1=!led1;
}
}
}
Ai đi qua giúp e với ah
#include <def_877a.h>
#FUSES NOWDT, XT, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use Delay(Clock=4000000)
#define led RC0
#define led1 RC1
#int_TIMER1
unsigned int8 dem;
void main()
{
set_tris_c(0x00);
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
set_timer1(59286);
enable_interrupts(INT_TIMER1);
enable_interrupts(GlOBAL);
while(true)
{
if(input(PIN_A0)==0)
{
dem=0;
do
{
set_timer1(59286);
dem++;
}
while((dem<5)&&(input(PIN_A0)==0));
if (dem==5)
{
led=!led;
while(input(PIN_A0)==0);
}
else led1=!led1;
}
}
}
Ai đi qua giúp e với ah
Comment