Searching \ for '[PIC] Config Bits Puzzle' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Config Bits Puzzle'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Config Bits Puzzle'
2006\02\05@075653 by Phil Cross

picon face
I am using an 18F452, and am a novice, so please forgive me if I am being
stupid.

I used to use __CONFIG commands for setting config bits, and put up with the
resultant warnings. However, I just decided to try the newer CONFIG
commands. My programmer now tells me I have a FUSE error in my HEX file.

I used MPLAB IDE V7.30 "configure/configuration bits" command to look at
what the bits had been set to. They are different, and maybe I'm missing
something, but for the life of me I can't undertand why. To expand on this:

OLD:
 __CONFIG        _CONFIG1H,        _OSCS_OFF_1H & _HSPLL_OSC_1H
"configure/configuration bits" shows:
   30001    FE     Oscillator                    HS-PLL Enabled
                            Osc, switch enable    Disabled

Looking at the PIC18FXX2 manual, the value FE makes no sense to me. And yet
my programmer programs this OK, and the program runs OK - correct oscillator
speed, too.

NEW:
 CONFIG        OSC =HSPLL        ; Use HS PLL osc.
 CONFIG        OSCS=OFF        ; Disable osc. switching.
"configure/configuration bits" shows:
   30001    26     Oscillator                    HS-PLL Enabled
                            Osc, switch enable    Disabled

Looking at the PIC18FXX2 manual, the value 26 looks correct.  However, my
programmer tells me I have a FUSE error, and won't program my chip.

All the other values are wildly different too - I just chose the first one
as an example.

Please could someone enlighten me? I would be very grateful.

Regards,
Phil Cross


2006\02\05@081137 by John Nall

picon face
Phil Cross wrote:
> I am using an 18F452, and am a novice, so please forgive me if I am being
> stupid.
>
> I used to use __CONFIG commands for setting config bits, and put up with the
> resultant warnings. However, I just decided to try the newer CONFIG
> commands. My programmer now tells me I have a FUSE error in my HEX file.
>
> I used MPLAB IDE V7.30 "configure/configuration bits" command to look at
> what the bits had been set to. They are different, and maybe I'm missing
> something, but for the life of me I can't undertand why. To expand on this:
>  

Did you look at the P18F452.INC file (on my system, located at
c:\Program Files\Microchip\MPASM Suite\)?  That has all the CONFIG
options.  Perhaps that might give you a clue.  (I still use the old
__CONFIG commands myself, so am not familiar with the new options -- but
starting with the include file would be what I would do).

Regards,
John

2006\02\05@082139 by Rolf

face picon face
Let me guess... your programmer is one of the DIY Kit 128/149/150/182 types.

In MPLab, after a successful compile, Go to File->Export->OK

Choose a different HEX File name, and use that to load MicroPro

Obviously, if you are not using the above programmer, ignore this reply....

Rolf

Phil Cross wrote:
{Quote hidden}

2006\02\05@085541 by Tom Sefranek

face picon face
;******************************************************************************
;       Filename:       F452Conf.inc                 Part of
MCA.asm          *
;       Date:          
12/08/2005                                            *
;                                                                            
*
;    Author:  Thomas C. J.
Sefranek                                           *
;    Company: NeuroPhysics
Corp                                               *
;             900 Mount Laurel
Circle                                          *
;             Shirley, Massachussetts  
01464                                   *
;                                                                          
   *
;   IMPORTANT: For the PIC18 devices, the __CONFIG directive has
been         *
;              superseded by the CONFIG
directive.                            *
;******************************************************************************
;   Oscillator Selection:
;     OSC = LP             LP
;     OSC = XT             XT
;     OSC = HS             HS
;     OSC = RC             RC
;     OSC = EC             EC-OSC2 as Clock Out
;     OSC = ECIO           EC-OSC2 as RA6
   CONFIG     OSC = HSPLL    ;      HS-PLL Enabled
;     OSC = RCIO           RC-OSC2 as RA6
;
;   Osc. Switch Enable:
;     OSCS = ON            Enabled
   CONFIG     OSCS = OFF      ;     Disabled
;
;   Power-up Timer:
   CONFIG     PWRT = ON     ;      Enabled
;     PWRT = OFF           Disabled
;
;   Brown-out Reset:
;     BOR = OFF            Disabled
   CONFIG     BOR = ON      ;       Enabled
;
;   Brown-out Voltage:
;     BORV = 45            4.5V
   CONFIG     BORV = 42    ;        4.2V
;     BORV = 27            2.7V
;     BORV = 25            2.5V
;
;   Watchdog Timer:
   CONFIG     WDT = OFF       ;     Disabled
;     WDT = ON             Enabled
;
;   Watchdog Postscaler:
;     WDTPS = 1            1:1
;     WDTPS = 2            1:2
;     WDTPS = 4            1:4
;     WDTPS = 8            1:8
;     WDTPS = 16           1:16
;     WDTPS = 32           1:32
;     WDTPS = 64           1:64
   CONFIG      WDTPS = 128     ;     1:128
;
;   CCP2 MUX:
;     CCP2MUX = OFF        Disable (RB3)
   CONFIG      CCP2MUX = ON     ;    Enable (RC1)
;
;   Stack Overflow Reset:
;     STVR = OFF           Disabled
   CONFIG      STVR = ON     ;       Enabled
;
;   Low Voltage ICSP:
   CONFIG      LVP = OFF      ;      Disabled
;     LVP = ON             Enabled
;
;   Background Debugger Enable:
;     DEBUG = ON           Enabled
   CONFIG      DEBUG = OFF    ;      Disabled
;
;   Code Protection Block 0:
;     CP0 = ON             Enabled
   CONFIG      CP0 = OFF     ;       Disabled
;
;   Code Protection Block 1:
;     CP1 = ON             Enabled
   CONFIG      CP1 = OFF     ;       Disabled
;
;   Code Protection Block 2:
;     CP2 = ON             Enabled
   CONFIG      CP2 = OFF      ;      Disabled
;
;   Code Protection Block 3:
;     CP3 = ON             Enabled
   CONFIG      CP3 = OFF      ;      Disabled
;
;   Boot Block Code Protection:
;      CPB = ON       ;      Enabled
   CONFIG    CPB = OFF      ;      Disabled
;
;   Data EEPROM Code Protection:
;     CPD = ON             Enabled
   CONFIG      CPD = OFF      ;      Disabled
;
;   Write Protection Block 0:
;     WRT0 = ON            Enabled
   CONFIG      WRT0 = OFF      ;     Disabled
;
;   Write Protection Block 1:
;     WRT1 = ON            Enabled
   CONFIG      WRT1 = OFF       ;    Disabled
;
;   Write Protection Block 2:
;     WRT2 = ON            Enabled
   CONFIG      WRT2 = OFF        ;   Disabled
;
;   Write Protection Block 3:
;     WRT3 = ON            Enabled
   CONFIG      WRT3 = OFF       ;    Disabled
;
;   Boot Block Write Protection:
   CONFIG      WRTB = ON        ;    Enabled
;    CONFIG      WRTB = OFF       ;    Disabled
;
;   Configuration Register Write Protection:
;     WRTC = ON            Enabled
   CONFIG      WRTC = OFF       ;    Disabled
;
;   Data EEPROM Write Protection:
;     WRTD = ON            Enabled
   CONFIG      WRTD = OFF       ;    Disabled
;
;   Table Read Protection Block 0:
;     EBTR0 = ON           Enabled
   CONFIG      EBTR0 = OFF      ;    Disabled
;
;   Table Read Protection Block 1:
;     EBTR1 = ON           Enabled
   CONFIG      EBTR1 = OFF      ;    Disabled
;
;   Table Read Protection Block 2:
;     EBTR2 = ON           Enabled
   CONFIG      EBTR2 = OFF        ;  Disabled
;
;   Table Read Protection Block 3:
;     EBTR3 = ON           Enabled
   CONFIG      EBTR3 = OFF      ;    Disabled
;
;   Boot Block Table Read Protection:
;     EBTRB = ON           Enabled
   CONFIG      EBTRB = OFF      ;    Disabled
;

--
 *
 |  __O    Thomas C. Sefranek   spam_OUTWA1RHPTakeThisOuTspamARRL.net
 |_-\<,_   Amateur Radio Operator: WA1RHP  
 (*)/ (*)  Bicycle mobile on 145.41, 448.625 MHz

hamradio.cmcorp.com/inventory/Inventory.html
http://www.harvardrepeater.org


2006\02\05@102928 by Jan-Erik Soderholm

face picon face
Phil Cross wrote :

> NEW:
>   CONFIG        OSC =HSPLL        ; Use HS PLL osc.
>   CONFIG        OSCS=OFF        ; Disable osc. switching.


Where are the rest ?

*Always* specify *all* config options.

(And I'm sure you've already found them at the
end of the INC file, right ?)

Regards,
Jan-Erik.



2006\02\05@215327 by Chen Xiao Fan

face
flavicon
face

> From: .....piclist-bouncesKILLspamspam@spam@mit.edu
> [piclist-bouncesspamKILLspammit.edu] On Behalf Of Jan-Erik Soderholm
> Sent: Sunday, February 05, 2006 11:29 PM
>
> Phil Cross wrote :
>
> > NEW:
> >   CONFIG        OSC =HSPLL        ; Use HS PLL osc.
> >   CONFIG        OSCS=OFF        ; Disable osc. switching.
>
> Where are the rest ?
>
> *Always* specify *all* config options.
>

I think this is a good point for 18F. Unfortunately,
Microchip provides many samples (with MPLAB C18)
without doing this.

For absolute mode assembly code and they even provide the
default values inside the final hex file for those config
options not specified at the source.

It is also worth to take note that MPASM/MPLINK allow the
config word to split across files in the relocatable mode.
In that case, it will not fill in the default values in the
final hex file. I can not think why one wants to put
configuration word though.

For MPLAB C18, it seems to me that it produces hex file
without filling the default configuration values (in
consisent with the relocatable mode assembly).

Regards,
Xiaofan

2006\02\06@044703 by Phil Cross
picon face
John Nall wrote:
>Did you look at the P18F452.INC file ?

Yes I did. It contains the values generateded by __CONFIG, but not by
CONFIG. I assume the latter are provided by the assembler.

Rolf wrote:
>Let me guess... your programmer is one of the DIY Kit 128/149/150/182
>types.

No, it isn't. It is a cheapo Quasar kit - but it gives me reliable (so far)
ICSP.

Tom Sefranek wrote:
>;******************************************************************************
>;       Filename:       F452Conf.inc                 Part of              
>MCA.asm          *
>*SNIP SNIP*

Yep - that looks pretty much like my CONFIG definitions.

Jan-Erik Soderholm wrote:
>Where are the rest ?
>
>*Always* specify *all* config options.

I did - my penultimate sentence was "All the other values are wildly
different too - I just chose the first one as an example".

******I now believe I understand what is happening:******

__CONFIG writes a '1' in unused bits.
CONFIG writes a '0' in unused bits.

Hence, with OSCS set to '1', and FOSC set to '110', the config word 300001h
becomes 'XX1XX110', where X are the unused bits.

__CONFIG replaces X by 1, therefore 300001h becomes '11111110' = FEh
CONFIG replaces X by 0, therefore 300001h becomes '00100110'=26h

and these are the values that the MPLAB "configure/configuration bits"
command shows me. Similarly with all the other configuration registers.

My cheapo programmer has what it calls a "chipinfo" file with the driver.
This specifies fuse settings, presumably for checking purposes (?), and
these are the old __CONFIG generated values. So it craps out with a FUSE
error.

Thanks to all who commented.
Regards,
Phil Cross


2006\02\06@050929 by Dave Wheeler

flavicon
face
Phil Cross wrote:

{Quote hidden}

------------------snip-------------------

Phil,

As your programmer has a chipinfo file it is almost certainly one of the
DIY kits. Quasar markets them. if you look at http://www.kitsrus.com you will
almost certainly find your programmer and 'may' find some useful updates.

Cheers,

Dave

2006\02\06@061249 by Alan B. Pearce

face picon face
>My cheapo programmer has what it calls a "chipinfo" file
>with the driver. This specifies fuse settings, presumably
>for checking purposes (?), and these are the old __CONFIG
>generated values. So it craps out with a FUSE error.

So presumably you could add entries for the CONFIG version so you don't get
errors ?

2006\02\06@062038 by Jan-Erik Soderholm

face picon face
Phil Cross wrote :

>
> John Nall wrote:
> >Did you look at the P18F452.INC file ?
>
> Yes I did. It contains the values generateded by __CONFIG,
> but not by CONFIG.

It does, if you're not using some old version of MPLAB,
but why would you ?

Here is the (start of the) rellevant part of my copy of P18F452.INC
(MPLAB 7.30) :

;
==========================================================================
;
;   IMPORTANT: For the PIC18 devices, the __CONFIG directive has been
;              superseded by the CONFIG directive.  The following
settings
;              are available for this device.
;
;   Oscillator Selection:
;     OSC = LP             LP
;     OSC = XT             XT
;     OSC = HS             HS
;     OSC = RC             RC
;     OSC = EC             EC-OSC2 as Clock Out
;     OSC = ECIO           EC-OSC2 as RA6
;     OSC = HSPLL          HS-PLL Enabled
;     OSC = RCIO           RC-OSC2 as RA6
;
;   Osc. Switch Enable:
;     OSCS = ON            Enabled
;     OSCS = OFF           Disabled
;

and so on...



2006\02\06@171228 by Phil Cross

picon face
Jan-Erik Soderholm wrote:
>It does, if you're not using some old version of MPLAB,
>but why would you ?

I am using MPLAB 7.30

>
>Here is the (start of the) rellevant part of my copy of P18F452.INC
>(MPLAB 7.30) :

<SNIP>

>;   Oscillator Selection:
>;     OSC = LP             LP
>;     OSC = XT             XT
>;     OSC = HS             HS
>;     OSC = RC             RC
>;     OSC = EC             EC-OSC2 as Clock Out
>;     OSC = ECIO           EC-OSC2 as RA6
>;     OSC = HSPLL          HS-PLL Enabled
>;     OSC = RCIO           RC-OSC2 as RA6

<SNIP>

Yes - but my point is that it doesn't specify the VALUES of LP, XT, etc, as
it does for the __CONFIG constants.

In any case, those statements are all commented - the assembly process won't
use them, will it? I assumed they were just for programmer reference. My
whole argument has been about the different VALUES of configuration bits
generated by CONFIG and __CONFIG, which seems to be down to CONFIG setting
unused bits to '0', but __CONFIG setting them to '1'.

Regards,
Phil Cross


2006\02\06@172749 by Jan-Erik Soderholm

face picon face
Phil Cross wrote :

> I am using MPLAB 7.30

Fine then.

> Yes - but my point is that it doesn't specify the VALUES of
> LP, XT, etc, as  it does for the __CONFIG constants.

What values ?
And if there actualy are some, why do you need them ??

> In any case, those statements are all commented - the
> assembly process won't  use them, will it?

Correct, they are the "documentation".
You are expected to use those you need in your source code file.

> I assumed they were just for programmer reference.

They are.
Just add those you need to (usualy) the start of your
source ASM code.

> My whole argument has been about the different VALUES of
> configuration bits generated by CONFIG and __CONFIG,...

I couldn't care less, I'm not debugging MPLAB/MPASM.
I expect they does what they should...

Why do you need those "values"  ?
I'm sorry if I missed something from the start of the thread.

Best Regards,
Jan-Erik.



2006\02\06@232233 by Chen Xiao Fan

face
flavicon
face


> -----Original Message-----
> From: .....piclist-bouncesKILLspamspam.....mit.edu
> [EraseMEpiclist-bouncesspam_OUTspamTakeThisOuTmit.edu]On Behalf Of Phil Cross
>
> My  whole argument has been about the different VALUES of
> configuration bits  generated by CONFIG and __CONFIG,
> which seems to be down to CONFIG setting
> unused bits to '0', but __CONFIG setting them to '1'.

This is a valid question to Microchip and I do not
want to say that Microchip is always right with MPLAB.
In fact, MPASM 5.01 and MPLAB C18 V3.01 have fixed
some problems with CONFIG settings and there may still
be some errors.

There are quite some problems with the wrong CONFIG
options which break some codes (even the Microchip
examples). For example, PICKit 2 firmware will fail to
build with the V3.01 version of MPLAB C18 due to
the wrong config options used in the old version of
MPLAB C18.

MPLAB C18 v3.02 is just out. I have not checked it out.
You may want to check out the readme for V3.01 and V3.02.

Release Notes for MPLAB(R) C18, PICmicro(R) 18Cxx C Compiler
v3.01
18 November, 2005
...
(27358 / 27515) The #pragma config directive causes unimplemented bits
       to become 0, but should be left a '1'.
       Unimplemented/reserve bits are now included in the mask and
       default settings when the bit must be maintained set.
...


Here is the readme file for MPASM V5.01 (comes with
MPLAB C18 V3.01)


Release Notes for MPASM(TM) Assembler version v5.01
18 November, 2005
...
-----------------------------------------------------------------
Repairs and Enhancements Made in v5.01
-----------------------------------------------------------------

Problems resolved:

(27358 / 27515) The new config directive causes unimplemented bits to
       become 0, but should be left a '1'.
       Unimplemented/reserve bits are now included in the mask and
       default settings when the bit must be maintained set.

       Following are the devices and configuration words that were
       corrected:
       ...

Hope this helps.

Regards,
Xiaofan

2006\02\07@023345 by William Chops Westfield

face picon face

>> Yes - but my point is that it doesn't specify the VALUES of
>> LP, XT, etc, as  it does for the __CONFIG constants.
>>
Does someone have a macro or macros to wrap around the microchip
"__config" directive that will enforce having the user set an
explicit value for every settable bit?

Seems like it would be useful...

BillW

2006\02\07@042731 by Phil Cross

picon face
Jan-Erik Soderholm wrote:
>Why do you need those "values"  ?
>I'm sorry if I missed something from the start of the thread.

Well, yes - I think you did. I started the thread because use of CONFIG
instead of __CONFIG caused my programmer to throw a FUSE error. It turned
out to be because my programmer driver checks the fuse values against values
in a "chipinfo.cid" file, and the values it checks them against are those
generated by __CONFIG. And to repeat myself, this is because __CONFIG fills
unused bits with '1's, but CONFIG fills them with '0's.

I agree with what you say in general - it is just that I have a cheapo
crappo programmer, which for some reason demands that FUSE values be of the
old __CONFIG type.

Now I understand, and can deal with the problem, the discussion has
satisfied my needs, and I won't go on about it :)

Regards,
Phil Cross


2006\02\07@051013 by Jan-Erik Soderholm

face picon face
Phil Cross wrote :

> It turned out to be because my programmer driver checks the
> fuse values against values in a "chipinfo.cid" file, and the values
> it checks them against are those generated by __CONFIG. And
> to repeat myself, this is because  __CONFIG fills unused bits
> with '1's, but CONFIG fills them with '0's.

Ah, yes !
I get it. :-)

And with "unused bits" you mean the bits in the config words
that has no config function (in the processor), not the bits that
aren't specificaly set by the __CONFIG (or CONFIG) directives,
right ?

Yes, that's makes sense. I had a similar problem where what
was read back from the "unused" bits in i config words did
not match what was in the HEX file. That broke the verify.

In that case (this was while using __CONFIG) each config
word was adjusted with an extra "& ..." to set the unused
bits in the HEX file to match whatever was read back from
the processor. A later version of the software simply
stripped off the unused bits before doing the verify, so they
could be set to anything in the HEX file.

That also explains why I saw no direct need to know
the "values" each CONFIG parameter had, since the
unused bits are clearly documented in the datasheet
anyway.

Sorry for the fuzz... :-)

Best Regards,
Jan-Erik.



More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...