⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.h

📁 mcs51,2051,x86系列MCU
💻 H
字号:
/*
 *  ApBUILDER INCLUDE FILE - Intel Corporation
 *
 *
 *  Purpose:            Include file containing bit definitions, sfr definitions, and miscellaneous
 *                      globally used definitions/typedefs.
 *
 *                      The Software is provided "AS IS."
 *
 *                      LIMITATION OF LIABILITY:    NEITHER INTEL NOR ITS VENDORS OR AGENTS
 *                      SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
 *                      INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
 *                      CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
 *                      OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 *                      While we have made every attempt to completely test this code, we request that
 *                      you personally test it completely prior to actual inclusion in your own projects.
 *
 *  Compiler:           Developed using Compass251 from Production Languages corporation.
 *
 *  Ext Packages:       None
 *
 *  Author:             Brad B.
 *
 *  Revisions:
 *
 *
 */

#ifndef GLOBAL_H
#define GLOBAL_H

/* Remember, set this only if you want the TCB functionality */
#define TASK_CONTROL_BLOCK_ENABLED


typedef struct
{
   unsigned B7 : 1;
   unsigned B6 : 1;
   unsigned B5 : 1;
   unsigned B4 : 1;
   unsigned B3 : 1;
   unsigned B2 : 1;
   unsigned B1 : 1;
   unsigned B0 : 1;
} _SFR_BITS ;
#define _BIT(byte,bit) (*(_SFR_BITS near *)&(byte)).B##bit



intrinsic void SET_VECTOR(long vector,void (*)(void));
intrinsic void EI(void);
intrinsic void DI(void);



/* -----------------7/30/96 10:21AM------------------
 * Architecture specific SFR definitions/locations.
 * --------------------------------------------------*/
#define ACC    (*((near char *)0xe0))
#define B      (*((near char *)0xf0))
#define PSW    (*((near char *)0xd0))
#define PSW1   (*((near char *)0xd1))
#define SP     (*((near char *)0x81))
#define SPL    (*((near char *)0x81))
#define SPH    (*((near char *)0xbd))
#define DPL    (*((near char *)0x82))
#define DPH    (*((near char *)0x83))
#define DPXL   (*((near char *)0x84))
#define PCON   (*((near char *)0x87))
#define IPH0   (*((near char *)0xb7))
#define IPL0   (*((near char *)0xb8))
#define IF0    (*((near char *)0xc2))
#define CCON   (*((near char *)0xd8))
#define CMOD   (*((near char *)0xd9))
#define CCAPM0 (*((near char *)0xda))
#define CCAPM1 (*((near char *)0xdb))
#define CCAPM2 (*((near char *)0xdc))
#define CCAPM3 (*((near char *)0xdd))
#define CCAPM4 (*((near char *)0xde))
#define CL     (*((near char *)0xe9))
#define CCAP0L (*((near char *)0xea))
#define CCAP1L (*((near char *)0xeb))
#define CCAP2L (*((near char *)0xec))
#define CCAP3L (*((near char *)0xed))
#define CCAP4L (*((near char *)0xee))
#define CH     (*((near char *)0xf9))
#define CCAP0H (*((near char *)0xfa))
#define CCAP1H (*((near char *)0xfb))
#define CCAP2H (*((near char *)0xfc))
#define CCAP3H (*((near char *)0xfd))
#define CCAP4H (*((near char *)0xfe))
#define SCON   (*((near char *)0x98))
#define SBUF   (*((near char *)0x99))
#define SADEN  (*((near char *)0xb9))
#define SADDR  (*((near char *)0xa9))
#define TL0    (*((near char *)0x8a))
#define TH0    (*((near char *)0x8c))
#define TL1    (*((near char *)0x8b))
#define TH1    (*((near char *)0x8d))
#define TL2    (*((near char *)0xcc))
#define TH2    (*((near char *)0xcd))
#define TCON   (*((near char *)0x88))
#define TMOD   (*((near char *)0x89))
#define T2CON  (*((near char *)0xc8))
#define T2MOD  (*((near char *)0xc9))
#define RCAP2L (*((near char *)0xca))
#define RCAP2H (*((near char *)0xcb))
#define WDTRST (*((near char *)0xa6))
#define WCON   (*((near char *)0xa7))
#define P0     (*((near char *)0x80))
#define P1     (*((near char *)0x90))
#define P2     (*((near char *)0xa0))
#define P3     (*((near char *)0xb0))
#define IP     (*((near char *)0xb8))
#define IE     (*((near char *)0xa8))
#define IE0    (*((near char *)0xa8))


/* -----------------7/30/96 10:21AM------------------
 * Standard Bit macros.
 * --------------------------------------------------*/
#define TF1       _BIT(TCON,7)
#define TR1       _BIT(TCON,6)
#define TF0       _BIT(TCON,5)
#define TR0       _BIT(TCON,4)
#define IE1       _BIT(TCON,3)
#define IT1       _BIT(TCON,2)
#define TCON_IE0  _BIT(TCON,1)
#define IT0       _BIT(TCON,0)

#define SM0       _BIT(SCON,7)
#define SM1       _BIT(SCON,6)
#define SM2       _BIT(SCON,5)
#define REN       _BIT(SCON,4)
#define TB8       _BIT(SCON,3)
#define RB8       _BIT(SCON,2)
#define TI        _BIT(SCON,1)
#define RI        _BIT(SCON,0)

#define EA        _BIT(IE,7)
#define EC        _BIT(IE,6)
#define ET2       _BIT(IE,5)
#define ES        _BIT(IE,4)
#define ET1       _BIT(IE,3)
#define EX1       _BIT(IE,2)
#define ET0       _BIT(IE,1)
#define EX0       _BIT(IE,0)

#define PT2       _BIT(IP,5)
#define PS        _BIT(IP,4)
#define PT1       _BIT(IP,3)
#define PX1       _BIT(IP,2)
#define PT0       _BIT(IP,1)
#define PX0       _BIT(IP,0)

#define CY        _BIT(PSW,7)
#define AC        _BIT(PSW,6)
#define F0        _BIT(PSW,5)
#define RS1       _BIT(PSW,4)
#define RS0       _BIT(PSW,3)
#define OV        _BIT(PSW,2)
#define UD        _BIT(PSW,1)
#define P         _BIT(PSW,0)

#define CF        _BIT(CCON, 7)
#define CR        _BIT(CCON, 6)
#define CCF4      _BIT(CCON, 4)
#define CCF3      _BIT(CCON, 3)
#define CCF2      _BIT(CCON, 2)
#define CCF1      _BIT(CCON, 1)
#define CCF0      _BIT(CCON, 0)

#define TF2       _BIT(T2CON,7)
#define EXF2      _BIT(T2CON,6)
#define RCLK      _BIT(T2CON,5)
#define TCLK      _BIT(T2CON,4)
#define EXEN2     _BIT(T2CON,3)
#define TR2       _BIT(T2CON,2)
#define C_T2      _BIT(T2CON,1)
#define CP_RL2    _BIT(T2CON,0)


/* Interrupt Vectors.  You may need to change these depending on your development environment */

#define INT0   0x0003
#define TIMER0 0x000b
#define INT1   0x0013
#define TIMER1 0x001b
#define SERIO  0x0023
#define TIMER2 0x002b
#define PCA    0x0033
#define TRAP   0x007b

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -