PIC configuration bit

Source: Internet
Author: User

I. Configuration words
You can use the _ config command to define the configuration word of the PIC microcontroller:
# Include
_ Config (X)
X is the configuration word, and the header file defines the corresponding configuration specifiers, such:
_ Config (wdtdis & XT & unprotect );
This will disable the watchdog and set the XT vibrator,ProgramNot encrypted. Note: Different configuration characters are associated with '&'. undefined parts are retained. For details, refer to the header file and the PIC Data Manual.

Ii. ID location
Some PIC Single-chip computers also have ID space outside the program space, which can be defined using the following method:
# Include
_ Idloc (x) where X is the ID, for example:
_ Idloc (15f0 );
The four units of ID are defined as: 1, 5, 15, 0. the specific position of ID is automatically set by the specified PIC chip.

Iii. EEPROM data
Some PIC Single-Chip Microcomputer support programming internal EEPROM with an external programmer.
_ Eeprom_data () can put the data for initialization into the Hex file, for example:
_ Eeprom_data (0, 1, 2, 3, 4, 5, 6, 7)
You can add the numbers 0-7 to the Hex file, and write these eight numbers into the PIC microcontroller when programming with an external programmer.
_ Eeprom_data is not used to write EEPROM data during runtime. during runtime, use eeprom_read () and eeprom_write ().

 

The _ config setting of pic18 is different from that of pic16. For example, pic16:

_ Config (_ cp_off & _ wdt_on & _ boden_on & _ pwrte_on & _ rc_osc); is written together.

Pic18 is not written together, And config1.. 7 is written separately. For example:

_ Config (1, iesodis & fcmdis & HS );
_ Config (2, Boren & pwrten & wdtdis & wdtwindis & wdtps32k );
_ Config (3, mclren );
_ Config (4, debugen & xinsten & stvrdis );
_ Config (5, unprotect );

The _ config (n, x) function is prototype in pic18. H file. The settings are in pic18fxx22. H.

The preceding settings mean:

// Content is defined in pic18fxx22. h.
// 1. oscillator switch off & Fault Protection clock monitor off & High-speed mode
// 2. undervoltage reset on & power-on delay on & watchdog off & watchdog frequency
// 3. The mclr is used to reset the pin.
// 4. Enable the Background Debugger & enable instruction set extension & Stack Overflow without resetting
// 5.CodeNot Protected

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.