Hi everyone
I was trying to blink led with external 8MHz oscillator but i cant succeed. I wrote the code in microC Pro and given below:
void main() {
TRISD= 0;
ANSELD=0;
do{
LATD = 0x00;
Delay_ms(300);
LATD = 0xFF;
Delay_ms(300);
}while(1);
}
Maybe i choose wrong oscillator selection. Did i connect oscillator correctly.
Configuration is given in the picture:
Here is circuit:
How can i make it work. I tried with internal 16MHz oscillator and its working fine but its too slow. i needed to increase it till 32MHz
Schematic is not complete (no power to the PIC), but no error in the partial schematic shown.
Attached is complete working project folder - proven good.
Guess the problem must be with your hardware..... how about posting a photo of your actual hardware?
Make sure that connections to the crystal and 22pF capacitors are very short in length. Leads longer than a centimetre or two may cause oscillator to fail.
Don't forget that the PIC18F family use 4 clock pulses for each instruction.
I don't know how your delay function works but if it is counting cycles then this may explain why you are getting a longer time than expected.
Susan
External crystals will never be simulated. Stop posting that again and again. Frequency specified in model parameters. No external components needed. It is digital model. Don't mix it with analog one!