Long config line


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115

    Default Long config line

    Well, it might sound stupid but, how can I break this long configuration line in two as it is too long to be printed or displayed on-screen? This line compiles OK:

    @ __CONFIG _CONFIG1, _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_ON & _CP_ON & _MCLRE_ON & _PWRTE_ON & _WDT_ON & _HS_OSC


    The idea of multiple @ __CONFIG lines won't work:

    @ __CONFIG _CONFIG1, _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF
    @ __CONFIG _CONFIG1, _BOR_ON & _CP_ON & _MCLRE_ON & _PWRTE_ON & _WDT_ON & _HS_OSC

    It produces an Overwriting previous address contents (2007) error.

    Thanks for the care,
    Ioannis

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    It won't work the way you want it to work... Not all of those CONFIG options are location in CONFIG1, some are located CONFIG2L, CONFIG2H, and so on and so on...
    And since I'm not 100% sure which PIC you're using, I can't tell you which option goes where.
    This is one of my old config setups for a PIC18F4620.
    Code:
    @ __CONFIG    _CONFIG1H, _OSC_HSPLL_1H & _FCMEN_ON_1H & _IESO_ON_1H
    	;_HSC_1H=HS, HSPLL_1H=PLL	'4xPLL on, failsafe/switch-over on
    @ __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOREN_OFF_2L & _BORV_3_2L
    	;powerup timer on, brown out off
    @ __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_32768_2H
    	;'wdt off
    @ __CONFIG    _CONFIG3H, _MCLRE_OFF_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_PORTC_3H
    	;mclr is i/o, t1osc off, porta digital
    @ __CONFIG    _CONFIG4L, _STVREN_OFF_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    	;stack overflow , lvp off, xinst off, debug off
    @ __CONFIG    _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
    	;all code protection, eeprom write protection off
    @ __CONFIG    _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    @ __CONFIG    _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
    @ __CONFIG    _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H
    @ __CONFIG    _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
    @ __CONFIG    _CONFIG7H, _EBTRB_OFF_7H
    EDIT: Just noticed the 'Overwriting.....(2007) error... So, yes, it is a 16F... Kinda hard to get that error with an 18F...
    Last edited by skimask; - 6th October 2008 at 23:21.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    I won't work the way you want it to work... Not all of those CONFIG options are location in CONFIG1, some are located CONFIG2L, CONFIG2H, and so on and so on...
    And since I'm not 100% sure which PIC you're using, I can't tell you which option goes where.
    This is one of my old config setups for a PIC18F4620.
    It will work the way he want's it.
    Almost all the options are in the CONFIG1 word.
    There are no CONFIG2L or H. Because even though I'm not 100% sure which PIC he's using.
    I'm 100% sure it's a 16F.
    Code:
    @MyConfig = _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_ON 
    @MyConfig = MyConfig  & _CP_ON & _MCLRE_ON & _PWRTE_ON & _WDT_ON & _HS_OSC
    @ __CONFIG _CONFIG1, MyConfig
    DT

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    Thanks for the replies. Sorry I forgot to mention the MCU, that is 16F887... I did it like a newbie!

    Well, the solution of Darrels is clever. Where is this trick described? On MPASM manual maybe?

    Thanks,
    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    Probably won't find it in a manual. It's just a single value.

    When you do something like ...

      __CONFIG _CONFIG1, _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_ON

    You might as well put a couple parenthesis around everything ...

      __CONFIG _CONFIG1, (_DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_ON)

    Because you're really only giving it a single value.

    So you are free to figure out that value on your own, before supplying it to the __CONFIG statement.

    Binary Math, it's a wonderful diversion.
    <br>
    DT

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    Suddenly there was light!

    Yeah, that '&' is really a binary addition to the total value to be placed at 2007 address...

    All are simple and easy now!

    Thanks,
    Ioannis

Similar Threads

  1. 18F4550 Bootloader enter via eeprom setting
    By bradb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 23:51
  2. Error 0X0000008E when connecting a 18F2550 USB HID
    By FranciscoMartin in forum USB
    Replies: 8
    Last Post: - 16th October 2008, 17:20
  3. PortE problems (PIC18F4455)
    By RubenR in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 12th July 2006, 15:26
  4. Installation sequence
    By Demon in forum General
    Replies: 23
    Last Post: - 11th July 2006, 03:56
  5. having problems with Hantronix 20x4 lcd
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 22nd December 2005, 12:22

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