⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p30f6012a.h

📁 pic30f6012I2C的程序
💻 H
📖 第 1 页 / 共 5 页
字号:
/* IC5BUF: Input Capture 5 Buffer */
extern volatile unsigned int IC5BUF __attribute__((__near__));

/* IC5CON: Input Capture 5 Control Register */
extern volatile unsigned int IC5CON __attribute__((__near__));
extern volatile ICxCONBITS IC5CONbits __attribute__((__near__));

/* IC6BUF: Input Capture 6 Buffer */
extern volatile unsigned int IC6BUF __attribute__((__near__));

/* IC6CON: Input Capture 6 Control Register */
extern volatile unsigned int IC6CON __attribute__((__near__));
extern volatile ICxCONBITS IC6CONbits __attribute__((__near__));

/* IC7BUF: Input Capture 7 Buffer */
extern volatile unsigned int IC7BUF __attribute__((__near__));

/* IC7CON: Input Capture 7 Control Register */
extern volatile unsigned int IC7CON __attribute__((__near__));
extern volatile ICxCONBITS IC7CONbits __attribute__((__near__));

/* IC8BUF: Input Capture 8 Buffer */
extern volatile unsigned int IC8BUF __attribute__((__near__));

/* IC8CON: Input Capture 8 Control Register */
extern volatile unsigned int IC8CON __attribute__((__near__));
extern volatile ICxCONBITS IC8CONbits __attribute__((__near__));


/* --------------------------------------- */
/* Output Compare/PWM register definitions */
/* --------------------------------------- */

/* Generic structure of entire SFR area for each Output Compare module */
typedef struct tagOC {
        unsigned int ocxrs;
        unsigned int ocxr;
        unsigned int ocxcon;
} OC, *POC;

/* SFR blocks for each Output Compare module */
extern volatile OC OC1 __attribute__((__near__));
extern volatile OC OC2 __attribute__((__near__));
extern volatile OC OC3 __attribute__((__near__));
extern volatile OC OC4 __attribute__((__near__));
extern volatile OC OC5 __attribute__((__near__));
extern volatile OC OC6 __attribute__((__near__));
extern volatile OC OC7 __attribute__((__near__));
extern volatile OC OC8 __attribute__((__near__));

/* Generic structure for Output Compare Control Registers */
typedef struct tagOCxCONBITS {
        unsigned OCM    :3;
        unsigned OCTSEL :1;
        unsigned OCFLT  :1;
        unsigned        :8;
        unsigned OCSIDL :1;
        unsigned        :2;
} OCxCONBITS;

/* OC1RS: Output Compare 1 Secondary Register */
extern volatile unsigned int OC1RS __attribute__((__near__));

/* OC1R: Output Compare 1 Main Register */
extern volatile unsigned int OC1R __attribute__((__near__));

/* OC1CON: Output Compare 1 Control Register */
extern volatile unsigned int OC1CON __attribute__((__near__));
extern volatile OCxCONBITS OC1CONbits __attribute__((__near__));

/* OC2RS: Output Compare 2 Secondary Register */
extern volatile unsigned int OC2RS __attribute__((__near__));

/* OC2R: Output Compare 2 Main Register */
extern volatile unsigned int OC2R __attribute__((__near__));

/* OC2CON: Output Compare 2 Control Register */
extern volatile unsigned int OC2CON __attribute__((__near__));
extern volatile OCxCONBITS OC2CONbits __attribute__((__near__));

/* OC3RS: Output Compare 3 Secondary Register */
extern volatile unsigned int OC3RS __attribute__((__near__));

/* OC3R: Output Compare 3 Main Register */
extern volatile unsigned int OC3R __attribute__((__near__));

/* OC3CON: Output Compare 3 Control Register */
extern volatile unsigned int OC3CON __attribute__((__near__));
extern volatile OCxCONBITS OC3CONbits __attribute__((__near__));

/* OC4RS: Output Compare 4 Secondary Register */
extern volatile unsigned int OC4RS __attribute__((__near__));

/* OC4R: Output Compare 4 Main Register */
extern volatile unsigned int OC4R __attribute__((__near__));

/* OC4CON: Output Compare 4 Control Register */
extern volatile unsigned int OC4CON __attribute__((__near__));
extern volatile OCxCONBITS OC4CONbits __attribute__((__near__));

/* OC5RS: Output Compare 5 Secondary Register */
extern volatile unsigned int OC5RS __attribute__((__near__));

/* OC5R: Output Compare 5 Main Register */
extern volatile unsigned int OC5R __attribute__((__near__));

/* OC5CON: Output Compare 5 Control Register */
extern volatile unsigned int OC5CON __attribute__((__near__));
extern volatile OCxCONBITS OC5CONbits __attribute__((__near__));

/* OC6RS: Output Compare 6 Secondary Register */
extern volatile unsigned int OC6RS __attribute__((__near__));

/* OC6R: Output Compare 6 Main Register */
extern volatile unsigned int OC6R __attribute__((__near__));

/* OC6CON: Output Compare 6 Control Register */
extern volatile unsigned int OC6CON __attribute__((__near__));
extern volatile OCxCONBITS OC6CONbits __attribute__((__near__));

/* OC7RS: Output Compare 7 Secondary Register */
extern volatile unsigned int OC7RS __attribute__((__near__));

/* OC7R: Output Compare 7 Main Register */
extern volatile unsigned int OC7R __attribute__((__near__));

/* OC7CON: Output Compare 7 Control Register */
extern volatile unsigned int OC7CON __attribute__((__near__));
extern volatile OCxCONBITS OC7CONbits __attribute__((__near__));

/* OC8RS: Output Compare 8 Secondary Register */
extern volatile unsigned int OC8RS __attribute__((__near__));

/* OC8R: Output Compare 8 Main Register */
extern volatile unsigned int OC8R __attribute__((__near__));

/* OC8CON: Output Compare 8 Control Register */
extern volatile unsigned int OC8CON __attribute__((__near__));
extern volatile OCxCONBITS OC8CONbits __attribute__((__near__));


/* ------------------------ */
/* I2C register definitions */
/* ------------------------ */

/* I2CRCV: I2C Receive Register */
extern volatile unsigned char I2CRCV __attribute__((__near__));
typedef struct tagI2CRCVBITS {
        unsigned I2CRCV0:1;
        unsigned I2CRCV1:1;
        unsigned I2CRCV2:1;
        unsigned I2CRCV3:1;
        unsigned I2CRCV4:1;
        unsigned I2CRCV5:1;
        unsigned I2CRCV6:1;
        unsigned I2CRCV7:1;
} I2CRCVBITS;
extern volatile I2CRCVBITS I2CRCVbits __attribute__((__near__));

/* I2CTRN: I2C Transmit Register */
extern volatile unsigned char I2CTRN __attribute__((__near__));
typedef struct tagI2CTRNBITS {
        unsigned I2CTRN0:1;
        unsigned I2CTRN1:1;
        unsigned I2CTRN2:1;
        unsigned I2CTRN3:1;
        unsigned I2CTRN4:1;
        unsigned I2CTRN5:1;
        unsigned I2CTRN6:1;
        unsigned I2CTRN7:1;
} I2CTRNBITS;
extern volatile I2CTRNBITS I2CTRNbits __attribute__((__near__));

/* I2CBRG: I2C Baud Rate Generator Register */
extern volatile unsigned int I2CBRG __attribute__((__near__));
typedef struct tagI2CBRGBITS {
        unsigned I2CBRG :9;
        unsigned        :7;
} I2CBRGBITS;
extern volatile I2CBRGBITS I2CBRGbits __attribute__((__near__));

/* I2CCON: I2C Control Register */
extern volatile unsigned int I2CCON __attribute__((__near__));
typedef struct tagI2CCONBITS {
        unsigned SEN    :1;
        unsigned RSEN   :1;
        unsigned PEN    :1;
        unsigned RCEN   :1;
        unsigned ACKEN  :1;
        unsigned ACKDT  :1;
        unsigned STREN  :1;
        unsigned GCEN   :1;
        unsigned SMEN   :1;
        unsigned DISSLW :1;
        unsigned A10M  :1;
        unsigned IPMIEN :1;
        unsigned SCLREL :1;
        unsigned I2CSIDL:1;
        unsigned        :1;
        unsigned I2CEN  :1;
} I2CCONBITS;
extern volatile I2CCONBITS I2CCONbits __attribute__((__near__));

/* I2CSTAT: I2C Status Register */
extern volatile unsigned int I2CSTAT __attribute__((__near__));
typedef struct tagI2CSTATBITS {
        unsigned TBF    :1;
        unsigned RBF    :1;
        unsigned R_W    :1;
        unsigned S      :1;
        unsigned P      :1;
        unsigned D_A    :1;
        unsigned I2COV  :1;
        unsigned IWCOL  :1;
        unsigned ADD10  :1;
        unsigned GCSTAT :1;
        unsigned BCL    :1;
        unsigned        :3;
        unsigned TRSTAT :1;
        unsigned ACKSTAT:1;
} I2CSTATBITS;
extern volatile I2CSTATBITS I2CSTATbits __attribute__((__near__));

/* I2CADD: I2C Address Register */
extern volatile unsigned int I2CADD __attribute__((__near__));
typedef struct tagI2CADDBITS {
        unsigned I2CADD :10;
        unsigned        :6;
} I2CADDBITS;
extern volatile I2CADDBITS I2CADDbits __attribute__((__near__));


/* -------------------------- */
/* UART1 register definitions */
/* -------------------------- */

/* Generic structure of entire SFR area for each UART module */
typedef struct tagUART {
        unsigned int uxmode;
        unsigned int uxsta;
        unsigned int uxtxreg;
        unsigned int uxrxreg;
        unsigned int uxbrg;
} UART, *PUART;

