+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2013
    Posts
    28

    Default Proper Technique of Setting Config Values

    Hello,

    What is the proper technique for setting configuration values?
    The below works fine, but, being all in one line, it is hard to read vs the older style below it.


    #CONFIG
    __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF & _BOD_ON & _IESO_OFF & _FCMEN_OFF & _PWRTE_ON


    #ENDCONFIG


    '@ DEVICE PIC16F684
    '@ DEVICE INTRC_OSC_NOCLKOUT
    '@ DEVICE WDT_OFF
    '@ DEVICE MCLR_OFF
    '@ DEVICE BOD_ON
    '@ DEVICE IESO_OFF
    '@ DEVICE FCMEN_OFF
    '@ DEVICE PWRT_ON

    Thanks,

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,819

    Default Re: Proper Technique of Setting Config Values

    Darrel showed me to do it this way in PBP, not PBP3 :
    16F690
    Code:
    @MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON  
    @MyConfig = MyConfig & _MCLRE_OFF & _BOR_OFF & _FCMEN_OFF & _IESO_OFF 
    @ __config  MyConfig
    Last edited by Archangel; - 3rd March 2015 at 23:48.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    Tyranny is defined when law enforcement is allowed to make the law.
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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

    Default Re: Proper Technique of Setting Config Values

    What is the proper technique for setting configuration values?
    The proper way is described in the manual and for a 16F part it IS the "one liner". Back in the day MELABS had their own assembler for which the @ DEVICE stuff you reference was used. PM is now obsolete and you need to use whatever Microchip dictates for their MPASM. The manual states:
    Microchip determines the form and syntax of the actual configuration directives, and they are not consistent for different families of PIC microcontrollers.
    So, with PBP3 and a 16F part you do it the one line way, for the 16F684:
    Code:
    #CONFIG
       __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
    #ENDCONFIG
    Which, I suppose you could "extend" to what Arcangel is showing (not tested and IMHO more cluttered than the oneliner)
    Code:
    @MyConfig = _INTRC_OSC_NOCLKOUT
    @MyConfig = MyConfig & _WDT_ON
    @MyConfig = MyConfig & _MCLR_ON
    @MyConfig = MyConfig & _CP_OFF
    
    #CONFIG
       __config MyConfig
    #ENDCONFIG
    For 18F parts it's more like the way it was with the PM assembler:
    Code:
    #config
      CONFIG FOSC = HS
      CONFIG WDTEN = OFF
      CONFIG PWRT = ON
      CONFIG BOREN = OFF
      CONFIG PBADEN = OFF
      CONFIG MCLRE = OFF
      CONFIG LVP = OFF
      CONFIG DEBUG = OFF
      CONFIG XINST = OFF
    #endconfig
    /Henrik.

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,819

    Default Re: Proper Technique of Setting Config Values

    Reply: It IS more cluttered BUT for those who have both poor vision and do not use a wide
    screen monitor it allows you to string
    the configs across several lines . . .
    And it IS tested, I use it on a regular basis. I have PBP3 but use PBP2.6c mostly because I use simpler PICs
    and do not want to fritz with PBP3 s configs . . .
    Last edited by Archangel; - 3rd March 2015 at 23:47.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    Tyranny is defined when law enforcement is allowed to make the law.
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  5. #5
    Join Date
    Jul 2013
    Posts
    28

    Default Re: Proper Technique of Setting Config Values

    Well, I did ask but am disappointed.
    Yes, that alternate method is even more cluttered and confusing.
    Raises more rule questions than the awkward but more clearer one-liner.

    Not being as sophisticated as you all, I strive for consistency in formatting,
    hoping that anything "messy" has not been thought through yet by me.

    Thanks!

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    633

    Default Re: Proper Technique of Setting Config Values

    Quote Originally Posted by Zebryk View Post
    Well, I did ask but am disappointed.
    Yes, that alternate method is even more cluttered and confusing.
    Raises more rule questions than the awkward but more clearer one-liner.

    Not being as sophisticated as you all, I strive for consistency in formatting,
    hoping that anything "messy" has not been thought through yet by me.

    Thanks!
    Well, you can always use the U2 Melabs programmer and the software that comes with it. It is very easy to use.

    http://store.melabs.com/prod/u2/U2.html

    Name:  config_window.bmp
Views: 137
Size:  104.4 KB
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  7. #7

    Default Re: Proper Technique of Setting Config Values

    If you you use the programmer to set the fuses, how do you remember what they were 3 months later?

    George

Similar Threads

  1. setting values and percentages
    By Scampy in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 4th July 2014, 10:33
  2. 16f88 setting config
    By be80be in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th December 2012, 15:39
  3. setting config fuses not working
    By queenidog in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd April 2012, 14:30
  4. BUSY line technique
    By Demon in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 3rd December 2005, 12:33
  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 : 0

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