1. Field of Invention
The present invention relates to a control system and a control method, and more particularly to a storage control system having a storage function of a USB (universal serial bus) flash drive (U disk) and an information-reading function of a card reader, and a storage control method thereof.
2. Description of Related Arts
A U disk is a storage device based on a USB interface and having a storage medium of a flash chip. The invention of U disk is a great breakthrough in the field of portable storage technology, whose small size makes it fit for carrying about and convenient to exchange data at any time and any place, which is an ideal product for mobile office and data storage and exchange.
A card reader is a device for reading and writing information on a card, and is also a standard computer external device. The card reader has a big data storage capacity with a card inserted in, and other features of small size, low price, steady performance and convenience to carry about, and thus it is widely accepted by consumers.
The present U disks and card readers are respectively independent devices. For designers, they need to design different storage control systems to realize corresponding functions for different products, which leads to complicated designings and high costs.
Thus, it is necessary to provide a storage control system having a storage function of a U disk and an information-reading function of a card reader, and a storage control method thereof.
A storage control system, for controlling data transmission between a computer and an external device, comprises a USB interface connected to the computer, an external interface connected to the external device and a control module connected between the USB interface and the external interface. The control module comprises a data transmission submodule transmitting data with the computer, a microcontroller controlling a work flow of the control module, a ROM (read-only memory) connected to the microcontroller, a protocol resolution submodule for resolving data, a protocol timing sequencer connected to the external interface for transforming protocol and a buffer connected between the protocol resolution submodule and the protocol timing sequencer for storing data. A code in the ROM is changed based on different external devices. Based on the code in the ROM, the microcontroller controls the work flow of the control module to realize functions of the different external devices.
A storage control method, for controlling data transmission between a computer and an external device, comprises the following steps:
receiving data transmitted by the computer with a data transmission submodule, and transmitting the data to a protocol resolution submodule;
resolving a protocol of the received data by the protocol resolution submodule and transmitting the data to a buffer;
reading the data in the buffer by a protocol timing sequencer, transforming the data into a standard protocol and transmitting the standard protocol to the external device;
transforming the standard protocol transmitted by the external device into the data and storing the data to the buffer by the protocol timing sequencer; and
reading the data in the buffer, transforming the data to be recognizable to the computer, transmitting the data to the data transmission submodule by the protocol resolution submodule, and further transmitting the data to the computer by the data transmission submodule.
Compared to the prior art, the storage control system and the storage control method of the present invention only need changing the code of the ROM to realize the corresponding functions of different designed products. The present invention also has a simple structure and is easy to be used and in low cost.
Referring to
According to the preferred embodiment of the present invention, the power source is a +5 volt power supply and the USB interface is a USB 2.0 full-speed interface. The reset submodule is for resetting the whole system when powering up. The data transmission submodule is able to transmit data with the computer through the USB interface, i.e., receiving transmitted data from the computer and transmitting data to the computer through the USB interface. The microcontroller controls a work flow of the whole control module according to the code in the ROM. The protocol resolution submodule is for resolving a protocol of the data received by the data transmission submodule and transforming the data in the buffer to be recognizable to the computer. The buffer is for storing the resolved data. The protocol timing sequencer is for reading the data in the buffer, transforming the data into a standard protocol, transmitting the standard protocol to the external interface, transforming the standard protocol in the external device transmitted by the external interface into the data and storing the data to the buffer. According to the preferred embodiment of the present invention, the standard protocol is an SPI (Serial Peripheral Interface) protocol.
The storage control system has the following working principles: when needing to read the data in the computer and store the data to an external device, the USB interface transmits and communicates data with the computer, the data transmission submodule receives the data transmitted by the computer and transmits the data to the protocol resolution submodule, the protocol resolution submodule protocol resolves the received data and transmits to the buffer, the protocol timing sequencer reads the data in the buffer, transform the data into the SPI protocol and transmits to the external device through the external interface; when needing to read the data in the external device and store the data to the computer, the external interface transmits and communicates with the external device, the protocol timing sequencer transforms the SPI protocol transmitted by the external interface into the data and stores the data to the buffer, the protocol resolution submodule reads the data in the buffer, transforms the data to be recognizable to the computer and transmits to the data transmission submodule, the data transmission submodule transmits the data through the USB interface to the computer. In the whole working process, the microcontroller controls and coordinates the work flow of the whole control module according to the code in the ROM.
Referring to
Step one: transmitting and communicating the data between the computer and the USB interface;
Step two: receiving the data transmitted by the computer and transmitting the data to the protocol resolution submodule by the data transmission submodule;
Step three: resolving a protocol of the received data by the protocol resolution submodule and transmitting to the buffer;
Step four: reading the data in the buffer by the protocol timing sequencer and transforming the data into the SPI protocol and transmitting to the external interface;
Step five: transmitting and communicating the data between the external interface and the external device;
Step six: transforming the SPI protocol transmitted by the external interface into the data and storing to the buffer by the protocol resolution submodule;
Step seven: reading the data in the buffer, transforming the data to be recognizable to the computer and transmitting to the data transmission submodule by the protocol resolution submodule, transmitting the data to the computer through the USB interface by the data transmission submodule, and then going to the Step one.
In the storage control method, designers can change the code saved in the ROM based on the different types of external devices, so as to realize the data transmission between the computer and the different external devices.
In the present invention, changing the code in the ROM can realize different functions, for example, when needing a storage function of a U disk, by connecting the external interface to the flash chip, and supposing that the code saved in the ROM is a first code, the microcontroller controls the work flow of the whole control module based on the first code to realize the storage function of the U disk; when needing an information reading function of a card reader, by connecting the external interface to the memory card and changing the saved code in the ROM to a second code, the microcontroller controls the work flow of the whole control module based on the second code, so as to realize the information reading function of the card reader; when needing a storage function of a U disk and an information reading function of a card reader simultaneously, by changing the saved code in the ROM to a third code, the micro controller controls the work flow of the whole control module based on the third code, so as to realize the storage function of the U disk and the information reading function of the card reader. Obviously, for different designed products, only changing the code of the ROM is needed, that is, using a frame of the same storage control system to realize functions of different products.
In the storage control system and the storage control method of the present invention, only changing the code of the ROM is needed to realize the corresponding functions of different designed products. The present invention also has a simple structure and is easy to be used and in low cost.
Number | Date | Country | Kind |
---|---|---|---|
201010522877.9 | Oct 2010 | CN | national |