Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined(__dsPIC33F__)
- #include "p33Fxxxx.h"
- #elif defined(__PIC24H__)
- #include "p24Hxxxx.h"
- #endif
- #include "math.h"
- #define PI 3.14159265358979323846
- // Internal FRC Oscillator
- _FOSCSEL(FNOSC_FRC)
- _FOSC(FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_NONE)
- _FWDT(FWDTEN_OFF)
- _FICD(ICS_PGD3)
- void initPLL(void)
- {
- PLLFBD = 41;
- CLKDIVbits.PLLPOST = 0;
- CLKDIVbits.PLLPRE = 0;
- OSCTUN = 0;
- RCONbits.SWDTEN=0;
- __builtin_write_OSCCONH(0x01);
- __builtin_write_OSCCONL(0x01);
- while (OSCCONbits.COSC != 0b001);
- while(OSCCONbits.LOCK != 1) {};
- }
- int main(void)
- {
- initPLL();
- float i = 0;
- float j = 0;
- float sinArray[100] = {};
- unsigned int count = 0;
- i = 2*PI*0.25;
- while(count < 20000)
- {
- j = sin(i); // Result should be 1;
- count++;
- }
- int breakhere = 1;
- breakhere = 2;
- breakhere = 3;
- breakhere = 4;
- breakhere = 5;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement