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,
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
Re: Proper Technique of Setting Config Values
Quote:
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:
Quote:
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.
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 . . .
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!
1 Attachment(s)
Re: Proper Technique of Setting Config Values
Quote:
Originally Posted by
Zebryk
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
Attachment 7723
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