fork download
  1. #include <htc.h>
  2.  
  3. // Configurație Fuse Bits
  4. #pragma config FOSC = HS, WDTE = OFF, PWRTE = ON, BOREN = ON, LVP = OFF
  5.  
  6. #define _XTAL_FREQ 4000000 // Frecvența cristalului 4MHz
  7.  
  8. void delay_seconds(unsigned char s) {
  9. while(s--) {
  10. __delay_ms(1000); // Întârziere de 1 secundă
  11. }
  12. }
  13.  
  14. void main(void) {
  15. TRISBbits.TRISB0 = 0; // Setăm RB0 ca ieșire
  16. PORTBbits.RB0 = 0; // Inițializăm pe Low
  17.  
  18. while(1) {
  19. PORTBbits.RB0 = 1; // High
  20. delay_seconds(18); // Menține 18 secunde
  21.  
  22. PORTBbits.RB0 = 0; // Low
  23. delay_seconds(13); // Menține 13 secunde
  24. }
  25. }
Success #stdin #stdout 0.04s 25420KB
stdin
Standard input is empty
stdout
#include <htc.h>

// Configurație Fuse Bits
#pragma config FOSC = HS, WDTE = OFF, PWRTE = ON, BOREN = ON, LVP = OFF

#define _XTAL_FREQ 4000000 // Frecvența cristalului 4MHz

void delay_seconds(unsigned char s) {
    while(s--) {
        __delay_ms(1000); // Întârziere de 1 secundă
    }
}

void main(void) {
    TRISBbits.TRISB0 = 0; // Setăm RB0 ca ieșire
    PORTBbits.RB0 = 0;    // Inițializăm pe Low

    while(1) {
        PORTBbits.RB0 = 1;  // High
        delay_seconds(18);  // Menține 18 secunde

        PORTBbits.RB0 = 0;  // Low
        delay_seconds(13);  // Menține 13 secunde
    }
}