Guest User

Untitled

a guest
May 26th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. /*
  2. * File: main.c
  3. * Author: Fsociety Darkness
  4. *
  5. * Created on 16 de Maio de 2018, 20:26
  6. */
  7.  
  8.  
  9. #include <xc.h>
  10. #include <p18f4550.h>
  11. #define _XTAL_FREQ 4000000
  12.  
  13. #pragma config FOSC = INTOSC_EC //internal oscillator
  14. #pragma config PLLDIV = 4 //divide by 5 to give 4MHz to PLL
  15. #pragma config FCMEN = OFF //no fail safe clock monitor
  16. #pragma config IESO = OFF //oscillator switchover disabled
  17. #pragma config PWRT = ON //oscillator power up timer enabled
  18. #pragma config BOR = OFF //hardware brown out reset
  19. #pragma config WDT = OFF //watchdog timer disabled
  20.  
  21. #pragma config MCLRE = OFF //MCLR pin enabled
  22.  
  23. #pragma config LPT1OSC = ON //timer1 low power operation
  24.  
  25. #pragma config PBADEN = OFF //portB 0to 4 digital - not analogue
  26. #pragma config LVP = OFF //low voltage programming disabled
  27. #pragma config CCP2MX = OFF //portc1 = CCP2
  28. #pragma config XINST = OFF //do not allow PIC18 extended instructions
  29. #pragma config STVREN = ON //stack overflow will cause reset
  30.  
  31. void main(void) {
  32. TRISD = 0;
  33. LATDbits.LATD0 = 0;
  34. while(1){
  35. LATDbits.LATD0 = 1 ;
  36. __delay_ms(500);
  37. LATDbits.LATD0 = 0;
  38. __delay_ms(500);
  39. }
  40. }
Add Comment
Please, Sign In to add comment