![]() #pragma config CPUDIV = OSC1_PLL2// System Clock Postscaler Selection bits () #pragma config PLLDIV = 1 // PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly)) Everthing seems to work as expected (when I touch the oscillator's pins, both LED turns on, there is a delay and then one LED turns off and the other too after a little delay that I don't know why). When the failure is detected, we go to the ISR where I turn on a LED to indicate the failure and checking OSTS bit we go to a routine that resets the PIC to restart primary oscillator. It basically do nothing but see if Oscillator is running fine. How can I fix this?Īnother question: what is Internal/External Oscillator switchover? I looked for it in google but found nothing clear. When the Oscillator Failure is detected, the PIC starts to run from internal clock (which I set to 8MHz), but in my code, _XTAL_FREQ is set to 20000000 (20MHz), so, if I try to use _delay functions, it will not match the expected time. I used WatchDog and Fail-Safe Clock Monitor sucesfully. ![]() I just started learning internal modules of PIC18F2550. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |