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



 /* header file for the SIDSA microcontrollers
	FIPSOC
 */

#ifndef	__FIPSOC_H

#define	__FIPSOC_H

typedef struct {
	unsigned B7:1; //This is the most signifigant bit
	unsigned B6:1;
	unsigned B5:1;
	unsigned B4:1;
	unsigned B3:1;
	unsigned B2:1;
	unsigned B1:1;
	unsigned B0:1;
}	SFR_BITS;

//Special Function Registers
static volatile unsigned char PRTA	@ 0x80;
static volatile unsigned char SP	@ 0x81;
static volatile unsigned char DPL	@ 0x82;
static volatile unsigned char DPH	@ 0x83;
// 16 bit definition
static volatile unsigned char PCON	@ 0x87;
static volatile unsigned char TCON	@ 0x88;
static          unsigned char TMOD	@ 0x89;
static volatile unsigned char TL0	@ 0x8A;
static volatile unsigned char TL1	@ 0x8B;
static volatile unsigned char TH0	@ 0x8C;
static volatile unsigned char TH1	@ 0x8D;
static volatile unsigned char PRTB	@ 0x90;
static volatile unsigned char SCON	@ 0x98;
static volatile unsigned char SBUF	@ 0x99;
static volatile unsigned char WDOG	@ 0x9A;
static volatile unsigned char RG3	@ 0x9B;
static volatile unsigned char I2CREG	@ 0x9C;
static volatile unsigned char BTREG	@ 0x9D;
static volatile unsigned char DDRGP	@ 0x9E;
static volatile unsigned char CMBUF	@ 0x9F;
static volatile unsigned char PRTC	@ 0xA0;
static		unsigned char VPLLL	@ 0xA4;
static		unsigned char VPLLH	@ 0xA5;
static		unsigned char VHW1L	@ 0xA6;
static		unsigned char VHW1H	@ 0xA7;
static		unsigned char IE	@ 0xA8;
static		unsigned char VCLKL	@ 0xAC;
static		unsigned char VCLKH	@ 0xAD;
static		unsigned char VHW2L	@ 0xAE;
static		unsigned char VHW2H	@ 0xAF;
static volatile unsigned char PRTD	@ 0xB0;
static		unsigned char VDBGL	@ 0xB4;
static		unsigned char VDBGH	@ 0xB5;
static		unsigned char VHW3L	@ 0xB6;
static		unsigned char VHW3H	@ 0xB7;
static		unsigned char IP	@ 0xB8;
static		unsigned char VHW4L	@ 0xBC;
static		unsigned char VHW4H	@ 0xBD;
static		unsigned char VANAL	@ 0xBE;
static		unsigned char VANAH	@ 0xBF;
static		unsigned char EIMR0	@ 0xC0;
static		unsigned char EIMR1	@ 0xC1;
static		unsigned char SGNI0	@ 0xC2;
static		unsigned char SGNI1	@ 0xC3;
static volatile unsigned char IRS	@ 0xC4;
static volatile unsigned char IRSCKDB	@ 0xC5;
static volatile unsigned char PSW	@ 0xD0;
static volatile unsigned char DANA1	@ 0xD8;
static volatile unsigned char DANA2	@ 0xD9;
static volatile unsigned char DANA3	@ 0xDA;
static volatile unsigned char DANA4	@ 0xDB;
static volatile unsigned char DANA5	@ 0xDC;
static volatile unsigned char DANA6	@ 0xDD;
static volatile unsigned char DANA7	@ 0xDE;
static volatile unsigned char DANA8	@ 0xDF;
static volatile unsigned char ACC	@ 0xE0;
static volatile unsigned char ANAST	@ 0xE1;
static volatile unsigned char DBGCNF	@ 0xE2;
static		unsigned char DBGMSK	@ 0xE3;
static		unsigned char DBG0L	@ 0xE4;
static		unsigned char DBG0H	@ 0xE5;
static		unsigned char DBG1L	@ 0xE6;
static		unsigned char DBG1H	@ 0xE7;
static		unsigned char DBG2L	@ 0xE8;
static		unsigned char DBG2H	@ 0xE9;
static		unsigned char DBG3L	@ 0xEA;
static		unsigned char DBG3H	@ 0xEB;
static		unsigned char DBG4L	@ 0xEC;
static		unsigned char DBG4H	@ 0xED;
static		unsigned char DBG5L	@ 0xEE;
static		unsigned char DBG5H	@ 0xEF;
static volatile unsigned char B		@ 0xF0;
static volatile unsigned char CKCONF	@ 0xF1;
static volatile unsigned char CKCNTL	@ 0xF2;
static volatile unsigned char CKCNTH	@ 0xF3;
static		unsigned char CKDMC2	@ 0xF4;
static		unsigned char CKDMC1	@ 0xF5;
static		unsigned char CKANA	@ 0xF6;
static		unsigned char CK8051	@ 0xF7;
static		unsigned char ROWL	@ 0xF8;
static		unsigned char ROWH	@ 0xF9;
static		unsigned char COLL	@ 0xFA;
static		unsigned char COLH	@ 0xFB;
static		unsigned char RG1	@ 0xFC;
static volatile unsigned char RG2	@ 0xFD;
static volatile unsigned char RGTX	@ 0xFE;
static volatile unsigned char OUTCOMP	@ 0xFF;

static volatile SFR_BITS	 PRTA_BITS	@ 0x80;
static volatile SFR_BITS	 PCON_BITS	@ 0x87;
static volatile SFR_BITS	 TCON_BITS	@ 0x88;
static          SFR_BITS	 TMOD_BITS	@ 0x89;
static volatile SFR_BITS	 PRTB_BITS	@ 0x90;
static volatile SFR_BITS	 SCON_BITS	@ 0x98;
static volatile SFR_BITS	 WDOG_BITS	@ 0x9A;
static volatile SFR_BITS	 RG3_BITS	@ 0x9B;
static volatile SFR_BITS	 I2CREG_BITS	@ 0x9C;
static volatile SFR_BITS	 BTREG_BITS	@ 0x9D;
static volatile SFR_BITS	 DDRGP_BITS	@ 0x9E;
static volatile SFR_BITS	 PRTC_BITS	@ 0xA0;
static          SFR_BITS	 IE_BITS	@ 0xA8;
static volatile SFR_BITS	 PRTD_BITS	@ 0xB0;
static          SFR_BITS	 IP_BITS	@ 0xB8;
static		SFR_BITS	 EIMR0_BITS	@ 0xC0;
static		SFR_BITS	 EIMR1_BITS	@ 0xC1;
static		SFR_BITS	 SGNI0_BITS	@ 0xC2;
static		SFR_BITS	 SGNI1_BITS	@ 0xC3;
static volatile SFR_BITS	 IRS_BITS	@ 0xC4;
static volatile SFR_BITS	 IRSCKDB_BITS	@ 0xC5;
static volatile SFR_BITS	 PSW_BITS	@ 0xD0;
static volatile SFR_BITS	 ACC_BITS	@ 0xE0;
static volatile SFR_BITS	 ANAST_BITS	@ 0xE1;
static volatile SFR_BITS	 DBGCNF_BITS	@ 0xE2;
static volatile SFR_BITS	 B_BITS		@ 0xF0;
static volatile SFR_BITS	 CKCONF_BITS	@ 0xF1;
static		SFR_BITS	 CKDMC2_BITS	@ 0xF4;
static		SFR_BITS	 CKDMC1_BITS	@ 0xF5;
static		SFR_BITS	 CKANA_BITS	@ 0xF6;
static		SFR_BITS	 CK8051_BITS	@ 0xF7;
static		SFR_BITS	 RG1_BITS	@ 0xFC;
static volatile SFR_BITS	 RG2_BITS	@ 0xFD;
static volatile SFR_BITS	 RGTX_BITS	@ 0xFE;
static volatile SFR_BITS	 OUTCOMP_BITS	@ 0xFF;


// Bit Addressable Locations
// definitions for register PRTA
static volatile bit	PRTA0	@ 0x80;
static volatile bit	PRTA1	@ 0x81;
static volatile bit	PRTA2	@ 0x82;
static volatile bit	PRTA3	@ 0x83;
static volatile bit	PRTA4	@ 0x84;
static volatile bit	PRTA5	@ 0x85;
static volatile bit	PRTA6	@ 0x86;
static volatile bit	PRTA7	@ 0x87;

//Timer Control TCON
static 		bit	IT0	@ 0x88;
static volatile bit	IE0	@ 0x89;
static 		bit	IT1	@ 0x8A;
static volatile bit	IE1	@ 0x8B;
static 		bit	TR0	@ 0x8C;
static volatile bit	TF0	@ 0x8D;
static 		bit	TR1	@ 0x8E;
static volatile bit	TF1	@ 0x8F;

// definitions for register PRTB
static volatile bit	PRTB0	@ 0x90;
static volatile bit	PRTB1	@ 0x91;
static volatile bit	PRTB2	@ 0x92;
static volatile bit	PRTB3	@ 0x93;
static volatile bit	PRTB4	@ 0x94;
static volatile bit	PRTB5	@ 0x95;
static volatile bit	PRTB6	@ 0x96;
static volatile bit	PRTB7	@ 0x97;

//Serial Control SCON
static volatile bit	RI	@ 0x98;
static volatile bit	TI	@ 0x99;
static volatile bit	RB8	@ 0x9A;
static		bit	TB8	@ 0x9B;
static 		bit	REN	@ 0x9C;
static		bit	SM2	@ 0x9D;
static		bit	SM1	@ 0x9E;
static		bit	SM0	@ 0x9F;

// definitions for register PRTC
static volatile bit	PRTC0	@ 0xA0;
static volatile bit	PRTC1	@ 0xA1;
static volatile bit	PRTC2	@ 0xA2;
static volatile bit	PRTC3	@ 0xA3;
static volatile bit	PRTC4	@ 0xA4;
static volatile bit	PRTC5	@ 0xA5;
static volatile bit	PRTC6	@ 0xA6;
static volatile bit	PRTC7	@ 0xA7;

//Interrupt Enable IE
static		bit	EX0	@ 0xA8;
static		bit	ET0	@ 0xA9;
static		bit	EX1	@ 0xAA;
static		bit	ET1	@ 0xAB;
static 		bit	ES	@ 0xAC;
static 		bit	EA	@ 0xAF;

// definitions for register PRTD
static volatile bit	PRTD0	@ 0xB0;
static volatile bit	PRTD1	@ 0xB1;
static volatile bit	PRTD2	@ 0xB2;
static volatile bit	PRTD3	@ 0xB3;
static volatile bit	PRTD4	@ 0xB4;
static volatile bit	PRTD5	@ 0xB5;
static volatile bit	PRTD6	@ 0xB6;
static volatile bit	PRTD7	@ 0xB7;

//Interrupt Priority
static 		bit	PX0	@ 0xB8;
static 		bit	PT0	@ 0xB9;
static 		bit	PX1	@ 0xBA;
static 		bit	PT1	@ 0xBB;
static 		bit	PS	@ 0xBC;
static 		bit	PT2	@ 0xBD;

//Program Status Word PSW
static volatile bit	P	@ 0xD0;
static volatile bit	OV	@ 0xD2;
static 		bit	RS0	@ 0xD3;
static 		bit	RS1	@ 0xD4;
static volatile bit	F0	@ 0xD5;
static volatile bit	AC	@ 0xD6;
static volatile bit	CY	@ 0xD7;

//Accumulator ACC
static volatile bit	ACC0	@ 0xE0;
static volatile bit	ACC1	@ 0xE1;
static volatile bit	ACC2	@ 0xE2;
static volatile bit	ACC3	@ 0xE3;
static volatile bit	ACC4	@ 0xE4;
static volatile bit	ACC5	@ 0xE5;
static volatile bit	ACC6	@ 0xE6;
static volatile bit	ACC7	@ 0xE7;

//B register
static volatile bit	B0	@ 0xF0;
static volatile bit	B1	@ 0xF1;
static volatile bit	B2	@ 0xF2;
static volatile bit	B3	@ 0xF3;
static volatile bit	B4	@ 0xF4;
static volatile bit	B5	@ 0xF5;
static volatile bit	B6	@ 0xF6;
static volatile bit	B7	@ 0xF7;


//Interrupt Vectors
#define	RESET	0
#define	EXTINT0	0x03
#define TIMER0	0x0B
#define	EXTINT1	0x13
#define	TIMER1	0x1B
#define	SERIAL	0x23

#endif
