/* * Header file for the Microchip * PIC 16F873A chip * PIC 16F874A chip * PIC 16F876A chip * PIC 16F877A chip * Midrange Microcontroller */ #if defined(_16F874A) || defined(_16F877A) #define __PINS_40 #endif static volatile unsigned char INDF @ 0x00; //間接定址寄存器 static volatile unsigned char TMR0 @ 0x01; //定時器0 static volatile unsigned char PCL @ 0x02; //低8位程序計數器 static volatile unsigned char STATUS @ 0x03; //程序狀態寄存器 static unsigned char FSR @ 0x04; //特殊功能寄存器 static volatile unsigned char PORTA @ 0x05; //埠A寄存器 static volatile unsigned char PORTB @ 0x06; //埠B寄存器 static volatile unsigned char PORTC @ 0x07; //埠C寄存器 #ifdef __PINS_40 static volatile unsigned char PORTD @ 0x08; //埠D寄存器 static volatile unsigned char PORTE @ 0x09; //埠E寄存器 #endif static unsigned char PCLATH @ 0x0A; //高5位程序計數器 static volatile unsigned char INTCON @ 0x0B; //中斷控制寄存器 static volatile unsigned char PIR1 @ 0x0C; //中斷標誌寄存器PIR1 static volatile unsigned char PIR2 @ 0x0D; //中斷標誌寄存器PIR2 static volatile unsigned char TMR1L @ 0x0E; //低位元組計數寄存器 static volatile unsigned char TMR1H @ 0x0F; //高位元組計數寄存器 static volatile unsigned char T1CON @ 0x10; //TMR1控制寄存器 static volatile unsigned char TMR2 @ 0x11; //定時/計數器TMR2 static volatile unsigned char T2CON @ 0x12; //TMR2控制寄存器 static volatile unsigned char SSPBUF @ 0x13; //收/發數據緩衝器 static volatile unsigned char SSPCON @ 0x14; //同步串口控制寄存器,對MSSP模塊的功能和指標進行設置和定義。 static volatile unsigned char CCPR1L @ 0x15; //捕獲/比較/PWM寄存器低位元組 static volatile unsigned char CCPR1H @ 0x16; //捕獲/比較/PWM寄存器低位元組 static volatile unsigned char CCP1CON @ 0x17; //CCP1CON寄存器 static volatile unsigned char RCSTA @ 0x18; //USART接收控制兼狀態寄存器 static volatile unsigned char TXREG @ 0x19; //USART發生緩衝器 static volatile unsigned char RCREG @ 0x1A; //USART接收緩衝器 static volatile unsigned char CCPR2L @ 0x1B; //捕獲/比較/PWM寄存器低位元組 static volatile unsigned char CCPR2H @ 0x1C; //捕獲/比較/PWM寄存器低位元組 static volatile unsigned char CCP2CON @ 0x1D; //CCP2CON寄存器 static volatile unsigned char ADRESH @ 0x1E; //ADC轉換結果寄存器高位元組 static volatile unsigned char ADCON0 @ 0x1F; //A/D轉換器開關位。 /* bank 1 registers */ static unsigned char bank1 OPTION @ 0x81; //選擇寄存器,用於配置TMR0/WDT預分頻係數、外部INT中斷、TMR0和埠B的弱上拉。 static volatile unsigned char bank1 TRISA @ 0x85; //A口方向寄存器 static volatile unsigned char bank1 TRISB @ 0x86; //B口方向寄存器 static volatile unsigned char bank1 TRISC @ 0x87; //C口方向寄存器 #ifdef __PINS_40 static volatile unsigned char bank1 TRISD @ 0x88; //D口方向寄存器 static volatile unsigned char bank1 TRISE @ 0x89; //E口方向寄存器 #endif static volatile unsigned char bank1 PIE1 @ 0x8C; //中斷允許寄存器PIE1 static volatile unsigned char bank1 PIE2 @ 0x8D; //中斷允許寄存器PIE2 static volatile unsigned char bank1 PCON @ 0x8E; //電源控制狀態寄存器 static volatile unsigned char bank1 SSPCON2 @ 0x91; //MSSP控制寄存器2 static volatile unsigned char bank1 PR2 @ 0x92; //TMR2周期寄存器 static volatile unsigned char bank1 SSPADD @ 0x93; //同步串口地址寄存器 static volatile unsigned char bank1 SSPSTAT @ 0x94; //同步串口狀態寄存器 static volatile unsigned char bank1 TXSTA @ 0x98; //USART發生控制兼狀態寄存器 static volatile unsigned char bank1 SPBRG @ 0x99; //USART波特率發生器初值寄存器 static volatile unsigned char bank1 CMCON @ 0x9C; //比較控制寄存器 static volatile unsigned char bank1 CVRCON @ 0x9D; //比較電壓參考控制寄存器 static volatile unsigned char bank1 ADRESL @ 0x9E; //ADC轉換結果寄存器低位元組 static volatile unsigned char bank1 ADCON1 @ 0x9F; //ADC控制寄存器ADCON1 /* bank 2 registers */ static volatile unsigned char bank2 EEDATA @ 0x10C; //EEPROM數據寄存器低位元組 static volatile unsigned char bank2 EEADR @ 0x10D; //EEPROM地址寄存器低位元組 static volatile unsigned char bank2 EEDATH @ 0x10E; //EEPROM數據寄存器高位元組 |