+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2007
    Posts
    37

    Question Clarification need about #CONFIG...#ENDCONFIG / asm ...endasm.

    Hi

    I'm using MCS 5.0.0.3 & PBP 3.0.6.1 (trial version).

    I have a big doubt about the #CONFIG...#ENDCONFIG

    On the Darrel Taylor USB sample program (USB.pbp) there are:
    Code:
    ;--- if you un-comment these, you must comment the ones in the .inc file ---
    asm  ; 18F2550/4550, 8mhz crystal
       __CONFIG    _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
       __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
       __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    endasm
    and on the related file: "C:\PBP3\DEVICES\PIC18F4550.PBPINC" file there are
    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;  The #CONFIG block is passed directly to the asm file, but PBP will replace it
    ;  automagically with the contents of a user-defined #CONFIG block if one is
    ;  found in the PBP source program.  There is no need to edit or comment this 
    ;  block in this file.  Simply copy it to your source program and edit it there.
    
    #CONFIG
            __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_3_2L & _VREGEN_ON_2L
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG3H, _CCP2MX_ON_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
            __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
    #ENDCONFIG
    :

    And the PBP3 manual say:
    Code:
    The #CONFIG block is similar to the ASM..ENDASM and @ runtime commands
    because its contents are written in Assembly Language. It is a special case,
    however, and differs from the runtime commands in significant ways. The code
    enclosed in a #CONFIG block always replaces the default configuration settings
    that PBP would normally include. The code is placed in a special location in the
    generated Assembly Language. This location is reserved for configuration
    directives; therefore #CONFIG should not be used for other Assembly instructions.
    That seem self explicative; if I leave all as is. I should compile the program without any trouble, but this is not true. When I compile I see the following:
    Code:
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 301 : Overwriting previous address contents (0000)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 301 : Overwriting previous address contents (0001)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 302 : Overwriting previous address contents (0000)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 302 : Overwriting previous address contents (0001)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 303 : Overwriting previous address contents (0002)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 303 : Overwriting previous address contents (0003)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 304 : Overwriting previous address contents (0002)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 304 : Overwriting previous address contents (0003)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 305 : Overwriting previous address contents (0004)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 305 : Overwriting previous address contents (0005)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 306 : Overwriting previous address contents (0006)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\USB_PIC\USB.ASM 306 : Overwriting previous address contents (0007)
    I need to improve my understand on english language or there are actions that I do not have done?

    Leo

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,259

    Default Re: Clarification need about #CONFIG...#ENDCONFIG / asm ...endasm.

    Hi,
    The #CONFIG/#ENDCONFIG was introduced in PBP3 and the first piece of code you posted was written when the CONFIG was handled in a different way.
    If you have a config block within ASM/ENDASM and compile it with PBP3 you will get the error message that you get because PBP3 then it then tries to use "both" the default configuration from the .PBPINC file AND the ones in the ASM/ENDASM block - kind of.

    If you want to use the configuration in the first piece of code then simply change ASM to #CONFIG and ENDASM to #ENDCONFIG. It'll then use that configuration instead of the defauly and I think you'll be fine.

    /Henrik.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,259

    Default Re: Clarification need about #CONFIG...#ENDCONFIG / asm ...endasm.

    Hi,
    (This is very weird, I posted an answer to this thread but it just disapeared. So, here's a second attempt)

    #CONFIG/#ENDCONFIG was introduced with PBP3. The first code snippet shows the old way of handling the config (which required the default ones to be commented out).
    You get the errors because it now tries to use the default ones and the ones within the ASM/ENDASM block. Change ASM/ENDASM to #CONFIG/#ENDCONFIG and it will use the ones within the block instead of the default ones. The errors should then go away.

    /Henrik.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,914

    Default Re: Clarification need about #CONFIG...#ENDCONFIG / asm ...endasm.

    I see the post you did Henrik as moderated. Maybe that is why you do not see it.

    Ioannis


    Edit by Robert:

    Weird, even this post was awaiting to be moderated.

  5. #5
    Join Date
    Feb 2007
    Posts
    37

    Default Re: Clarification need about #CONFIG...#ENDCONFIG / asm ...endasm.

    Thanks HenrikOllson

    I have made the modification as you say and "automagically" all woks.

    I will become crazy without your help.

    Thanks again.
    Last edited by Wirecut; - 7th April 2013 at 00:52.
    Leo

Similar Threads

  1. DT_INT Vs ASM - Round 1
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th January 2013, 21:33
  2. #config...#endconfig
    By ptig185 in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 7th September 2012, 07:17
  3. Pro upgrade clarification
    By fowardbias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th January 2010, 21:17
  4. question about how to implement ASM and ENDASM
    By karenhornby in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th March 2008, 09:21
  5. Asm...Endasm
    By Socal in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th April 2007, 05:27

Members who have read this thread : 2

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

Tags for this Thread

Posting Permissions

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