/* SFR blocks for each UART module */
extern volatile UART UART1 __attribute__((__near__));
extern volatile UART UART2 __attribute__((__near__));

/* Generic structure for UART Mode Registers */
typedef struct tagUxMODEBITS {
        unsigned STSEL  :1;
        unsigned PDSEL  :2;
        unsigned        :2;
        unsigned ABAUD  :1;
        unsigned LPBACK :1;
        unsigned WAKE   :1;
        unsigned        :2;
        unsigned ALTIO  :1;
        unsigned        :2;
        unsigned USIDL  :1;
        unsigned        :1;
        unsigned UARTEN :1;
} UxMODEBITS;

/* Generic structure for UART Status and Control Registers */
typedef struct tagUxSTABITS {
        unsigned URXDA  :1;
        unsigned OERR   :1;
        unsigned FERR   :1;
        unsigned PERR   :1;
        unsigned RIDLE  :1;
        unsigned ADDEN  :1;
        unsigned URXISEL:2;
        unsigned TRMT   :1;
        unsigned UTXBF  :1;
        unsigned UTXEN  :1;
        unsigned UTXBRK :1;
        unsigned        :3;
        unsigned UTXISEL:1;
} UxSTABITS; 

/* Generic structure for UART Transmit Registers */
typedef struct tagUxTXREGBITS {
        unsigned UTXREG0:1;
        unsigned UTXREG1:1;
        unsigned UTXREG2:1;
        unsigned UTXREG3:1;
        unsigned UTXREG4:1;
        unsigned UTXREG5:1;
        unsigned UTXREG6:1;
        unsigned UTXREG7:1;
        unsigned UTX8   :1;
        unsigned        :7;
} UxTXREGBITS;

/* Generic structure for UART Receive Registers */
typedef struct tagUxRXREGBITS {
        unsigned URXREG0:1;
        unsigned URXREG1:1;
        unsigned URXREG2:1;
        unsigned URXREG3:1;
        unsigned URXREG4:1;
        unsigned URXREG5:1;
        unsigned URXREG6:1;
        unsigned URXREG7:1;
        unsigned URX8   :1;
        unsigned        :7;
} UxRXREGBITS;

/* U1MODE: UART1 Mode Regsiter */
extern volatile unsigned int U1MODE __attribute__((__near__));
extern volatile UxMODEBITS U1MODEbits __attribute__((__near__));

/* U1STA: UART1 Status and Control Register */
extern volatile unsigned int U1STA __attribute__((__near__));
extern volatile UxSTABITS U1STAbits __attribute__((__near__));

/* U1TXREG: UART1 Transmit Register */
extern volatile unsigned int U1TXREG __attribute__((__near__));
extern volatile UxTXREGBITS U1TXREGbits __attribute__((__near__));

/* U1RXREG: UART1 Receive Register */
extern volatile unsigned int U1RXREG __attribute__((__near__));
extern volatile UxRXREGBITS U1RXREGbits __attribute__((__near__));   

/* U1BRG: UART1 Baud Rate Generator Register */
extern volatile unsigned int U1BRG __attribute__((__near__));


/* -------------------------- */
/* UART2 register definitions */
/* -------------------------- */

/* U2MODE: UART2 Mode Regsiter */
extern volatile unsigned int U2MODE __attribute__((__near__));
extern volatile UxMODEBITS U2MODEbits __attribute__((__near__));

/* U2STA: UART2 Status and Control Register */
extern volatile unsigned int U2STA __attribute__((__near__));
extern volatile UxSTABITS U2STAbits __attribute__((__near__));

/* U2TXREG: UART2 Transmit Register */
extern volatile unsigned int U2TXREG __attribute__((__near__));
extern volatile UxTXREGBITS U2TXREGbits __attribute__((__near__));

/* U2RXREG: UART2 Receive Register */
extern volatile unsigned int U2RXREG __attribute__((__near__));
extern volatile UxRXREGBITS U2RXREGbits __attribute__((__near__));   

/* U2BRG: UART2 Baud Rate Generator Register */
extern volatile unsigned int U2BRG __attribute__((__near__));


/* ------------------------- */
/* SPI1 register definitions */
/* ------------------------- */

/* Generic structure of entire SFR area for each SPI module */
typedef struct tagSPI {
        unsigned int spixstat;
        unsigned int spixcon;
        unsigned int spixbuf;
} SPI, *PSPI;

/* SFR blocks for each SPI module */
extern volatile SPI SPI1 __attribute__((__near__));
extern volatile SPI SPI2 __attribute__((__near__));

/* Generic structure for SPI Status Registers */
typedef struct tagSPIxSTATBITS {
        unsigned SPIRBF :1;
        unsigned SPITBF :1;
        unsigned        :4;
        unsigned SPIROV :1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -