Conditional default config's


Results 1 to 11 of 11

Threaded View

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


    Did you find this post helpful? Yes | No

    Default Re: Conditional default config's

    Bert,

    Comment out the default configs in the .inc file like normal.
    Code:
    ;****************************************************************
    ;*  18F4520.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2010 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 05/21/10                                        *
    ;*  Version   : 2.60a                                           *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F4520, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F4520.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
            NOLIST
        endif
            LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 32
    Copy the defaults or create your own in a .cfg file like this ...

    18F4520.cfg
    Code:
    ASM
      ifndef CONFIGOVERRIDE
        __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
      endif
    ENDASM
    INCLUDE that file from the .bas file
    Code:
    '****************************************************************
    '*  18F4520.BAS                                                 *
    '*                                                              *
    '*  By        : Leonard Zerman, Jeff Schmoyer                   *
    '*  Notice    : Copyright (c) 2004 microEngineering Labs, Inc.  *
    '*              All Rights Reserved                             *
    '*  Date      : 12/29/04                                        *
    '*  Version   : 2.46                                            *
    '*  Notes     :                                                 *
    '****************************************************************
    BANKA   $0000, $007F
    BANK0   $0080, $00FF
    BANK1   $0100, $01FF
    BANK2   $0200, $02FF
    BANK3   $0300, $03FF
    BANK4   $0400, $04FF
    BANK5   $0500, $05FF
    'EEPROM  $F00000, $F000FF
    LIBRARY "PBPPIC18"
            include "PIC18EXT.BAS"
    PORTL   VAR     PORTB
    PORTH   VAR     PORTC
    TRISL   VAR     TRISB
    TRISH   VAR     TRISC
            include "PBPPIC18.RAM"
            include "18F4520.cfg"
    '*----------------------* EOF 18F4520.BAS *---------------------*
    Then in your main program, you can do what you wanted.
    Code:
    DEFINE CONFIGOVERRIDE
    ASM
        __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
    ENDASM
    HTH,
    Last edited by Darrel Taylor; - 8th May 2011 at 01:58.
    DT

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