Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here are the choices for each of the 15 configuration options in the 2 words tha

ID: 3793706 • Letter: H

Question

Here are the choices for each of the 15 configuration options in the 2 words that we have used:

__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF

__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF

List how many bits for each option and explain why we chose each option or if it makes no difference.

3. How many bits in each configuration word?

4. How many different modes can the system clock operate?

5. Why do you think this chip has so many different clock modes?

6. List some applications you can think of which would require each different (High, Medium and Low) accuracy of the clock. I.e. for high accuracy the PIC16F1829 could be the guts of a timer for a track meet.

Explanation / Answer

The Code given is:

_CONFIG _CONFIG1, _FOSC_INTOSC&_WDTE_OFF&_PWRTE_OFF&_MCLRE_ON&_CP_OFF&_CPD_OFF&_BOREN_ON&_CLKOUTEN_OFF&_IESO_OFF&_FCMEN_OFF

__CONFIG _CONFIG2, _WRT_OFF&_PLLEN_ON & _LVP_OFF

Lets first know the meaning of all this codes individually then we will deal with the problems given.One does not have to use every setting, if left out, it will use the default on power up. These can also be set via MLAB X in the project.

-- Configuration 1 settings

_FOSC_INTOSC - This was chosen for we are using the internal oscillator. One can connect an external oscillator to the pic, and there are quite a few choices.

_WDTE_OFF – watchdog timer is rarely used, so Normally disable it.

_PWRTE_OFF - People normally turn off the power up timer. This timer is useful if we want to let the rest of the circuit stabilize before the picture starts executing its code. So here are the choices:

Code:

_PWRTE_ON        ; PWRT enabled

_PWRTE_OFF        ; PWRT disabled

MCLRE_ON - People enable the Master Clear/Reset pin. Looking at the data sheet, this pin can also be used an input pin. If one uses it as an input pin, one needs to turn off the Master clear function.

_CP_OFF - This disables code protection. If you want to not allow an external reader to read your program memory, then enable this function. If enabled , attempts to read program memory from and external device will return all 0's

_BOREN_ON - This enables the brown out reset function. If the voltage to the chip falls below a certain voltage, the chip is held in reset mode until the voltage rises. The level of the voltage is set by options in the CONFIG2 word.

_CLKOUTEN_OFF - This disables the Fosc/4 clock on pin3. In exercise 1, this was enabled to aid in determining if we had set the internal oscillator correctly. This output can be used as a clock to source to other components in your circuit. If not using this function, are using the pin for other purposes, disable this function.

_IESO_OFF - This disables internal/external switchover of the oscillator. If one is going to switch between internal/external oscillator functions real time, enable this setting.

_FCMEN_OFF - Disable the Fail-save clock monitor. The fail safe clock monitor will detect a failure on an external oscillator and automatically switch over to the internal oscillator if enabled.

In Configuration Word 2. The Sections of the Flash memory can be protected from self writes. If one had a boot loader, this would prevent it from being overwritten from internal writes. Note, this prevents your firmware from writing to these sections of flash.

_PLLEN_ON - Enable the 4x Phase Lock Loop circuitry. Enable this to achieve the desired clock rate for the internal oscillator

_SRVREN_OFF - Disable the stack overflow. The stack is 16 levels deep. This limits the nesting of calls to subroutines that can be made. If too many calls are made (or too many returns versus calls), causing this to exceed the number, it will cause an reset if enabled.

_BORV_LO: _BORV_LO means Brown out trip point. If the brown out reset is enabled, this setting determines the voltage level it will trip.

_LVP_OFF : _LVP_OFF is used in Low voltage programming enabled. This is used to supports a low voltage programming mode.

;method using a #define to partially emulate PIC18 config directive

#define CONFIG cfgword=cfgword &

variable cfgword=0x3fff    ;initialise CONFIG to defaults

;now the individual options

CONFIG _INTRC_OSC_NOCLKOUT    ;8 MHz and OSC pins are I/O with:

CONFIG _IESO_OFF             ;no switchover

CONFIG _FCMEN_OFF            ;or failsafe

                          ;

CONFIG _WDT_OFF                ;NO WDT

CONFIG _PWRTE_OFF            ;Power up delay disabled

CONFIG _MCLRE_OFF            ;no /MCLR, use as input

CONFIG _CP_OFF ;no code protect

CONFIG _BOR_OFF                ;No BOR for low voltage operation

From the PIC16F1829 data sheet, the part has a 14-bit configuration word.

        --------------------------------------------------

                   PIC16F1829 Configuration Bits

        --------------------------------------------------

        13 ___________ 4 3 2 1 0

        --------------------------------------------------

        Code protect    | | |__|____ Osc type 11 = RC

             0 = on       | |                     10 = HS

             1 = off      | |__ WDT               01 = XT

                          |        0 = disabled    00 = LP

                          |        1 = enabled

                          |

                          |__ Power-up timer

                                0 = enabled

                                1 = disabled

Looking at the list of equates for the configuration bits in Microchip's Device Header File reveals the following:

                       _CP_ON     EQU   H'000F'

                       _CP_OFF   EQU   H'3FFF'

                       _PWRTE_ON EQU   H'3FF7'

                       _PWRTE_OFF EQU   H'3FFF'

                       _WDT_ON    EQU   H'3FFF'

                       _WDT_OFF   EQU   H'3FFB'

                       _LP_OSC    EQU   H'3FFC'

                       _Xt_OSC    EQU   H'3FFD'

                       _HS_OSC    EQU   H'3FFE'

                       _RC_OSC    EQU   H'3FFF'

Notice that Microchip uses upper case.

The default configuration bit pattern is all 1's or H'3FFF'. Programming involves changing the 1's that need changing to 0's.

The configuration bit equates are repeated with the bit patterns for the least significant for bits along side to make a point.

                       _CP_ON     EQU   H'000F'   1111

                       _CP_OFF    EQU   H'3FFF'   1111

                       _PWRTE_ON EQU   H'3FF7'   0111

                       _PWRTE_OFF EQU   H'3FFF'   1111

                       _WDT_ON    EQU   H'3FFF'   1111

                       _WDT_OFF   EQU   H'3FFB'   1011

                       _LP_OSC    EQU   H'3FFC'   1100

                       _Xt_OSC    EQU   H'3FFD'   1101

                       _HS_OSC    EQU   H'3FFE'   1110

                       _RC_OSC    EQU   H'3FFF'   1111

From the PIC16F1829 data sheet, the part has a 14-bit configuration word.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote