#config length ?


Closed Thread
Results 1 to 8 of 8

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: #config length ?

    If the chip only has one config word, you don't specify the word's name because it doesn't have one.
    For chips with more than one config word, you must specify the word with _CONFIG1 or _CONFIG2 etc.

    If you like commenting everthing really well, you can do the configs like this ...
    Code:
    #if __PROCESSOR__ = "16F1828"
        #config
    CFG =       _FOSC_INTOSC         ; Oscillator
    CFG=CFG&    _WDTE_ON             ; Watch Dog Timer 
    CFG=CFG&    _PWRTE_OFF           ; Power-on Timer
    CFG=CFG&    _MCLRE_OFF           ; Master Clear Reset
    CFG=CFG&    _CP_ON               ; Code Protect
    CFG=CFG&    _CPD_OFF             ; EEPROM Data Protect
    CFG=CFG&    _BOREN_OFF           ; Brown-out Detect
    CFG=CFG&    _CLKOUTEN_OFF        ; FOSC/4 Output
    CFG=CFG&    _IESO_OFF            ; Internal External Switchover
    CFG=CFG&    _FCMEN_OFF           ; Fail-Safe Clock Monitor
       __CONFIG _CONFIG1, CFG
     
    CFG =       _WRT_OFF             ; Flash table writes
    CFG=CFG&    _PLLEN_OFF           ; 4xPLL OSC multiplier
    CFG=CFG&    _STVREN_OFF          ; Stack Over/Underflow
    CFG=CFG&    _BORV_25             ; Brown-out voltage
    CFG=CFG&    _LVP_OFF             ; Low Voltage Programming
       __CONFIG _CONFIG2, CFG
        #endconfig
    #else
        #IF __PROCESSOR__ = "16F690"
        #config
    CFG =       _INTRC_OSC_NOCLKOUT  ; Oscillator
    CFG=CFG&    _WDT_ON              ; Watch Dog Timer
    CFG=CFG&    _PWRTE_OFF           ; Power-on Timer
    CFG=CFG&    _MCLRE_OFF           ; Master Clear Reset
    CFG=CFG&    _CP_ON               ; Code Protect
    CFG=CFG&    _CPD_OFF             ; EEPROM Data Protect
    CFG=CFG&    _BOD_OFF             ; Brown-out Detect
    CFG=CFG&    _IESO_OFF            ; Internal External Switchover
    CFG=CFG&    _FCMEN_OFF           ; Fail-Safe Clock Monitor
      __CONFIG  CFG
        #endconfig
        #else
            #error "Program does not support " + __PROCESSOR__
        #endif
    #endif
    #msg "compiling for target " + __PROCESSOR__
    DT

  2. #2
    Join Date
    Aug 2004
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: #config length ?

    Hi:
    Thanks Steve, it works now !.
    Greetings...
    Ruben de la Pena Valdes.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: #config length ?

    Still doable the long way, still easy though
    Code:
           ASM                  
                              
           __CONFIG _CONFIG1, B'11111101010100'                     
                              ; 1------------- CP:    Code Protection off
                              ; -1------------ CPMX:  CCP1 on RB0 
                              ; --1----------- DEBUG: Disabled.  RB<7:6> are general purpose i/o
                              ; ---11--------- WRT:   Write Protection off
                              ; -----1-------- CPD:   Code Protection off
                              ; ------0------- LVP:   Disabled.  RB3 Is General I/O
                              ; -------1------ BOREN: Enable Brown Out Reset
                              ; --------0----- MCLRE: Disable MCLR, RA5 Is digital I/O
                              ; ----------0--- PWRTE: Enable Power-Up Timer
                              ; -----------1-- WDTEN: Enable Watch Dog Timer
                              ; ---------1--00 FOSC:  INTRC, NOCLKOUT 
    
           __CONFIG _CONFIG2, b'11111111111100'
                              ; xxxxxxxxxxxx-- unimplemented
                              ; ------------0- IESO: Disable Internal/External Swichover
                              ; -------------0 FCMEN: Disable Fail-Safe Clock Monitor
                              
           ENDASM
    Not too hot with that method, but neat
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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