网学网为广大网友收集整理了,单片机读写U盘,希望对大家有所帮助!
论文编号:ZD835 论文字数:17050,页数:38 附任务书,开题报告,文献综述,外文翻译
摘 要
USB ( universal serial bus)是近年发展起来的一种快速、灵活的总线接口。它最大的特点是易于使用、可热插拔、接口连接灵活,并且能够提供外设电源,在嵌入式系统及智能仪表中得到广泛的应用。而51系列单片机以其优越的性能、成熟的技术、高性价比被广泛应用于测控仪器等自动化领域。因此用51系列单片机实现USB主机接口,进而实现对USB外设的控制,对提高整个系统的数据存储、数据传输、设备控制等性能都有很大的作用。介绍了一种USB总线的通用接口芯片CH375,并在此基础上提出了一种外部单片机读写U盘的基本方法及其硬件连接方法。单片机只要在原硬件系统中增加1个CH375芯片就可以直接调用CH375提供的子程序库来直接读取U盘中的数据,从而实现了普通单片机与U盘的通讯、方法简单、便于操作、综合成本比较低,具有较大的推广应用价值。
关键词:U盘;CH375;接口芯片;单片机
Abstract
USB (universal serial bus) is one kind which the recent years developed fast, the nimble bus interface. It most major characteristic is easy to use, may to insert hotly pulls out, the connection to be flexible, and can provide the peripheral device power source, obtains the widespread application in the embedded system and the intelligent measuring appliance. But 51 series monolithic integrated circuits by its superior performance, the mature technology, the high performance-to-price ratio are widely applied in observe and control automated domains and so on instrument. Therefore uses 51 series monolithic integrated circuits to realize the USB host interface, then realizes to the USB peripheral device control, to enhances performance and so on overall system''s data storage, data transmission, device control to have the very major function。a general purpose interface chip CH375 for USB is introduced in this paper.Based On which a new method of Using external single chip microcomputer to connect with the flash disk is given.Only add one CH375 chip to the single chip microcomputer s hardware system,the operator can use the program given by the CH375 to read the data from the flash disk and realize the communication between the single chip microcomputer and the flash disk.This method is very simple and can be operated easily.
Keywords:USB;CH375;interface chip;single chip microcomputer
目 录
摘要……………………………………………………………………………. . .……………..I
1 前言…………………………………………………………………………………………..1
2 总体设计方案……………………………………………………………………………. . 2
2.1 电路原理图……….……………………………………………………………………2
2.2 硬件结构………………………………………………………………………….... …2
2.3 软件结构…………………………………………………………………. . .………….3
2.4 软件设计流程图………………………………………………………………………..4
3 51单片机的结构及组成………………………………………………………………….5
3.1 51单片机的内部结构………………………………………………………………….5
3.2 51单片机结构特点.……………………………………………………………………5
3.3 MCS-51的CPU的组成……………………………………………………………….6
4 USB总线接口芯片CH375……………………………………………………………...8
4.1 概述………………………………………………………………………………………8
4.2特点…………………………………………………………....................8
4.3封装………………………………………………………………………………………9
4.4引脚………………………………………………………………………………………9
4.5功能说明…………………………………………………………….............10
4.6 参数…………………………………………………………………………………….14
5 应用……………………….……………………………………………………. . .……16
5.1 并口方式…………………………………………………………………………….16
5.2 串口方式…………………………………………………………………………….17
5.3 单片机读写U盘文件………………………………………………………………..18
5.4 U盘读写的并口说明……………………………………………………………….19
5.5 U盘读写的串口说明………………………………………………………………..26
6 软件设计….……………………………………………………………………………...31
6.1 USB协议…………………………………………………………………………….31
6.2 BULK_ONLY和UFI协议…………………………………………………………31
6.3 FAT32………………………………………………………………………………..34
6.4 软件系统模块………………………………………………………………………34
7 总结……………………………………………………………………………………….36
致谢…………………………………………………………………………………………...37