
#ifndef	_HTC_H_
#warning Header file pic1677x.h included directly. Use #include <htc.h> instead.
#endif

/*
 *	Header file for the Microchip 
 *	PIC 16C770 chip
 *	PIC 16C771 chip
 *	PIC 16C717 chip
 *	PIC 16C773 chip
 *	PIC 16C774 chip
 *	PIC 16C745 chip
 *	PIC 16C765 chip
 *	Midrange Microcontrollers
 */

static volatile unsigned char	TMR0	@ 0x01;
static volatile unsigned char	PCL	@ 0x02;
static volatile unsigned char	STATUS	@ 0x03;
static          unsigned char	FSR	@ 0x04;
static volatile unsigned char	PORTA	@ 0x05;
static volatile unsigned char	PORTB	@ 0x06;
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile unsigned char	PORTC	@ 0x07;
#endif
#if defined(_16C774) || defined(_16C765)
static volatile unsigned char	PORTD	@ 0x08;
static volatile unsigned char	PORTE	@ 0x09;
#endif
static          unsigned char	PCLATH	@ 0x0A;
static volatile unsigned char	INTCON	@ 0x0B;
static volatile unsigned char	PIR1	@ 0x0C;
static volatile unsigned char	PIR2	@ 0x0D;
static volatile unsigned char	TMR1L	@ 0x0E;
static volatile unsigned char	TMR1H	@ 0x0F;
static volatile unsigned char	T1CON	@ 0x10;
static volatile unsigned char	TMR2	@ 0x11;
static volatile unsigned char	T2CON	@ 0x12;
#if !defined(_16C745) && !defined(_16C765)
static volatile unsigned char	SSPBUF	@ 0x13;
static volatile unsigned char	SSPCON	@ 0x14;
#endif
static volatile unsigned char	CCPR1L	@ 0x15;
static volatile unsigned char	CCPR1H	@ 0x16;
static volatile unsigned char	CCP1CON	@ 0x17;
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile unsigned char	RCSTA	@ 0x18;
static volatile unsigned char	TXREG	@ 0x19;
static volatile unsigned char	RCREG	@ 0x1A;
static volatile unsigned char	CCPR2L	@ 0x1B;
static volatile unsigned char	CCPR2H	@ 0x1C;
static volatile unsigned char	CCP2CON	@ 0x1D;
#endif
static volatile unsigned char	ADRESH	@ 0x1E;
static volatile unsigned char	ADCON0	@ 0x1F;

static          unsigned char bank1	OPTION	@ 0x81;
static          unsigned char bank1	TRISA	@ 0x85;
static          unsigned char bank1	TRISB	@ 0x86;
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static          unsigned char bank1	TRISC	@ 0x87;
#endif
#if defined(_16C774) || defined(_16C765)
static          unsigned char bank1	TRISD	@ 0x88;
static          unsigned char bank1	TRISE	@ 0x89;
#endif
static volatile unsigned char bank1	PIE1	@ 0x8C;
static volatile unsigned char bank1	PIE2	@ 0x8D;
static volatile unsigned char bank1	PCON	@ 0x8E;
#if !defined(_16C745) && !defined(_16C765)
static volatile unsigned char bank1	SSPCON2	@ 0x91;
#endif
static volatile unsigned char bank1	PR2	@ 0x92;
#if !defined(_16C745) && !defined(_16C765)
static volatile unsigned char bank1	SSPADD	@ 0x93;
static volatile unsigned char bank1	SSPSTAT	@ 0x94;
#if defined(_16C770) || defined(_16C771) || defined(_16C717)
static volatile unsigned char bank1	WPUB	@ 0x95;
static volatile unsigned char bank1	IOCB	@ 0x96;
static volatile unsigned char bank1	P1DEL	@ 0x97;
#endif
#endif
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile unsigned char bank1	TXSTA	@ 0x98;
static volatile unsigned char bank1	SPBRG	@ 0x99;
#endif
#if !defined(_16C745) && !defined(_16C765)
static volatile unsigned char bank1	REFCON	@ 0x9B;
static volatile unsigned char bank1	LVDCON	@ 0x9C;
#if defined(_16C770) || defined(_16C771) || defined(_16C717)
static volatile unsigned char bank1	ANSEL	@ 0x9D;
#endif
static volatile unsigned char bank1	ADRESL	@ 0x9E;
#endif
static volatile unsigned char bank1	ADCON1	@ 0x9F;

#if defined(_16C770) || defined(_16C771) || defined(_16C717)
static		unsigned char bank2	PMDATL	@ 0x10C;
static		unsigned char bank2	PMADRL	@ 0x10D;
static 		unsigned char bank2	PMDATH	@ 0x10E;
static 		unsigned char bank2	PMADRH	@ 0x10F;
#endif

#if defined(_16C745) || defined(_16C765)
/* USB Registers */
static volatile unsigned char bank3	UIR	@ 0x190;
static volatile unsigned char bank3	UIE	@ 0x191;
static volatile unsigned char bank3	UEIR	@ 0x192;
static volatile unsigned char bank3	UEIE	@ 0x193;
static volatile unsigned char bank3	USTAT	@ 0x194;
static volatile unsigned char bank3	UCTRL	@ 0x195;
static volatile unsigned char bank3	UADDR	@ 0x196;
static volatile unsigned char bank3	USWSTAT	@ 0x197;
static volatile unsigned char bank3	UEP0	@ 0x198;
static volatile unsigned char bank3	UEP1	@ 0x199;
static volatile unsigned char bank3	UEP2	@ 0x19A;

static volatile unsigned char bank3	BD0OST @ 0x1A0;
static volatile unsigned char bank3	BD1OST @ 0x1A8;
static volatile unsigned char bank3	BD2OST @ 0x1B0;

static volatile unsigned char bank3	BD0IST @ 0x1A4;
static volatile unsigned char bank3	BD1IST @ 0x1AC;
static volatile unsigned char bank3	BD2IST @ 0x1B4;

static volatile unsigned char bank3	BD0OBC	@ 0x1A1;
static volatile unsigned char bank3	BD1OBC	@ 0x1A9;
static volatile unsigned char bank3	BD2OBC	@ 0x1B1;

static volatile unsigned char bank3	BD0IBC	@ 0x1A5;
static volatile unsigned char bank3	BD1IBC	@ 0x1AD;
static volatile unsigned char bank3	BD2IBC	@ 0x1B5;

static volatile unsigned char bank3 	BD0OAL	@ 0x1A2;
static volatile unsigned char bank3 	BD1OAL	@ 0x1AA;
static volatile unsigned char bank3 	BD2OAL	@ 0x1B2;

static volatile unsigned char bank3 	BD0IAL	@ 0x1A6;
static volatile unsigned char bank3 	BD1IAL	@ 0x1AE;
static volatile unsigned char bank3 	BD2IAL	@ 0x1B6;

/* USB Dual Port Memory buffer */
static volatile unsigned char bank3 USBMEM[40]	@ 0x1B8;

#endif


/* 	TMR0 bits	*/
static bit	TMR07	@ (unsigned)&TMR0*8+7;
static bit	TMR06   @ (unsigned)&TMR0*8+6;
static bit	TMR05   @ (unsigned)&TMR0*8+5;
static bit	TMR04	@ (unsigned)&TMR0*8+4;
static bit	TMR03	@ (unsigned)&TMR0*8+3;
static bit	TMR02   @ (unsigned)&TMR0*8+2;
static bit	TMR01   @ (unsigned)&TMR0*8+1;
static bit	TMR00   @ (unsigned)&TMR0*8+0;

/*	PCL bits	*/
static bit	PCL7	@ (unsigned)&PCL*8+7;
static bit	PCL6   	@ (unsigned)&PCL*8+6;
static bit	PCL5   	@ (unsigned)&PCL*8+5;
static bit	PCL4	@ (unsigned)&PCL*8+4;
static bit	PCL3	@ (unsigned)&PCL*8+3;
static bit	PCL2	@ (unsigned)&PCL*8+2;
static bit	PCL1   	@ (unsigned)&PCL*8+1;
static bit	PCL0  	@ (unsigned)&PCL*8+0;

/*	STATUS bits	*/
static volatile bit	IRP     @ (unsigned)&STATUS*8+7;
static volatile bit	RP1     @ (unsigned)&STATUS*8+6;
static volatile bit	RP0     @ (unsigned)&STATUS*8+5;
static volatile bit	TO	@ (unsigned)&STATUS*8+4;
static volatile bit	PD	@ (unsigned)&STATUS*8+3;
static volatile bit	ZERO    @ (unsigned)&STATUS*8+2;
static volatile bit	DC      @ (unsigned)&STATUS*8+1;
static volatile bit	CARRY   @ (unsigned)&STATUS*8+0;

/*      PORTA bits      */
#if defined(_16C770) || defined(_16C771) || defined(_16C717)
static volatile bit	RA7     @ (unsigned)&PORTA*8+7;
static volatile bit	RA6     @ (unsigned)&PORTA*8+6;
#endif
#if defined(_16C770) || defined(_16C771) || defined(_16C717) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit	RA5     @ (unsigned)&PORTA*8+5;
#endif
static volatile bit	RA4     @ (unsigned)&PORTA*8+4;
static volatile bit	RA3     @ (unsigned)&PORTA*8+3;
static volatile bit	RA2     @ (unsigned)&PORTA*8+2;
static volatile bit	RA1     @ (unsigned)&PORTA*8+1;
static volatile bit	RA0     @ (unsigned)&PORTA*8+0;

/*      PORTB bits      */
static volatile bit	RB7     @ (unsigned)&PORTB*8+7;
static volatile bit	RB6     @ (unsigned)&PORTB*8+6;
static volatile bit	RB5     @ (unsigned)&PORTB*8+5;
static volatile bit	RB4     @ (unsigned)&PORTB*8+4;
static volatile bit	RB3     @ (unsigned)&PORTB*8+3;
static volatile bit	RB2     @ (unsigned)&PORTB*8+2;
static volatile bit	RB1     @ (unsigned)&PORTB*8+1;
static volatile bit	RB0     @ (unsigned)&PORTB*8+0;

/*      PORTC bits      */
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit	RC7     @ (unsigned)&PORTC*8+7;
static volatile bit	RC6     @ (unsigned)&PORTC*8+6;
#if !defined(_16C745) && !defined(_16C765)
static volatile bit	RC5     @ (unsigned)&PORTC*8+5;
static volatile bit	RC4     @ (unsigned)&PORTC*8+4;
static volatile bit	RC3     @ (unsigned)&PORTC*8+3;
#endif
static volatile bit	RC2     @ (unsigned)&PORTC*8+2;
static volatile bit	RC1     @ (unsigned)&PORTC*8+1;
static volatile bit	RC0     @ (unsigned)&PORTC*8+0;
#endif

#if defined(_16C774) || defined(_16C765)
/*      PORTD bits      */
static volatile bit	RD7     @ (unsigned)&PORTD*8+7;
static volatile bit	RD6     @ (unsigned)&PORTD*8+6;
static volatile bit	RD5     @ (unsigned)&PORTD*8+5;
static volatile bit	RD4     @ (unsigned)&PORTD*8+4;
static volatile bit	RD3     @ (unsigned)&PORTD*8+3;
static volatile bit	RD2     @ (unsigned)&PORTD*8+2;
static volatile bit	RD1     @ (unsigned)&PORTD*8+1;
static volatile bit	RD0     @ (unsigned)&PORTD*8+0;

/*      PORTE bits      */
static volatile bit      RE2     @ (unsigned)&PORTE*8+2;
static volatile bit      RE1     @ (unsigned)&PORTE*8+1;
static volatile bit      RE0     @ (unsigned)&PORTE*8+0;
#endif

/*	INTCON bits	*/
static volatile bit	GIE	@ (unsigned)&INTCON*8+7;
static volatile bit	PEIE	@ (unsigned)&INTCON*8+6;
static volatile bit	T0IE	@ (unsigned)&INTCON*8+5;
static volatile bit	INTE	@ (unsigned)&INTCON*8+4;
static volatile bit	RBIE	@ (unsigned)&INTCON*8+3;
static volatile bit	T0IF	@ (unsigned)&INTCON*8+2;
static volatile bit	INTF	@ (unsigned)&INTCON*8+1;
static volatile bit	RBIF	@ (unsigned)&INTCON*8+0;

/*	PIR1 bits	*/
#if defined(_16C774) || defined(_16C765)
static volatile bit	PSPIF	@ (unsigned)&PIR1*8+7;
#endif
static volatile bit	ADIF	@ (unsigned)&PIR1*8+6;
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit	RCIF	@ (unsigned)&PIR1*8+5;
static volatile bit	TXIF	@ (unsigned)&PIR1*8+4;
#endif
#if defined(_16C745) || defined(_16C765)
static volatile bit	USBIF	@ (unsigned)&PIR1*8+3;
#endif
#if !defined(_16C745) && !defined(_16C765)
static volatile bit	SSPIF	@ (unsigned)&PIR1*8+3;
#endif
static volatile bit	CCP1IF	@ (unsigned)&PIR1*8+2;
static volatile bit	TMR2IF	@ (unsigned)&PIR1*8+1;
static volatile bit	TMR1IF	@ (unsigned)&PIR1*8+0;

/*	PIR2 bits	*/
#if !defined(_16C745) && !defined(_16C765)
static volatile bit	LVDIF	@ (unsigned)&PIR2*8+7;
static volatile bit	BCLIF	@ (unsigned)&PIR2*8+3;
#endif
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit	CCP2IF	@ (unsigned)&PIR2*8+0;
#endif

