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 "dsp.h"
- #define n 15
- //#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)
- {
- CLKDIVbits.PLLPRE = 0;
- PLLFBD = 41; //M = 43
- CLKDIVbits.PLLPOST = 0;
- OSCTUN = 0;
- RCONbits.SWDTEN=0;
- __builtin_write_OSCCONH(0x01);
- __builtin_write_OSCCONL(0x01);
- while (OSCCONbits.COSC != 0b001);
- while(OSCCONbits.LOCK != 1) {};
- }
- volatile float i = 0;
- volatile float j = 0;
- volatile float k = 0;
- volatile float l = 0;
- volatile unsigned int m = 2000;
- volatile unsigned int v = 0;
- volatile unsigned int count = 0;
- volatile unsigned int breakhere = 0;
- int main(void)
- {
- initPLL();
- i = 2*PI*0.25;
- while(count < 2000)
- {
- j = sin(i*m);
- v += j;
- count++;
- m--;
- }
- if (v == j)
- {
- TRISAbits.TRISA4 = 0; //Output
- LATAbits.LATA4 = 1;
- }
- breakhere = 1;
- breakhere = 0;
- count = 0;
- while(count < 2000)
- {
- k = 2 + 4;
- count++;
- }
- breakhere = 2;
- breakhere = 3;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement