
/**************************************************************
Updata:20210903：更新位定义，开头是否带F，都做到里面；

IC Type Support:
	HS16F3211,
	HS16F3311,
//Special function register definitions
**************************************************************/
#ifndef __HS23F2211B_H
#define __HS23F2211B_H


//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// BANK0 Special function register definitions
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

// Register: INDF :BANK0
volatile unsigned char           INDF                @ 0x000;
// bit and bitfield definitions


// Register: TMR0
volatile unsigned char           TMR0                @ 0x001;
// bit and bitfield definitions


// Register: PCL
volatile unsigned char           PCL                 @ 0x002;
// bit and bitfield definitions


// Register: STATUS
volatile unsigned char           STATUS              @ 0x003;
// bit and bitfield definitions
volatile bit CARRY               @ ((unsigned)&STATUS*8)+0;
volatile bit C	                 @ ((unsigned)&STATUS*8)+0;
volatile bit DC                  @ ((unsigned)&STATUS*8)+1;
volatile bit Z                   @ ((unsigned)&STATUS*8)+2;
volatile bit ZERO                @ ((unsigned)&STATUS*8)+2;
volatile bit NPD                 @ ((unsigned)&STATUS*8)+3;
volatile bit nPD                 @ ((unsigned)&STATUS*8)+3;
volatile bit NTO                 @ ((unsigned)&STATUS*8)+4;
volatile bit nTO                 @ ((unsigned)&STATUS*8)+4;
volatile bit RP0                 @ ((unsigned)&STATUS*8)+5;
volatile bit RP1                 @ ((unsigned)&STATUS*8)+6;
volatile bit RST                 @ ((unsigned)&STATUS*8)+7;
volatile bit IRP                 @ ((unsigned)&STATUS*8)+7;

// Register: FSR
volatile unsigned char           FSR                 @ 0x004;
volatile bit FSR_7                 @ ((unsigned)&FSR*8)+7;
// bit and bitfield definitions

// Register: PORTA
volatile unsigned char           PORTA            @ 0x005;
volatile unsigned char           RA               @ 0x005;
volatile unsigned char           PA               @ 0x005;
// bit and bitfield definitions
volatile bit FIOA0                @ ((unsigned)&PORTA*8)+0;
volatile bit FIOA1                @ ((unsigned)&PORTA*8)+1;
volatile bit FIOA2                @ ((unsigned)&PORTA*8)+2;
volatile bit FIOA3                @ ((unsigned)&PORTA*8)+3;
volatile bit FIOA4                @ ((unsigned)&PORTA*8)+4;
volatile bit FIOA5                @ ((unsigned)&PORTA*8)+5;
volatile bit FIOA6                @ ((unsigned)&PORTA*8)+6;
volatile bit FIOA7                @ ((unsigned)&PORTA*8)+7;

volatile bit IOA0                @ ((unsigned)&PORTA*8)+0;
volatile bit IOA1                @ ((unsigned)&PORTA*8)+1;
volatile bit IOA2                @ ((unsigned)&PORTA*8)+2;
volatile bit IOA3                @ ((unsigned)&PORTA*8)+3;
volatile bit IOA4                @ ((unsigned)&PORTA*8)+4;
volatile bit IOA5                @ ((unsigned)&PORTA*8)+5;
volatile bit IOA6                @ ((unsigned)&PORTA*8)+6;
volatile bit IOA7                @ ((unsigned)&PORTA*8)+7;

volatile bit FRA0                 @ ((unsigned)&PORTA*8)+0;
volatile bit FRA1                 @ ((unsigned)&PORTA*8)+1;
volatile bit FRA2                 @ ((unsigned)&PORTA*8)+2;
volatile bit FRA3                 @ ((unsigned)&PORTA*8)+3;
volatile bit FRA4                 @ ((unsigned)&PORTA*8)+4;
volatile bit FRA5                 @ ((unsigned)&PORTA*8)+5;
volatile bit FRA6                 @ ((unsigned)&PORTA*8)+6;
volatile bit FRA7                 @ ((unsigned)&PORTA*8)+7;

volatile bit RA0                 @ ((unsigned)&PORTA*8)+0;
volatile bit RA1                 @ ((unsigned)&PORTA*8)+1;
volatile bit RA2                 @ ((unsigned)&PORTA*8)+2;
volatile bit RA3                 @ ((unsigned)&PORTA*8)+3;
volatile bit RA4                 @ ((unsigned)&PORTA*8)+4;
volatile bit RA5                 @ ((unsigned)&PORTA*8)+5;
volatile bit RA6                 @ ((unsigned)&PORTA*8)+6;
volatile bit RA7                 @ ((unsigned)&PORTA*8)+7;

volatile bit FPA0                 @ ((unsigned)&PORTA*8)+0;
volatile bit FPA1                 @ ((unsigned)&PORTA*8)+1;
volatile bit FPA2                 @ ((unsigned)&PORTA*8)+2;
volatile bit FPA3                 @ ((unsigned)&PORTA*8)+3;
volatile bit FPA4                 @ ((unsigned)&PORTA*8)+4;
volatile bit FPA5                 @ ((unsigned)&PORTA*8)+5;
volatile bit FPA6                 @ ((unsigned)&PORTA*8)+6;
volatile bit FPA7                 @ ((unsigned)&PORTA*8)+7;

volatile bit PA0                 @ ((unsigned)&PORTA*8)+0;
volatile bit PA1                 @ ((unsigned)&PORTA*8)+1;
volatile bit PA2                 @ ((unsigned)&PORTA*8)+2;
volatile bit PA3                 @ ((unsigned)&PORTA*8)+3;
volatile bit PA4                 @ ((unsigned)&PORTA*8)+4;
volatile bit PA5                 @ ((unsigned)&PORTA*8)+5;
volatile bit PA6                 @ ((unsigned)&PORTA*8)+6;
volatile bit PA7                 @ ((unsigned)&PORTA*8)+7;


// Register: PORTB
volatile unsigned char           PORTB            @ 0x006;
volatile unsigned char           RB               @ 0x006;
volatile unsigned char           PB               @ 0x006;
// bit and bitfield definitions
volatile bit FIOB0                @ ((unsigned)&PORTB*8)+0;
volatile bit FIOB1                @ ((unsigned)&PORTB*8)+1;
volatile bit FIOB2                @ ((unsigned)&PORTB*8)+2;
volatile bit FIOB3                @ ((unsigned)&PORTB*8)+3;
volatile bit FIOB4                @ ((unsigned)&PORTB*8)+4;
volatile bit FIOB5                @ ((unsigned)&PORTB*8)+5;
volatile bit FIOB6                @ ((unsigned)&PORTB*8)+6;
volatile bit FIOB7                @ ((unsigned)&PORTB*8)+7;

volatile bit IOB0                @ ((unsigned)&PORTB*8)+0;
volatile bit IOB1                @ ((unsigned)&PORTB*8)+1;
volatile bit IOB2                @ ((unsigned)&PORTB*8)+2;
volatile bit IOB3                @ ((unsigned)&PORTB*8)+3;
volatile bit IOB4                @ ((unsigned)&PORTB*8)+4;
volatile bit IOB5                @ ((unsigned)&PORTB*8)+5;
volatile bit IOB6                @ ((unsigned)&PORTB*8)+6;
volatile bit IOB7                @ ((unsigned)&PORTB*8)+7;

volatile bit FRB0                 @ ((unsigned)&PORTB*8)+0;
volatile bit FRB1                 @ ((unsigned)&PORTB*8)+1;
volatile bit FRB2                 @ ((unsigned)&PORTB*8)+2;
volatile bit FRB3                 @ ((unsigned)&PORTB*8)+3;
volatile bit FRB4                 @ ((unsigned)&PORTB*8)+4;
volatile bit FRB5                 @ ((unsigned)&PORTB*8)+5;
volatile bit FRB6                 @ ((unsigned)&PORTB*8)+6;
volatile bit FRB7                 @ ((unsigned)&PORTB*8)+7;

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

volatile bit FPB0                 @ ((unsigned)&PORTB*8)+0;
volatile bit FPB1                 @ ((unsigned)&PORTB*8)+1;
volatile bit FPB2                 @ ((unsigned)&PORTB*8)+2;
volatile bit FPB3                 @ ((unsigned)&PORTB*8)+3;
volatile bit FPB4                 @ ((unsigned)&PORTB*8)+4;
volatile bit FPB5                 @ ((unsigned)&PORTB*8)+5;
volatile bit FPB6                 @ ((unsigned)&PORTB*8)+6;
volatile bit FPB7                 @ ((unsigned)&PORTB*8)+7;

volatile bit PB0                 @ ((unsigned)&PORTB*8)+0;
volatile bit PB1                 @ ((unsigned)&PORTB*8)+1;
volatile bit PB2                 @ ((unsigned)&PORTB*8)+2;
volatile bit PB3                 @ ((unsigned)&PORTB*8)+3;
volatile bit PB4                 @ ((unsigned)&PORTB*8)+4;
volatile bit PB5                 @ ((unsigned)&PORTB*8)+5;
volatile bit PB6                 @ ((unsigned)&PORTB*8)+6;
volatile bit PB7                 @ ((unsigned)&PORTB*8)+7;

// Register: W_REG
volatile unsigned char           W_REG            @ 0x007;

// Register: PCHBUF
volatile unsigned char           PCHBUF              @ 0x00A;
#define 	PCLATH 	PCHBUF 

// Register: INTEN
volatile unsigned char           INTEN               @ 0x00B;
// bit and bitfield definitions
volatile bit FT0IE                 @ ((unsigned)&INTEN*8)+0;
volatile bit FPBIE                 @ ((unsigned)&INTEN*8)+1;
volatile bit FINTIE                @ ((unsigned)&INTEN*8)+2;
volatile bit FTC0IE                @ ((unsigned)&INTEN*8)+3;
volatile bit FTP0IE                @ ((unsigned)&INTEN*8)+4;
volatile bit FINT1IE               @ ((unsigned)&INTEN*8)+5;
volatile bit FGIE                  @ ((unsigned)&INTEN*8)+7;

volatile bit T0IE                 @ ((unsigned)&INTEN*8)+0;
volatile bit PBIE                 @ ((unsigned)&INTEN*8)+1;
volatile bit INTIE                @ ((unsigned)&INTEN*8)+2;
volatile bit TC0IE                @ ((unsigned)&INTEN*8)+3;
volatile bit TP0IE                @ ((unsigned)&INTEN*8)+4;
volatile bit INT1IE               @ ((unsigned)&INTEN*8)+5;
volatile bit GIE                  @ ((unsigned)&INTEN*8)+7;

// Register: INTFLAG1
volatile unsigned char           INTFLAG               @ 0x00C;
// bit and bitfield definitions
volatile bit FT0IF                 @ ((unsigned)&INTFLAG*8)+0;
volatile bit FPBIF                 @ ((unsigned)&INTFLAG*8)+1;
volatile bit FINTIF                @ ((unsigned)&INTFLAG*8)+2;
volatile bit FTC0IF                @ ((unsigned)&INTFLAG*8)+3;
volatile bit FTP0IF                @ ((unsigned)&INTFLAG*8)+4;
volatile bit FINT1IF               @ ((unsigned)&INTFLAG*8)+5;

volatile bit T0IF                 @ ((unsigned)&INTFLAG*8)+0;
volatile bit PBIF                 @ ((unsigned)&INTFLAG*8)+1;
volatile bit INTIF                @ ((unsigned)&INTFLAG*8)+2;
volatile bit TC0IF                @ ((unsigned)&INTFLAG*8)+3;
volatile bit TP0IF                @ ((unsigned)&INTFLAG*8)+4;
volatile bit INT1IF               @ ((unsigned)&INTFLAG*8)+5;

// Register: INTFLAG1
volatile unsigned char           INTFLAG1               @ 0x0D; 
// bit and bitfield definitions
volatile bit FTKINTF                @ ((unsigned)&INTFLAG1*8)+0;
volatile bit FCOMINTF               @ ((unsigned)&INTFLAG1*8)+1;

volatile bit TKINTF                @ ((unsigned)&INTFLAG1*8)+0;
volatile bit COMINTF               @ ((unsigned)&INTFLAG1*8)+1;


// Register: PDCON
volatile unsigned char           PDCON               @ 0x00E;
// bit and bitfield definitions


// Register: ODCON
volatile unsigned char           ODCON               @ 0x00F;
// bit and bitfield definitions

//**************************************************************

// Register: PHCON
volatile unsigned char           PHCON               @ 0x010;
// bit and bitfield definitions

// Register: TC0L
volatile unsigned char           TC0L               @ 0x011;
// bit and bitfield definitions

// Register: TC0M
volatile unsigned char           TC0M               @ 0x012;
// bit and bitfield definitions
volatile bit FPWM0               @ ((unsigned)&TC0M*8)+0;
volatile bit FBUZ                @ ((unsigned)&TC0M*8)+1;
volatile bit FT16SEL             @ ((unsigned)&TC0M*8)+2;
volatile bit FTCCKS              @ ((unsigned)&TC0M*8)+3;
volatile bit FTC0S0              @ ((unsigned)&TC0M*8)+4;
volatile bit FTC0S1              @ ((unsigned)&TC0M*8)+5;
volatile bit FTC0S2              @ ((unsigned)&TC0M*8)+6;
volatile bit FTC0TR              @ ((unsigned)&TC0M*8)+7;

