亚洲免费av电影一区二区三区,日韩爱爱视频,51精品视频一区二区三区,91视频爱爱,日韩欧美在线播放视频,中文字幕少妇AV,亚洲电影中文字幕,久久久久亚洲av成人网址,久久综合视频网站,国产在线不卡免费播放

        ?

        U disk recorder based on CH376 and ATmega 128

        2013-12-20 07:22:17RANZibo冉自博MAYouchun馬游春LIUHongyu劉紅雨
        關(guān)鍵詞:游春

        RAN Zi-bo (冉自博), MA You-chun (馬游春), LIU Hong-yu (劉紅雨)

        (Department of Electronic Science and Technology, North University of China, Taiyuan 030051 , China)

        U disk recorder based on CH376 and ATmega 128

        RAN Zi-bo (冉自博), MA You-chun (馬游春), LIU Hong-yu (劉紅雨)

        (Department of Electronic Science and Technology, North University of China, Taiyuan 030051 , China)

        By using enhanced reduced instruction set computing(RISC) architecture and carrying out powerful instructions in a single clock cycle, the ATmega128 achieves the data transmission speed of about one MIPS per MHz. With this advantage, the designer can eliminate the contradiction between power consumption and processing speed in data acquisition system based on U disk. In this paper, a U disk recorder for mass data storage is designed. It consists of a microcontroller ATmega128 and a U disk management chip CH376. ATmega128 with 4 KB SRAM provides enough buffer memory and CH376 enables U disk files to be written or read in sector size. Based on analysis of the system, the hardware and software designs are given. With the designed data acquisition system, data transmission speed can reach 460 KB per second. The experimental results show that the designed system has higher efficiency and reliability than the traditional ones when writing or reading U disk files.

        ATmega128; U disk; CH376

        CLD number: TP274 Document code: A

        0 Introduction

        To evaluate system performance, many parameters need to be collected for a long period of time, so the amount of data is very large. In addition, there may be a mass of interrelated data need only post analysis and processing but feedback to the control system and reak-time analysis by computer[1], such as real-time data, engineering vehicle test parameters and aeronautical navigation data, etc. in some process control systems on the occasion that bulk data need to be acquired are from the moving object or the workplace of data acquisition system is not fixed.

        U disk has been widely used with the development of the universal serial bus(USB) device driver, and it can be a good solution to the problem of an amount of data acquisition. In the data acquisition process, U disk controlled by microcontrotter unit (MCU) can be used as the portable mobile device for bulk data storage in data acquisition system, which needs to exchange data with computer. Thus it effectively reduces the wasted time and resources when reading the mass-storage data of the traditional data acquisition system and achieves data storage in real time[2]. In this paper, a U disk recorder for mass data storage is designed.

        1 Analysis of the system

        1.1 Feasibility analysis and system structure

        USB interface is a new serial communication standard specified by some large computer manufacturers in order to eliminate the contradiction between the growing PC peripherals with limited motherboard slots. USB bus has some advantages such as plug-and-play, high-speed, etc[3].

        U disk as one of the typical USB devices has occupied an important position in our daily life. Its advantages of portability, mass storage and real-time have laid the foundation for high-speed data acquisition system.

        The ATmega128 is a 8-bit low-power CMOS microcontroller based on AVR RISC architecture[4], which can execute powerful instructions in a single clock cycle and achieve data throughput approaching 1 MIPS per MHz.

        The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly connected to the arithmetic logic unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. Thus not only code efficiency increases but also data throughput can reach ten times faster than that of the conventional complex instrument set computer (CISC). Furthermore, the contradiction between power consumption and processing speed can be eliminated to prepare for storing real-time high speed data[5]. ATmega128 MCU also has a wealth of on-chip resources: 128 KB in-system programmable Flash with read-while-write capabilities, 4 KB EEPROM, 4 KB SRAM, 53 general-purpose I/O lines, ISP download interface and JTAG emulation.

        The ATmega128 AVR is supported by a full suite of program and system development tools, including: C compilers, macro assemblers, program debugger or simulators, in-circuit emulators and evaluation kits, which offer a better development condition for designers.

        With the development of USB technology gradually, more and more USB interface chips have been applied in engineering. CH376 is a U disk file management chip provided by Nanjing Qinheng company. It is used for SCM system to read and write files in U disk or SD card. It supports USB device mode and USB host mode, and it includes built-in USB communication protocol firmware, communication protocol firmware customized for mass-storage, FAT16, FAT32 and FAT12 file system management firmware[6].

        CH376 supports three communication interfaces: 8-bit parallel communication, SPI communication and UART communication. USB host mode and 8-bit parallel communication of CH376 are applied in this design to manage files in U disk.

        The whole system consists of a controller unit ATmegs128, a U disk management chip CH376, two 422 bus interfaces and some necessary peripheral circuits. The serial data with speed approaching 460 KB per second from device terminals is transferred to the system via 422 bus interface, and sequentially MCU receives and processes the data to control CH376 to write or read the received data into U disk. Finally, data storage is completed. The block diagram of the whole design is shown in Fig.1. RS232 is a serial interface used to connect MCU system with computer. Serial debugging assistant, a software is used to track the running of program timely to debug the program.

        Fig.1 Block diagram of system structure

        1.2 High-speed serial data storage

        The serial data transmission speed of traditional MCU system that manages U disk files is limited because of little buffer with small memory. This will lead to loss of data, so the reliability of data storage can not be guaranteed.

        In order to achieve high-speed data acquisition and ensure the reliability of data storage, rich memory resources of the ATmega128 MCU are fully taken advantage of as system cache. On one hand, it is necessary to test the availability of U disk when writing or reading U disk data, so the data can not be inputted continuously, which needs a large memory buffer to avoid a bad phenomenon of the loss of data during the waiting period whether U disk has been ready. On the other hand, due to non- uniform and non-continuity of serial data from device terminals, it will take a longer time to produce a half flag if memory buffer is too large. Thus the efficiency of data storage reduces. For mass data storage, it may also produce loss and overflow of data because of longer waiting time even though there is a large memory buffer.

        It is necessary to design a special circuit, consisting of a micro controller FPGA and a Flash memory, to act as a cache in the whole system. The Flash with a large capacity of 4 GB can guarantee the high-speed serial data not to be lost and enhance the reliability of data storage. The functions of the part include two aspects: one of them is to separate the two 422 bus serial data and pack them as packages by frame with a special flag of frame; another function is to connect MCU to transfer the high-speed serial data from Flash to MCU. The data will be stored into U disk perfectly owing to the large Flash memory.

        1.3 U disk file management

        CH376 is a chip to manage U disk files, and it can write data into U disk or read data from it.CH376 supports FAT32, FAT16 and FAT12 in accordance with Windows file system format. It is convenient to exchange data between MCU of electronic products with that of personal computer with Windows operation system. Nanjing Qinheng Company offers C language library with many functions about write/read U disk, which simplifies the process of programming. For example, the function CH376FileCreatePath() is used to create multi-level directory file and open it, and the function CH376SecWrite() is used to write data into U disk in sector-write way. CH376 has the biggest capacity of U disk which is 32 GB, and the biggest capacity of single file which is 1 GB.

        Fig.2 Flow chart of U disk file management

        A U disk can store a number of files, and each file is a collection of data, which is identified by file name. Actually, the storage of the file is not be continuous, whereas it uses “pointer” to link multiple data blocks (that is, the allocation unit or cluster). Therefore, file length can increase in order to store more data. In order to guarantee the integrity and continuity of data storage, and taking into account the non-continuity of actual process, it is necessary to manage U disk files in writing-after-reading mode, that is, a log file is created to record index of the current file, at the same time, the follow-up file is named and data is written into it. The flow diagram of U disk file management is shown in Fig.2.

        Capacity of U disk depends on the number of files. The system will give a warning by a LED if the length of file exceeds the capacity of U disk.

        2 Design of hardware and software

        ATmega128 has working voltage in the range of -4.5 V to 5.5 V. And CH376 supports power supply of 3.3 V and 5 V[7]. An appropriate voltage can be obtained by designing related peripheral circuits for V3 pin of CH376. A power module is used to supply 3.3 V for the system in this design. The design adopts the 8-bit parallel interface for communication. The signal lines of parallel interface include 8 dual-port lines D7-D0, input pin RD# for enabling read, input pin WR# for enabling write, input pin PCS# for chip selection and address input pin A0. The pin PCS# of CH376 is driven by address decoder circuits. It is used to select a needed device when there are a lot of peripheral devices. A 12 MHz oscillator is selected to enhance frequency accuracy of the system. CH376 can be connected to MCU system bus conveniently like other periphesal circuits via the parallel interface.

        CH376 needs two address bits. The command port is selected by setting pin A0 high to write a new command or read the state of interface; the data port is selected by setting pin A0 low to write or read data.

        The output pin ACT# of CH376 is used to indicate status of the system. In the case of working in host mode, the pin ACT# is set at 1 when after USB devices are not set or settings are cancelled; And the pin ACT# is set at 0 when USB devices are connected. The pin ACT# of CH376 connects a LED which is combined with a resistor to indicate whether U disk has been connected or not. ATmega128 supports real-time simulation, and a JTAG interface is designed to track the program conveniently in debugging process. Schematic diagram of peripheral circuit is shown in Fig.3.

        Fig.3 Schematic diatram of CH376 peripheral circuit

        3 Experimental results

        To debug the system, a high-speed digital signal source is generated by imitating to send serial data to the system at the speed of about 460 KB per second. The system receives data via 422 bus interface, and then transfers it to inner memory for processing. At last, the data is stored into U disk under the controlling of MCU.

        Fig.4 Experimental result at the first time

        At the first time, data is written into U disk and a file named “file .log” is created with content as follows: “The file's index is x”, where x stands for the number of current files. Once the length of the first file is over 512 MB, the file is closed. Subsequently, the value of x is increased up to x+1, and then the new value is written into “file.log” to avoid the phenomenon that the existed gile is covered by new files when new data is written into U disk again. At the same time, the system will create a new file to store new data. At the second time, the system will check U disk firstly, if there are not the file named “file.log” yet, it will repeat the operation like the fist time; if the file exists, the system will read the content of the file, and then change the value of x from current value x to x+1 as well as write the refreshed content into “file.log”. At the same time, a new file is created to record the new data. For example, we can find the files that has been written into U disk by the system, as shown in Fig.4. The content of “file.log” is shown as follows:“The file's index is 3”, which means the name of current file is “file_3.NAV”. We also can see that the lengths of the other files such as “file_0.NAV”,“file_1.NAV” and “file_2.NAV” are all 512 MB. Repeating the operation again, the system will show “The file's index is 3”. After updating “file.log” with “The file's index is 4”, the file named “file_4.NAV” is created to store the received data. The file named “file_5.NAV” is created after “file_4.NAV” is closed when the received data is over 512 MB. Finally, the file “file.log” is renewed with the content as “The file's index is 5”. The result is shown in Fig.5.

        Fig.5 Experimental result at the second time

        4 Conclusion

        The recorder based on U disk microcontroller system is constituted by AVR core microcontroller ATmega128 and U disk file management chip CH376. It can realize real-time high-speed serial data storage without a computer to operate U disk. It not only provides a new design method for the data acquisition system, but also simplifies system structure as well as improves the efficiency of data storage. Therefore, it plays an important role and has practical value in the design of mass data storage system.

        [1] JIANG Yi-jun. Design of multi-line data acquisition process recorder based on U disk. Master thesis. Nanjing: Nanjing University of Science ang Technology, 2008.

        [2] Thukaram D, Lomi A. Selection of static VAR compensator location and size for system voltage stability improvement. Electric Power Systems Research, 2000, 54(2): 139-150.

        [3] SONG Nan. The test-equipment with U disk storage function for mechanical parameters acquisition system. Taiyuan: North University of China, 2012.

        [4] Atmel Corporation. AVR core MCU ATmega128 Data-sheet. 2008.

        [5] Lee E. AVR basic direction for C programming. Beijing: Tsinghua University press, 2003.

        [6] Nanjing Qinheng Company. U disk and AD card file management chip CH376 reference. 2010.

        [7] Barnett R H, Cox S, O'Cull L. Embedded C programming and the Atmel AVR. [2013-01-11]. http:∥www.filecrop.com/Embedded-C-Programming-and-the-ATM-EL-AVR-2nd-Edition.html.

        date: 2013-06-27

        RAN Zi-bo (13753485975@139.com)

        1674-8042(2013)04-0330-05

        10.3969/j.issn.1674-8042.2013.04.006

        猜你喜歡
        游春
        Graphene-based heterojunction for enhanced photodetectors
        少年游·游春
        風(fēng)鳶圖詩(shī)
        愛(ài)他莽蒼蒼青天碧海,熙攘攘赤縣神州——顧隨《游春記》雜劇主題意蘊(yùn)新探
        戲曲研究(2020年2期)2020-11-16 01:21:24
        風(fēng)鶯圖詩(shī)
        詩(shī)二首
        老乞丐
        詩(shī)潮(2018年10期)2018-10-17 06:50:36
        孔子游春與課堂動(dòng)態(tài)生成
        無(wú)心戀良夜
        花火B(yǎng)(2016年8期)2016-05-14 03:09:56
        游春
        讀者欣賞(2014年5期)2014-07-03 03:35:36
        四虎欧美国产精品| 国产精品无码素人福利不卡| 又大又粗又爽18禁免费看| 亚洲熟妇少妇任你躁在线观看| 亚洲无码观看a| 东京热加勒比视频一区| 成人免费看aa片| 国产精品亚洲综合色区韩国| 久9热免费精品视频在线观看| 国产成人精品一区二三区在线观看| 成人区人妻精品一区二区三区| 国产美女自慰在线观看| 久久国产品野战| 日韩人妻大奶子生活片| 日韩在线永久免费播放| 久久人人玩人妻潮喷内射人人 | 国产成人无码a在线观看不卡| 熟女人妻在线视频| 天天干夜夜躁| 亚洲第一大av在线综合| 99在线精品免费视频| 最近中文字幕在线mv视频在线 | 少妇精品亚洲一区二区成人| 乌克兰少妇xxxx做受野外| 亚洲国产另类久久久精品小说 | 中国一 片免费观看| 一区二区三区国产高潮| 亚洲国产综合精品中久| 人妻 色综合网站| 国产成人精品自在线无码| 亚洲av午夜福利一区二区国产| 免费a级毛片18禁网站免费| 国产精品麻豆成人av电影艾秋| 亚洲成a人片在线观看中文!!!| 国产日产亚洲系列首页| 少妇高潮无套内谢麻豆传| 四虎影永久在线观看精品| 色婷婷精品国产一区二区三区| 免费的日本一区二区三区视频| 免费a级毛片无码无遮挡| 日本岛国精品中文字幕|