/*	TMR1L bits	*/
static bit	TMR1L7		@ (unsigned)&TMR1L*8+7;
static bit	TMR1L6  	@ (unsigned)&TMR1L*8+6;
static bit	TMR1L5  	@ (unsigned)&TMR1L*8+5;
static bit	TMR1L4		@ (unsigned)&TMR1L*8+4;
static bit	TMR1L3		@ (unsigned)&TMR1L*8+3;
static bit	TMR1L2  	@ (unsigned)&TMR1L*8+2;
static bit	TMR1L1  	@ (unsigned)&TMR1L*8+1;
static bit	TMR1L0  	@ (unsigned)&TMR1L*8+0;

/*	TMR1H bits	*/
static bit	TMR1H7		@ (unsigned)&TMR1H*8+7;
static bit	TMR1H6  	@ (unsigned)&TMR1H*8+6;
static bit	TMR1H5  	@ (unsigned)&TMR1H*8+5;
static bit	TMR1H4		@ (unsigned)&TMR1H*8+4;
static bit	TMR1H3		@ (unsigned)&TMR1H*8+3;
static bit	TMR1H2  	@ (unsigned)&TMR1H*8+2;
static bit	TMR1H1  	@ (unsigned)&TMR1H*8+1;
static bit	TMR1H0  	@ (unsigned)&TMR1H*8+0;

/* 	TMR2 bits	*/
static bit	TMR27	@ (unsigned)&TMR2*8+7;
static bit	TMR26   @ (unsigned)&TMR2*8+6;
static bit	TMR25   @ (unsigned)&TMR2*8+5;
static bit	TMR24	@ (unsigned)&TMR2*8+4;
static bit	TMR23	@ (unsigned)&TMR2*8+3;
static bit	TMR22   @ (unsigned)&TMR2*8+2;
static bit	TMR21   @ (unsigned)&TMR2*8+1;
static bit	TMR20   @ (unsigned)&TMR2*8+0;

/*	T1CON bits	*/
static volatile bit	T1CKPS1	@ (unsigned)&T1CON*8+5;
static volatile bit	T1CKPS0	@ (unsigned)&T1CON*8+4;
static volatile bit	T1OSCEN	@ (unsigned)&T1CON*8+3;
static volatile bit	T1SYNC 	@ (unsigned)&T1CON*8+2;
static volatile bit	TMR1CS 	@ (unsigned)&T1CON*8+1;
static volatile bit	TMR1ON 	@ (unsigned)&T1CON*8+0;

/*	T2CON bits	*/
static volatile bit	TOUTPS3	@ (unsigned)&T2CON*8+6;
static volatile bit	TOUTPS2	@ (unsigned)&T2CON*8+5;
static volatile bit	TOUTPS1	@ (unsigned)&T2CON*8+4;
static volatile bit	TOUTPS0	@ (unsigned)&T2CON*8+3;
static volatile bit	TMR2ON 	@ (unsigned)&T2CON*8+2;
static volatile bit	T2CKPS1	@ (unsigned)&T2CON*8+1;
static volatile bit	T2CKPS0	@ (unsigned)&T2CON*8+0;

#if !defined(_16C745) && !defined(_16C765)
/*	SSPBUF bits	*/
static volatile bit	SSPBUF7 @ (unsigned)&SSPBUF*8+7;
static volatile bit	SSPBUF6 @ (unsigned)&SSPBUF*8+6;
static volatile bit	SSPBUF5 @ (unsigned)&SSPBUF*8+5;
static volatile bit	SSPBUF4 @ (unsigned)&SSPBUF*8+4;
static volatile bit	SSPBUF3 @ (unsigned)&SSPBUF*8+3;
static volatile bit	SSPBUF2 @ (unsigned)&SSPBUF*8+2;
static volatile bit	SSPBUF1 @ (unsigned)&SSPBUF*8+1;
static volatile bit	SSPBUF0 @ (unsigned)&SSPBUF*8+0;

/*	SSPCON bits	*/
static volatile bit	WCOL	@ (unsigned)&SSPCON*8+7;
static volatile bit	SSPOV	@ (unsigned)&SSPCON*8+6;
static volatile bit	SSPEN	@ (unsigned)&SSPCON*8+5;
static volatile bit	CKP	@ (unsigned)&SSPCON*8+4;
static volatile bit	SSPM3	@ (unsigned)&SSPCON*8+3;
static volatile bit	SSPM2	@ (unsigned)&SSPCON*8+2;
static volatile bit	SSPM1	@ (unsigned)&SSPCON*8+1;
static volatile bit	SSPM0	@ (unsigned)&SSPCON*8+0;
#endif

/* 	CCPR1L bits	*/
static 		bit	CCPR1L7 @ (unsigned)&CCPR1L*8+7;
static 		bit	CCPR1L6 @ (unsigned)&CCPR1L*8+6;
static 		bit	CCPR1L5 @ (unsigned)&CCPR1L*8+5;
static 		bit	CCPR1L4 @ (unsigned)&CCPR1L*8+4;
static 		bit	CCPR1L3 @ (unsigned)&CCPR1L*8+3;
static 		bit	CCPR1L2 @ (unsigned)&CCPR1L*8+2;
static 		bit	CCPR1L1 @ (unsigned)&CCPR1L*8+1;
static 		bit	CCPR1L0 @ (unsigned)&CCPR1L*8+0;

/* 	CCPR1H bits	*/
static 		bit	CCPR1H7 @ (unsigned)&CCPR1H*8+7;
static 		bit	CCPR1H6 @ (unsigned)&CCPR1H*8+6;
static 		bit	CCPR1H5 @ (unsigned)&CCPR1H*8+5;
static 		bit	CCPR1H4 @ (unsigned)&CCPR1H*8+4;
static 		bit	CCPR1H3 @ (unsigned)&CCPR1H*8+3;
static 		bit	CCPR1H2 @ (unsigned)&CCPR1H*8+2;
static 		bit	CCPR1H1 @ (unsigned)&CCPR1H*8+1;
static 		bit	CCPR1H0 @ (unsigned)&CCPR1H*8+0;

/*	CCP1CON bits	*/
#if defined(_16C770) || defined(_16C771) || defined(_16C717) || defined(_16C745) || defined(_16C765)
#if !defined(_16C745) && !defined(_16C765)
static volatile bit	PWM1M1	@ (unsigned)&CCP1CON*8+7;
static volatile bit	PWM1M0	@ (unsigned)&CCP1CON*8+6;
#endif
static volatile bit	DC1B1	@ (unsigned)&CCP1CON*8+5;
static volatile bit	DC1B0	@ (unsigned)&CCP1CON*8+4;
#endif
#if defined(_16C773) || defined(_16C774)
static volatile bit	CCP1X	@ (unsigned)&CCP1CON*8+5;
static volatile bit	CCP1Y	@ (unsigned)&CCP1CON*8+4;
#endif
static volatile bit	CCP1M3	@ (unsigned)&CCP1CON*8+3;
static volatile bit	CCP1M2	@ (unsigned)&CCP1CON*8+2;
static volatile bit	CCP1M1	@ (unsigned)&CCP1CON*8+1;
static volatile bit	CCP1M0	@ (unsigned)&CCP1CON*8+0;

#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
/*	RCSTA bits	*/
static volatile bit	SPEN	@ (unsigned)&RCSTA*8+7;
static volatile bit	RX9 	@ (unsigned)&RCSTA*8+6;
static volatile bit	SREN	@ (unsigned)&RCSTA*8+5;
static volatile bit	CREN	@ (unsigned)&RCSTA*8+4;
#if !defined(_16C745) && !defined(_16C765)
static volatile bit	ADDEN	@ (unsigned)&RCSTA*8+3;
#endif
static volatile bit	FERR	@ (unsigned)&RCSTA*8+2;
static volatile bit	OERR	@ (unsigned)&RCSTA*8+1;
static volatile bit	RX9D	@ (unsigned)&RCSTA*8+0;

/*	CCP2CON bits	*/
#if !defined(_16C745) && !defined(_16C765)
static volatile bit	CCP2X	@ (unsigned)&CCP2CON*8+5;
static volatile bit	CCP2Y	@ (unsigned)&CCP2CON*8+4;
#endif
#if defined(_16C745) || defined(_16C765)
static volatile bit	DC2B1	@ (unsigned)&CCP2CON*8+5;
static volatile bit	DC2B0	@ (unsigned)&CCP2CON*8+4;
#endif
static volatile bit	CCP2M3	@ (unsigned)&CCP2CON*8+3;
static volatile bit	CCP2M2	@ (unsigned)&CCP2CON*8+2;
static volatile bit	CCP2M1	@ (unsigned)&CCP2CON*8+1;
static volatile bit	CCP2M0	@ (unsigned)&CCP2CON*8+0;
#endif

/*	 ADCON0 bits	*/
static volatile bit	ADCS1	@ (unsigned)&ADCON0*8+7;
static volatile bit	ADCS0 	@ (unsigned)&ADCON0*8+6;
static volatile bit	CHS2	@ (unsigned)&ADCON0*8+5;
static volatile bit	CHS1	@ (unsigned)&ADCON0*8+4;
static volatile bit	CHS0	@ (unsigned)&ADCON0*8+3;
static volatile bit	ADGO	@ (unsigned)&ADCON0*8+2;
#if !defined(_16C745) && !defined(_16C765)
static volatile bit	CHS3	@ (unsigned)&ADCON0*8+1;
#endif
static volatile bit	ADON	@ (unsigned)&ADCON0*8+0;

/* 	ADRESH bits	*/
static		bit 	ADRESH7 @ (unsigned)&ADRESH*8+7;
static		bit 	ADRESH6 @ (unsigned)&ADRESH*8+6;
static		bit 	ADRESH5 @ (unsigned)&ADRESH*8+5;
static		bit 	ADRESH4 @ (unsigned)&ADRESH*8+4;
static		bit 	ADRESH3 @ (unsigned)&ADRESH*8+3;
static		bit 	ADRESH2 @ (unsigned)&ADRESH*8+2;
static		bit 	ADRESH1 @ (unsigned)&ADRESH*8+1;
static		bit 	ADRESH0 @ (unsigned)&ADRESH*8+0;

/* 	OPTION bits	*/
static volatile bit bank1	RBPU	@ (unsigned)&OPTION*8+7;
static volatile bit bank1	INTEDG	@ (unsigned)&OPTION*8+6;
static volatile bit bank1	T0CS	@ (unsigned)&OPTION*8+5;
static volatile bit bank1	T0SE	@ (unsigned)&OPTION*8+4;
static volatile bit bank1	PSA	@ (unsigned)&OPTION*8+3;
static volatile bit bank1	PS2	@ (unsigned)&OPTION*8+2;
static volatile bit bank1	PS1	@ (unsigned)&OPTION*8+1;
static volatile bit bank1 	PS0	@ (unsigned)&OPTION*8+0;

/*      TRISA bits      */
#if defined(_16C770) || defined(_16C771) || defined(_16C717)
static volatile bit bank1	TRISA7  @ (unsigned)&TRISA*8+7;
static volatile bit bank1	TRISA6  @ (unsigned)&TRISA*8+6;
#endif
#if defined(_16C770) || defined(_16C771) || defined(_16C717) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit bank1	TRISA5  @ (unsigned)&TRISA*8+5;
#endif
static volatile bit bank1	TRISA4  @ (unsigned)&TRISA*8+4;
static volatile bit bank1	TRISA3  @ (unsigned)&TRISA*8+3;
static volatile bit bank1	TRISA2  @ (unsigned)&TRISA*8+2;
static volatile bit bank1	TRISA1  @ (unsigned)&TRISA*8+1;
static volatile bit bank1	TRISA0  @ (unsigned)&TRISA*8+0;

/*      TRISB bits      */
static volatile bit bank1	TRISB7  @ (unsigned)&TRISB*8+7;
static volatile bit bank1	TRISB6  @ (unsigned)&TRISB*8+6;
static volatile bit bank1	TRISB5  @ (unsigned)&TRISB*8+5;
static volatile bit bank1	TRISB4  @ (unsigned)&TRISB*8+4;
static volatile bit bank1	TRISB3  @ (unsigned)&TRISB*8+3;
static volatile bit bank1	TRISB2  @ (unsigned)&TRISB*8+2;
static volatile bit bank1	TRISB1  @ (unsigned)&TRISB*8+1;
static volatile bit bank1	TRISB0  @ (unsigned)&TRISB*8+0;

/*      TRISC bits      */
#if defined(_16C773) || defined(_16C774)
static volatile bit bank1	TRISC7  @ (unsigned)&TRISC*8+7;
static volatile bit bank1	TRISC6  @ (unsigned)&TRISC*8+6;
#if !defined(_16C745) && !defined(_16C765)
static volatile bit bank1	TRISC5  @ (unsigned)&TRISC*8+5; 
static volatile bit bank1	TRISC4  @ (unsigned)&TRISC*8+4;
static volatile bit bank1	TRISC3  @ (unsigned)&TRISC*8+3;
#endif
static volatile bit bank1	TRISC2  @ (unsigned)&TRISC*8+2;
static volatile bit bank1	TRISC1  @ (unsigned)&TRISC*8+1;
static volatile bit bank1	TRISC0  @ (unsigned)&TRISC*8+0;
#endif

#if defined(_16C774) || defined(_16C765)
/*      TRISD bits      */
static volatile bit bank1	TRISD7  @ (unsigned)&TRISD*8+7;
static volatile bit bank1	TRISD6  @ (unsigned)&TRISD*8+6;
static volatile bit bank1	TRISD5  @ (unsigned)&TRISD*8+5;
static volatile bit bank1	TRISD4  @ (unsigned)&TRISD*8+4;
static volatile bit bank1	TRISD3  @ (unsigned)&TRISD*8+3;
static volatile bit bank1	TRISD2  @ (unsigned)&TRISD*8+2;
static volatile bit bank1	TRISD1  @ (unsigned)&TRISD*8+1;
static volatile bit bank1	TRISD0  @ (unsigned)&TRISD*8+0;

/*      TRISE bits      */
static volatile bit bank1	IBF     @ (unsigned)&TRISE*8+7;
static volatile bit bank1	OBF     @ (unsigned)&TRISE*8+6;
static volatile bit bank1	IBOV    @ (unsigned)&TRISE*8+5;
static volatile bit bank1	PSPMODE @ (unsigned)&TRISE*8+4;
static volatile bit bank1	TRISE2	@ (unsigned)&TRISE*8+2;
static volatile bit bank1	TRISE1	@ (unsigned)&TRISE*8+1;
static volatile bit bank1	TRISE0	@ (unsigned)&TRISE*8+0;
#endif

/*	PIE1 bits	*/
#if defined(_16C774) || defined(_16C765)
static volatile bit bank1	PSPIE	@ (unsigned)&PIE1*8+7;
#endif
static volatile bit bank1	ADIE	@ (unsigned)&PIE1*8+6;
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit bank1	RCIE	@ (unsigned)&PIE1*8+5;
static volatile bit bank1	TXIE	@ (unsigned)&PIE1*8+4;
#endif
#if defined(_16C745) || defined(_16C765)
static volatile bit bank1	USBIE	@ (unsigned)&PIE1*8+3;
#endif
#if !defined(_16C745) && !defined(_16C765)
static volatile bit bank1	SSPIE	@ (unsigned)&PIE1*8+3;
#endif
static volatile bit bank1	CCP1IE	@ (unsigned)&PIE1*8+2;
static volatile bit bank1	TMR2IE	@ (unsigned)&PIE1*8+1;
static volatile bit bank1	TMR1IE	@ (unsigned)&PIE1*8+0;

/*	PIE2 bits	*/
#if !defined(_16C774) && !defined(_16C765)
static volatile bit bank1	LVDIE	@ (unsigned)&PIE2*8+7;
static volatile bit bank1	BCLIE	@ (unsigned)&PIE2*8+3;
#endif
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit bank1	CCP2IE	@ (unsigned)&PIE2*8+0;
#endif

/*	PCON bits	*/
#if defined(_16C770) || defined(_16C771) || defined(_16C717)
static volatile bit bank1	OSCF	@ (unsigned)&PCON*8+3;	
#endif
static volatile bit bank1	POR	@ (unsigned)&PCON*8+1;	
static volatile bit bank1	BOR	@ (unsigned)&PCON*8+0;	

/*		SSPCON2 BITS	*/
#if !defined(_16C745) && !defined(_16C765)
static volatile bit bank1	GCEN	@ (unsigned)&SSPCON2*8+7;
static volatile bit bank1	ACKSTAT	@ (unsigned)&SSPCON2*8+6;
static volatile bit bank1	ACKDT	@ (unsigned)&SSPCON2*8+5;
static volatile bit bank1	ACKEN	@ (unsigned)&SSPCON2*8+4;
static volatile bit bank1	RCEN	@ (unsigned)&SSPCON2*8+3;
static volatile bit bank1	PEN	@ (unsigned)&SSPCON2*8+2;
static volatile bit bank1	RSEN	@ (unsigned)&SSPCON2*8+1;
static volatile bit bank1	SEN	@ (unsigned)&SSPCON2*8+0;

/*      SSPSTAT bits    */
static volatile bit bank1	SMP	@ (unsigned)&SSPSTAT*8+7;
static volatile bit bank1	CKE	@ (unsigned)&SSPSTAT*8+6;
static volatile bit bank1	DA	@ (unsigned)&SSPSTAT*8+5;
static volatile bit bank1	STOP	@ (unsigned)&SSPSTAT*8+4;
static volatile bit bank1	START	@ (unsigned)&SSPSTAT*8+3;
static volatile bit bank1	RW	@ (unsigned)&SSPSTAT*8+2;
static volatile bit bank1	UA	@ (unsigned)&SSPSTAT*8+1;
static volatile bit bank1	BF	@ (unsigned)&SSPSTAT*8+0;
#ifdef __STAT_BACKWARD_COMPATIBILITY
#define STAT_SMP	SMP
#define STAT_CKE	CKE
#define STAT_DA	DA
#define STAT_P	STOP
#define STAT_S	START
#define STAT_RW	RW
#define STAT_UA	UA
#define STAT_BF	BF
#endif
#endif

/*	PR2 bits	*/
static 		bit bank1	PR27	@ (unsigned)&PR2*8+7;
static 		bit bank1	PR26	@ (unsigned)&PR2*8+6;
static 		bit bank1	PR25	@ (unsigned)&PR2*8+5;
static 		bit bank1	PR24	@ (unsigned)&PR2*8+4;
static 		bit bank1	PR23	@ (unsigned)&PR2*8+3;
static 		bit bank1	PR22	@ (unsigned)&PR2*8+2;
static 		bit bank1	PR21	@ (unsigned)&PR2*8+1;
static 		bit bank1	PR20	@ (unsigned)&PR2*8+0;

/*	SSPADD bits	*/
#if !defined(_16C745) && !defined(_16C765)
static 		bit bank1	SSPADD7 @ (unsigned)&SSPADD*8+7;
static 		bit bank1	SSPADD6 @ (unsigned)&SSPADD*8+6;
static 		bit bank1	SSPADD5 @ (unsigned)&SSPADD*8+5;
static 		bit bank1	SSPADD4 @ (unsigned)&SSPADD*8+4;
static 		bit bank1	SSPADD3 @ (unsigned)&SSPADD*8+3;
static 		bit bank1	SSPADD2 @ (unsigned)&SSPADD*8+2;
static 		bit bank1	SSPADD1 @ (unsigned)&SSPADD*8+1;
static 		bit bank1	SSPADD0 @ (unsigned)&SSPADD*8+0;
#endif

#if defined(_16C770) || defined(_16C771) || defined(_16C717)
/*	WPUB bits 	*/
static volatile bit bank1	WPUB7 	@ (unsigned)&WPUB*8+7;
static volatile bit bank1	WPUB6 	@ (unsigned)&WPUB*8+6;
static volatile bit bank1	WPUB5 	@ (unsigned)&WPUB*8+5;
static volatile bit bank1	WPUB4 	@ (unsigned)&WPUB*8+4;
static volatile bit bank1	WPUB3 	@ (unsigned)&WPUB*8+3;
static volatile bit bank1	WPUB2 	@ (unsigned)&WPUB*8+2;
static volatile bit bank1	WPUB1 	@ (unsigned)&WPUB*8+1;
static volatile bit bank1	WPUB0 	@ (unsigned)&WPUB*8+0;

/*	IOCB bits	*/
static volatile bit bank1	IOCB7	@ (unsigned)&IOCB*8+7;
static volatile bit bank1	IOCB6	@ (unsigned)&IOCB*8+6;
static volatile bit bank1	IOCB5	@ (unsigned)&IOCB*8+5;
static volatile bit bank1	IOCB4	@ (unsigned)&IOCB*8+4;
static volatile bit bank1	IOCB3	@ (unsigned)&IOCB*8+3;
static volatile bit bank1	IOCB2	@ (unsigned)&IOCB*8+2;
static volatile bit bank1	IOCB1	@ (unsigned)&IOCB*8+1;
static volatile bit bank1	IOCB0	@ (unsigned)&IOCB*8+0;

/*	P1DEL bits	*/
static		bit bank1	P1DEL7 	@ (unsigned)&P1DEL*8+7;
static		bit bank1	P1DEL6 	@ (unsigned)&P1DEL*8+6;
static		bit bank1	P1DEL5 	@ (unsigned)&P1DEL*8+5;
static		bit bank1	P1DEL4 	@ (unsigned)&P1DEL*8+4;
static		bit bank1	P1DEL3 	@ (unsigned)&P1DEL*8+3;
static		bit bank1	P1DEL2 	@ (unsigned)&P1DEL*8+2;
static		bit bank1	P1DEL1 	@ (unsigned)&P1DEL*8+1;
static		bit bank1	P1DEL0 	@ (unsigned)&P1DEL*8+0;
#endif

/*	TXSTA bits	*/
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
static volatile bit bank1	CSRC	@ (unsigned)&TXSTA*8+7;
static volatile bit bank1	TX9	@ (unsigned)&TXSTA*8+6;
static volatile bit bank1	TXEN	@ (unsigned)&TXSTA*8+5;
static volatile bit bank1	SYNC	@ (unsigned)&TXSTA*8+4;
static volatile bit bank1	BRGH	@ (unsigned)&TXSTA*8+2;
static volatile bit bank1	TRMT	@ (unsigned)&TXSTA*8+1;
static volatile bit bank1	TX9D	@ (unsigned)&TXSTA*8+0;
#endif

/*	REFCON bits	*/
#if !defined(_16C745) && !defined(_16C765)
static volatile bit bank1	VRHEN	@ (unsigned)&REFCON*8+7;
static volatile bit bank1	VRLEN	@ (unsigned)&REFCON*8+6;
static volatile bit bank1	VRHOEN	@ (unsigned)&REFCON*8+5;
static volatile bit bank1	VRLOEN	@ (unsigned)&REFCON*8+4;

/*	LVDCON bits	*/
static volatile bit bank1	BGST	@ (unsigned)&LVDCON*8+5;
static volatile bit bank1	LVDEN	@ (unsigned)&LVDCON*8+4;
static volatile bit bank1	LV3	@ (unsigned)&LVDCON*8+3;
static volatile bit bank1	LV2	@ (unsigned)&LVDCON*8+2;
static volatile bit bank1	LV1	@ (unsigned)&LVDCON*8+1;
static volatile bit bank1	LV0	@ (unsigned)&LVDCON*8+0;
#endif

/* 	ANSEL bits 	*/
#if defined(_16C770) || defined(_16C771) || defined(_16C717)
static 		bit bank1	ANSEL5	@ (unsigned)&ANSEL*8+5;
static 		bit bank1	ANSEL4	@ (unsigned)&ANSEL*8+4;
static 		bit bank1	ANSEL3	@ (unsigned)&ANSEL*8+3;
static 		bit bank1	ANSEL2	@ (unsigned)&ANSEL*8+2;
static 		bit bank1	ANSEL1	@ (unsigned)&ANSEL*8+1;
static 		bit bank1	ANSEL0	@ (unsigned)&ANSEL*8+0;
#endif

/*	ADRESL bits	*/
#if !defined(_16C745) && !defined(_16C765)
static		bit 	ADRESL7 @ (unsigned)&ADRESL*8+7;
static		bit 	ADRESL6 @ (unsigned)&ADRESL*8+6;
static		bit 	ADRESL5 @ (unsigned)&ADRESL*8+5;
static		bit 	ADRESL4 @ (unsigned)&ADRESL*8+4;
static		bit 	ADRESL3 @ (unsigned)&ADRESL*8+3;
static		bit 	ADRESL2 @ (unsigned)&ADRESL*8+2;
static		bit 	ADRESL1 @ (unsigned)&ADRESL*8+1;
static		bit 	ADRESL0 @ (unsigned)&ADRESL*8+0;
#endif

/*	ADCON1 bits	*/
#if !defined(_16C745) && !defined(_16C765)
static volatile bit bank1	ADFM	@ (unsigned)&ADCON1*8+7;
static volatile bit bank1	VCFG2	@ (unsigned)&ADCON1*8+6;
static volatile bit bank1	VCFG1	@ (unsigned)&ADCON1*8+5;
static volatile bit bank1	VCFG0	@ (unsigned)&ADCON1*8+4;
#endif
#if defined(_16C773) || defined(_16C774) || defined(_16C745) || defined(_16C765)
#if !defined(_16C774) && !defined(_16C765)
static volatile bit bank1	PCFG3	@ (unsigned)&ADCON1*8+3;
#endif
static volatile bit bank1	PCFG2	@ (unsigned)&ADCON1*8+2;
static volatile bit bank1	PCFG1	@ (unsigned)&ADCON1*8+1;
static volatile bit bank1	PCFG0	@ (unsigned)&ADCON1*8+0;
#endif

#if defined(_16C770) || defined(_16C771) || defined(_16C717)
/*	PMDATL bits	*/
static		bit bank2 	PMDATL7 @ (unsigned)&PMDATL*8+7;
static		bit bank2 	PMDATL6 @ (unsigned)&PMDATL*8+6;
static		bit bank2 	PMDATL5 @ (unsigned)&PMDATL*8+5;
static		bit bank2 	PMDATL4 @ (unsigned)&PMDATL*8+4;
static		bit bank2 	PMDATL3 @ (unsigned)&PMDATL*8+3;
static		bit bank2 	PMDATL2 @ (unsigned)&PMDATL*8+2;
static		bit bank2 	PMDATL1	@ (unsigned)&PMDATL*8+1;
static		bit bank2 	PMDATL0 @ (unsigned)&PMDATL*8+0;

/*	PMADRL bits	*/
static		bit bank2 	PMADRL7 @ (unsigned)&PMADRL*8+7;
static		bit bank2 	PMADRL6 @ (unsigned)&PMADRL*8+6;
static		bit bank2 	PMADRL5 @ (unsigned)&PMADRL*8+5;
static		bit bank2 	PMADRL4	@ (unsigned)&PMADRL*8+4;
static		bit bank2 	PMADRL3 @ (unsigned)&PMADRL*8+3;
static		bit bank2 	PMADRL2 @ (unsigned)&PMADRL*8+2;
static		bit bank2 	PMADRL1 @ (unsigned)&PMADRL*8+1;
static		bit bank2 	PMADRL0 @ (unsigned)&PMADRL*8+0;

/*	PMDATH bits	*/
static		bit bank2	PMDATH5 @ (unsigned)&PMDATH*8+5;
static		bit bank2	PMDATH4 @ (unsigned)&PMDATH*8+4;
static		bit bank2	PMDATH3 @ (unsigned)&PMDATH*8+3;
static		bit bank2	PMDATH2 @ (unsigned)&PMDATH*8+2;
static		bit bank2	PMDATH1 @ (unsigned)&PMDATH*8+1;
static		bit bank2	PMDATH0 @ (unsigned)&PMDATH*8+0;

