18F4520 XTAL Flashing LED speed

Discussion in 'General Electronics Chat' started by camerart, Nov 26, 2015.

  1. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi,

    I have timing errors with a LED flash, on 18F4520 PIC

    I have a circuit with these PICs using internals 8mHz timing. I am having problems as there is a start-up LED flash ON/OFF, that appeared to be going far too fast.

    I made a simple circuit board, with a 20mHz Crystal plus Caps. The MCLR is 10K pulled-up. And a LED. With a simple program (LVP disabled) and a goto loop (LED on, waitms 1000, LED off, waitms 1000) The LED flashes at 75 ons and 75 offs/min. The crystal shows 20mHz on an oscilloscope.

    Any ideas please.

    Camerart.
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,870
    996
    Where is your schematic?

    Where is your code?


    This should be posted in the embedded forum.
     
  3. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi s,

    While checking the correct program to post, I noticed I had:
    (Define CLOCK_FREQUENCY = 20 'Was 8) at the top
    and farther down the program:
    (Define CLOCK_FREQUENCY = 8)

    It's flashing at the correct speed now, thanks.

    P.S. what does embedded forum mean?

    C.
     
    Last edited: Nov 26, 2015
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,870
    996
  5. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    All good, thanks.

    C.
     
Loading...