how do I speed up an existing pic18f2525 program ?


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi,

    1) I do not think you have to modify the OSCTUNE register ...

    2) Place PAUSE 1000 AFTER " DEFINE OSC ..."

    3) You can use PLL x 4 Setting, with a 10 to 16 Mhz Xtal ... will give 40 to 64 Mhz Osc speed. Should be enough ...
    40 and 48 Mhz are commonly admitted ... 64 is experimental ... but works fine !!!

    You first have to change your 18F2525.inc file ( in the PBP/ INC folder ) for :

    Code:
    ;****************************************************************
    ;*  18F2525.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2008 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 09/15/08                                        *
    ;*  Version   : 2.60                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F2525, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F2525.INC" ; MPASM  Header
            ;__CONFIG    _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
            ;__CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            ;__CONFIG    _CONFIG3H, _CCP2MX_PORTC_3H & _PBADEN_OFF_3H 
    _LPT1OSC_OFF_3H & _MCLRE_ON_3H
            ;__CONFIG    _CONFIG4L,  _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L
      Messg " Think to WRITE the correct  CONFIGURATION ... "
      Messg " Think to WRITE the correct  CONFIGURATION ... "
      Messg " Think to WRITE the correct  CONFIGURATION ... "
            NOLIST
        endif
            LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 64
    THEN

    add to the top of your code, just past the Header :

    Code:
    '*****************************************************************************
    'Config processeur
    '*****************************************************************************
    @   __CONFIG    _CONFIG1H, _IESO_OFF_1H & _OSC_HSPLL_1H & _FCMEN_OFF_1H
    @   __CONFIG    _CONFIG2L, _BOREN_OFF_2L & _PWRT_ON_2L
    @   __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
    @   __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_PORTBE_3H
    @   __CONFIG    _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L & _XINST_OFF_4L
    @   __CONFIG    _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
    @   __CONFIG    _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    @   __CONFIG    _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
    @   __CONFIG    _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H 
    @   __CONFIG    _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
    @   __CONFIG    _CONFIG7H, _EBTRB_OFF_7H
    You'll have to use " DEFINE OSC xx " Where XX will be 4 x your choosen Xtal frequency.

    an also think to modify Serin2/Serout2 to match your Osc speed ...

    after that ... check your program flow ... if not enough !!!

    Alain
    Last edited by Acetronics2; - 1st November 2010 at 17:34.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Members who have read this thread : 1

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