PIC16f877a Oscillator Frequency problem

Discussion in 'Embedded Systems and Microcontrollers' started by lloydi12345, Dec 23, 2010.

  1. lloydi12345

    Thread Starter Member

    Aug 15, 2010
    103
    0
    I am programming in MikroC PRO and the first try was having 4Mhz external crystal and 4Mhz on software setting. It was so slow. I tried changing the software setting to 8Mhz but still slow (although a lot faster than 4Mhz software setting). I changed the software setting from 16, 32, 40 but nothing changed.

    I tried changing XT oscillator on the hardware. I compared the speed of 4Mhz crystal and 20Mhz crystal with a software setting of 8Mhz, they are just the same. Changing the software clock setting to 4Mhz makes the program execute slower again. Help me please? How can I achieve faster execution time (except from changing the program delays to faster one). :(
     
  2. lloydi12345

    Thread Starter Member

    Aug 15, 2010
    103
    0
    Okay finally I got it working. I can't determine what's wrong with it before. I changed the external oscillator to 20Mhz. The strange thing is that, it only executes the first few lines of the program then freezes, I tried touching the leg of the 16Mhz oscillator with the leg of 4Mhz on the PIC's Osc out pin and it executed the program faster. I ended up soldering one of the leg of 4Mhz to one of the leg of 20Mhz on the OSC out side of the PIC. It looks messy looking at two crystal oscillator touching each other. Can you explain to me the problem?
     
Loading...