configuration bits and their importance

Thread Starter

ect_09

Joined May 6, 2012
180
Hello everybody,
as you know am new with PIC18f452. i become successful to run LED Blinking code on hardware.although its was copy paste first time but i understand all the code and configuration bits but am confused in

__CONFIG(1, OSCSDIS & HSPLL);

__CONFIG(2, BORDIS & PWRTDIS & WDTDIS);

what is this meaning that these are being AND with one another .??
can i write all the configuration bit in a single line with the bits that AND with one another.
please Explain it


Regards,
 

Art

Joined Sep 10, 2007
806
I don't think they are logically and in that context.
They might be in two lines because the bits are parts of two config bytes/words.

Are you using a BASIC or C compiler?
The midrange pic config in asm might look something like:
Code:
DEVICE LVP_OFF,BOD_OFF,HS_OSC
 
Last edited:

Papabravo

Joined Feb 24, 2006
12,775
The configuration bits are "off" or "unprogrammed" when they are in the '1' state. If you look at the definition of the constants you'll see that they are all '1's except for a single '0' bit. When these constants are bitwise ANDed together, the desired '0' bits show up in the resulting constant that is programmed into the configuration word(s).
 

ErnieM

Joined Apr 24, 2011
8,011
as you know am new with PIC18f452.
Believe it or not we have no idea your skill set, just possibly a guess. Nor do we remember what tools you use, such as the compiler and other such things you are asking question about.

what is this meaning that these are being AND with one another .??
can i write all the configuration bit in a single line with the bits that AND with one another.
One can AND together several constants to set multiple or individual bits, or actually reset them. One could use an OR to set bits.

This device has some 33 config bits in 14 bytes. Do you really expect to set them all in a single line?

Open up the data sheet for this device and read section 19.1.

Open up the users guide for your compiler and check the section on config bits.
 

Thread Starter

ect_09

Joined May 6, 2012
180
I don't think they are logically and in that context.
They might be in two lines because the bits are parts of two config bytes/words.

Are you using a BASIC or C compiler?
The midrange pic config in asm might look something like:
Code:
DEVICE LVP_OFF,BOD_OFF,HS_OSC
using HI-Tech compiler
 

Thread Starter

ect_09

Joined May 6, 2012
180
Believe it or not we have no idea your skill set, just possibly a guess. Nor do we remember what tools you use, such as the compiler and other such things you are asking question about.



One can AND together several constants to set multiple or individual bits, or actually reset them. One could use an OR to set bits.

This device has some 33 config bits in 14 bytes. Do you really expect to set them all in a single line?

Open up the data sheet for this device and read section 19.1.

Open up the users guide for your compiler and check the section on config bits.
using Hi-Tech compiler
and i have a beginner level..
i know about AND gate for binary.
for example
Code:
          0101
AND  0011
 ans      = 0001
but am confused about it
Code:
OSCSDIS & HSPLL
 

Papabravo

Joined Feb 24, 2006
12,775
Look at the definition of the constants in the header file, and pay attention to what I previously posted. Each constant should have one or more zeros corresponding to the bits that must transition from the unprogrammed state ('1') to the programmed state ('0'). Do I have to post in capitals with bold and underlining -- sheeesh!!
 
Top