Ejemplo Programa 1 XC
Ejemplo Programa 1 XC
/*
2. * File: main.c
3. * Author: lucas
5. * Microcontrolador: PIC16F648A
6. *
7. */
8.
9. #include <stdio.h>
12.
14.
17. #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
18. #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT
disabled)
19. #pragma config MCLRE = OFF // RA5/MCLR/VPP Pin Function Select bit
(RA5/MCLR/VPP pin function is digital input, MCLR internally tied to VDD)
20. #pragma config BOREN = ON // Brown-out Detect Enable bit (BOD
enabled)
22. #pragma config CPD = OFF // Data EE Memory Code Protection bit (Data
memory code protection off)
23. #pragma config CP = OFF // Flash Program Memory Code Protection bit
(Code protection off)
24.
26.
28.
31.
32. if (PORTBbits.RB0 == 1) {
33. PORTBbits.RB4 = 1;
34. } else {
35. PORTBbits.RB4 = 0;
36. }
37. }