📄 msp430x22x4.h
字号:
#define INCH_4 (4*0x1000u)
#define INCH_5 (5*0x1000u)
#define INCH_6 (6*0x1000u)
#define INCH_7 (7*0x1000u)
#define INCH_8 (8*0x1000u)
#define INCH_9 (9*0x1000u)
#define INCH_10 (10*0x1000u)
#define INCH_11 (11*0x1000u)
#define INCH_12 (12*0x1000u) /* Selects Channel 11 */
#define INCH_13 (13*0x1000u) /* Selects Channel 11 */
#define INCH_14 (14*0x1000u) /* Selects Channel 11 */
#define INCH_15 (15*0x1000u) /* Selects Channel 11 */
/* ADC10DTC0 */
#define ADC10FETCH (0x001)
#define ADC10B1 (0x002)
#define ADC10CT (0x004)
#define ADC10TB (0x008)
#define ADC10DISABLE (0x000) /* ADC10DTC1 */
/************************************************************
* Basic Clock Module
************************************************************/
#define __MSP430_HAS_BC2__ /* Definition to show that Module is available */
#define DCOCTL_ (0x0056) /* DCO Clock Frequency Control */
DEFC( DCOCTL , DCOCTL_)
#define BCSCTL1_ (0x0057) /* Basic Clock System Control 1 */
DEFC( BCSCTL1 , BCSCTL1_)
#define BCSCTL2_ (0x0058) /* Basic Clock System Control 2 */
DEFC( BCSCTL2 , BCSCTL2_)
#define BCSCTL3_ (0x0053) /* Basic Clock System Control 3 */
DEFC( BCSCTL3 , BCSCTL3_)
#define MOD0 (0x01) /* Modulation Bit 0 */
#define MOD1 (0x02) /* Modulation Bit 1 */
#define MOD2 (0x04) /* Modulation Bit 2 */
#define MOD3 (0x08) /* Modulation Bit 3 */
#define MOD4 (0x10) /* Modulation Bit 4 */
#define DCO0 (0x20) /* DCO Select Bit 0 */
#define DCO1 (0x40) /* DCO Select Bit 1 */
#define DCO2 (0x80) /* DCO Select Bit 2 */
#define RSEL0 (0x01) /* Range Select Bit 0 */
#define RSEL1 (0x02) /* Range Select Bit 1 */
#define RSEL2 (0x04) /* Range Select Bit 2 */
#define RSEL3 (0x08) /* Range Select Bit 3 */
#define DIVA0 (0x10) /* ACLK Divider 0 */
#define DIVA1 (0x20) /* ACLK Divider 1 */
#define XTS (0x40) /* LFXTCLK 0:Low Freq. / 1: High Freq. */
#define XT2OFF (0x80) /* Enable XT2CLK */
#define DIVA_0 (0x00) /* ACLK Divider 0: /1 */
#define DIVA_1 (0x10) /* ACLK Divider 1: /2 */
#define DIVA_2 (0x20) /* ACLK Divider 2: /4 */
#define DIVA_3 (0x30) /* ACLK Divider 3: /8 */
#define DCOR (0x01) /* Enable External Resistor : 1 */
#define DIVS0 (0x02) /* SMCLK Divider 0 */
#define DIVS1 (0x04) /* SMCLK Divider 1 */
#define SELS (0x08) /* SMCLK Source Select 0:DCOCLK / 1:XT2CLK/LFXTCLK */
#define DIVM0 (0x10) /* MCLK Divider 0 */
#define DIVM1 (0x20) /* MCLK Divider 1 */
#define SELM0 (0x40) /* MCLK Source Select 0 */
#define SELM1 (0x80) /* MCLK Source Select 1 */
#define DIVS_0 (0x00) /* SMCLK Divider 0: /1 */
#define DIVS_1 (0x02) /* SMCLK Divider 1: /2 */
#define DIVS_2 (0x04) /* SMCLK Divider 2: /4 */
#define DIVS_3 (0x06) /* SMCLK Divider 3: /8 */
#define DIVM_0 (0x00) /* MCLK Divider 0: /1 */
#define DIVM_1 (0x10) /* MCLK Divider 1: /2 */
#define DIVM_2 (0x20) /* MCLK Divider 2: /4 */
#define DIVM_3 (0x30) /* MCLK Divider 3: /8 */
#define SELM_0 (0x00) /* MCLK Source Select 0: DCOCLK */
#define SELM_1 (0x40) /* MCLK Source Select 1: DCOCLK */
#define SELM_2 (0x80) /* MCLK Source Select 2: XT2CLK/LFXTCLK */
#define SELM_3 (0xC0) /* MCLK Source Select 3: LFXTCLK */
#define LFXT1OF (0x01) /* Low/high Frequency Oscillator Fault Flag */
#define XT2OF (0x02) /* High frequency oscillator 2 fault flag */
#define XCAP0 (0x04) /* XIN/XOUT Cap 0 */
#define XCAP1 (0x08) /* XIN/XOUT Cap 1 */
#define LFXT1S0 (0x10) /* Mode 0 for LFXT1 (XTS = 0) */
#define LFXT1S1 (0x20) /* Mode 1 for LFXT1 (XTS = 0) */
#define XT2S0 (0x40) /* Mode 0 for XT2 */
#define XT2S1 (0x80) /* Mode 1 for XT2 */
#define XCAP_0 (0x00) /* XIN/XOUT Cap : 0 pF */
#define XCAP_1 (0x04) /* XIN/XOUT Cap : 6 pF */
#define XCAP_2 (0x08) /* XIN/XOUT Cap : 10 pF */
#define XCAP_3 (0x0C) /* XIN/XOUT Cap : 12.5 pF */
#define LFXT1S_0 (0x00) /* Mode 0 for LFXT1 : Normal operation */
#define LFXT1S_1 (0x10) /* Mode 1 for LFXT1 : Reserved */
#define LFXT1S_2 (0x20) /* Mode 2 for LFXT1 : VLO */
#define LFXT1S_3 (0x30) /* Mode 3 for LFXT1 : Digital input signal */
#define XT2S_0 (0x00) /* Mode 0 for XT2 : 0.4 - 1 MHz */
#define XT2S_1 (0x40) /* Mode 1 for XT2 : 1 - 4 MHz */
#define XT2S_2 (0x80) /* Mode 2 for XT2 : 2 - 16 MHz */
#define XT2S_3 (0xC0) /* Mode 3 for XT2 : Digital input signal */
/*************************************************************
* Flash Memory
*************************************************************/
#define __MSP430_HAS_FLASH2__ /* Definition to show that Module is available */
#define FCTL1_ (0x0128) /* FLASH Control 1 */
DEFW( FCTL1 , FCTL1_)
#define FCTL2_ (0x012A) /* FLASH Control 2 */
DEFW( FCTL2 , FCTL2_)
#define FCTL3_ (0x012C) /* FLASH Control 3 */
DEFW( FCTL3 , FCTL3_)
#define FRKEY (0x9600) /* Flash key returned by read */
#define FWKEY (0xA500) /* Flash key for write */
#define FXKEY (0x3300) /* for use with XOR instruction */
#define ERASE (0x0002) /* Enable bit for Flash segment erase */
#define MERAS (0x0004) /* Enable bit for Flash mass erase */
#define EEI (0x0008) /* Enable Erase Interrupts */
#define EEIEX (0x0010) /* Enable Emergency Interrupt Exit */
#define WRT (0x0040) /* Enable bit for Flash write */
#define BLKWRT (0x0080) /* Enable bit for Flash segment write */
#define SEGWRT (0x0080) /* old definition */ /* Enable bit for Flash segment write */
#define FN0 (0x0001) /* Divide Flash clock by 1 to 64 using FN0 to FN5 according to: */
#define FN1 (0x0002) /* 32*FN5 + 16*FN4 + 8*FN3 + 4*FN2 + 2*FN1 + FN0 + 1 */
#ifndef FN2
#define FN2 (0x0004)
#endif
#ifndef FN3
#define FN3 (0x0008)
#endif
#ifndef FN4
#define FN4 (0x0010)
#endif
#define FN5 (0x0020)
#define FSSEL0 (0x0040) /* Flash clock select 0 */ /* to distinguish from USART SSELx */
#define FSSEL1 (0x0080) /* Flash clock select 1 */
#define FSSEL_0 (0x0000) /* Flash clock select: 0 - ACLK */
#define FSSEL_1 (0x0040) /* Flash clock select: 1 - MCLK */
#define FSSEL_2 (0x0080) /* Flash clock select: 2 - SMCLK */
#define FSSEL_3 (0x00C0) /* Flash clock select: 3 - SMCLK */
#define BUSY (0x0001) /* Flash busy: 1 */
#define KEYV (0x0002) /* Flash Key violation flag */
#define ACCVIFG (0x0004) /* Flash Access violation flag */
#define WAIT (0x0008) /* Wait flag for segment write */
#define LOCK (0x0010) /* Lock bit: 1 - Flash is locked (read only) */
#define EMEX (0x0020) /* Flash Emergency Exit */
#define LOCKA (0x0040) /* Segment A Lock bit: read = 1 - Segment is locked (read only) */
#define FAIL (0x0080) /* Last Program or Erase failed */
/************************************************************
* Operational Amplifier
************************************************************/
#define __MSP430_HAS_OA_2__ /* Definition to show that Module is available */
#define OA0CTL0_ (0x00C0) /* OA0 Control register 0 */
DEFC( OA0CTL0 , OA0CTL0_)
#define OA0CTL1_ (0x00C1) /* OA0 Control register 1 */
DEFC( OA0CTL1 , OA0CTL1_)
#define OA1CTL0_ (0x00C2) /* OA1 Control register 0 */
DEFC( OA1CTL0 , OA1CTL0_)
#define OA1CTL1_ (0x00C3) /* OA1 Control register 1 */
DEFC( OA1CTL1 , OA1CTL1_)
#define OAADC0 (0x01) /* OAx output to ADC12 input channel select 0 */
#define OAADC1 (0x02) /* OAx output to ADC12 input channel select 1 */
#define OAPM0 (0x04) /* OAx Power mode select 0 */
#define OAPM1 (0x08) /* OAx Power mode select 1 */
#define OAP0 (0x10) /* OAx Non-inverting input select 0 */
#define OAP1 (0x20) /* OAx Non-inverting input select 1 */
#define OAN0 (0x40) /* OAx Inverting input select 0 */
#define OAN1 (0x80) /* OAx Inverting input select 1 */
#define OAPM_0 (0x00) /* OAx Power mode select: off */
#define OAPM_1 (0x04) /* OAx Power mode select: slow */
#define OAPM_2 (0x08) /* OAx Power mode select: meduim */
#define OAPM_3 (0x0C) /* OAx Power mode select: fast */
#define OAP_0 (0x00) /* OAx Non-inverting input select 00 */
#define OAP_1 (0x10) /* OAx Non-inverting input select 01 */
#define OAP_2 (0x20) /* OAx Non-inverting input select 10 */
#define OAP_3 (0x30) /* OAx Non-inverting input select 11 */
#define OAN_0 (0x00) /* OAx Inverting input select 00 */
#define OAN_1 (0x40) /* OAx Inverting input select 01 */
#define OAN_2 (0x80) /* OAx Inverting input select 10 */
#define OAN_3 (0xC0) /* OAx Inverting input select 11 */
#define OARRIP (0x01) /* OAx Rail-to-Rail Input off */
#define OANEXT (0x02) /* OAx Inverting input external */
//#define OACAL (0x02) /* OAx Offset Calibration */
#define OAFC0 (0x04) /* OAx Function control 0 */
#define OAFC1 (0x08) /* OAx Function control 1 */
#define OAFC2 (0x10) /* OAx Function control 2 */
#define OAFBR0 (0x20) /* OAx Feedback resistor select 0 */
#define OAFBR1 (0x40) /* OAx Feedback resistor select 1 */
#define OAFBR2 (0x80) /* OAx Feedback resistor select 2 */
#define OAFC_0 (0x00) /* OAx Function: Gen. Purpose */
#define OAFC_1 (0x04) /* OAx Function: Unity gain buffer */
#define OAFC_2 (0x08) /* OAx Function: Reserved */
#define OAFC_3 (0x0C) /* OAx Function: Comparator */
#define OAFC_4 (0x10) /* OAx Function: Non-inverting PGA */
#define OAFC_5 (0x14) /* OAx Function: Cascaded non-inverting PGA */
#define OAFC_6 (0x18) /* OAx Function: Inverting PGA */
#define OAFC_7 (0x1C) /* OAx Function: Differential amplifier */
#define OAFBR_0 (0x00) /* OAx Feedback resistor: Tap 0 */
#define OAFBR_1 (0x20) /* OAx Feedback resistor: Tap 1 */
#define OAFBR_2 (0x40) /* OAx Feedback resistor: Tap 2 */
#define OAFBR_3 (0x60) /* OAx Feedback resistor: Tap 3 */
#define OAFBR_4 (0x80) /* OAx Feedback resistor: Tap 4 */
#define OAFBR_5 (0xA0) /* OAx Feedback resistor: Tap 5 */
#define OAFBR_6 (0xC0) /* OAx Feedback resistor: Tap 6 */
#define OAFBR_7 (0xE0) /* OAx Feedback resistor: Tap 7 */
/************************************************************
* DIGITAL I/O Port1/2 Pull up / Pull down Resistors
************************************************************/
#define __MSP430_HAS_PORT1_R__ /* Definition to show that Module is available */
#define __MSP430_HAS_PORT2_R__ /* Definition to show that Module is available */
#define P1IN_ (0x0020) /* Port 1 Input */
READ_ONLY DEFC( P1IN , P1IN_)
#define P1OUT_ (0x0021) /* Port 1 Output */
DEFC( P1OUT , P1OUT_)
#define P1DIR_ (0x0022) /* Port 1 Direction */
DEFC( P1DIR , P1DIR_)
#define P1IFG_ (0x0023) /* Port 1 Interrupt Flag */
DEFC( P1IFG , P1IFG_)
#define P1IES_ (0x0024) /* Port 1 Interrupt Edge Select */
DEFC( P1IES , P1IES_)
#define P1IE_ (0x0025) /* Port 1 Interrupt Enable */
DEFC( P1IE , P1IE_)
#define P1SEL_ (0x0026) /* Port 1 Selection */
DEFC( P1SEL , P1SEL_)
#define P1REN_ (0x0027) /* Port 1 Resistor Enable */
DEFC( P1REN , P1REN_)
#define P2IN_ (0x0028) /* Port 2 Input */
READ_ONLY DEFC( P2IN , P2IN_)
#define P2OUT_ (0x0029) /* Port 2 Output */
DEFC( P2OUT , P2OUT_)
#define P2DIR_ (0x002A) /* Port 2 Direction */
DEFC( P2DIR , P2DIR_)
#define P2IFG_ (0x002B) /* Port 2 Interrupt Flag */
DEFC( P2IFG , P2IFG_)
#define P2IES_ (0x002C) /* Port 2 Interrupt Edge Select */
DEFC( P2IES , P2IES_)
#define P2IE_ (0x002D) /* Port 2 Interrupt Enable */
DEFC( P2IE , P2IE_)
#define P2SEL_ (0x002E) /* Port 2 Selection */
DEFC( P2SEL , P2SEL_)
#define P2REN_ (0x002F) /* Port 2 Resistor Enable */
DEFC( P2REN , P2REN_)
/************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -