I work with a PIC18F45K80 microcontroller and need to verify its operating frequency without using external equipment like a logic analyzer or oscilloscope. Buying new equipment is not an option for me right now.
To check the frequency, I used an LED toggle method. My MCU is running at the default internal frequency of 8MHz, so I toggled an LED every 5 seconds and verified the timing with a stopwatch. The LED blinked as expected, confirming the assumed frequency.
Now, my question is:
If I change my MCU's clock to 20MHz but keep the same toggle time as before, will the LED still toggle every 5 seconds? Or will the timing change due to the clock speed difference?
To check the frequency, I used an LED toggle method. My MCU is running at the default internal frequency of 8MHz, so I toggled an LED every 5 seconds and verified the timing with a stopwatch. The LED blinked as expected, confirming the assumed frequency.
Code:
while (1) {
LATAbits.LA5 ^= 1; // Toggle LED
__delay_ms(5000); // 5 seconds delay
}
If I change my MCU's clock to 20MHz but keep the same toggle time as before, will the LED still toggle every 5 seconds? Or will the timing change due to the clock speed difference?

