18f4550 running slow?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 18f4550 running slow?

    melabs has replied (yesterday), maybe you didn't get the email.

    And nothing you've reported "Points to" DEFINE OSC.
    What it does suggest is a problem with your oscillator.

    If IESO is 0 then the code fails to run totally. When it's set, the whole thing is much slower than expected.
    IESO is the "Internal/External Oscillator Switchover bit".
    Meaning that on power-up it starts running on the internal oscillator, then when the external oscillator is running and stable it switches over to that.
    If the external oscillator is not running properly, it never switches over.

    The default (power-on) frequency of the internal oscillator is 1 Mhz, so with DEFINE OSC 20 it will take 20 seconds to execute a PAUSE 1000. And everything else will run at 1/20th speed too.

    You say that you are swapping between a 2550 and 4550.
    The pins are different. Are you sure you have the crystal and caps on the correct pins after swapping.
    On the 2550, it's pins 9 and 10. On the 4550 it's pins 13 and 14.

    The 2550 only has one VDD pin and the 4550 has two. Are you connecting both VDD's.
    DT

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: 18f4550 running slow?

    Try this:

    Code:
    @   __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @   __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    @   __CONFIG    _CONFIG2L, _PWRT_OFF_2L & _BOR_ON_2L & _BORV_1_2L & _VREGEN_ON_2L
    @   __CONFIG    _CONFIG2H, _WDT_OFF_2H
    @   __CONFIG    _CONFIG3H, _CCP2MX_OFF_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
    @   __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    
    DEFINE OSC 48
    
    TRISA = %00000000
    TRISB = %00000000
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %00000000
    
    ADCON1 = %00001111
    
    Led var PORTC.2
    
    Loopthis:
      toggle Led
      pause 500
      goto LoopThis
    
    END
    It blinks at 1 second intervals on my 18F4550 using external 20 MHz oscillator.

    Robert

  3. #3
    Join Date
    Aug 2005
    Posts
    27


    Did you find this post helpful? Yes | No

    Default Re: 18f4550 running slow?

    I stand corrected. MELabs did reply [thanks Darrel], and the mail somehow found its way into my spam folder?

    By way of an apology, sorry if it sounded like I was complaining. I most certainly was not. Their support, when I've contacted them in the past, has been immediate, and first rate. I only mentioned it above in case anybody asked if I'd contacted them.

    Darrel sent the following fuse settings, which worked! Thought I'd tried every combination, but obviously had not. Thank you Darrel !

    G

    p.s. Thanks too, to Demon, for your settings example, and everybody else that took time out to help a confused hobbyist!

    #CONFIG
    CONFIG PLLDIV = 5 ; Divide by 5 (20 MHz oscillator input)
    CONFIG CPUDIV = OSC1_PLL2 ; [Primary Oscillator Src: /1][96 MHz PLL Src: /2]
    CONFIG USBDIV = 2 ; USB clock source comes from the 96 MHz PLL divided by 2
    CONFIG FOSC = HS ; HS oscillator, PLL enabled (HSPLL)
    CONFIG FCMEN = OFF ; Fail-Safe Clock Monitor disabled
    CONFIG IESO = OFF ; Oscillator Switchover mode disabled
    CONFIG PWRT = OFF ; PWRT disabled
    CONFIG BOR = ON ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
    CONFIG BORV = 3 ; Minimum setting
    CONFIG VREGEN = ON ; USB voltage regulator enabled
    CONFIG WDT = ON ; WDT enabled
    CONFIG WDTPS = 512 ; 1:512
    CONFIG CCP2MX = ON ; CCP2 input/output is multiplexed with RC1
    CONFIG PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset
    CONFIG LPT1OSC = OFF ; Timer1 configured for higher power operation
    CONFIG MCLRE = ON ; MCLR pin enabled; RE3 input pin disabled
    CONFIG STVREN = ON ; Stack full/underflow will cause Reset
    CONFIG LVP = OFF ; Single-Supply ICSP disabled
    CONFIG ICPRT = OFF ; ICPORT disabled
    CONFIG XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    CONFIG DEBUG = OFF ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
    #ENDCONFIG
    Last edited by Giulio; - 18th October 2012 at 09:12.

  4. #4
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Re: 18f4550 running slow?

    Which fuse made the difference to your problem?

  5. #5
    Join Date
    Aug 2005
    Posts
    27


    Did you find this post helpful? Yes | No

    Default Re: 18f4550 running slow?

    Well, that's poor form on my behalf, as I'm not sure!

    I was changing them in mplab, trying every combination [or so I though], but not keeping track, which is a 'random' approach to solving a problem, and nothing to be proud of.

    My frustration got the better of me. I shall remove the settings that Darrel sent me, and have a look at the default, and see what happens, as I should be documenting this, for my own reference...

    G

Similar Threads

  1. 18F4550 not running
    By comwarrior in forum General
    Replies: 6
    Last Post: - 1st January 2011, 02:07
  2. Replies: 7
    Last Post: - 20th December 2010, 20:43
  3. DT Interrupt and Elapsed Time Running Slow
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 11th May 2009, 19:00
  4. 16-48 pin Multi slow PWM
    By krohtech in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th March 2009, 04:28
  5. PIC18F2431 Running Super SLow!!
    By Philip Biebach in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th July 2006, 13:03

Members who have read this thread : 0

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

Posting Permissions

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