1 Introduction
In the wire rope flaw detection, 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 of its technology and its wide application, how to use single-chip microcomputer control to complete the mobile storage process has become a hot topic in the field of industrial control.
2 Introduction to USB Functional Module
2.1 Module Overview
USB[1] is a polling bus, and all data transmission is initiated by the host controller. The peripherals connected to the USB share the USB bandwidth through the host-scheduled and token-based protocols. At present, most of the host function roles are integrated in various types of PCs (or higher-level machines). Various USB-based mobile devices, including USB mobile storage devices, digital cameras with USB interfaces, etc., have integrated USBSlave function roles. As a result, these digital devices with USB interfaces as USBSlaves cannot be used in embedded systems. The fundamental solution to this problem is to integrate the USBHost function module in the embedded system that needs to use USB devices, so that it has the ability to transmit data with USBSlave devices. The MemMaster[2] module has this function.
MemMaster is the host device in the USB system and has a RootHUB that 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 they can be processed in the PC when needed.
After being integrated into the user system, the 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 reads responses and corresponding data from the specified area to obtain the services provided by the MemMaster module. In this way, both parties realize protocol interaction.
2.2 Hardware Configuration
MemMaster supports the 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 devices). The INTR pin is used as the interrupt signal from the RAM to the microcontroller, BUSYR is used as the working signal of the RAM, SEMR is used as the synchronization signal, CER is used as the chip select signal, and other pins are not described in detail here.
2.3 The interface uses
MemMaster to connect directly to the user's microcontroller system through the bus through the dual-port RAM. Therefore, as far as the user's microcontroller system is concerned, MemMaster appears as an external RAM, and some areas in the RAM cannot be used, some areas are used for the interaction of protocol commands and data, 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 the area available to the user system;
The two bytes 0xFFFE-0xFFFF are used as system protocol interaction indicators 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
[page]
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 trickle current. Its I/O pins are used as data input and output, as reset signal input, and SCLK as clock signal input.
The MCU used is Winbond's W78E58B[5], which is an 8-bit MCU with 32KB Flash/EEPROM. Its pin functions are fully compatible with the 8051 series MCUs. 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]:
[page]
#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 the file exists*/
{
CreateFileCmdPkg*crCmdPkg;
/*CreateFileCmdPkg is to create a command package, including the various attributes of the creation command*/
crCmdPkg=(CreateFileCmdPkg*)Command;
MemSet((char*)crCmdPkg,0,64);
MemSet(crCmdPkg->FileName,0x20,8);
crCmdPkg->CommandCode=SYS_CREATE_FILE;
/*SYS_CREATE_FILE is the creation 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 name*/
crCmdPkg->FileAttr=0x20;
crCmdPkg->CreateTime[0]=min;
crCmdPkg->CreateTime[1]=hour;
/*CreateTime is the creation time*/
[page]
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 the dual-port RAM receives the 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, dynamically detect whether there are files with the same name in the mobile storage, 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 a real-time alarm for broken wires, which facilitates real-time processing.
The device applies the USB standard to the wire rope detection system, adapts to the development trend of computers, has the advantages of easy portability, fast operation, low cost, large storage capacity, etc., has good effects and broad application prospects.
Previous article:Excellent design of anti-theft alarm - "Walnut-shaped prevention plan"
Next article:Analysis and application of information fusion technology in fire alarm system
Recommended ReadingLatest update time:2024-11-16 19:40
- Mir T527 series core board, high-performance vehicle video surveillance, departmental standard all-in-one solution
- Akamai Expands Control Over Media Platforms with New Video Workflow Capabilities
- Tsinghua Unigroup launches the world's first open architecture security chip E450R, which has obtained the National Security Level 2 Certification
- Pickering exhibits a variety of modular signal switches and simulation solutions at the Defense Electronics Show
- Parker Hannifin Launches Service Master COMPACT Measuring Device for Field Monitoring and Diagnostics
- Connection and distance: A new trend in security cameras - Wi-Fi HaLow brings longer transmission distance and lower power consumption
- Smartway made a strong appearance at the 2023 CPSE Expo with a number of blockbuster products
- Dual-wheel drive, Intellifusion launches 12TOPS edge vision SoC
- Toyota receives Japanese administrative guidance due to information leakage case involving 2.41 million pieces of user data
- 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
- Live broadcast at 10:00 am today: ADI energy storage system helps build electric vehicle fast charging stations
- Please tell me about the inductance in this boost circuit
- I want to know what device this is.
- [Repost] Understand the difference between PCB and integrated circuit in one article
- SPWM wave generation tool
- How to force the switch state of TI TMS320F28335 EPWM by software
- "Intel SoC FPGA Learning Experience" + My Implementation Method of GDBServer in Lesson 5
- EEWORLD University Hall----Live Replay: The Development and Latest Application of TTI TE Sensors in Industrial Motors
- C6455 CSL_EMIF example
- Application of OPT3004 in battery-powered cameras