fork download
  1. // PIC16F76 Configuration Bit Settings
  2. // CONFIG
  3. #pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
  4. #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT enabled)
  5. #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
  6. #pragma config CP = OFF // FLASH Program Memory Code Protection bit (Code protection off)
  7. #pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR enabled)
  8.  
  9. #define _XTAL_FREQ 8000000
  10.  
  11. #include <pic16f7x.h>
  12.  
  13. long t;
  14.  
  15. void main(void) {
  16.  
  17. TRISC2 = 0;
  18.  
  19. while (1) {
  20. RC2 = 1;
  21. t = 0;
  22. while(t < 20000) {
  23. t ++;
  24. }
  25. RC2 = 0;
  26. t = 0;
  27. while(t < 20000) {
  28. t ++;
  29. }
  30. //_delay(1000);
  31. }
  32. }
Success #stdin #stdout 0.03s 25936KB
stdin
1
2
10
42
11
stdout
// PIC16F76 Configuration Bit Settings
// CONFIG
#pragma config FOSC = HS        // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF        // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF      // Power-up Timer Enable bit (PWRT disabled)
#pragma config CP = OFF         // FLASH Program Memory Code Protection bit (Code protection off)
#pragma config BOREN = OFF       // Brown-out Reset Enable bit (BOR enabled)

#define _XTAL_FREQ 8000000

#include <pic16f7x.h>

long t;

void main(void) {

    TRISC2 = 0;

    while (1) {
        RC2 = 1;
        t = 0;
        while(t < 20000) {
          t ++;
        }
        RC2 = 0;
        t = 0;
        while(t < 20000) {
          t ++;
        }
        //_delay(1000);
    }
}