/* * Header file for the Microchip : * PIC 14000 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 PORTC @ 0x07; static unsigned char PORTD @ 0x08; static unsigned char PCLATH @ 0x0A; static unsigned char INTCON @ 0x0B; static unsigned char PIR1 @ 0x0C; static unsigned char ADTMRL @ 0x0E; static unsigned char ADTMRH @ 0x0F; static unsigned char I2CBUF @ 0x13; static unsigned char I2CCON @ 0x14; static unsigned char ADCAPL @ 0x15; static unsigned char ADCAPH @ 0x16; static unsigned char ADCON0 @ 0x1F; static unsigned char bank1 OPTION @ 0x81; static unsigned char bank1 TRISA @ 0x85; static unsigned char bank1 TRISC @ 0x87; static unsigned char bank1 TRISD @ 0x88; static unsigned char bank1 PIE1 @ 0x8C; static unsigned char bank1 PCON @ 0x8E; static unsigned char bank1 SLPCON @ 0x8F; static unsigned char bank1 I2CADD @ 0x93; static unsigned char bank1 I2CSTAT @ 0x94; static unsigned char bank1 PREFA @ 0x9B; static unsigned char bank1 PREFB @ 0x9C; static unsigned char bank1 CMCON @ 0x9D; static unsigned char bank1 MISC @ 0x9E; static unsigned char bank1 ADCON1 @ 0x9F; /* 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 T0IF @ (unsigned)&INTCON*8+2; /* PIR1 bits */ static bit CMIF @ (unsigned)&PIR1*8+7; static bit PBIF @ (unsigned)&PIR1*8+4; static bit I2CIF @ (unsigned)&PIR1*8+3; static bit RCIF @ (unsigned)&PIR1*8+2; static bit ADCIF @ (unsigned)&PIR1*8+1; static bit OVFIF @ (unsigned)&PIR1*8+0; /* I2CCON bits */ static bit WCOL @ (unsigned)&I2CCON*8+7; static bit I2COV @ (unsigned)&I2CCON*8+6; static bit I2CEN @ (unsigned)&I2CCON*8+5; static bit CKP @ (unsigned)&I2CCON*8+4; static bit I2CM3 @ (unsigned)&I2CCON*8+3; static bit I2CM2 @ (unsigned)&I2CCON*8+2; static bit I2CM1 @ (unsigned)&I2CCON*8+1; static bit I2CM0 @ (unsigned)&I2CCON*8+0; /* ADCON0 bits */ static bit ADCS3 @ (unsigned)&ADCON0*8+7; static bit ADCS2 @ (unsigned)&ADCON0*8+6; static bit ADCS1 @ (unsigned)&ADCON0*8+5; static bit ADCS0 @ (unsigned)&ADCON0*8+4; static bit AMUXOE @ (unsigned)&ADCON0*8+2; static bit ADRST @ (unsigned)&ADCON0*8+1; static bit ADZERO @ (unsigned)&ADCON0*8+0; /* OPTION bits */ static bit RCPU @ (unsigned)&OPTION*8+7; 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 CMIE @ (unsigned)&PIE1*8+7; static bit PBIE @ (unsigned)&PIE1*8+4; static bit I2CIE @ (unsigned)&PIE1*8+3; static bit RCIE @ (unsigned)&PIE1*8+2; static bit ADCIE @ (unsigned)&PIE1*8+1; static bit OVFIE @ (unsigned)&PIE1*8+0; /* PCON bits */ static bit POR @ (unsigned)&PCON*8+1; static bit LVD @ (unsigned)&PCON*8+0; /* SLPCON bits */ static bit HIBEN @ (unsigned)&SLPCON*8+7; static bit REFOFF @ (unsigned)&SLPCON*8+5; static bit LSOFF @ (unsigned)&SLPCON*8+4; static bit OSCOFF @ (unsigned)&SLPCON*8+3; static bit CMOFF @ (unsigned)&SLPCON*8+2; static bit TEMPOFF @ (unsigned)&SLPCON*8+1; static bit ADOFF @ (unsigned)&SLPCON*8+0; /* CMCON bits */ static bit CMBOUT @ (unsigned)&CMCON*8+6; static bit CMBOE @ (unsigned)&CMCON*8+5; static bit CPOLB @ (unsigned)&CMCON*8+4; static bit CMAOUT @ (unsigned)&CMCON*8+2; static bit CMAOE @ (unsigned)&CMCON*8+1; static bit CPOLA @ (unsigned)&CMCON*8+0; /* MISC bits */ static bit SMHOG @ (unsigned)&MISC*8+7; static bit SPGNDB @ (unsigned)&MISC*8+6; static bit SPGNDA @ (unsigned)&MISC*8+5; static bit I2CSEL @ (unsigned)&MISC*8+4; static bit SMBUS @ (unsigned)&MISC*8+3; static bit INCLKEN @ (unsigned)&MISC*8+2; static bit OSC2 @ (unsigned)&MISC*8+1; static bit OSC1 @ (unsigned)&MISC*8+0; /* ADCON1 bits */ static bit ADDAC3 @ (unsigned)&ADCON1*8+7; static bit ADDAC2 @ (unsigned)&ADCON1*8+6; static bit ADDAC1 @ (unsigned)&ADCON1*8+5; static bit ADDAC0 @ (unsigned)&ADCON1*8+4; static bit PCFG3 @ (unsigned)&ADCON1*8+3; static bit PCFG2 @ (unsigned)&ADCON1*8+2; static bit PCFG1 @ (unsigned)&ADCON1*8+1; static bit PCFG0 @ (unsigned)&ADCON1*8+0; #define CONFIG_ADDR 0x2007 #define FOSC 0x01 #define WDTE 0x04 #define PWRTE 0x08 #define CPP0 0x10 #define CPP1 0x20 #define CPC 0x80