AtomSoft
Well-Known Member
Hello all im stuck yet again on this dsPIC stuff heh this time i want to use a 10Mhz crystal on OSC1:2 and want to turn it to 80Mhz using the PLL on chip. Now i have 2 questions...
1. Will this give me 20MIPS ?
2. If so why doesnt this delay for 1 second ? When i run this code it takes 12 seconds for the led to toggle.
1. Will this give me 20MIPS ?
2. If so why doesnt this delay for 1 second ? When i run this code it takes 12 seconds for the led to toggle.
Code:
#include "p30f4013.h"
_FOSC(XT_PLL8)
_FWDT(WDT_OFF)
_FBORPOR(MCLR_EN & PWRT_OFF)
_FGS(CODE_PROT_OFF)
void delay(void);
int main(void)
{
ADPCFG=0xffff;
TRISD=0; //PORTs all outputs
LATD=0;
delay();
while(1){
LATDbits.LATD3 = 1;
delay();
LATDbits.LATD3 = 0;
delay();
}
}
void delay(void)
{
unsigned long var1;
for(var1=0;var1!=20000000;var1++);
}