View Single Post
Old 01-12-2010, 09:21 PM   #7
chestnut
Đệ tử 2 túi
 
Tham gia ngày: Jul 2008
Bài gửi: 40
:
_FOSCSEL(FNOSC_FRC);
// Enable clock switching and configure
_FOSC(FCKSM_CSECMD & OSCIOFNC_OFF);

int main()
{
// Configure PLL prescaler, PLL postscaler, and PLL divisor
PLLFBD = 41; // M = 43
CLKDIVbits.PLLPRE=0; // N1 = 2
CLKDIVbits.PLLPOST=0; // N2 = 2
// Initiate clock switch to internal FRC with PLL (NOSC = 0b001)
__builtin_write_OSCCONH(0x01);
__builtin_write_OSCCONL(0x01);
// Wait for clock switch to occur
while (OSCCONbits.COSC != 0b001);
// Wait for PLL to lock
while(OSCCONbits.LOCK!=1) {};

init_gpio();
//RTDM_Start();
RLED = LED_ON;
GLED = LED_OFF;
while(1)
{
//RTDM_ProcessMsgs();
}

return 0;
}

Code rất đơn giản như vầy, nhưng vẫn bị problem đó.
chestnut vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn