The code below is a simple one to turn the LED on for 1 second and then off for 1 second. External crystal of 10MHz is used and the PLL is turned on which brings the FOSC up to 40MHz. However when I program and run the code, The LED appears to stay ON for only 1/4 of a second.
Am I missing something..? Thanks.
Am I missing something..? Thanks.
Code:
#include <p18F4620.h>
#include <delays.h>
#include <stdio.h>
#pragma config WDT = OFF
#pragma config MCLRE = ON
#pragma config LVP = OFF
#pragma config OSC = HSPLL
#define CLOCK_FREQ (40000000ul) // Hz
void main()
{
TRISB = 0x00;
while(1)
{
PORTBbits.RB0 = 1;
Delay10KTCYx(1000);
PORTBbits.RB0 = 0;
Delay10KTCYx(1000);
}
}