Advertisement
Guest User

Untitled

a guest
Jul 6th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #if defined(__dsPIC33F__)
  2. #include "p33Fxxxx.h"
  3. #elif defined(__PIC24H__)
  4. #include "p24Hxxxx.h"
  5. #endif
  6.  
  7. #include "math.h"
  8.  
  9. // Internal FRC Oscillator
  10. _FOSCSEL(FNOSC_FRC);
  11. _FOSC(FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_NONE);
  12. _FWDT(FWDTEN_OFF);
  13. _FICD(ICS_PGD3);
  14.  
  15. void initPLL(void)
  16. {
  17.     PLLFBD = 41;
  18.     CLKDIVbits.PLLPOST = 0;
  19.     CLKDIVbits.PLLPRE = 0;
  20.     OSCTUN = 0;
  21.     RCONbits.SWDTEN=0;
  22.     __builtin_write_OSCCONH(0x01);
  23.     __builtin_write_OSCCONL(0x01);
  24.     while (OSCCONbits.COSC != 0b001);
  25.     while(OSCCONbits.LOCK != 1) {};
  26. }
  27.  
  28. int main(void)
  29. {
  30.     initPLL();
  31.     float i = 0;
  32.     i = sin(45);
  33.     int breakhere = 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement