shinigami.alv
Newbie level 4
im using 16F877A and my hardware is not working. my program supposes to light up LED for 2 secs after releasing a button. just recently changed to MPLAB. below is my code:
PHP:
#include <pic.h>
#define _XTAL_FREQ 20000000
void main(void)
{
TRISD = 0b000000;
TRISC = 0b111111;;
while(1)
{
if (RC2==1)
{
RD2=1;
while (RC2==1);
__delay_ms(2000);
RD2=0;
}
else if (RC3==1)
{
RD3=1;
while(RC3==1);
__delay_ms(2000);
RD3=0;
}
else PORTD = 255;
}
}
Last edited: