Garyl
Full Member level 5
- Joined
- Mar 28, 2017
- Messages
- 253
- Helped
- 6
- Reputation
- 12
- Reaction score
- 7
- Trophy points
- 18
- Activity points
- 2,633
Hey.
I have setup my 16F628A with INTOSC and CLKOUT function:
I have setup the circuit on the breadboard and added 100nF capacitor between VCC and VDD.
I have also setup "intosc + CLKOUT" config bit in mikroC PRO for PIC.
Now, I have measured the output waveform with the old analogue scope, and it shows a correct shape but period is 4.7 divs at 0.1uS time base, which means 0.47uS period, which is around 2.12MHz!
Even rounding to 5 divs - 0.5uS period gives 2MHz.
So now, my question is, am I mistaken with PIC configuration and it's infact generating the 2MHz square wave instead of 4MHz, or is there something wrong with my measurement?
I have setup my 16F628A with INTOSC and CLKOUT function:
Code:
// Precision internal 4 MHz oscillator factory calibrated to ±1%
void main() {
TRISA = 0; // set direction to be output
TRISB = 0; // set direction to be output
PCON.OSCF = 1; // Set internal oscillator frequency to 4 MHz
PCON = 0x08;
do {
PORTA = 0;
PORTB = 0;
Delay_ms(1000); // 1 second delay
PORTA = 0xff;
PORTB = 0xff;
Delay_ms(1000); // 1 second delay
} while(1); // Endless loop
}
I have setup the circuit on the breadboard and added 100nF capacitor between VCC and VDD.
I have also setup "intosc + CLKOUT" config bit in mikroC PRO for PIC.
Now, I have measured the output waveform with the old analogue scope, and it shows a correct shape but period is 4.7 divs at 0.1uS time base, which means 0.47uS period, which is around 2.12MHz!
Even rounding to 5 divs - 0.5uS period gives 2MHz.
So now, my question is, am I mistaken with PIC configuration and it's infact generating the 2MHz square wave instead of 4MHz, or is there something wrong with my measurement?