//--------------------------------------------------------
// Файл был создан генератором FBD системы MCStudio
// Версия 1.7.0.0 от 02.09.2006
// Этот файл создан 09.09.2009 16:23:49
// Исходный путь: D:\p\MCStudio\Models\80C51.mcs
//--------------------------------------------------------

#ifndef _REG_80C51
#define _REG_80C51

// Байтовые регистры
sfr at 0xE0 ACC;
sfr at 0xF0 B;
sfr at 0xD0 PSW;
sfr at 0x81 SP;
sfr at 0x83 DPH;
sfr at 0x82 DPL;
sfr at 0x80 P0;
sfr at 0x90 P1;
sfr at 0xA0 P2;
sfr at 0xB0 P3;
sfr at 0xA8 IE;
sfr at 0xB8 IP;
sfr at 0x88 TCON;
sfr at 0x8A TL0;
sfr at 0x8C TH0;
sfr at 0x89 TMOD;
sfr at 0x8B TL1;
sfr at 0x8D TH1;
sfr at 0x99 SBUF;
sfr at 0x98 SCON;
sfr at 0x87 PCON;

// Биты битовоадресуемых регистров
sbit at 0xE0 ACC0;
sbit at 0xE1 ACC1;
sbit at 0xE2 ACC2;
sbit at 0xE3 ACC3;
sbit at 0xE4 ACC4;
sbit at 0xE5 ACC5;
sbit at 0xE6 ACC6;
sbit at 0xE7 ACC7;
sbit at 0xE0 ACC_0;
sbit at 0xE1 ACC_1;
sbit at 0xE2 ACC_2;
sbit at 0xE3 ACC_3;
sbit at 0xE4 ACC_4;
sbit at 0xE5 ACC_5;
sbit at 0xE6 ACC_6;
sbit at 0xE7 ACC_7;
sbit at 0xF0 B_0;
sbit at 0xF1 B_1;
sbit at 0xF2 B_2;
sbit at 0xF3 B_3;
sbit at 0xF4 B_4;
sbit at 0xF5 B_5;
sbit at 0xF6 B_6;
sbit at 0xF7 B_7;
sbit at 0xD0 P;
sbit at 0xD1 PSW_1;
sbit at 0xD1 PSW1;
sbit at 0xD2 OV;
sbit at 0xD3 RS0;
sbit at 0xD4 RS1;
sbit at 0xD5 F0;
sbit at 0xD6 AC;
sbit at 0xD7 CY;
sbit at 0x80 P0_0;
sbit at 0x81 P0_1;
sbit at 0x82 P0_2;
sbit at 0x83 P0_3;
sbit at 0x84 P0_4;
sbit at 0x85 P0_5;
sbit at 0x86 P0_6;
sbit at 0x87 P0_7;
sbit at 0x90 P1_0;
sbit at 0x91 P1_1;
sbit at 0x92 P1_2;
sbit at 0x93 P1_3;
sbit at 0x94 P1_4;
sbit at 0x95 P1_5;
sbit at 0x96 P1_6;
sbit at 0x97 P1_7;
sbit at 0xA0 P2_0;
sbit at 0xA1 P2_1;
sbit at 0xA2 P2_2;
sbit at 0xA3 P2_3;
sbit at 0xA4 P2_4;
sbit at 0xA5 P2_5;
sbit at 0xA6 P2_6;
sbit at 0xA7 P2_7;
sbit at 0xB0 P3_0;
sbit at 0xB1 P3_1;
sbit at 0xB2 P3_2;
sbit at 0xB3 P3_3;
sbit at 0xB4 P3_4;
sbit at 0xB5 P3_5;
sbit at 0xB6 P3_6;
sbit at 0xB7 P3_7;
sbit at 0x80 AD0;
sbit at 0x81 AD1;
sbit at 0x82 AD2;
sbit at 0x83 AD3;
sbit at 0x84 AD4;
sbit at 0x85 AD5;
sbit at 0x86 AD6;
sbit at 0x87 AD7;
sbit at 0xA0 A8;
sbit at 0xA1 A9;
sbit at 0xA2 A10;
sbit at 0xA3 A11;
sbit at 0xA4 A12;
sbit at 0xA5 A13;
sbit at 0xA6 A14;
sbit at 0xA7 A15;
sbit at 0xB7 RD;
sbit at 0xA8 EX0;
sbit at 0xA9 ET0;
sbit at 0xAA EX1;
sbit at 0xAB ET1;
sbit at 0xAC ES;
sbit at 0xAF EA;
sbit at 0xB2 INT0;
sbit at 0xB3 INT1;
sbit at 0xB8 PX0;
sbit at 0xB9 PT0;
sbit at 0xBA PX1;
sbit at 0xBB PT1;
sbit at 0xBC PS;
sbit at 0x88 IT0;
sbit at 0x89 IE0;
sbit at 0x8A IT1;
sbit at 0x8B IE1;
sbit at 0x8C TR0;
sbit at 0x8D TF0;
sbit at 0xB4 T0;
sbit at 0x8E TR1;
sbit at 0x8F TF1;
sbit at 0xB5 T1;
sbit at 0xB0 RXD;
sbit at 0xB1 TXD;
sbit at 0x98 RI;
sbit at 0x99 TI;
sbit at 0x9A RB8;
sbit at 0x9B TB8;
sbit at 0x9C REN;
sbit at 0x9D SM2;
sbit at 0x9E SM1;
sbit at 0x9F SM0;

// Маски для доступа к небитовоадресуемым битам
#define PX0H 0x01
#define PT0H 0x02
#define PX1H 0x04
#define PT1H 0x08
#define PSH 0x10
#define M0_0 0x01
#define M0_1 0x02
#define C_T0 0x04
#define GATE0 0x08
#define M1_0 0x10
#define M1_1 0x20
#define C_T1 0x40
#define GATE1 0x80
#define SMOD 0x80
#define IDL 0x01
#define PD 0x02
#define GF0 0x04
#define GF1 0x08
#define TL0_7 0x80
#define TL0_6 0x40
#define TL0_5 0x20
#define TL0_4 0x10
#define TL0_3 0x08
#define TL0_2 0x04
#define TL0_1 0x02
#define TL0_0 0x01
#define TL1_7 0x80
#define TL1_6 0x40
#define TL1_5 0x20
#define TL1_4 0x10
#define TL1_3 0x08
#define TL1_2 0x04
#define TL1_1 0x02
#define TL1_0 0x01
#define TH0_7 0x80
#define TH0_6 0x40
#define TH0_5 0x20
#define TH0_4 0x10
#define TH0_3 0x08
#define TH0_2 0x04
#define TH0_1 0x02
#define TH0_0 0x01
#define TH1_7 0x80
#define TH1_6 0x40
#define TH1_5 0x20
#define TH1_4 0x10
#define TH1_3 0x08
#define TH1_2 0x04
#define TH1_1 0x02
#define TH1_0 0x01
#define SBUF_7 0x80
#define SBUF_6 0x40
#define SBUF_5 0x20
#define SBUF_4 0x10
#define SBUF_3 0x08
#define SBUF_2 0x04
#define SBUF_1 0x02
#define SBUF_0 0x01

// Номера прерываний: адрес = 8*номер + 3
#define IE0_VECTOR  0  /* 0x03 внешнее прерывание 0 */
#define TF0_VECTOR  1  /* 0x0B таймер 0 */
#define IE1_VECTOR  2  /* 0x13 внешнее прерывание 1 */
#define TF1_VECTOR  3  /* 0x1B таймер 1 */
#define SI0_VECTOR  4  /* 0x23 последовательный порт 0 */

#endif
