ATY_LIB
V2_102_230218
ATY_LIB for general devices or ALGO
Loading...
Searching...
No Matches
fw_reg_base.h
Go to the documentation of this file.
1
// Copyright 2021 IOsetting <iosetting(at)outlook.com>
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef __FW_REG_BASE_H__
16
#define __FW_REG_BASE_H__
17
18
#if defined (__SDCC_SYNTAX_FIX)
19
#include <stdbool.h>
20
#include <lint.h>
21
# warning unrecognized compiler
22
#define __BIT bool
23
#define __DATA
24
#define __IDATA
25
#define __PDATA
26
#define __XDATA
27
#define __CODE
28
#define __REENTRANT
29
#define SBIT(name, addr, bit) volatile bool name
30
#define SFR(name, addr) volatile unsigned char name
31
#define SFRX(addr) (*(unsigned char volatile *)(addr))
32
#define SFR16X(addr) (*(unsigned char volatile *)(addr))
33
#define INTERRUPT(name, vector) void name (void)
34
#define INTERRUPT_USING(name, vector, regnum) void name (void)
35
#define NOP()
36
37
#elif defined (SDCC) || defined (__SDCC)
38
#define __BIT __bit
39
#define __DATA __data
40
#define __IDATA __idata
41
#define __PDATA __pdata
42
#define __XDATA __xdata
43
#define __CODE __code
44
#define __REENTRANT __reentrant
45
#define SBIT(name, addr, bit) __sbit __at(addr+bit) name
46
#define SFR(name, addr) __sfr __at(addr) name
47
#define SFRX(addr) (*(unsigned char volatile __xdata *)(addr))
48
#define SFR16X(addr) (*(unsigned int volatile __xdata *)(addr))
49
50
#define INTERRUPT(name, vector) void name (void) __interrupt (vector)
51
#define INTERRUPT_USING(name, vector, regnum) void name (void) __interrupt (vector) __using (regnum)
52
#define NOP() __asm NOP __endasm
53
54
#elif defined __CX51__ || defined __C51__
55
#define __BIT bit
56
#define __DATA data
57
#define __IDATA idata
58
#define __PDATA pdata
59
#define __XDATA xdata
60
#define __CODE code
61
#define __REENTRANT reentrant
62
#define SBIT(name, addr, bit) sbit name = addr^bit
63
#define SFR(name, addr) sfr name = addr
64
#define SFRX(addr) (*(unsigned char volatile xdata *)(addr))
65
#define SFR16X(addr) (*(unsigned int volatile xdata *)(addr))
66
67
#define INTERRUPT(name, vector) void name (void) interrupt vector
68
#define INTERRUPT_USING(name, vector, regnum) void name (void) interrupt vector using regnum
69
extern
void
_nop_ (
void
);
70
#define NOP() _nop_()
71
72
#endif
73
74
#define _P0 0x80
75
SFR
(P0,
_P0
);
76
SBIT
(P00,
_P0
, 0);
77
SBIT
(P01,
_P0
, 1);
78
SBIT
(P02,
_P0
, 2);
79
SBIT
(P03,
_P0
, 3);
80
SBIT
(P04,
_P0
, 4);
81
SBIT
(P05,
_P0
, 5);
82
SBIT
(P06,
_P0
, 6);
83
SBIT
(P07,
_P0
, 7);
84
SFR
(SP, 0x81);
85
SFR
(DPL, 0x82);
86
SFR
(DPH, 0x83);
87
SFR
(S4CON, 0x84);
88
SFR
(S4BUF, 0x85);
89
SFR
(PCON, 0x87);
90
91
#define _TCON 0x88
92
SFR
(TCON,
_TCON
);
93
SBIT
(TF1,
_TCON
, 7);
94
SBIT
(TR1,
_TCON
, 6);
95
SBIT
(TF0,
_TCON
, 5);
96
SBIT
(TR0,
_TCON
, 4);
97
SBIT
(IE1,
_TCON
, 3);
98
SBIT
(IT1,
_TCON
, 2);
99
SBIT
(IE0,
_TCON
, 1);
100
SBIT
(IT0,
_TCON
, 0);
101
SFR
(TMOD, 0x89);
102
103
SFR
(TL0, 0x8A);
104
SFR
(TL1, 0x8B);
105
SFR
(TH0, 0x8C);
106
SFR
(TH1, 0x8D);
107
SFR
(AUXR, 0x8E);
108
SFR
(INTCLKO, 0x8F);
109
110
#define _P1 0x90
111
SFR
(P1,
_P1
);
112
SBIT
(P10,
_P1
, 0);
113
SBIT
(P11,
_P1
, 1);
114
SBIT
(P12,
_P1
, 2);
115
SBIT
(P13,
_P1
, 3);
116
SBIT
(P14,
_P1
, 4);
117
SBIT
(P15,
_P1
, 5);
118
SBIT
(P16,
_P1
, 6);
119
SBIT
(P17,
_P1
, 7);
120
SFR
(P1M1, 0x91);
121
SFR
(P1M0, 0x92);
122
SFR
(P0M1, 0x93);
123
SFR
(P0M0, 0x94);
124
SFR
(P2M1, 0x95);
125
SFR
(P2M0, 0x96);
126
127
#define _SCON 0x98
128
SFR
(SCON,
_SCON
);
129
SBIT
(SM0,
_SCON
, 7);
130
SBIT
(SM1,
_SCON
, 6);
131
SBIT
(SM2,
_SCON
, 5);
132
SBIT
(REN,
_SCON
, 4);
133
SBIT
(TB8,
_SCON
, 3);
134
SBIT
(RB8,
_SCON
, 2);
135
SBIT
(TI,
_SCON
, 1);
136
SBIT
(RI,
_SCON
, 0);
137
SFR
(SBUF, 0x99);
138
SFR
(S2CON, 0x9A);
139
SFR
(S2BUF, 0x9B);
140
SFR
(IRCBAND, 0x9D);
141
SFR
(LIRTRIM, 0x9E);
142
SFR
(IRTRIM, 0x9F);
143
144
#define _P2 0xA0
145
SFR
(P2,
_P2
);
146
SBIT
(P20,
_P2
, 0);
147
SBIT
(P21,
_P2
, 1);
148
SBIT
(P22,
_P2
, 2);
149
SBIT
(P23,
_P2
, 3);
150
SBIT
(P24,
_P2
, 4);
151
SBIT
(P25,
_P2
, 5);
152
SBIT
(P26,
_P2
, 6);
153
SBIT
(P27,
_P2
, 7);
154
SFR
(BUS_SPEED, 0xA1);
155
SFR
(P_SW1, 0xA2);
156
157
#define _IE 0xA8
158
SFR
(IE,
_IE
);
159
SBIT
(EA,
_IE
, 7);
160
SBIT
(ELVD,
_IE
, 6);
161
SBIT
(EADC,
_IE
, 5);
162
SBIT
(ES,
_IE
, 4);
163
SBIT
(ET1,
_IE
, 3);
164
SBIT
(EX1,
_IE
, 2);
165
SBIT
(ET0,
_IE
, 1);
166
SBIT
(EX0,
_IE
, 0);
167
SFR
(SADDR, 0xA9);
168
SFR
(WKTCL, 0xAA);
169
SFR
(WKTCH, 0xAB);
170
SFR
(S3CON, 0xAC);
171
SFR
(S3BUF, 0xAD);
172
SFR
(TA, 0xAE);
173
SFR
(IE2, 0xAF);
174
175
#define _P3 0xB0
176
SFR
(P3,
_P3
);
177
SBIT
(P30,
_P3
, 0);
178
SBIT
(P31,
_P3
, 1);
179
SBIT
(P32,
_P3
, 2);
180
SBIT
(P33,
_P3
, 3);
181
SBIT
(P34,
_P3
, 4);
182
SBIT
(P35,
_P3
, 5);
183
SBIT
(P36,
_P3
, 6);
184
SBIT
(P37,
_P3
, 7);
185
SFR
(P3M1, 0xB1);
186
SFR
(P3M0, 0xB2);
187
SFR
(P4M1, 0xB3);
188
SFR
(P4M0, 0xB4);
189
SFR
(IP2, 0xB5);
190
SFR
(IP2H, 0xB6);
191
SFR
(IPH, 0xB7);
192
193
#define _IP 0xB8
194
SFR
(IP,
_IP
);
195
SBIT
(PPCA,
_IP
, 7);
196
SBIT
(PLVD,
_IP
, 6);
197
SBIT
(PADC,
_IP
, 5);
198
SBIT
(PS,
_IP
, 4);
199
SBIT
(PT1,
_IP
, 3);
200
SBIT
(PX1,
_IP
, 2);
201
SBIT
(PT0,
_IP
, 1);
202
SBIT
(PX0,
_IP
, 0);
203
SFR
(SADEN, 0xB9);
204
SFR
(P_SW2, 0xBA);
205
SFR
(ADC_CONTR, 0xBC);
206
SFR
(ADC_RES, 0xBD);
207
SFR
(ADC_RESL, 0xBE);
208
209
#define _P4 0xC0
210
SFR
(P4,
_P4
);
211
SBIT
(P40,
_P4
, 0);
212
SBIT
(P41,
_P4
, 1);
213
SBIT
(P42,
_P4
, 2);
214
SBIT
(P43,
_P4
, 3);
215
SBIT
(P44,
_P4
, 4);
216
SBIT
(P45,
_P4
, 5);
217
SBIT
(P46,
_P4
, 6);
218
SBIT
(P47,
_P4
, 7);
219
SFR
(WDT_CONTR, 0xC1);
220
SFR
(IAP_DATA, 0xC2);
221
SFR
(IAP_ADDRH, 0xC3);
222
SFR
(IAP_ADDRL, 0xC4);
223
SFR
(IAP_CMD, 0xC5);
224
SFR
(IAP_TRIG, 0xC6);
225
SFR
(IAP_CONTR, 0xC7);
226
227
#define _P5 0xC8
228
SFR
(P5,
_P5
);
229
SBIT
(P50,
_P5
, 0);
230
SBIT
(P51,
_P5
, 1);
231
SBIT
(P52,
_P5
, 2);
232
SBIT
(P53,
_P5
, 3);
233
SBIT
(P54,
_P5
, 4);
234
SBIT
(P55,
_P5
, 5);
235
SBIT
(P56,
_P5
, 6);
236
SBIT
(P57,
_P5
, 7);
237
SFR
(P5M1, 0xC9);
238
SFR
(P5M0, 0xCA);
239
SFR
(P6M1, 0xCB);
240
SFR
(P6M0, 0xCC);
241
SFR
(SPSTAT, 0xCD);
242
SFR
(SPCTL, 0xCE);
243
SFR
(SPDAT, 0xCF);
244
245
#define _PSW 0xD0
246
SFR
(PSW,
_PSW
);
247
SBIT
(CY,
_PSW
, 7);
248
SBIT
(AC,
_PSW
, 6);
249
SBIT
(F0,
_PSW
, 5);
250
SBIT
(RS1,
_PSW
, 4);
251
SBIT
(RS0,
_PSW
, 3);
252
SBIT
(OV,
_PSW
, 2);
253
SBIT
(F1,
_PSW
, 1);
254
SBIT
(P,
_PSW
, 0);
255
SFR
(T4T3M, 0xD1);
256
SFR
(T4H, 0xD2);
257
SFR
(T4L, 0xD3);
258
SFR
(T3H, 0xD4);
259
SFR
(T3L, 0xD5);
260
SFR
(T2H, 0xD6);
261
SFR
(T2L, 0xD7);
262
263
SFR
(ACC, 0xE0);
264
265
#define _P6 0xE8
266
SFR
(P6,
_P6
);
267
SBIT
(P60,
_P6
, 0);
268
SBIT
(P61,
_P6
, 1);
269
SBIT
(P62,
_P6
, 2);
270
SBIT
(P63,
_P6
, 3);
271
SBIT
(P64,
_P6
, 4);
272
SBIT
(P65,
_P6
, 5);
273
SBIT
(P66,
_P6
, 6);
274
SBIT
(P67,
_P6
, 7);
275
276
SFR
(B, 0xF0);
277
278
#define _P7 0xF8
279
SFR
(P7,
_P7
);
280
SBIT
(P70,
_P7
, 0);
281
SBIT
(P71,
_P7
, 1);
282
SBIT
(P72,
_P7
, 2);
283
SBIT
(P73,
_P7
, 3);
284
SBIT
(P74,
_P7
, 4);
285
SBIT
(P75,
_P7
, 5);
286
SBIT
(P76,
_P7
, 6);
287
SBIT
(P77,
_P7
, 7);
288
289
#endif
_TCON
#define _TCON
Definition:
fw_reg_base.h:91
_P5
#define _P5
Definition:
fw_reg_base.h:227
_P7
#define _P7
Definition:
fw_reg_base.h:278
_P4
#define _P4
Definition:
fw_reg_base.h:209
_P2
#define _P2
Definition:
fw_reg_base.h:144
_IE
#define _IE
Definition:
fw_reg_base.h:157
_P0
#define _P0
Definition:
fw_reg_base.h:74
_SCON
#define _SCON
Definition:
fw_reg_base.h:127
_P6
#define _P6
Definition:
fw_reg_base.h:265
SBIT
SBIT(P00, _P0, 0)
_PSW
#define _PSW
Definition:
fw_reg_base.h:245
_IP
#define _IP
Definition:
fw_reg_base.h:193
SFR
SFR(P0, _P0)
_P3
#define _P3
Definition:
fw_reg_base.h:175
_P1
#define _P1
Definition:
fw_reg_base.h:110
ATY_LIB
FwLib_STC8
include
fw_reg_base.h
Generated by
1.9.6