Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 314
 2012 Microchip Technology Inc.
__CONFIG (PIC18) 
Synopsis
#include <xc.h>
__CONFIG(num, data)
Description
This macro is provided for legacy support only. Use the #pragma config for new proj-
ects.
This macro is used to program the configuration fuses that set the device’s operating 
modes.
The macro accepts the number corresponding to the configuration register it is to pro-
gram, then the 16-Bit value it is to update it with.
16-bit masks have been defined to describe each programmable attribute available on 
each device. These masks can be found in the chip-specific header files included via 
<xc.h>
.
Multiple attributes can be selected by ANDing them together.
Example
#include <xc.h>
__CONFIG(1,RC & OSCEN)
__CONFIG(2,WDTPS16 & BORV45)
__CONFIG(4, DEBUGEN)
void 
main (void)
{
}
See also
__EEPROM_DATA()
, __IDLOC(), __IDLOC7(), CONFIG() (baseline & 
mid-range devices)
__DELAY_MS, __DELAY_US
Synopsis
__delay_ms(x)  // request a delay in milliseconds
__delay_us(x)  // request a delay in microseconds
Description
As it is often more convenient request a delay in time-based terms rather than in cycle 
counts, the macros __delay_ms(x) and __delay_us(x) are provided. These mac-
ros simply wrap around _delay(n) and convert the time based request into instruction 
cycles based on the system frequency. In order to achieve this, these macros require 
the prior definition of preprocessor symbol _XTAL_FREQ. This symbol should be 
defined as the oscillator frequency (in Hertz) used by the system.
An error will result if these macros are used without defining oscillator frequency 
symbol or if the delay period requested is too large.
See also
_delay()