volatile bit PWM0               @ ((unsigned)&TC0M*8)+0;
volatile bit BUZ                @ ((unsigned)&TC0M*8)+1;
volatile bit T16SEL             @ ((unsigned)&TC0M*8)+2;
volatile bit TCCKS              @ ((unsigned)&TC0M*8)+3;
volatile bit TC0S0              @ ((unsigned)&TC0M*8)+4;
volatile bit TC0S1              @ ((unsigned)&TC0M*8)+5;
volatile bit TC0S2              @ ((unsigned)&TC0M*8)+6;
volatile bit TC0TR              @ ((unsigned)&TC0M*8)+7;

// Register: TC0R
volatile unsigned char           TC0R               @ 0x013;
// bit and bitfield definitions

// Register: TC0H
volatile unsigned char           TC0H               @ 0x014;
// bit and bitfield definitions

//TC0D1
// Register: TC0D1
volatile unsigned char           TC0D1               @ 0x015;
// bit and bitfield definitions

//TC0D2
// Register: TC0D2
volatile unsigned char           TC0D2               @ 0x016;
// bit and bitfield definitions

//PWMCON
// Register: PWMCON
volatile unsigned char           PWMCON               @ 0x017;
// bit and bitfield definitions
volatile bit FPWM1EN               @ ((unsigned)&PWMCON*8)+0;
volatile bit FPWM2EN               @ ((unsigned)&PWMCON*8)+1;
volatile bit FPWM1S                @ ((unsigned)&PWMCON*8)+2;
volatile bit FPWM2S                @ ((unsigned)&PWMCON*8)+3;
volatile bit FPWM1XR0              @ ((unsigned)&PWMCON*8)+4;
volatile bit FPWM1XR1              @ ((unsigned)&PWMCON*8)+5;
volatile bit FPWM2XR0              @ ((unsigned)&PWMCON*8)+6;
volatile bit FPWM2XR1              @ ((unsigned)&PWMCON*8)+7;

volatile bit PWM1EN               @ ((unsigned)&PWMCON*8)+0;
volatile bit PWM2EN               @ ((unsigned)&PWMCON*8)+1;
volatile bit PWM1S                @ ((unsigned)&PWMCON*8)+2;
volatile bit PWM2S                @ ((unsigned)&PWMCON*8)+3;
volatile bit PWM1XR0              @ ((unsigned)&PWMCON*8)+4;
volatile bit PWM1XR1              @ ((unsigned)&PWMCON*8)+5;
volatile bit PWM2XR0              @ ((unsigned)&PWMCON*8)+6;
volatile bit PWM2XR1              @ ((unsigned)&PWMCON*8)+7;

//General USER RAM 
//20H~5FH
//60H~6FH
//70H~7FH
//General USER RAM 

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//BANK1
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

//OPTION_REG
volatile unsigned char           OPTION_REG          @ 0x081; 
#define 	OPTION 	OPTION_REG
// bit and bitfield definitions
volatile bit FPS0               @ ((unsigned)&OPTION_REG*8)+0;
volatile bit FPS1               @ ((unsigned)&OPTION_REG*8)+1;
volatile bit FS2                @ ((unsigned)&OPTION_REG*8)+2;
volatile bit FSA                @ ((unsigned)&OPTION_REG*8)+3;
volatile bit FT0SE              @ ((unsigned)&OPTION_REG*8)+4;
volatile bit FT0CS              @ ((unsigned)&OPTION_REG*8)+5;
volatile bit FINTEDG            @ ((unsigned)&OPTION_REG*8)+6;
volatile bit FINTEDG1           @ ((unsigned)&OPTION_REG*8)+7;

volatile bit PS0               @ ((unsigned)&OPTION_REG*8)+0;
volatile bit PS1               @ ((unsigned)&OPTION_REG*8)+1;
volatile bit S2                @ ((unsigned)&OPTION_REG*8)+2;
volatile bit FSA                @ ((unsigned)&OPTION_REG*8)+3;
volatile bit T0SE              @ ((unsigned)&OPTION_REG*8)+4;
volatile bit T0CS              @ ((unsigned)&OPTION_REG*8)+5;
volatile bit INTEDG            @ ((unsigned)&OPTION_REG*8)+6;
volatile bit INTEDG1           @ ((unsigned)&OPTION_REG*8)+7;

//TRISA 85H
volatile unsigned char           TRISA               @ 0x085; 
#define 	IOSTA	TRISA
// bit and bitfield definitions

//TRISB	86H
volatile unsigned char           TRISB               @ 0x086; 
#define 	IOSTB	TRISB
// bit and bitfield definitions



//INTEN1 8DH
volatile unsigned char           INTEN1               @ 0x08D; 
// bit and bitfield definitions
volatile bit FTKINTEN                @ ((unsigned)&INTEN1*8)+0;
volatile bit FCOMINTEN               @ ((unsigned)&INTEN1*8)+1;
volatile bit TKINTEN                @ ((unsigned)&INTEN1*8)+0;
volatile bit COMINTEN               @ ((unsigned)&INTEN1*8)+1;


//PCON 8EH
volatile unsigned char           CHIPCON            @ 0x08E;
volatile unsigned char           PCON               @ 0x08E;
// bit and bitfield definitions
volatile bit FLVDTE                 @ ((unsigned)&PCON*8)+5;
volatile bit FEIS                   @ ((unsigned)&PCON*8)+6;
volatile bit FWDTE                  @ ((unsigned)&PCON*8)+7;

volatile bit LVDTE                 @ ((unsigned)&PCON*8)+5;
volatile bit EIS                   @ ((unsigned)&PCON*8)+6;
volatile bit WDTE                  @ ((unsigned)&PCON*8)+7;


//WUCON 8FH
volatile unsigned char           WUCON               @ 0x08F;
// bit and bitfield definitions

//**************************************************************

//PAIC0 90H
volatile unsigned char           PAIC0               @ 0x090;
// bit and bitfield definitions

//PBIC0 91H
volatile unsigned char           PBIC0               @ 0x091;
// bit and bitfield definitions

//PAHCON 92H
volatile unsigned char           PAHCON               @ 0x092;
// bit and bitfield definitions

//PADCON 93H
volatile unsigned char           PADCON               @ 0x093;
// bit and bitfield definitions
volatile bit FPADC4              @ ((unsigned)&PADCON*8)+4;
volatile bit FPADC5              @ ((unsigned)&PADCON*8)+5;

volatile bit PADC4              @ ((unsigned)&PADCON*8)+4;
volatile bit PADC5              @ ((unsigned)&PADCON*8)+5;
//volatile bit PHB4               @ ((unsigned)&PADCON*8)+4;
//volatile bit PHB5               @ ((unsigned)&PADCON*8)+5;


//OSCM 94H
volatile unsigned char           OSCM               @ 0x094;
// bit and bitfield definitions
volatile bit FCLKMD               @ ((unsigned)&OSCM*8)+0;
volatile bit FSTPHX               @ ((unsigned)&OSCM*8)+1;
volatile bit FXTSEL               @ ((unsigned)&OSCM*8)+2;
volatile bit FSLCON               @ ((unsigned)&OSCM*8)+3;
volatile bit FSLT0CON             @ ((unsigned)&OSCM*8)+4;
volatile bit FGREENEN             @ ((unsigned)&OSCM*8)+5;
volatile bit FWAKEMODE            @ ((unsigned)&OSCM*8)+6;

volatile bit CLKMD               @ ((unsigned)&OSCM*8)+0;
volatile bit STPHX               @ ((unsigned)&OSCM*8)+1;
volatile bit XTSEL               @ ((unsigned)&OSCM*8)+2;
volatile bit SLCON               @ ((unsigned)&OSCM*8)+3;
volatile bit SLT0CON             @ ((unsigned)&OSCM*8)+4;
volatile bit GREENEN             @ ((unsigned)&OSCM*8)+5;
volatile bit WAKEMODE            @ ((unsigned)&OSCM*8)+6;

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//BANK2
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//EEADR 10DH
volatile unsigned char           EEADR               @ 0x10D;
volatile unsigned char           EEADRL              @ 0x10D;
// bit and bitfield definitions

//EEDATL 10EH
volatile unsigned char           EEDATL               @ 0x10E;
// bit and bitfield definitions

//EEADRH 10FH 
volatile unsigned char           EEADRH               @ 0x10F;
// bit and bitfield definitions

//EECON 110H EECON
volatile unsigned char           EECON               @ 0x110;
volatile unsigned char           EECON1               @ 0x110;
// bit and bitfield definitions
volatile bit FREADEE               @ ((unsigned)&EECON*8)+0;
volatile bit FPROGEE               @ ((unsigned)&EECON*8)+1;
volatile bit FERASEEE              @ ((unsigned)&EECON*8)+2;
volatile bit FERSALLEE             @ ((unsigned)&EECON*8)+3;
volatile bit FTIMEEE               @ ((unsigned)&EECON*8)+6;

volatile bit READEE               @ ((unsigned)&EECON*8)+0;
volatile bit PROGEE               @ ((unsigned)&EECON*8)+1;
volatile bit ERASEEE              @ ((unsigned)&EECON*8)+2;
volatile bit ERSALLEE             @ ((unsigned)&EECON*8)+3;
volatile bit TIMEEE               @ ((unsigned)&EECON*8)+6;


//PWM0EN 111H
// Register: PWM0EN
volatile unsigned char           PWM0EN               @ 0x111;
// bit and bitfield definitions
volatile bit FPWM0_EN                @ ((unsigned)&PWM0EN*8)+0;
volatile bit FPWM0_OEN               @ ((unsigned)&PWM0EN*8)+1;
volatile bit FPWM01_OEN              @ ((unsigned)&PWM0EN*8)+2;
volatile bit FPWM0M                  @ ((unsigned)&PWM0EN*8)+3;
volatile bit FPWM1_OEN               @ ((unsigned)&PWM0EN*8)+4;
volatile bit FTP0SEL8                @ ((unsigned)&PWM0EN*8)+5;
volatile bit FTP0EN                  @ ((unsigned)&PWM0EN*8)+7;

volatile bit PWM0_EN                @ ((unsigned)&PWM0EN*8)+0;
volatile bit PWM0_OEN               @ ((unsigned)&PWM0EN*8)+1;
volatile bit PWM01_OEN              @ ((unsigned)&PWM0EN*8)+2;
volatile bit PWM0M                  @ ((unsigned)&PWM0EN*8)+3;
volatile bit PWM1_OEN               @ ((unsigned)&PWM0EN*8)+4;
volatile bit TP0SEL8                @ ((unsigned)&PWM0EN*8)+5;
volatile bit TP0EN                  @ ((unsigned)&PWM0EN*8)+7;

// Register: PWM0C
volatile unsigned char           PWM0C               @ 0x112;
// bit and bitfield definitions

// Register: PWM0TL
volatile unsigned char           PWM0TL               @ 0x113;
// bit and bitfield definitions

// Register: PWM0TH
volatile unsigned char           PWM0TH               @ 0x114;
// bit and bitfield definitions


// Register: PWM0PL
volatile unsigned char           PWM0PL               @ 0x115;
// bit and bitfield definitions

// Register: PWM0PH
volatile unsigned char           PWM0PH               @ 0x116;
// bit and bitfield definitions

// Register: PWM0DL
volatile unsigned char           PWM0DL               @ 0x117;
// bit and bitfield definitions

//**************************************************************
// Register: PWM0DH
volatile unsigned char           PWM0DH               @ 0x118;
// bit and bitfield definitions

// Register: PWM0DTL
volatile unsigned char           PWM0DTL              @ 0x119;
// bit and bitfield definitions

// Register: PWM0DTH
volatile unsigned char           PWM0DTH              @ 0x11A;
// bit and bitfield definitions

// Register: PWMPSCON
volatile unsigned char           PWMPSCON             @ 0x11B;
// bit and bitfield definitions

// Register: PWM1DL
volatile unsigned char           PWM1DL               @ 0x011C;
// bit and bitfield definitions

// Register: PWM1DH
volatile unsigned char           PWM1DH               @ 0x11D;
// bit and bitfield definitions

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//BANK3
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

//FLCON1 18EH
volatile unsigned char           FLCON1               @ 0x18E; 
// bit and bitfield definitions
volatile bit FREADL                @ ((unsigned)&FLCON1*8)+0;
volatile bit FPROGL                @ ((unsigned)&FLCON1*8)+1;
volatile bit FERASEL               @ ((unsigned)&FLCON1*8)+2;
volatile bit FTIMEL                @ ((unsigned)&FLCON1*8)+6;
volatile bit FCEFL                 @ ((unsigned)&FLCON1*8)+7;

volatile bit READL                @ ((unsigned)&FLCON1*8)+0;
volatile bit PROGL                @ ((unsigned)&FLCON1*8)+1;
volatile bit ERASEL               @ ((unsigned)&FLCON1*8)+2;
volatile bit TIMEL                @ ((unsigned)&FLCON1*8)+6;
volatile bit CEFL                 @ ((unsigned)&FLCON1*8)+7;

//FLCON2 18FH
volatile unsigned char           FLCON2               @ 0x18F;
// bit and bitfield definitions

//**************************************************************
// Register: FLADRH
volatile unsigned char           FLADRH               @ 0x190;
// bit and bitfield definitions


// Register: FLADRL
volatile unsigned char           FLADRL               @ 0x191;
// bit and bitfield definitions

// Register: FLDATH
volatile unsigned char           FLDATH               @ 0x192;
// bit and bitfield definitions


// Register: FLDATL
volatile unsigned char           FLDATL               @ 0x193;
// bit and bitfield definitions

// Register: FLerrf
volatile unsigned char           FLEF               @ 0x194;
volatile unsigned char           FLerrf             @ 0x194;
// bit and bitfield definitions

// Register: TKC0
volatile unsigned char           TKC0               @ 0x195;
// bit and bitfield definitions
volatile bit FTKPS_0               @ ((unsigned)&TKC0*8)+0;
volatile bit FTKPS_1               @ ((unsigned)&TKC0*8)+1;
volatile bit FTKPS_2               @ ((unsigned)&TKC0*8)+2;
volatile bit FTKPS_3               @ ((unsigned)&TKC0*8)+3;
volatile bit FCVS                  @ ((unsigned)&TKC0*8)+4;
volatile bit FTKST                 @ ((unsigned)&TKC0*8)+6;
volatile bit FTKEN                 @ ((unsigned)&TKC0*8)+7;

volatile bit TKPS_0               @ ((unsigned)&TKC0*8)+0;
volatile bit TKPS_1               @ ((unsigned)&TKC0*8)+1;
volatile bit TKPS_2               @ ((unsigned)&TKC0*8)+2;
volatile bit TKPS_3               @ ((unsigned)&TKC0*8)+3;
volatile bit CVS                  @ ((unsigned)&TKC0*8)+4;
volatile bit TKST                 @ ((unsigned)&TKC0*8)+6;
volatile bit TKEN                 @ ((unsigned)&TKC0*8)+7;


// Register: TK16DH
volatile unsigned char           TK16DH               @ 0x196;
// bit and bitfield definitions

// Register: TK16DL
volatile unsigned char           TK16DL               @ 0x197;
// bit and bitfield definitions

// Register: TKC1
volatile unsigned char           TKC1                 @ 0x198; 
// bit and bitfield definitions
volatile bit FDCTS_0               @ ((unsigned)&TKC1*8)+0;
volatile bit FDCTS_1               @ ((unsigned)&TKC1*8)+1;
volatile bit FCCFLT_0              @ ((unsigned)&TKC1*8)+4;
volatile bit FCCFLT_1              @ ((unsigned)&TKC1*8)+5;
volatile bit FCCFLT_2              @ ((unsigned)&TKC1*8)+6;

volatile bit DCTS_0               @ ((unsigned)&TKC1*8)+0;
volatile bit DCTS_1               @ ((unsigned)&TKC1*8)+1;
volatile bit CCFLT_0              @ ((unsigned)&TKC1*8)+4;
volatile bit CCFLT_1              @ ((unsigned)&TKC1*8)+5;
volatile bit CCFLT_2              @ ((unsigned)&TKC1*8)+6;

// Register: TKC2
volatile unsigned char           TKC2                 @ 0x199;
// bit and bitfield definitions

// Register: TKC3
volatile unsigned char           TKC3                 @ 0x19A;
// bit and bitfield definitions
volatile bit FCVREFS_0            @ ((unsigned)&TKC3*8)+0;
volatile bit FCVREFS_1            @ ((unsigned)&TKC3*8)+1;
volatile bit FCPVS_0              @ ((unsigned)&TKC3*8)+3;
volatile bit FCPVS_1              @ ((unsigned)&TKC3*8)+4;

volatile bit CVREFS_0            @ ((unsigned)&TKC3*8)+0;
volatile bit CVREFS_1            @ ((unsigned)&TKC3*8)+1;
volatile bit CPVS_0              @ ((unsigned)&TKC3*8)+3;
volatile bit CPVS_1              @ ((unsigned)&TKC3*8)+4;

// Register: TKSTA
volatile unsigned char           TKSTA                 @ 0x19B; 
// bit and bitfield definitions
volatile bit FSACMPO             @ ((unsigned)&TKSTA*8)+1;
volatile bit FACMPO              @ ((unsigned)&TKSTA*8)+2;
volatile bit FDCMPO              @ ((unsigned)&TKSTA*8)+3;
volatile bit FTMOUT              @ ((unsigned)&TKSTA*8)+7;

volatile bit SACMPO             @ ((unsigned)&TKSTA*8)+1;
volatile bit ACMPO              @ ((unsigned)&TKSTA*8)+2;
volatile bit DCMPO              @ ((unsigned)&TKSTA*8)+3;
volatile bit TMOUT              @ ((unsigned)&TKSTA*8)+7;


// Register: TKPDH
volatile unsigned char           TKPDH               @ 0x19C;
// bit and bitfield definitions

// Register: TKPDL
volatile unsigned char           TKPDL               @ 0x19D;
// bit and bitfield definitions

// Register: CMPCON
volatile unsigned char           CMPCON               @ 0x19E;
// bit and bitfield definitions
volatile bit FCOPOL               @ ((unsigned)&CMPCON*8)+1;
volatile bit FCVEN                @ ((unsigned)&CMPCON*8)+2;
volatile bit FCPEN                @ ((unsigned)&CMPCON*8)+3;
volatile bit FCODEB               @ ((unsigned)&CMPCON*8)+4;
volatile bit FFTCKS               @ ((unsigned)&CMPCON*8)+5;
volatile bit FCMPIF               @ ((unsigned)&CMPCON*8)+6;
volatile bit FCMPEN               @ ((unsigned)&CMPCON*8)+7;

volatile bit COPOL               @ ((unsigned)&CMPCON*8)+1;
volatile bit CVEN                @ ((unsigned)&CMPCON*8)+2;
volatile bit CPEN                @ ((unsigned)&CMPCON*8)+3;
volatile bit CODEB               @ ((unsigned)&CMPCON*8)+4;
volatile bit FTCKS               @ ((unsigned)&CMPCON*8)+5;
volatile bit CMPIF               @ ((unsigned)&CMPCON*8)+6;
volatile bit CMPEN               @ ((unsigned)&CMPCON*8)+7;

// Register: CMPM
volatile unsigned char           CMPM               @ 0x19F;
// bit and bitfield definitions
volatile bit FVRS0                @ ((unsigned)&CMPM*8)+0;
volatile bit FVRS1                @ ((unsigned)&CMPM*8)+1;
volatile bit FVRS2                @ ((unsigned)&CMPM*8)+2;
volatile bit FVRS3                @ ((unsigned)&CMPM*8)+3;
volatile bit FXRVSEL              @ ((unsigned)&CMPM*8)+4;
volatile bit FCPINS0              @ ((unsigned)&CMPM*8)+5;
volatile bit FCPINS1              @ ((unsigned)&CMPM*8)+6;

volatile bit VRS0                @ ((unsigned)&CMPM*8)+0;
volatile bit VRS1                @ ((unsigned)&CMPM*8)+1;
volatile bit VRS2                @ ((unsigned)&CMPM*8)+2;
volatile bit VRS3                @ ((unsigned)&CMPM*8)+3;
volatile bit XRVSEL              @ ((unsigned)&CMPM*8)+4;
volatile bit CPINS0              @ ((unsigned)&CMPM*8)+5;
volatile bit CPINS1              @ ((unsigned)&CMPM*8)+6;



//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//BANK END
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
#endif



/*
// Register: PBIC1
volatile unsigned char           PBIC1               @ 0x06C;
// bit and bitfield definitions

// Register: PAIC1
volatile unsigned char           PAIC1               @ 0x06F;
// bit and bitfield definitions

// Register: EECON
volatile unsigned char           EECON1               @ 0x07A;
// bit and bitfield definitions

// Register: OPAM
volatile unsigned char           OPAM               @ 0x0DB; //0X5B
// bit and bitfield definitions
volatile bit MULTS0                @ ((unsigned)&OPAM*8)+0;
volatile bit MULTS1                @ ((unsigned)&OPAM*8)+1;
volatile bit OPAMEN                @ ((unsigned)&OPAM*8)+2;
volatile bit COMMS                 @ ((unsigned)&OPAM*8)+3;

#ifndef _LIB_BUILD
volatile union {
    struct {
        unsigned	MULTS0              : 1;
        unsigned	MULTS1              : 1;
        unsigned	OPAMEN              : 1;
        unsigned	COMMS               : 1; 
        unsigned	                    : 4;
    };
} OPAMbits @ 0x0DB;
#endif
*/
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

/*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
变量定义 ：
bit				1	==布尔型位变量，0或1两种取值
char			8	==有符号或无符号字符变量，
unsigned char	8	==无符号字符变量
short			16	==有符号整型数
unsigned short	16	==无符号整型数
int				16	==有符号整型数
unsigned int	16	==无符号整型数
long			32	==有符号长整型
unsigned long	32	==无符号长整型
float			24	==浮点数
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
BANK数据寄存器定义的管理
如果没有特别说明，所定义的变量降被定义在Bank0;除了Bank0内的变量声明不需要特殊处理外，
定义在其它Bank内的变量前面必须加上相应的bank序号，例如
	bank1 unsigned char buffer[2]	;变量定位在bank0
	bank2 bit flag1,flag2	;变量定位在bank2(如果硬件有bank2)
	bank3 int U16_tmp0,U16_tmp1	;变量定位在bank3(如果硬件有bank3)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
其它变量修饰关键词:
extern - 外部变量声明；如果在一个C程序文件中要使用一些变量但其原型定义写在另外的文件中，
	那么在本文件中必须将这些变量声明成“extern ”外部类型。

volatile —易变型变量声明。
const  —  常数型变量声明。
persistent —  非初始化变量声明。
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*



*/


