roaa said
Newbie level 4
HELLO all
i have 16f677 .. i wrote the code and have no errors but when i simulate(proteus simulation) it didnot work properly
i wana to know where the error?
the code:
i have 16f677 .. i wrote the code and have no errors but when i simulate(proteus simulation) it didnot work properly
i wana to know where the error?
the code:
Code:
int sensor;
void main() {
TRISA=0Xff; //configure PORTA as input port
TRISC=0X00; //configure PORTC as output port
TRISB=0XFF; //configure PORTB as input port
sensor=RA0_bit;
do{
if(RB4_bit==1)
{
RC1_bit=1;
RC2_bit=1;
delay_ms(300);
}
if(sensor==1)
{
RC1_bit=1;
RC2_bit=1;
delay_ms(1000);
RC3_bit=1;
}
if(sensor==0)
{
RC1_bit=0;
RC2_bit=0;
RC3_bit=1;
}
delay_ms(3000);
RC1_bit=0;
RC2_bit=0;
RC3_bit=0;
RC4_bit=1;
RC5_bit=1;
}
while(1);
}
Last edited by a moderator: