Forum: Mikrocontroller und Digitale Elektronik PIC 16F84A Flackern der ersten LED (Relais)


von Martin M. (ats3788)


Lesenswert?

Hallo hat jemand eine Idee warum die erste LED (eigentlich Relais)
erst ca 0,5sec flackert und dann erst das Programm richtig durchläuft.
Es ist eine Schaltung mit RC Oszi's C = 82pF und R = 10K. Die Schaltung 
schwingt so um die 180KHz.
PIC
#include <xc.h>
#include <stdio.h>
#include <stdlib.h>
#include <pic16f84a.h>

#pragma config FOSC = EXTRC, WDTE = OFF, CP = OFF, PWRTE = OFF

#define _XTAL_FREQ 182000
#define ON 1
#define OFF 0

void InitPowerSeq(void) {
    unsigned char i;
    unsigned char PORT = 1;
    for (i=1; i<4;i++ ) {
      PORTB = PORTB & 0b00001111 | PORT;
      __delay_ms(1000);
     PORT = PORT<<1;
    }
}

int main(int argc, char** argv) {

 INTCON = GIE = OFF;
 INTCON = RBIE = OFF;
 INTCON = INTF = OFF;
 INTCON = RBIF = OFF;

 OPTION_REG = nRBPU = ON; // OFF It's Negate

 PORTB = 0; // Reset all PortsB to OFF
 TRISB = 0; // All PortB Output

 PORTA = 0; // Reset all PortsA to OFF
 TRISA = 0; // All PortA Output

 InitPowerSeq();

 PORTB = 0b00001000;

while (1) {
    asm("nop");
    asm("nop");

    RB4 = !RB4; // Nur Eingefügt
    __delay_ms(250); // zum Testen
    asm("nop");
    asm("nop");
}
    return (EXIT_SUCCESS);
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.