0
100% Satisfaction Guarantee
Amazing Value
Fast Shipping
Expert Customer Service
51单片机轻松入门——基于STC15W4K系列(C语言版)(第2版)
$45.52
本书可作为普通高校计算机类、电子类、自动控制类、仪器仪表类、机电一体化类等相关专业的教学用书,对已有一定设计经验的单片机工程师也有重要的参考价值。
本书以STC15W4K系列单片机为核心,详细介绍了单片机内部功能模块,如定时器、中断、串口、SPI接口、片内比较器、A/D转换器、可编程计数器阵列等。每个重要知识点都有简短精炼的实例作验证。然后是对单片机常用外围接口的介绍与STC15W4K系列单片机的实际产品运用实例分析。另外,对单片机开发必须掌握的C语言基础知识与Keil开发环境也作了较为详细的介绍。对于没有学习过C语言的读者,通过本书也能轻松进入以C语言开发单片机的学习状态。本书是再版书,相比旧版,本书对部分知识进行了更新。
第1章单片机高效入门1
1.1单片机简介1
1.1.1认识单片机1
1.1.2单片机的用途2
1.1.3典型芯片与C语言介绍2
1.1.4本书的配套实验板及相关学习工具介绍4
1.2点亮一个发光二极管13
1.2.1单片机型号命名规则13
1.2.2单片机引脚功能说明14
1.2.3制作一个简单的单片机实验电路20
1.2.4使用KeilμVision3环境编写简单的程序21
1.2.5ISP下载程序到单片机26
1.2.6程序解释27
1.3Keil仿真29
1.3.1软件仿真29
1.3.2硬件仿真36
1.4经典流水灯实例38
1.5单片机C语言延时程序详解40
1.5.1学会使用计算软件40
1.5.2计算软件内部运算过程详解42
1.5.3利用库函数实现短暂精确延时47
1.5.4使用定时器/计数器实现精确延时48
1.6main()、void main()和int main()的区别48
1.7printf格式化输出函数49
第2章单片机开发必须掌握的C语言基础53
2.1简单数据类型与运算符53
2.1.1原码、反码、补码、BCD码和格雷码54
2.1.2常量58
2.1.3变量的数据类型(bit、char、int、long、float)58
2.1.4变量的存储空间(code、data、bdata、idata、xdata)67
2.1.5变量的存储类型(auto、static、extern)68
2.1.6变量的作用域71
2.1.7运算符72
2.1.8运算符的优先级与结合性78
2.2C51构造数据类型80
2.2.1数组80
2.2.2结构体82
2.2.3共用体85
2.2.4指针86
2.2.5#define与typedef的区别90
2.3流程与控制92
2.3.1分支结构92
2.3.2循环结构94
2.3.3跳转结构95
2.4函数97
2.4.1函数定义97
2.4.2调用格式98
2.4.3传值调用与传地址调用的对比98
2.4.4数组作为函数参数99
2.4.5使用指针变量作为函数形式参数100
2.4.6使用结构体变量指针作为函数参数100
2.4.7函数作用域 101
2.4.8库函数101
2.5模块化编程102
2.5.1头文件的编写102
2.5.2条件编译102
2.5.3多文件程序(模块化编程)103
2.6关键字volatile与代码调试小技巧105
目录51单片机轻松入门——基于STC15W4K系列(C语言版)(第2版)第3章定时器/计数器、中断系统106
3.1定时器/计数器106
3.1.1单片机定时器/计数器工作原理概述106
3.1.2定时器/计数器的相关寄存器107
3.1.3定时器/计数器的工作方式110
3.1.4初值计算113
3.1.5编程举例114
3.2可编程时钟输出117
3.3中断系统122
3.3.1中断系统结构图122
3.3.2操作电路图中的开关(相关寄存器介绍)122
3.3.3编写中断函数126
3.3.4中断程序举例127
3.3.5外部中断代码调试(按键的防抖技术)131
第4章串口通信133
4.1基本的串口通信133
4.1.1串口数据发送格式134
4.1.2串口相关的寄存器135
4.1.3波特率的计算步骤140
4.1.4单片机与计算机通信的简单例子142
4.2彻底理解串口通信协议146
4.3串口隔离电路151
4.4计算机扩展串口(USB转串口芯片CH340G)153
4.5RS485串行通信157
4.6SSI通信160
4.6.1SSI数据通信格式160
4.6.2SSI硬件电路161
4.6.3SSI软件实现162
4.7数据通信中的错误校验165
4.7.1校验和(CheckSum)与重要的串口通信实例165
4.7.2CRC校验168
4.8单片机向计算机发送多种格式的数据172
第5章SPI通信177
5.1SPI总线数据传输格式177
5.1.1接口定义177
5.1.2传输格式178
5.2SPI接口相关的寄存器179
5.2.1SPI相关的特殊功能寄存器179
5.2.2SPI接口引脚切换183
5.3SPI接口运用举例183
第6章I2C通信193
6.1I2C总线数据传输格式193
6.1.1各位传输要求193
6.1.2多字节传输格式196
6.2程序模块功能测试200
6.2.1硬件仿真观察24C02读/写结果(R/C时钟:22.118 4 MHz)200
6.2.2硬件仿真观察24C32/64读/写结果(R/C时钟:22.118 4 MHz)207
6.2.3硬件仿真观察24C512读/写结果(R/C时钟:22.118 4 MHz)210
6.324C02运用实例(断电瞬间存储整数或浮点数)210
第7章单片机内部比较器与DataFlash存储器217
7.1STC15W系列单片机内部比较器217
7.1.1比较器结构图217
7.1.2寄存器说明217
7.1.3电路讲解与程序实例219
7.2DataFlash存储器220
7.2.1与DataFlash操作有关的寄存器介绍221
7.2.2DataFlash操作实例(断电瞬间存储数据)223
第8章可编程计数阵列CCP/PCA/PWM模块(可用作DAC)229
8.1PCA模块总体结构图 229
8.2PCA模块的特殊功能寄存器230
8.3PCA模块的工作模式与应用举例233
第9章模/数转换器ADC244
9.1ADC的主要技术指标244
9.2使用单片机内部的10位ADC246
9.2.1与ADC相关的特殊功能寄存器246
9.2.2实例代码248
9.312位ADC转换芯片MCP3202B250
9.4单通道16位ADC转换芯片ADS1110A0256
9.5单通道18位ADC转换芯片MCP3421A0TE/CH256
第10章数/模转换器DAC261
10.1TLC5615数/模转换电路与基本测试程序261
10.2TLC5615产生锯齿波、正弦波、三角波264
10.3TLC5615的高级运用(播放歌曲)268
第11章单片机实用小知识272
11.1复位272
11.1.1外部RST引脚复位272
11.1.2软件复位273
11.1.3内部低压检测复位273
11.1.4看门狗定时器复位274
11.2单片机的低功耗设计275
11.2.1相关寄存器说明275
11.2.2应用举例278
11.3单片机扩展32 KB外部数据存储器62C256279
11.3.1电路讲解280
11.3.2软件测试实例281
第12章常用单片机接口程序284
12.1数码管静态显示284
12.2数码管动态显示288
12.3独立键盘292
12.4矩阵键盘300
第13章1602液晶308
13.11602液晶外形与电路图308
13.21602液晶应用举例309
13.31602液晶显示汉字与特殊符号313
13.4使用中文液晶屏315
第14章精密电压表/电流表/通用显示器/计数器的制作317
14.1功能说明与电路原理分析317
14.2程序实例320
14.2.1通用显示器功能检测程序(外部程序)320
14.2.2计数器功能检测程序(外部程序)321
14.2.3模块程序321
第15章步进电机测试326
15.1步进电机的特点326
15.2步进电机的3种励磁方式327
15.3步进电机驱动电路328
15.4步进电机驱动实例329
15.5步进电机专用驱动器介绍 331
第16章频率检测334
16.1频率检测的用途与频率定义334
16.2频率检测实例335
第17章DS1302时钟芯片340
17.1DS1302的SPI数据通信格式340
17.2程序实例342
第18章红外通信346
18.1红外通信电路与基本原理346
18.2红外接收软件实例349
第19章单总线DS18B20通信(长距离无线通信)355
19.1DS18B20运用基础355
19.1.1单只DS18B20的温度检测电路355
19.1.2DS18B20的通信时序355
19.1.3DS18B20内部功能部件ROM、RAM和指令集358
19.1.4读取温度步骤360
19.2单只DS18B20的温度检测361
19.3多只DS18B20的温度检测366
19.3.1读取传感器代码366
19.3.2读取传感器温度367
第20章SD卡与znFAT文件系统371
20.1认识SD卡与SD卡驱动程序371
20.1.1认识SD卡371
20.1.2电路讲解373
20.1.3通信时序与完整驱动程序说明373
20.2znFAT文件系统382
20.2.1znFAT的移植方法382
20.2.2znFAT移植实例386
第21章MP3播放器实验388
21.1MP3的介绍与电路讲解388
21.1.1VS1003B引脚说明389
21.1.2VS1003寄存器390
21.2正弦测试392
21.3通过SD卡播放MP3文件395
第22章数字存储示波器技巧与逻辑分析仪的操作399
22.1测量直流电源开关机瞬间输出的毛刺浪涌399
22.2测量稍纵即逝的红外发射信号403
22.3精确测量直流电源纹波405
22.4示波器带宽选用依据407
22.5逻辑分析仪概述408
22.6线束和测试夹409
22.7逻辑分析仪软件的安装409
22.8采集数据和分析仪设置413
22.8.1演示模式413
22.8.2采集数据413
22.8.3逻辑分析仪设置414
22.9导航数据(缩放、平移、重排、隐藏等)415
22.9.1放大和缩小415
22.9.2左右平移415
22.9.3数字边缘跳跃416
22.9.4调整窗口大小417
22.9.5使用标签418
22.9.6重新排列通道419
22.9.7改变通道信号高度420
22.9.8隐藏通道420
22.10测量、时间标记和书签421
22.10.1数字测量421
22.10.2使用注释422
22.10.3使用时间标记422
22.10.4添加多个时间标记423
22.10.5快速显示任意两点间时间(持久显示)424
22.11使用书签426
22.12使用协议分析器427
22.13在波形的指定点启动分析器430
22.14查看协议分析器结果431
22.15导出分析结果432
22.16保存和加载波形433
22.17使用触发433
22.17.1边沿触发433
22.17.2脉冲宽度触发435
22.18键盘快捷键435
附录ASCII码表436
参考文献 438
Shipping Overview:
• Shipping: Standard Domestic Shipping within the United States charges USD 4.99. Standard International Shipping from United Kingdom, Germany and Japan to the United States charges 14.99.
• Order Processing: Please allow 1-2 business days for order processing and preparation before shipment.
• Domestic Shipping: Orders within the U.S. are shipped via USPS or FedEx, depending on the origin of the product. The average transit time is 3-7 business days.
• International Shipping: Currently, we only ship within the USA.
• Tracking Information: Every order is trackable. You will receive a tracking number once your order has been shipped. Products may be shipped from various global fulfillment centers.
Shipping Delays:
Please note that shipping times may vary due to factors beyond our control, such as weather conditions, natural disasters, or peak holiday periods. While we strive to ensure timely delivery, the exact arrival time cannot be guaranteed and is managed by the shipping carrier.
Shipping Options:
Standard Delivery: Most orders are shipped within 3-7 business days. Larger items may utilize LTL shipping for safe handling.
Handling Time: We handle shipments on business days (Monday - Friday), with a preparation time of 1-2 days.
Additional Charges: Some items require additional shipping charges due to their size, weight, or special handling. These charges are specified on the product pages and are not eligible for shipping discounts.
Exclusions: Gift cards, packaging, taxes, and prior purchases do not count toward the minimum purchase requirement for free shipping. This offer is valid only for shipments to U.S. addresses, including Puerto Rico.
Delivery Details:
Estimates: Standard shipping within the US typically takes 3-7 business days. These are estimates and not guarantees.
Shipping Restrictions: We ship to all 50 states, Washington, DC, U.S. territories, and APO/FPO/DPO addresses. Shipping options vary based on the delivery address.
Remote Areas: Shipments to remote areas may incur additional charges or require pickup from a nearby shipping partner’s location.
Shipping Confirmation:
You will receive a shipping confirmation email with a tracking number as soon as your order is dispatched. If you do not receive this email immediately, please be assured that your items will arrive within the estimated delivery window provided at checkout.
Order Modifications:
If you need to cancel or modify your order, please contact our customer support immediately.
Issues with Delivery:
If your order shows as delivered but you have not received it, please contact the shipping carrier directly to resolve the issue. For persistent problems, contact our customer service at cs@everymarket.com.
Customer Support:
Our team is available 24/7 to assist you with any questions or concerns regarding your order. We are committed to ensuring a smooth shopping experience.
Return & Refund Policy Overview
Please review our return and refund policies below to ensure a smooth transaction process.
Return Policy
Duration: You have 30 days from receiving your item to initiate a return.
Condition: Items must be unworn, unwashed, with original tags and packaging intact.
Shipping Costs: Customers are responsible for return shipping costs.
Packaging: Ensure returned items are well-packaged to avoid damage during transit.
Tracking: Use a trackable and insured shipping method as we are not liable for items lost or damaged on return.
Initiating a Return: Contact us at cs@everymarket.com to start your return. We will provide a return shipping label and instructions upon approval. Returns without prior approval will not be accepted.
How to Return
Method: Returns must be sent back by mail to the address provided in the return instructions.
Return Label
Defective Products: Return labels are provided for defective items.
Non-Defective Returns: Customers are responsible for obtaining their return shipping label.
Product Conditions for Return
Eligible Products: Returns are only accepted for items in new condition.
Nonreturnable Items
Certain items are not eligible for return:
Electronic devices after 30 days (e.g., computers, laptops, Kindles)
Gift cards, prepaid game cards
Perishable goods, live insects, some jewelry, some health and personal care items
Customized or personalized products
Items with special shipping restrictions
Refund Policy
Window: Eligible products may be returned within 30 days of delivery for a refund.
Refund Method: Refunds are processed to the original payment method or as store credit for items purchased with gift cards.
Processing Time: Refunds are processed within 3-5 business days after we receive the return; please allow additional time for shipping and bank processing.
Claims
Inspect your order upon arrival and report any defects, damages, or incorrect items immediately to allow us to address the issue. For claims, contact our support team with details of the issue.
Exchange Policy
For the quickest service, return your original item and place a new order for the desired product once your return is accepted.
Return Address
EveryMarket Customer Service 2101 E Terra Ln, O'Fallon, MO 63366
Customer Support
Available 24/7 for any questions or assistance needed:
Phone: +1 636-312-5925
Email: cs@everymarket.com
Oops!
Sorry, it looks like some products are not available in selected quantity.
OK