The system consists of a power supply module, an interface dump module, a control module, a keyboard module, and a liquid crystal display module, as shown in Figure 1. The C8051F040 micro control unit is connected with two CH375 U disk modules. By opening a data buffer in the microcontroller, it directly calls the subroutine library and is responsible for transferring the selected file data in one U disk to another U disk. The LCD and the external keyboard realize the man-machine interface. The file to be transferred is selected through the up, down, select, copy and other keys of the keyboard, and the file name, file size and other related information are displayed in the LCD module. The human-computer interaction interface is friendly and easy to operate.
1.2 CH375 U Disk Module
It adopts the CH375 U disk read-write module developed by Zhennan Electronics, which is small in size, only 3.3x2.0 cm2. The power supply of the module is 5 V, and it is equipped with an indicator light, which is lit when it is working. The module uses the USB master-slave controller CH375B, which is driven in parallel, which can realize the reading and writing of U disk. A total of 13 signal lines are required (5 control lines and 8 data lines).
The znFAT provided by this module, a FAT32 file system solution on a single-chip microcomputer, can easily implement various file-level applications on the U disk. The PCB copy board mainly includes some basic operations on files such as file sector location, file opening, information modification, file closing, file deletion, file reading, file writing, disk information query. The module has the characteristics of small size, low price and easy to use. Through this module, it is easy to realize the transfer of related files in the two U disks through the single-chip microcomputer.
The connection between CH375 U disk read-write module and C8051F040 microcontroller is shown in Figure 2. C8051F040 selects the U disk module through CS, and the U disk module communicates with the single-chip microcomputer in interrupt mode through INT. DO~D7 are the parallel communication data lines between the CH375 U disk module and the single-chip microcomputer. The single-chip microcomputer controls the CH375 U disk module through AO, RD, and WR control signals. D+ and D- are the serial interfaces of CH375 U disk module and USB storage device. The CH375 U disk module can easily realize the direct data dump between the MCU and the USB storage device.
1. 3 LCD module
This system uses 122x32 dot matrix MGLS12232 LCD module. The circuit board clone module has two built-in 2.560-bit RAM and two SED1520 controllers. The left and right half screens are controlled by two strobe signals, E1 and E2. The graphic liquid crystal display module has two connection modes: one is direct access mode, the other is indirect control mode. This system adopts the direct control mode, which uses the interface of the liquid crystal display module as a memory or I/O device to be directly connected to the single-chip microcomputer bus. The module is small in size, low in price, and can satisfy the display of general folder names, file names and file information through the liquid crystal module.
1.4 Keyboard module
The keyboard module is a 3x3 matrix keyboard structure. It uses Button keys to define power-on, reset, page up, page down, select, copy, paste and other keys, and realize various operations of file dumping with a minimum of keystrokes.
1.5 C8051F040 MCU control module
The C8051F040 single-chip control module is the core control module of this system. The microcontroller has rich on-chip resources and powerful control functions: it is fully compatible with 8051, the maximum system clock frequency is 24 MHz, and the execution time of 70% of the instructions is 1 or 2 system clock cycles. Abundant interrupt sources. The extended interrupt system provides 20 interrupt sources to CIP-51. An interrupt-driven system requires less MCU intervention and therefore has higher execution efficiency. So many interrupt sources can fully meet the requirements of this system. All peripherals. Universal Serial Bus (USB) function controller, with 8 flexible endpoint pipelines, integrated transceiver and 1K FIFO RAM; the on-chip storage is large, the SFR address space of CIP-51 can contain up to 256 SFR pages, through SFR paging, CIP-51MCU can control a large number of SFRs needed to control and configure on-chip peripherals. The serial port is rich in resources, with two enhanced full-duplex UARTs, an enhanced SPI bus and SMBus/I2C. Each serial bus is completely implemented in hardware and can generate interrupts to CIP-51, so it requires very little CPU intervention. These serial buses do not "share" resources such as timers, interrupts, or port I/O, and can use any one or multiple at the same time.
The function of this module is to cache the file data to be transferred between two U disks by opening up a data buffer in the single chip microcomputer, and controlling the opening, reading, writing and closing of U disk files through two CH375 U disk modules, To realize the transfer of file data. The control unit can also process the interrupt information sent by the peripheral keyboard to realize the control of the single-chip computer such as file selection. By controlling a MGLS12232 liquid crystal display module to display some related file information.
2 System software design
2.1 Peripheral control mode
This system adopts CH375 U disk module, which comes with znFAT, the FAT32 file system solution on the single-chip computer. Therefore, the complicated Fat32 file system programming is reduced. Because the CH375 U disk module is equipped with a file system and file operation subroutines, it is easier to realize the LCD display of the file name and file information, as well as the file selection and transfer through the main program of the single-chip microcomputer. operate.
Because the C8051F040 microcontroller has rich interrupt resources, and interrupts have the following advantages:
1) Time-sharing operation.The CPU can serve multiple I/O devices in time-sharing, which improves the utilization rate of the computer.
2) Real-time response. The CPU can process the random events of the application system in time, and the real-time performance of the system is greatly enhanced.
3) High reliability. The CPU has the ability to deal with emergencies such as equipment failures and power failures, thereby improving the reliability of the system