Warum blinken alle LEDs EasyPIC 7

Gast #2543457
Lesenswert?

Ich kapiere das nicht!

Hardware EasyPIC 7
µC PIC18F45K22
Programmiersprache C
Compiler mikroC PRO for PIC

Ich habe aus Beispielcode von EasyPIC 7 verwendet. Alle LEDS (PORTA bis 
PORTE) blinken.

Lösche ich PORTB bis PORTE und lasse PORTA drin, blinken alle LEDS immer 
noch. Was soll das????

char counter;

void wait() {
  Delay_ms(100);
}

void main() {

  TRISA = 0x00;                               // set direction to be 
output

  LATA = 0x00;                                    // turn OFF the LATD 
leds

  while (1) {
    for (counter=0; counter<8; counter++) {

      LATA |= 1 << counter;

      wait();
    }

    counter = 0;
    while (counter<8) {

      LATA &= ~(1 << counter);

      wait();
      counter++;
    }
  }
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren