3

I have the following program - Using XC8 C Compiler on MPLAB and the microcontroller is PIC16F877.

int main()
{
  TRISB = 0x00;
  while(1)
  {
    PORTB = 0xFF;
    __delay_ms(1000);
    PORTB = 0x00;
    __delay_ms(1000); 
  }
  return 0;
}

I have LED connected to the output pins of PORTB. BUT there is no blinking.

However, when I do this on individual pins, it works perfectly: Eg:

RB0 = 1;
RB1 = 0;
RB2 = 1;

What am I doing wrong?

Nujufas
  • 676
  • 1
  • 9
  • 19

0 Answers0