/*	PMADRH bits	*/
static		bit bank2	PMADRH3 @ (unsigned)&PMADRH*8+3;
static		bit bank2	PMADRH2 @ (unsigned)&PMADRH*8+2;
static		bit bank2	PMADRH1 @ (unsigned)&PMADRH*8+1;
static		bit bank2	PMADRH0 @ (unsigned)&PMADRH*8+0;
#endif

/* USB bits */
#if defined(_16C745) || defined(_16C765)

static volatile bit bank3	STALL		@ (unsigned)&UIR*8+5;
static volatile bit bank3	UIDLE		@ (unsigned)&UIR*8+4;
static volatile bit bank3	TOK_DONE	@ (unsigned)&UIR*8+3;
static volatile bit bank3	ACTIVITY	@ (unsigned)&UIR*8+2;
static volatile bit bank3	UERR		@ (unsigned)&UIR*8+1;
static volatile bit bank3	USB_RST		@ (unsigned)&UIR*8+0;

static volatile bit bank3	STALL_E		@ (unsigned)&UIE*8+5;
static volatile bit bank3	UIDLE_E		@ (unsigned)&UIE*8+4;
static volatile bit bank3	TOK_DONE_E	@ (unsigned)&UIE*8+3;
static volatile bit bank3	ACTIVITY_E	@ (unsigned)&UIE*8+2;
static volatile bit bank3	UERR_E		@ (unsigned)&UIE*8+1;
static volatile bit bank3	USB_RST_E	@ (unsigned)&UIE*8+0;

static volatile bit bank3	BTS_ERR		@ (unsigned)&UEIR*8+7;
static volatile bit bank3	OWN_ERR		@ (unsigned)&UEIR*8+6;
static volatile bit bank3	WRT_ERR		@ (unsigned)&UEIR*8+5;
static volatile bit bank3	BTO_ERR		@ (unsigned)&UEIR*8+4;
static volatile bit bank3	DFN8		@ (unsigned)&UEIR*8+3;
static volatile bit bank3	CRC16		@ (unsigned)&UEIR*8+2;
static volatile bit bank3	CRC5		@ (unsigned)&UEIR*8+1;
static volatile bit bank3	PID_ERR		@ (unsigned)&UEIR*8+0;

static volatile bit bank3	BTS_ERR_E	@ (unsigned)&UEIE*8+7;
static volatile bit bank3	OWN_ERR_E	@ (unsigned)&UEIE*8+6;
static volatile bit bank3	WRT_ERR_E	@ (unsigned)&UEIE*8+5;
static volatile bit bank3	BTO_ERR_E	@ (unsigned)&UEIE*8+4;
static volatile bit bank3	DFN8_E		@ (unsigned)&UEIE*8+3;
static volatile bit bank3	CRC16_E		@ (unsigned)&UEIE*8+2;
static volatile bit bank3	CRC5_E		@ (unsigned)&UEIE*8+1;
static volatile bit bank3	PID_ERR_E	@ (unsigned)&UEIE*8+0;

static volatile bit bank3	ENDP1		@ (unsigned)&USTAT*8+4;
static volatile bit bank3	ENDP0		@ (unsigned)&USTAT*8+3;
static volatile bit bank3	IN		@ (unsigned)&USTAT*8+2;

static volatile bit bank3	SEO		@ (unsigned)&UCTRL*8+5;
static volatile bit bank3	PKT_DIS		@ (unsigned)&UCTRL*8+4;
static volatile bit bank3	DEV_ATT		@ (unsigned)&UCTRL*8+3;
static volatile bit bank3	RESUME		@ (unsigned)&UCTRL*8+2;
static volatile bit bank3	SUSPND		@ (unsigned)&UCTRL*8+1;

static volatile bit bank3	ADDR6		@ (unsigned)&UADDR*8+6;
static volatile bit bank3	ADDR5		@ (unsigned)&UADDR*8+5;
static volatile bit bank3	ADDR4		@ (unsigned)&UADDR*8+4;
static volatile bit bank3	ADDR3		@ (unsigned)&UADDR*8+3;
static volatile bit bank3	ADDR2		@ (unsigned)&UADDR*8+2;
static volatile bit bank3	ADDR1		@ (unsigned)&UADDR*8+1;
static volatile bit bank3	ADDR0		@ (unsigned)&UADDR*8+0;

static volatile bit bank3	SWSTAT7		@ (unsigned)&USWSTAT*8+7;
static volatile bit bank3	SWSTAT6		@ (unsigned)&USWSTAT*8+6;
static volatile bit bank3	SWSTAT5		@ (unsigned)&USWSTAT*8+5;
static volatile bit bank3	SWSTAT4		@ (unsigned)&USWSTAT*8+4;
static volatile bit bank3	SWSTAT3		@ (unsigned)&USWSTAT*8+3;
static volatile bit bank3	SWSTAT2		@ (unsigned)&USWSTAT*8+2;
static volatile bit bank3	SWSTAT1		@ (unsigned)&USWSTAT*8+1;
static volatile bit bank3	SWSTAT0		@ (unsigned)&USWSTAT*8+0;

static volatile bit bank3	EP_CTL_DIS0	@ (unsigned)&UEP0*8+3;
static volatile bit bank3	EP_OUT_EN0	@ (unsigned)&UEP0*8+2;
static volatile bit bank3	EP_IN_EN0	@ (unsigned)&UEP0*8+1;
static volatile bit bank3	EP_STALL0	@ (unsigned)&UEP0*8+0;

static volatile bit bank3	EP_CTL_DIS1	@ (unsigned)&UEP1*8+3;
static volatile bit bank3	EP_OUT_EN1	@ (unsigned)&UEP1*8+2;
static volatile bit bank3	EP_IN_EN1	@ (unsigned)&UEP1*8+1;
static volatile bit bank3	EP_STALL1	@ (unsigned)&UEP1*8+0;

static volatile bit bank3	EP_CTL_DIS2	@ (unsigned)&UEP2*8+3;
static volatile bit bank3	EP_OUT_EN2	@ (unsigned)&UEP2*8+2;
static volatile bit bank3	EP_IN_EN2	@ (unsigned)&UEP2*8+1;
static volatile bit bank3	EP_STALL2	@ (unsigned)&UEP2*8+0;

static volatile bit bank3	UOWN_0O		@ (unsigned)&BD0OST*8+7;
static volatile bit bank3	DATA_0O		@ (unsigned)&BD0OST*8+6;
static volatile bit bank3	PID3_0O		@ (unsigned)&BD0OST*8+5;
static volatile bit bank3	PID2_0O		@ (unsigned)&BD0OST*8+4;
static volatile bit bank3	PID1_0O		@ (unsigned)&BD0OST*8+3;
static volatile bit bank3	PID0_0O		@ (unsigned)&BD0OST*8+2;

static volatile bit bank3	UOWN_0I		@ (unsigned)&BD0IST*8+7;
static volatile bit bank3	DATA_0I		@ (unsigned)&BD0IST*8+6;
static volatile bit bank3	PID3_0I		@ (unsigned)&BD0IST*8+5;
static volatile bit bank3	PID2_0I		@ (unsigned)&BD0IST*8+4;
static volatile bit bank3	PID1_0I		@ (unsigned)&BD0IST*8+3;
static volatile bit bank3	PID0_0I		@ (unsigned)&BD0IST*8+2;

static volatile bit bank3	UOWN_1O		@ (unsigned)&BD1OST*8+7;
static volatile bit bank3	DATA_1O		@ (unsigned)&BD1OST*8+6;
static volatile bit bank3	PID3_1O		@ (unsigned)&BD1OST*8+5;
static volatile bit bank3	PID2_1O		@ (unsigned)&BD1OST*8+4;
static volatile bit bank3	PID1_1O		@ (unsigned)&BD1OST*8+3;
static volatile bit bank3	PID0_1O		@ (unsigned)&BD1OST*8+2;

static volatile bit bank3	UOWN_1I		@ (unsigned)&BD1IST*8+7;
static volatile bit bank3	DATA_1I		@ (unsigned)&BD1IST*8+6;
static volatile bit bank3	PID3_1I		@ (unsigned)&BD1IST*8+5;
static volatile bit bank3	PID2_1I		@ (unsigned)&BD1IST*8+4;
static volatile bit bank3	PID1_1I		@ (unsigned)&BD1IST*8+3;
static volatile bit bank3	PID0_1I		@ (unsigned)&BD1IST*8+2;

static volatile bit bank3	UOWN_2O		@ (unsigned)&BD2OST*8+7;
static volatile bit bank3	DATA_2O		@ (unsigned)&BD2OST*8+6;
static volatile bit bank3	PID3_2O		@ (unsigned)&BD2OST*8+5;
static volatile bit bank3	PID2_2O		@ (unsigned)&BD2OST*8+4;
static volatile bit bank3	PID1_2O		@ (unsigned)&BD2OST*8+3;
static volatile bit bank3	PID0_2O		@ (unsigned)&BD2OST*8+2;

static volatile bit bank3	UOWN_2I		@ (unsigned)&BD2IST*8+7;
static volatile bit bank3	DATA_2I		@ (unsigned)&BD2IST*8+6;
static volatile bit bank3	PID3_2I		@ (unsigned)&BD2IST*8+5;
static volatile bit bank3	PID2_2I		@ (unsigned)&BD2IST*8+4;
static volatile bit bank3	PID1_2I		@ (unsigned)&BD2IST*8+3;
static volatile bit bank3	PID0_2I		@ (unsigned)&BD2IST*8+2;

#endif

/*      A full configuration word includes one of each group ORed together     */
#define CONFIG_ADDR	0x2007	

#if !defined(_16C745) || !defined(_16C765)
/*brown out reset*/
#define BOREN		0xFFFF	// enable brown out reset
#define BORDIS		0xF3BF	// disable brown out reset
/*Brown out voltage level*/
#define BORV25		0xFFFF 	// Brown out reset voltage is 2.5 volts
#define BORV27		0xFBFF	// Brown out reset voltage is 2.7 volts
#define BORV42		0xF7FF	// Brown out reset voltage is 4.2 volts
#define BORV45		0xF3FF	// Brown out reset voltage is 4.5 volts
// alternative definitions
#define VBOR_25		0xFFFF 	// use BORV25
#define VBOR_27		0xFBFF	// use BORV27
#define VBOR_42		0xF7FF	// use BORV42
#define VBOR_45		0xF3FF	// use BORV45
#define VBOR_OFF	0xF3BF	// use BORDIS
#endif

/*	Programming Notes
	BODEN    		BORV
	  1  	(BODEN_ON)	11      2.5 volts	(VBOR_25)
  	  1    	(BODEN_ON)	10      2.7 volts	(VBOR_27)
    	  1    	(BODEN_ON)	01      4.2 volts	(VBOR_42)
    	  1    	(BODEN_ON)	00      4.5 volts	(VBOR_45)
    	  0     (BODEN_OFF)	00      Brown out off 	(VBOR_OFF)
    	  0    	(BODEN_OFF)	01      Illegal		(VBOR_42) 
    	  0    	(BODEN_OFF)	10      Illegal 	(VBOR_27)
    	  0    	(BODEN_OFF)	11      Illegal		(VBOR_25)
 */	                                                                                               

/*code protection*/
#if defined(_16C717)
#define PROTECT		0x0CFF	/* enable code protection */
#elif defined (_16C770) || defined (_16C771)
#define PROTECT		0x004F	/* enable code protection */
#elif defined(_16C773) || defined (_16C774)
#define PROTECT		0x0CCF	/* enable code protection */
#define PROTECT75	0x1DDF	/* code protection 75% */
#define PROTECT50	0x2EEF	/* code protection 50% */
#elif defined(_16C745) || defined (_16C765)
#define PROTECT		0x00CF	/* enable code protection */
#define PROTECT75	0x15DF	/* code protection 75% */
#define PROTECT50	0x2AEF	/* code protection 50% */
#endif
#define UNPROTECT	0x3FFF	/* do not protect the code */

/* watchdog and power up timer */
#define WDTEN		0x3FFF	/* enable watchdog timer */
#define PWRTDIS		0x3FFF	/* disable power up timer */
#if defined(_16C717)
#define WDTDIS		0x3FF7	/* disable watchdog timer */
#define PWRTEN		0x3FEF	/* enable power up timer */
/* MCLR Pin function */
#define MCLREN		0x3FFF	/* master clear reset enable */
#define MCLRDIS		0x3FDF	/* master clear reset disable */
#else
#define WDTDIS		0x3FFB	/* disable watchdog timer */
#define PWRTEN		0x3FF7	/* enable power up timer */
#endif

/*osc configurations*/
#if defined(_16C717)
#define LP		0x3FF8	/* low power crystal */
#define XT		0x3FF9	/* crystal/resonator */
#define HS		0x3FFA	/* high speed crystal */
#define EC		0x3FFB	/* RA7=external clkin/RA6=IO */
#define INTRCIO		0x3FFC	/* internal RC oscillator/RA6=IO/RA7=IO */
#define INTRCCLKO	0x3FFD	/* internal RC oscillator/RA6=CLKOUT/RA7=IO */
#define ERIO		0x3FFE	/* external resistor on RA7/RA6=IO */
#define ERCLKO		0x3FFF	/* external resistor on RA7/RA6=CLKOUT */
#endif
#if defined(_16C773) || defined (_16C774) || defined (_16C770) || defined (_16C771)
#define RC		0x3FFF	/* resistor/capacitor */
#define HS		0x3FFE	/* high speed crystal/resonator */
#define XT		0x3FFD	/* crystal/resonator */
#define LP		0x3FFC	/* low power crystal/resonator */
#endif
#if defined(_16C745) || defined (_16C765)
#define EC		0x3FFD	/* external clock */
#define HS		0x3FFC	/* high speed crystal oscillator */
#define E4		0x3FFF	/* EC with 4x PLL enabled */
#define H4		0x3FFE	/* HS with 4x PLL enabled */
#endif
