boa tarde
criei o programa para um projeto e este esta travando depois de um certo tempo teria como dar uma luz , não sei se esta certo a maneira de programar
então se alguém tiver uma sugestão agradeço
#include <16f876a.h>
#FUSES NOWDT
#FUSES HS
#FUSES NOPUT
#FUSES PROTECT
#FUSES NODEBUG
#FUSES BROWNOUT
#FUSES LVP
#FUSES NOCPD
#FUSES NOWRT
#use delay(clock=8192000)
#define SENSE pin_a1
#define ON pin_a2
#define HELP pin_a3
#define SEPARADOR pin_c1
#define EMPURRA pin_c2
#define APERTA pin_c3
#define CONTATORA pin_c4
////////////////////////////////////////
int PULSE=0,PULSE_V=0,STATE_P=0,STATE_H=0,INIT=0,SEP_ON=0,PULSE1=0,PULSE_V1=0;
void main ()
{
while(1)
{
PULSE=INPUT(ON);
IF(PULSE==0 && PULSE_V==0)
PULSE_V=1;
IF(PULSE==1 && PULSE_V==1)
{
delay_ms(500);
STATE_P++;
PULSE_V=0;
SEP_ON=0;
if(STATE_P>=2)
{
STATE_P=0;
}
}
/* tratamento botao liga desliga */
///////////////////////////////////////////////////////////////////////////
IF(!input(HELP))
{
delay_ms(200);
STATE_H=1;
STATE_P=0;
SEP_ON=0;
}
ELSE STATE_H=1;
///////////////////////////////////////////////////////////////////////////
IF(STATE_P==1 && STATE_H==1 )
{
output_high(CONTATORA);
////////////////////////////////////////////////////////////////////////////
INIT=1;
PULSE1=INPUT(SENSE);
IF(PULSE1==0 && PULSE_V1==0)
PULSE_V1=1;
IF(PULSE1==1 && PULSE_V1==1 && INIT==1)
{
Output_high(SEPARADOR);
output_high(EMPURRA);
delay_ms(35);
Output_high(APERTA);
delay_ms(1200);
output_low(APERTA);
output_low(EMPURRA);
output_low(SEPARADOR);
PULSE_V1=0;
}
INIT=0;
}//programa principal
IF(STATE_P==0 && STATE_H==1)
{
output_low(CONTATORA);
output_low(APERTA);
output_low(EMPURRA);
}//Desliga tudo
}
}