Timing problem PIC18F2550


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2011
    Posts
    2

    Default Timing problem PIC18F2550

    Hello,

    I recently bought microcode studio and the PBP compiler. I am using the U2 programmer to perform ICSP on my 18F2550 PIC. I can program the chip no problem however the timing is no where near correct. For example I programed an LED to blink every seven seconds and it was blinking around every 5-6 secs. I think that i have the options wrong in the melabs programmer configuration window. As far as ocsillators go i am using a 20MHz crystal oscillator. I know the hardware setup is correct because i used the same hardware a couple of years ago when i was using this stuff in highschool (forgot most of it by now).

    I was hoping someone could suggest the options i should use. I want to use the external 20MHz oscillator.

    Thanks,

    Eric

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Timing problem PIC18F2550

    I think you should read the datasheet. The chips with USB have a wide variety oscillator PLL and divider configuations. Your chip is obviously not runnng at 20Mhz - internally, even though the oscillator itself is running 20.
    Charles Linquist

  3. #3
    Join Date
    Mar 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Timing problem PIC18F2550

    Doesn't the meprogrammer have all the settings built into their little drop down menu? Therefore it should just be a matter of selecting the correct settings correct?

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Timing problem PIC18F2550

    Many come here thinking they can use the drop down and many end up learning how to set the configs the "right" way.

    This should help you get started on that path.
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: Timing problem PIC18F2550

    I must admit, programming for many years in ASM, I always set my configs through the MPLAB menu. Always worked great, and ALWAYS messed me up when I had to program more chips for the same job. Take the time to learn to set them in your program. You will hate it at first, but later you will be so happy when you don't have to remember how you set them for each application.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  6. #6
    Join Date
    Aug 2005
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Timing problem PIC18F2550

    Place
    Code:
    DEFINE OSC 48
    at the beginning of your code and you should be sorted.

    Cheers

    Sean.
    Last edited by sean-h; - 6th March 2011 at 11:21.
    *********************
    http://www.cncdudez.co.uk
    *********************

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts