MS51BA9AE_MS51DA9AE
Mar. 03, 2021 Page 1 of 322 Rev 1.06
M
S51
系列技术参考手册
1T 8051
8位微控制器
NuMicro
®
家族
MS51系列
MS51DA9AE
MS51BA9AE
技术参考手册
The information described in this document is the exclusive intellectual property of
Nuvoton Technology Corporation and shall not be reproduced without permission from Nuvoton.
Nuvoton is providing this document only for reference purposes of NuMicro microcontroller based
system design. Nuvoton assumes no responsibility for errors or omissions.
All data and specifications are subject to change without notice.
For additional information or questions, please contact: Nuvoton Technology Corporation.
www.nuvoton.com
MS51BA9AE_MS51DA9AE
Mar. 03, 2021 Page 2 of 322 Rev 1.06
M
S51
系列技术参考手册
目录
1 概述 .................................................................................................................. 8
2 特性 .................................................................................................................. 9
3 料号信息 ......................................................................................................... 12
3.1 封装类型 ........................................................................................................................ 12
3.2 MS51系列选型指南 ..................................................................................................... 12
3.3 MS51系列命名规则 ..................................................................................................... 13
4 引脚配置 ......................................................................................................... 14
4.1 MS51BA9AE / MS51DA9AE 引脚配置..................................................................... 14
4.1.1 TSSOP 14脚封装引脚信息 ............................................................................................ 14
4.1.2 MSOP 10脚封装引脚信息.............................................................................................. 14
4.2 MS51BA9AE / MS51DA9AE 系列引脚描述............................................................. 15
5 功能框图 ......................................................................................................... 17
5.1 MS51BA9AE / MS51DA9AE 系列框图..................................................................... 17
6 功能描述 ......................................................................................................... 18
6.1 内存架构 ........................................................................................................................ 18
6.1.1 程序内存(APROM / LDROM) ........................................................................................ 18
6.1.2 非易失性数据存储 (Data Flash) .................................................................................... 19
6.1.3 安全保护存储器(SPROM) ............................................................................................. 19
6.1.4 配置字 (CONFIG) ........................................................................................................... 20
6.1.5 数据内存(RAM) ............................................................................................................... 25
6.1.6 特殊功能寄存器(SFR) .................................................................................................... 27
6.2 系统管理 ...................................................................................................................... 143
6.2.1 时钟系统 ......................................................................................................................... 143
6.2.2 电源管理 ......................................................................................................................... 147
6.2.3 电源监控及复位 ............................................................................................................. 149
6.2.4 中断系统 ......................................................................................................................... 159
6.3 內存储控制 .................................................................................................................. 169
6.3.1 在应用编程 (IAP) .......................................................................................................... 169
6.3.2 在线电路编程 (ICP) ...................................................................................................... 180
6.3.3 片上调试 (OCD) ............................................................................................................ 180
6.3.4 96位序列号(UID) ........................................................................................................... 181
6.4 I/O 口控制寄存器 ....................................................................................................... 182
6.4.1 GPIO端口结构和工作模式 ........................................................................................... 182
6.4.2 GPIO控制寄存器 ........................................................................................................... 184
6.4.3 读-修改-写 指令 ............................................................................................................. 187
MS51BA9AE_MS51DA9AE
Mar. 03, 2021 Page 3 of 322 Rev 1.06
M
S51
系列技术参考手册
6.4.4 管脚中断 ......................................................................................................................... 188
6.5 定时器 .......................................................................................................................... 191
6.5.1 定时器//计数器 0 和 1 ................................................................................................... 191
6.5.2 定时器 2 和输入捕获 .................................................................................................... 200
6.5.3 定时器 3 ......................................................................................................................... 218
6.6 看门狗定时器 (WDT) ................................................................................................. 222
6.6.1 看门狗定时器结构描述 ................................................................................................. 222
6.6.2 超时复位定时器 ............................................................................................................. 223
6.6.3 通用定时器 ..................................................................................................................... 223
6.6.4 看门狗控制寄存器 ......................................................................................................... 223
6.7 自唤醒定时器 (WKT) ................................................................................................. 226
6.7.1 WKT 结构描述 ............................................................................................................... 226
6.7.2 WKT 控制寄存器 ........................................................................................................... 226
6.8 脉冲宽度调制 (PWM) ................................................................................................ 228
6.8.1 脉冲宽度调制发生器 ..................................................................................................... 228
6.8.2 PWM类型 ....................................................................................................................... 231
6.8.3 工作模式 ......................................................................................................................... 232
6.8.4 屏蔽输出控制 ................................................................................................................. 233
6.8.5 故障刹车 ......................................................................................................................... 233
6.8.6 极性控制 ......................................................................................................................... 233
6.8.7 PWM 中断 ...................................................................................................................... 234
6.8.8 PWM 控制寄存器 .......................................................................................................... 235
6.9 串口 (UART0 & UART1) ........................................................................................... 248
6.9.1 工作模式 ......................................................................................................................... 248
6.9.2 波特率............................................................................................................................. 250
6.9.3 帧错误检测 ..................................................................................................................... 254
6.9.4 多机通讯 ......................................................................................................................... 254
6.9.5 自动地址识别 ................................................................................................................. 254
6.9.6 串口控制寄存器 ............................................................................................................. 256
6.10 I
2
C 总线(I
2
C) ......................................................................................................... 267
6.10.1 功能描述 ......................................................................................................................... 267
6.10.2 开始和停止条件 ............................................................................................................. 267
6.10.3 7位地址数据格式 .......................................................................................................... 268
6.10.4 应答Ack .......................................................................................................................... 269
6.10.5 仲裁 ................................................................................................................................ 270
6.10.6 操作模式 ......................................................................................................................... 270
6.10.7 I
2
C超时溢出 ................................................................................................................... 275
6.10.8 I
2
C中断 ........................................................................................................................... 275
6.10.9 各状态码表述 ................................................................................................................. 275
MS51BA9AE_MS51DA9AE
Mar. 03, 2021 Page 4 of 322 Rev 1.06
M
S51
系列技术参考手册
6.10.10 I
2
C控制寄存器 .......................................................................................................... 277
6.10.1 I
2
C 中断服务程序典型结构范例 .................................................................................. 282
6.11 串行外围总线(SPI) ............................................................................................... 286
6.11.1 结构功能图 ..................................................................................................................... 286
6.11.2 功能描述 ......................................................................................................................... 286
6.11.3 操作模式 ......................................................................................................................... 288
6.11.4 时钟格式和数据传输 ..................................................................................................... 288
6.11.5 从机选择引脚SS配置 ................................................................................................... 290
6.11.6 模式故障侦测 ................................................................................................................. 290
6.11.7 写冲突错误 ..................................................................................................................... 290
6.11.8 溢出错误 ......................................................................................................................... 291
6.11.9 SPI中断 .......................................................................................................................... 291
6.11.10 SPI 控制寄存器........................................................................................................ 292
6.12 12位模数转换器(ADC) ........................................................................................ 296
6.12.1 功能描述 ......................................................................................................................... 296
6.12.2 ADC 工作方式 ............................................................................................................... 297
6.12.3 外部触发ADC ................................................................................................................ 297
6.12.4 ADC 转换结果比较器 ................................................................................................... 298
6.12.5 带隙电压(Band-gap) 输入应用 .............................................................................. 298
6.12.6 ADC控制寄存器 ............................................................................................................ 299
6.13 辅助功能 ................................................................................................................ 309
6.13.1 双 DPTR ......................................................................................................................... 309
7 应用电路 ....................................................................................................... 311
7.1 供电电路 ...................................................................................................................... 311
7.2 外设应用电路 .............................................................................................................. 312
8 电气特性 ....................................................................................................... 313
9 封装信息 ....................................................................................................... 314
9.1 TSSOP 14 (4.4 x 5.5 x 1.2 mm) ............................................................................. 314
9.2 MSOP 10 (3.0 x 3.0 x 1.1 mm) ................................................................................ 315
10 缩写词 ........................................................................................................... 316
10.1 缩写词列表 ............................................................................................................ 316
11 指令集 ........................................................................................................... 317
11.1 指令集概述 ............................................................................................................ 317
11.2 指令集表 ................................................................................................................ 318
12 历史版本信息 ................................................................................................ 321
MS51BA9AE_MS51DA9AE
Mar. 03, 2021 Page 5 of 322 Rev 1.06
M
S51
系列技术参考手册
图集
图 4.1-1 TSSOP-14 封装引脚信息 ................................................................................................ 14
图 4.1-2 MSOP-10 封装引脚信息 .................................................................................................. 14
图 5.1-1 结构框图 .......................................................................................................................... 17
图 6.1-3 CONFIG0 复位后自动重载 .............................................................................................. 21
图 6.1-4 CONFIG2 上电复位重载位 .............................................................................................. 23
图 6.1-5 数据内存分配图 ............................................................................................................... 25
图 6.1-6内部 256 字节 RAM 地址 .................................................................................................. 26
图 6.2-1 时钟系统框图 ................................................................................................................. 143
图 6.2-2 欠压检测框图 ................................................................................................................. 150
图 6.6-1 WDT作为超时复位定时器 .............................................................................................. 223
图 6.6-2看门狗定时器框图 ........................................................................................................... 223
图 6.7-1自唤醒定时器框图 ........................................................................................................... 226
图 6.8-1 PWM 结构框图 .............................................................................................................. 229
图 6.8-2 PWM和故障刹车输出控制方框图 .................................................................................. 230
图 6.8-3 PWM 边沿对齐类型波形 ................................................................................................ 231
图 6.8-4 PWM中心对齐类型波形 ................................................................................................. 232
图 6.8-5 带死区时间插入的PWM互补模式 .................................................................................. 233
图 6.8-6 故障刹车功能方框图 ...................................................................................................... 233
图 6.8-7 PWM中断类型 ............................................................................................................... 234
图 6.9-1 串口模式 0 时序图 ......................................................................................................... 248
图 6.9-2 串口模式1的时序图 ........................................................................................................ 249
图 6.9-3 串口模式2模式3的传输时序 ........................................................................................... 250
图 6.10-1 I
2
C总线连接 ................................................................................................................. 267
图 6.10-2 I
2
C总线协议 ................................................................................................................. 267
图 6.10-3 起始条件, 重复起始条件和停止条件 ............................................................................ 268
图 6.10-4 主机发送数据给一个7位地址从机 ................................................................................ 268
图 6.10-5 主机读取数据从一个7位地址从机 ................................................................................ 268
图 6.10-6一个传输中的I2C数据格式 ............................................................................................ 269
图 6.10-7应答位 ........................................................................................................................... 269
图 6.10-8两台主机仲裁过程 ......................................................................................................... 270
图 6.10-9根据当前I
2
C 状态来控制I
2
C总线 ................................................................................... 271
图 6.10-10主机发送模式流程和寄存器状态 ................................................................................. 271