Hi, i'm new at programming and i tried this easy code for flashing leds with dspic33e usb starter kit, but it seems to take around 5 seconds to flash rather than 1
Any suggestions?
I'm not sure which compiler you are using but two possibilities come to mind...
Is the clock configured properly - for example are you using an internal 8MHz clock instead of your external 40MHz one? That would account for being five times slower than expected.
Is there a maximum value for the delay_ms() function that you could be exceeding?
On other microchip devices I have successfuly turn PLL on internal OSC, but these devices seems to have a startup limitation that may be a problem.
Check paragraph: "7.7.1 Input Clock Limitation at Start-up for PLL Mode"
It seems to me that you may not change PLL on the running oscillator and you should temporarily swap to an other one (eg to an external XT).
Hi, i'm new at programming and i tried this easy code for flashing leds with dspic33e usb starter kit, but it seems to take around 5 seconds to flash rather than 1
Any suggestions?
Since you have set the delay clock parameter to 40 000 000, it is natural that the speed is 1/5 of what you expect, if your actual CPU clock is 8MHz.
The delay(clock) parameter is not adjusting the CPU clock, it's only used as a base value for the compiler to compute the number of loops that is needed for the correct software delay.