int main(int argc, char** argv)
{
//产生Fosc = 120MHz
CLKDIVbits.PLLPRE = 0; //N1 = 2
PLLFBDbits.PLLDIV = 58; //M = 60
CLKDIVbits.PLLPOST = 0; //N2 = 2 8 * (60 / (2 + 2)) = 120M
OSCCONbits.NOSC = 0b11;
OSCCONbits.CLKLOCK = 0b0;
// Wait for Clock switch to occur
while(OSCCONbits.COSC != 0b011) /* Wait for new Oscillator to become XT with PLL */
{
}
while(OSCCONbits.LOCK != 1) /* Wait for Pll to Lock */
{
}
//Tim3_Init();
//timer1_init();
LATF = 0x0000; // B端口清零
TRISF = 0x0000; // B端口设为输入, 0: out, 1: in
PORTF = 0x0000;
while(1)
{
LATF=(PORTF ^ 0xff);
delay_ms(500);
}
return (EXIT_SUCCESS);
}
|