1 Introduction
In the flaw detection of wire ropes, it is necessary to realize the data exchange from the detection sensor to the memory. USB mobile memory has the advantages of easy portability, fast operation and low cost. With the development and wide application of its technology, how to use single-chip microcomputer control to complete the mobile storage process has become a hot topic in the field of industrial control.
2USB Function Module Introduction
2.1 Module Overview
USB[1] is a polling bus, where all data transfers are initiated by the host controller. Peripherals connected to the USB share the USB bandwidth through host-scheduled and token-based protocols. Currently, most host function roles are integrated into various types of PCs (or higher-level machines). Various USB-based mobile devices, including USB mobile storage devices and digital cameras with USB interfaces, have integrated USB Slave function roles. As a result, these digital devices with USB interfaces that serve as USB Slaves cannot be used in embedded systems. The fundamental solution to this problem is to integrate the USBHost function module into the embedded system that needs to use USB devices, so that it has the ability to transmit data with USB Slave devices. The MemMaster[2] module has this function.
MemMaster is a host device in the USB system, with a RootHUB, which allows users to access USB mobile storage devices as slaves. The MemMaster module complies with the USB1.1 protocol specification, supports all USB-based mobile storage devices, and supports FAT12 and FAT16 file systems. The MemMaster module can be integrated into the user's data acquisition system through the bus in a modular manner to provide users with the ability to save the acquired data in the form of files in the mobile storage device through the module so that it can be processed in the PC when needed.
After being integrated into the user system, MemMaster behaves as an external dual-port RAM of the user system. The user system controls the operation of the MemMaster module by writing commands and corresponding data to the specified area of the external RAM, and obtains the services provided by the MemMaster module by reading responses and corresponding data from the specified area. In this way, both parties realize protocol interaction.
2.2 Hardware Configuration
MemMaster supports USB1.1 standard, with a maximum write rate of 100KB/s (depending on the test environment), an input voltage of 5V, and an operating current of 100mA (excluding USB mobile storage). The INTR pin is used as an interrupt signal from RAM to the microcontroller, BUSYR is used as a working signal for RAM, SEMR is used as a synchronization signal, and CER is used as a chip select signal. Other pins are not described in detail here.
2.3 Interface Usage
MemMaster is connected to the user's MCU system directly through the bus via a dual-port RAM. Therefore, as far as the user's MCU system is concerned, MemMaster appears as an external RAM, and some areas in the RAM cannot be used, some areas are used for protocol commands and data interaction, and the remaining areas can be controlled and used by the user. In the dual-port RAM, the area allocation is as follows:
The area 0x0000-0xF8F has been occupied by the system;
0x5F80-0x5FBF, a total of 64 bytes, is used to store system commands;
0x5FC0-0x5FFF, a total of 64 bytes, is used to store system responses;
0x6000-0xDFFF, a total of 32768 bytes, is used to store the data part;
0xE000-0xFFFD is an area that can be used by the user system;
0xFFFE-0xFFFF two bytes are used as system protocol interaction instructions and cannot be used by users for data storage.
The protocol interaction commands between the user system and the MemMaster system include two types: Command and Response. Command is sent from the user system to the MemMaster system, while Response is sent in the opposite direction, from the MemMaster to the user system. The specific implementation is introduced in Section 4.
3. System Design
3.1 System Working Principle
Nowadays, the application of wire rope is becoming more and more extensive. In order to protect personal and property safety, wire rope flaw detection instruments have also developed accordingly. At present, wire rope flaw detection mostly uses PC as the receiving and storage device for detection data, but this is costly and inconvenient to carry. Here, the use of MemMaster module to store on-site detection data in mobile storage overcomes these shortcomings and improves the cost performance of the system. The working principle of the system is described as follows: When the detection sensor starts working, it outputs a pulse signal as a synchronization signal for the control circuit, and at the same time detects the three-way parameter data (analog signal) of the wire rope. When the control circuit obtains the synchronization signal, it starts the A/D conversion and obtains the conversion result. After the system processes the data, it determines whether there is a broken wire, and if so, it alarms. At the same time, the data is written into the file created in the mobile storage when the control circuit is powered on, so as to facilitate future analysis and processing.
3.2 System Configuration
Here, the A/D conversion device used is MAX186[3]. MAX186 integrates 8-channel analog switches, high-bandwidth tracking/holding circuits, 12-bit A/D converters and shift registers into a 20-pin dual in-line chip, eliminating transmission errors and improving sampling accuracy and conversion accuracy. It has a small size, fast conversion speed, high conversion accuracy, low power consumption, and is powered by a 5V single power supply or a V dual power supply. The analog input can be set by software to single or bipolar and single-ended or differential input conversion modes. Its SCLK pin is used as a clock signal input and a chip select signal input, DIN is used as a serial signal input, and DOUT is used as a serial signal output.
When the system is powered on, a receiving file needs to be created. The creation time of the file is provided by DS1302[4]. DS1302 is a high-performance, low-power real-time clock circuit with RAM launched by DALLAS Corporation of the United States. It can count the year, month, day, weekday, hour, minute, and second, and has a leap year compensation function. The operating voltage is 2.5V to 5.5V. It uses a three-wire interface to communicate synchronously with the CPU, has dual power pins for main power supply/backup power supply, and provides the ability to charge the backup power supply with a trickle current. Its I/O pins are used as data input and output, as reset signal input, and SCLK as clock signal input.
The microcontroller used is Winbond's W78E58B[5], which is an 8-bit microcontroller with 32KB Flash/EEPROM. Its pin functions are fully compatible with the 8051 series microcontrollers. The system connection diagram is shown in Figure 1.
4. Software Design
In order to make each part of the hardware circuit work in a certain order, the application program written in C51 is solidified in the program memory of the single-chip microcomputer, including the system initialization program, time parameter acquisition program, file creation program, A/D conversion program, alarm analysis program, and data writing program. The software adopts a modular design method to divide each function into independent modules. Among them, the A/D conversion program is placed in the interrupt program. The program flow chart is shown in Figure 2.
4.1 Analysis of alarm algorithm
The wire rope broken wire detection signal is an abnormal signal in a local area superimposed on the noise background. In order to be able to alarm for broken wires, it should first be separated from the detection signal. According to the real-time processing requirements of the alarm, the method for extracting the broken wire detection signal should be simple, with short computing time and small memory space. A peak-to-peak value exceeding limit method is given below.
The peak-to-peak value exceeding limit method uses the peak-to-valley difference characteristics of the local abnormal signal waveform to extract the broken wire detection signal. From the signal waveform, the detection signal is composed of a large number of local peaks and valleys, and there will be a complete peak-to-valley waveform signal in each tiny part of the detection signal. The peak-to-peak value is defined as the absolute value of the difference between the peak value and the valley value of a local peak-to-valley waveform signal. When the peak-to-peak value of a local peak-to-valley waveform signal exceeds the threshold, it is considered to be a local abnormal waveform signal. In the wire rope broken wire detection based on magnetic concentrator, the detection signal waveform is a complete local peak-to-valley waveform, which is determined by the distribution of the leakage magnetic field of the broken wire fracture. When the structure of the magnetic concentrator and the layout position of the detection element are selected, the broken wire detection signal will be a single positive peak signal, and the peak-to-peak value of the signal is much larger than the adjacent signal waveform, so it is easy to extract it using the peak-to-peak value exceeding limit method.
Suppose vn, n=0, 1, 2, 3, 4, are 5 consecutive local extreme points. In the program we judge: when ((v[1]-v[2])>3*(v[1]-v[0]))&&((v[3]-v[2])>3*(v[3]-v[4]))&&(v[0]-v[2]>26)&&(v[4]-v[2]>26), an alarm is issued.
4.2 USB data storage program design
In the interface usage, it has been introduced that the protocol interaction commands between the user system and the MemMaster system include two types: Command and Response. The following is a detailed explanation of the Command/Response message.
The Command/Response message is used to inform the other party (MemMaster or user system) that the Command or Response is ready and can be executed after the command or response to be issued by the user system or MemMaster system and the corresponding data are ready. This message is completed by writing/reading data to the 0xFFFE or 0xFFFF address of the dual-port RAM. This message is implemented through interrupts, that is, for the user system, when data is written to 0xFFFE, it notifies the MemMaster that there is a command to be executed. When the system enters the interrupt program, it means that the MemMaster has completed the command and prepared the response, and can proceed to the next step. At this time, the interrupt is cleared from 0xFFFF. The current system definition is that the value written to 0xFFFE and read from 0xFFFF is 0x01. The reference code is as follows [6]:
#defineDPRAMRInt((char*)0xFFFF)
#defineDPRAMLInt((char*)0xFFFE)
#defineSEND_SYSCMD*DPRAMLInt=0x01
voidservice_int1()interrupt0/*External interrupt 0*/
{
bRecvResp=*DPRAMRInt;
}
The following file creation function is given to illustrate how the user system and the MemMaster system implement Command message transmission (Response messages are similar).
voidCreateFile(unsignedcharnm)/*nm is used to determine whether a file exists*/
{
CreateFileCmdPkg*crCmdPkg;
/*CreateFileCmdPkg is a create command package, including various attributes of the create command*/
crCmdPkg=(CreateFileCmdPkg*)Command;
MemSet((char*)crCmdPkg,0,64);
MemSet(crCmdPkg->FileName,0x20,8);
crCmdPkg->CommandCode=SYS_CREATE_FILE;
/*SYS_CREATE_FILE is the create command code*/
crCmdPkg->FileName[0]='T';
crCmdPkg->FileName[1]='A'+nm;
/*FileName is the file name*/
crCmdPkg->ExtensionName[0]='S';
crCmdPkg->ExtensionName[1]='H';
crCmdPkg->ExtensionName[2]='J';
/*ExtensionName is the suffix*/
crCmdPkg->FileAttr=0x20;
crCmdPkg->CreateTime[0]=min;
crCmdPkg->CreateTime[1]=hour;
/*CreateTime is the creation time*/
crCmdPkg->CreateDate[0]=date;
crCmdPkg->CreateDate[1]=year;
/*CreateDate is the creation date*/
/*min, hour, date, year are calculated from the data provided by DS1302*/
crCmdPkg->Option=0x00;
bRecvResp=0;
SEND_SYSCMD;/*Send Command message*/
cs_ram=1;/*Cancel dual-port RAM chip select*/
Delayms(10);
while(!bRecvResp);/*Judge whether dual-port RAM receives message*/
cs_ram=0;/*Chip select*/
}
5 Experimental results analysis
The wire rope detection system is to magnetize the tested wire rope, detect the leakage magnetic field at the broken wire of the wire rope with sensitive elements, so as to judge whether there is broken wire, and then analyze the waveform of the leakage magnetic field through the computer and corresponding software, further judge the number of broken wires, and determine the position of the corresponding broken wire through the photoelectric encoder. In the experiment, a wire rope sample with a 24 (67) structure was selected, and a broken wire was made at the specified position. The experiment was divided into two groups, 50 times in each group, and the system was used for measurement. The experimental analysis results are shown in Table 1.
The analysis and calculation of Table 1 (negative sign indicates missed judgment, positive sign indicates wrong judgment) show that: when no wrong judgment is required (the number of wrongly detected broken wires is 0), the quantitative judgment rate of broken wires is 95%; when one wrong judgment is allowed (the number of wrongly detected broken wires is -1, 0, 1), the quantitative judgment rate of broken wires is 100%, so it meets the working condition requirements. At the same time, the alarm system also gives a real-time alarm for broken wires.
6 Conclusion
The wire rope detection system requires a detection speed of 0~2000 data per second. This device is fully capable of this task, while ensuring the accuracy of the measurement. The device can store data in a specified format, and dynamically detect whether there are files with the same name in the mobile storage device, and automatically add files. It can achieve multiple detections without manual intervention, and is extremely convenient to use. At the same time, the alarm system can give real-time alarms for broken wires, facilitating real-time processing.
The device applies the USB standard to the wire rope detection system, adapts to the development trend of computers, and has the advantages of easy portability, quick operation, low cost, large storage capacity, etc. It has good results and broad application prospects.
Previous article:Application of Computer Simulation Technology in Grinding Temperature Field
Next article:Simulation Study of Hybrid Active Power Filter in Industrial Control
Recommended ReadingLatest update time:2024-11-16 20:44
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- usb_host_device_code
- Image acquisition and processing system for panoramic map applications
- Teach you to learn 51 single chip microcomputer-C language version (Second Edition) (Song Xuefeng)
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Recommendations for pad and steel mesh design of asymmetric packaged power chips
- Meixin Award Live Broadcast: Supporting Integrated Digital IO Technology for Industrial Systems Registration Open
- MSP430F249 external interrupt P1.3 port
- Looking for part-time job,
- Cumulative error analysis and clock frequency optimization for UART communication in MSP430FR2311
- 1000m WIFI amplifier ~ Anyone interested?
- FilterSolutions User's Guide The simulated filter that has been practiced is pretty good
- What is the definition of these so-called self-organizing networks?
- dsp6657 serial port learning
- Try the data visualization tool of visionseed in Ubuntu