/* * Header file for the Microchip : * PIC 16c66 chip * Midrange Microcontroller */ static unsigned char TMR0 @ 0x01; static unsigned char PCL @ 0x02; static unsigned char STATUS @ 0x03; static unsigned char FSR @ 0x04; static unsigned char PORTA @ 0x05; static unsigned char PORTB @ 0x06; static unsigned char PORTC @ 0x07; static unsigned char PCLATH @ 0x0A; static unsigned char INTCON @ 0x0B; static unsigned char PIR1 @ 0x0C; static unsigned char PIR2 @ 0x0D; static unsigned char TMR1L @ 0x0E; static unsigned char TMR1H @ 0x0F; static unsigned char T1CON @ 0x10; static unsigned char TMR2 @ 0x11; static unsigned char T2CON @ 0x12; static unsigned char SSPBUF @ 0x13; static unsigned char SSPCON @ 0x14; static unsigned char CCPR1L @ 0x15; static unsigned char CCPR1H @ 0x16; static unsigned char CCP1CON @ 0x17; static unsigned char RCSTA @ 0x18; static unsigned char TXREG @ 0x19; static unsigned char RCREG @ 0x1A; static unsigned char CCPR2L @ 0x1B; static unsigned char CCPR2H @ 0x1C; static unsigned char CCP2CON @ 0x1D; static unsigned char bank1 OPTION @ 0x81; static unsigned char bank1 TRISA @ 0x85; static unsigned char bank1 TRISB @ 0x86; static unsigned char bank1 TRISC @ 0x87; static unsigned char bank1 PIE1 @ 0x8C; static unsigned char bank1 PIE2 @ 0x8D; static unsigned char bank1 PCON @ 0x8E; static unsigned char bank1 PR2 @ 0x92; static unsigned char bank1 SSPADD @ 0x93; static unsigned char bank1 SSPSTAT @ 0x94; static unsigned char bank1 TXSTA @ 0x98; static unsigned char bank1 SPBRG @ 0x99; /* STATUS bits */ static bit TO @ (unsigned)&STATUS*8+4; static bit PD @ (unsigned)&STATUS*8+3; /* INTCON bits */ static bit GIE @ (unsigned)&INTCON*8+7; static bit PEIE @ (unsigned)&INTCON*8+6; static bit T0IE @ (unsigned)&INTCON*8+5; static bit INTE @ (unsigned)&INTCON*8+4; static bit RBIE @ (unsigned)&INTCON*8+3; static bit T0IF @ (unsigned)&INTCON*8+2; static bit INTF @ (unsigned)&INTCON*8+1; static bit RBIF @ (unsigned)&INTCON*8+0; /* PIR1 bits */ static bit RCIF @ (unsigned)&PIR1*8+5; static bit TXIF @ (unsigned)&PIR1*8+4; static bit SSPIF @ (unsigned)&PIR1*8+3; static bit CCP1IF @ (unsigned)&PIR1*8+2; static bit TMR2IF @ (unsigned)&PIR1*8+1; static bit TMR1IF @ (unsigned)&PIR1*8+0; /* PIR2 bits */ static bit CCP2IF @ (unsigned)&PIR2*8+0; /* T1CON bits */ static bit T1CKPS1 @ (unsigned)&T1CON*8+5; static bit T1CKPS0 @ (unsigned)&T1CON*8+4; static bit T1OSCEN @ (unsigned)&T1CON*8+3; static bit T1SYNC @ (unsigned)&T1CON*8+2; static bit TMR1CS @ (unsigned)&T1CON*8+1; static bit TMR1ON @ (unsigned)&T1CON*8+0; /* T2CON bits */ static bit TOUTPS3 @ (unsigned)&T2CON*8+6; static bit TOUTPS2 @ (unsigned)&T2CON*8+5; static bit TOUTPS1 @ (unsigned)&T2CON*8+4; static bit TOUTPS0 @ (unsigned)&T2CON*8+3; static bit TMR2ON @ (unsigned)&T2CON*8+2; static bit T2CKPS1 @ (unsigned)&T2CON*8+1; static bit T2CKPS0 @ (unsigned)&T2CON*8+0; /* SSPCON bits */ static bit WCOL @ (unsigned)&SSPCON*8+7; static bit SSPOV @ (unsigned)&SSPCON*8+6; static bit SSPEN @ (unsigned)&SSPCON*8+5; static bit CKP @ (unsigned)&SSPCON*8+4; static bit SSPM3 @ (unsigned)&SSPCON*8+3; static bit SSPM2 @ (unsigned)&SSPCON*8+2; static bit SSPM1 @ (unsigned)&SSPCON*8+1; static bit SSPM0 @ (unsigned)&SSPCON*8+0; /* CCP1CON bits */ static bit CCP1X @ (unsigned)&CCP1CON*8+5; static bit CCP1Y @ (unsigned)&CCP1CON*8+4; static bit CCP1M3 @ (unsigned)&CCP1CON*8+3; static bit CCP1M2 @ (unsigned)&CCP1CON*8+2; static bit CCP1M1 @ (unsigned)&CCP1CON*8+1; static bit CCP1M0 @ (unsigned)&CCP1CON*8+0; /* RCSTA bits */ static bit SPEN @ (unsigned)&RCSTA*8+7; static bit RX9 @ (unsigned)&RCSTA*8+6; static bit SREN @ (unsigned)&RCSTA*8+5; static bit CREN @ (unsigned)&RCSTA*8+4; static bit FERR @ (unsigned)&RCSTA*8+2; static bit OERR @ (unsigned)&RCSTA*8+1; static bit RX9D @ (unsigned)&RCSTA*8+0; /* CCP2CON bits */ static bit CCP2X @ (unsigned)&CCP2CON*8+5; static bit CCP2Y @ (unsigned)&CCP2CON*8+4; static bit CCP2M3 @ (unsigned)&CCP2CON*8+3; static bit CCP2M2 @ (unsigned)&CCP2CON*8+2; static bit CCP2M1 @ (unsigned)&CCP2CON*8+1; static bit CCP2M0 @ (unsigned)&CCP2CON*8+0; /* OPTION bits */ static bit RBPU @ (unsigned)&OPTION*8+7; static bit INTEDG @ (unsigned)&OPTION*8+6; static bit T0CS @ (unsigned)&OPTION*8+5; static bit T0SE @ (unsigned)&OPTION*8+4; static bit PSA @ (unsigned)&OPTION*8+3; static bit PS2 @ (unsigned)&OPTION*8+2; static bit PS1 @ (unsigned)&OPTION*8+1; static bit PS0 @ (unsigned)&OPTION*8+0; /* PIE1 bits */ static bit RCIE @ (unsigned)&PIE1*8+5; static bit TXIE @ (unsigned)&PIE1*8+4; static bit SSPIE @ (unsigned)&PIE1*8+3; static bit CCP1IE @ (unsigned)&PIE1*8+2; static bit TMR2IE @ (unsigned)&PIE1*8+1; static bit TMR1IE @ (unsigned)&PIE1*8+0; /* PIE2 bits */ static bit CCP2IE @ (unsigned)&PIE2*8+0; /* PCON bits */ static bit POR @ (unsigned)&PCON*8+1; static bit BOR @ (unsigned)&PCON*8+0; /* TXSTA bits */ static bit CSRC @ (unsigned)&TXSTA*8+7; static bit TX9 @ (unsigned)&TXSTA*8+6; static bit TXEN @ (unsigned)&TXSTA*8+5; static bit SYNC @ (unsigned)&TXSTA*8+4; static bit BRGH @ (unsigned)&TXSTA*8+2; static bit TRMT @ (unsigned)&TXSTA*8+1; static bit TX9D @ (unsigned)&TXSTA*8+0; #define CONFIG_ADDR 0x2007 #define FOSC0 0x01 #define FOSC1 0x02 #define WDTE 0x04 #define PWRTE 0x08 #define CP0 0x10