Problems setting config bits on 10F222 part


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Problems setting config bits on 10F222 part

    This is from memory and I've got no way of doublechecking right now but if you want to get to the bottom of it you can always check/verify/try.

    In the .inc file the __CONFIG is enclosed within an ASM/ENDASM block, it gets passed to the assembler as is and it is indented, as it should be.

    When you comment it out of the .inc file and put it in your source file you need to tell the compiler to pass that line to the assembler (just as is the case with the .inc file). You do this by either enclosing it within a ASM/ENDASM block or using the single line ASM directive, @, just as you tried.

    What I suspect happened in your case is that there is no space between the @ and the __CONFIG so __CONFIG ended up in column 1, hence the error (or is it actually only a warning?).

    So, comment it out of the .inc file, then in your source
    Code:
    ASM
       __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_ON & _IOFSCS_8MHZ   ; <---- Note the intendation
    ENDASM
    or
    Code:
    @   __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_ON & _IOFSCS_8MHZ   ; <---- Again, note the intendation
    /Henrik.
    Last edited by HenrikOlsson; - 19th September 2016 at 14:41.

  2. #2
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Problems setting config bits on 10F222 part

    I tend to use the ASM/ENDASM commands to set the config bits, for example (not related to your chip)

    Code:
    ASM 
      __CONFIG    _CONFIG1H, _OSC_HS_1H
      __CONFIG    _CONFIG2L, _PWRT_ON_2L  
      __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
      __CONFIG    _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H  
      __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ENDASM

  3. #3
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Problems setting config bits on 10F222 part

    Thanks Scampy,

    That worked. I was using #ASM & #ENDASM instead of ASM & ENDASM.

    Jim

  4. #4
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Problems setting config bits on 10F222 part

    Henrik,

    You are absolutely correct. I indented the entire line including the "@". It worked once I indented. I also tried the ASM/ENDASM without the "#" and that also worked.

    Thanks,
    Jim


    Quote Originally Posted by HenrikOlsson View Post
    This is from memory and I've got no way of doublechecking right now but if you want to get to the bottom of it you can always check/verify/try.

    In the .inc file the __CONFIG is enclosed within an ASM/ENDASM block, it gets passed to the assembler as is and it is indented, as it should be.

    When you comment it out of the .inc file and put it in your source file you need to tell the compiler to pass that line to the assembler (just as is the case with the .inc file). You do this by either enclosing it within a ASM/ENDASM block or using the single line ASM directive, @, just as you tried.

    What I suspect happened in your case is that there is no space between the @ and the __CONFIG so __CONFIG ended up in column 1, hence the error (or is it actually only a warning?).

    So, comment it out of the .inc file, then in your source
    Code:
    ASM
       __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_ON & _IOFSCS_8MHZ   ; <---- Note the intendation
    ENDASM
    or
    Code:
    @   __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_ON & _IOFSCS_8MHZ   ; <---- Again, note the intendation
    /Henrik.

Similar Threads

  1. how to loop thru setting port bits?
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th February 2013, 13:38
  2. 16f88 setting config
    By be80be in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th December 2012, 15:39
  3. Setting bits
    By bearpawz in forum General
    Replies: 9
    Last Post: - 28th November 2009, 00:37
  4. Configuration bits setting problem
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th August 2009, 17:25
  5. Trouble setting config. bits
    By jswayze in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th March 2004, 22:22

Members who have read this thread : 1

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