8051-ELL库
beta 1.1.6
8051-ELL library API Document Center
STC8x_MDU16.h
浏览该文件的文档.
1
/*-----------------------------------------------------------------------
2
| FILE DESCRIPTION |
3
-----------------------------------------------------------------------*/
4
/*----------------------------------------------------------------------
5
- File name : STC8Ax_MDU16.h
6
- Author : zeweni
7
- Update date : 2020.04.27
8
- Copyright(C) : 2020-2021 zeweni. All rights reserved.
9
-----------------------------------------------------------------------*/
10
/*------------------------------------------------------------------------
11
| COPYRIGHT NOTICE |
12
------------------------------------------------------------------------*/
13
/*
14
* Copyright (C) 2021, zeweni (17870070675@163.com)
15
16
* This file is part of 8051 ELL low-layer libraries.
17
18
* 8051 ELL low-layer libraries is free software: you can redistribute
19
* it and/or modify it under the terms of the Apache-2.0 License.
20
21
* 8051 ELL low-layer libraries is distributed in the hope that it will
22
* be useful,but WITHOUT ANY WARRANTY; without even the implied warranty
23
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
* Apache-2.0 License License for more details.
25
26
* You should have received a copy of the Apache-2.0 License.8051 ELL
27
* low-layer libraries. If not, see <http://www.apache.org/licenses/>.
28
**/
29
/*-----------------------------------------------------------------------
30
| INCLUDES |
31
-----------------------------------------------------------------------*/
32
#ifndef __STC8x_MDU16_H_
33
#define __STC8x_MDU16_H_
34
35
/*--------------------------------------------------------
36
| @Description: STC8x core |
37
--------------------------------------------------------*/
38
#include "ELL_CORE.h"
39
40
41
42
#if (PER_LIB_MCU_MUODEL == STC8Ax)
43
#include "
STC8Ax_REG.h
"
44
#elif (PER_LIB_MCU_MUODEL == STC8Cx)
45
#include "
STC8Cx_REG.h
"
46
#elif (PER_LIB_MCU_MUODEL == STC8Fx)
47
#include "
STC8Fx_REG.h
"
48
#elif (PER_LIB_MCU_MUODEL == STC8Gx)
49
#include "
STC8Gx_REG.h
"
50
#elif (PER_LIB_MCU_MUODEL == STC8Hx)
51
#include "
STC8Hx_REG.h
"
52
#endif
53
54
/*-----------------------------------------------------------------------
55
| DATA |
56
-----------------------------------------------------------------------*/
57
/* None */
58
59
#ifndef PER_LIB_MDU16_CTRL
62
#define PER_LIB_MDU16_CTRL 1
63
#endif
64
65
/*-----------------------------------------------------------------------
66
| API FUNCTION |
67
-----------------------------------------------------------------------*/
68
#if (PER_LIB_MDU16_CTRL == 1)
69
70
#if (PER_LIB_MCU_MUODEL == STC8Cx || PER_LIB_MCU_MUODEL == STC8Gx || PER_LIB_MCU_MUODEL == STC8Hx)
71
79
#define MUL_16_BIT(mul1, mul2, pro) \
80
do{ \
81
EAXFR_ENABLE(); \
82
MD1U16 = mul1; MD5U16 = mul2; \
83
ARCON = 0x04 << 5; OPCON = 1; \
84
while((OPCON & 0x01) != 0); \
85
pro = MD3U32; \
86
EAXFR_DISABLE(); \
87
}while(0)
88
89
98
#define DIV_16_BIT(mol, den, quo, rem) \
99
do{ \
100
EAXFR_ENABLE(); \
101
MD1U16 = mol; MD5U16 = den; \
102
ARCON = 0x06 << 5; OPCON = 1; \
103
while((OPCON & 0x01) != 0); \
104
quo = MD1U16; mol = MD5U16; \
105
EAXFR_DISABLE(); \
106
}while (0)
107
116
#define DIV_32_BIT(mol, den, quo, rem) \
117
do{ \
118
EAXFR_ENABLE(); \
119
MD3U32 = mol; MD5U16 = den; \
120
ARCON = 0x06 << 5; OPCON = 1; \
121
while((OPCON & 0x01) != 0); \
122
quo = MD3U32; mod = MD5U16; \
123
EAXFR_DISABLE(); \
124
}while (0)
125
126
134
#define MOVE_LEFT_SHIFT(mdata, digits, result) \
135
do{ \
136
EAXFR_ENABLE(); \
137
ARCON = (0x02 << 5) + digits; \
138
MD3U32 = mdata; OPCON = 1; \
139
while((OPCON & 0x01) != 0); \
140
result = MD3U32; \
141
EAXFR_DISABLE(); \
142
}while (0)
143
144
152
#define MOVE_RIGHT_SHIFT(mdata, digits, result) \
153
do{ \
154
EAXFR_ENABLE(); \
155
ARCON = (0x01 << 5) + digits; \
156
MD3U32 = mdata; OPCON = 1; \
157
while((OPCON & 0x01) != 0); \
158
result = MD3U32; \
159
EAXFR_DISABLE(); \
160
}while (0)
161
162
#endif
163
164
#endif
165
/*-----------------------------------------------------------------------
166
| END OF FLIE. (C) COPYRIGHT zeweni |
167
-----------------------------------------------------------------------*/
168
#endif
STC8Ax_REG.h
STC8Cx_REG.h
STC8Fx_REG.h
STC8Gx_REG.h
STC8Hx_REG.h
open-ell-code
libraries
peripherals
STC8x
inc
STC8x_MDU16.h
生成于 2021年 七月 25日 星期日 20:17:37 , 为 8051-ELL库使用
1.9.1