Description
3721C TRICONEX controller
3721C TRICONEX controller
Module Clips Drive controller servo motor
Contact: Mr. Lai
Wechat:17750010683
Whats app:+86 17750010683
Skype:+86 17750010683
QQ: 3221366881
3221366881@qq.com
Ethernet IO module assists industrial robots
Industrial robots are multi joint robotic arms or multi degree of freedom machine devices aimed at the industrial field, which can achieve many material distribution, retrieval, pallets, and so on in industrial sites. However, due to the fact that many industrial six axes are equipped with 32 IO ports as standard, the IO ports are not sufficient in practical applications. Therefore, some DIN and DO extensions can be met through IO modules.
MQTT Ethernet IO Remote Module3721C TRICONEX controller
The Modbus TCP Ethernet IO module has multiple channels, such as 4-way, 8-way, and 16-way switch input and output options. The communication protocol of the Ethernet IO module adopts the standard Modbus TCP protocol, Modbus RTU over TCP protocol, and MQTT protocol. Can support LAN configuration, with 1 DC power output to other devices on site, reducing the difficulty and cost of on-site wiring.
Most of the MQTT Ethernet IO modules should collect some IO port information and transmit data through the network port. In fact, the Ethernet IO module can not only serve as a TCP server, but also as a TCP client. In addition, it can not only count high-speed pulses but also output high-3721C TRICONEX controllerspeed pulses. This is very convenient for doing some control processing on industrial sites, such as controlling servo motors and other scenarios! The most important thing is the data caching function. Even if the network is disconnected, it is not afraid. The data will be automatically cached, and after the network is restored, it will be automatically retransmitted.
The MxxxT industrial remote Ethernet I/O data acquisition module is embedded with a 32-bit high-performance microprocessor MCU, and integrates an industrial grade 10/100M adaptive Ethernet interface to support the standard Modbus protocol. It can easily integrate with third-party SCADA software, PLC, and HMI devices for application. Equipped with an RS485 interface, it has good scalability and can be cascaded with standard Modbus RTU I/O devices through the RS485 bus to achieve the combination of various digital, analog, and thermal resistance IO modules, saving costs. At the same time, this device has the function of cluster register mapping, and the data of the cluster is automatically collected into the mapping storage area of the local computer. The upper computer can respond quickly without waiting when querying, meeting the strict and timely functional requirements of industrial sites.
What is a remote IO module and what are its purposes
Technology is constantly evolving, and we can come into contact with various electronic devices both in daily life and in the workplace. And a large number of electronic devices work together to generate some signal sources. In order to better transmit and collect signals, industrial control products such as remote IO modules, signal transmitters, and signal acquisition modules have been developed.
In the past, people had to connect existing lines and boxes one at a time, which greatly increased the cost and construction time of cables. Moreover, if the distance was too long, they also had to face issues such as voltage attenuation. And through the remote IO module, this problem can be effectively solved.
If your cabinet is 200 meters away from the site and remote IO is not used, then you can extend each signal line by 200 meters and install the remote IO module on site, which can save you a lot of cable costs and reduce the complexity of construction.
In short, sometimes some IOs are set far away from the central control room and then connected back to the central control room through fiber optics to save on cable procurement and construction. Sometimes, the logical “remote” is because the allowed quantity of “local IO” cannot meet the actual needs, so it is necessary to connect to the “remote IO template”, which depends on the situation.
In addition, the general cabinet is placed on the equipment site. However, some control signals, such as emergency stop and bypass, are implemented in the control room, so remote IO modules need to be used to transmit these signals to the control system in the computer room.
What is an Ethernet IO module and what are its functions
The Ethernet IO module is a hardware gateway that adds IO to the network port.
The Ethernet IO module has hardware interfaces such as switches, analog signals, relays, RS485, RJ45, etc. Can be used for IO data collection network port transmission in industrial automation. Simply put, it refers to sensors with standard signals on site, or serial devices with 485 signals such as PLCs, which can be converted into real values through such gateways and then transmitted to the host for display through network ports.
1. Collect and control data for internal processing and transmit it to the external network through Ethernet
2. Support 4-way photoelectric isolation switch input
3. Supports 4 independent relay control outputs
4. Supports 8 analog inputs, 4-20mA or 0-5V/0-10V/0-30V (optional)
5. Support RS485 serial port data collection, with serial port server function
6. Supports Modbus RTU communication protocol and virtual serial port
7. Supports docking with various configuration software and TCP/UDP servers
What exactly does embedded development do?
Embedded development is a technology similar to programming, but our understanding of the scope of programmers is to do computer software, web development, and also to do apps.
The majority of embedded development is intelligent electronic products, which are designed for hardware programming. This hardware can be understood as a circuit board, usually composed of a controller (processor) chip and different circuits.
The specific program and circuit are generally determined by the product function. For example, an electronic clock product is usually composed of a digital tube and a microcontroller (controller), and then written in C language to download it to the microcontroller to achieve clock display.3721C TRICONEX controller
Of course, there are far more products that can be developed in embedded systems, including smartphones, wearable devices, drones, robots, mice and keyboards, and so on.
The knowledge system of embedded development and design is also very diverse, and different products require different learning contents.
So, if we want to enter embedded development, we must first understand several directions of embedded development, otherwise you will never find a starting point.
The general mainstream directions are microcontroller development, ARM+Linux development, and FPGA/DSP development.
I have been working on microcontroller development for the past 10 years of my career.
Microcontrollers can be said to be the foundation of all directions. If you have strong microcontroller development capabilities, then ARM+Linux, or FPGA/DSP are easy for you to get started.
The development of microcontrollers is also one of the directions with the lowest threshold for embedded systems. Initially, I was self-taught in electrical engineering and transferred there. It took me about four months from the beginning of my studies to finding a job.
However, at that time, the threshold was still very low, and you could basically find a job by working on a small project with a 51 microcontroller.
If it”s the current situation, you only know these things and have little competitiveness. Nowadays, the main focus of enterprises is on whether you have project experience, rather than what kind of microcontroller you know.
The project experience can be accumulated through practical projects with endless microcontroller programming, which can be said to be the closest to actual development at present.
At present, the salary of single-chip microcontrollers is not low, and it is normal for them to start at 8K in first tier cities, and they can reach 15K after working for 2-3 years.
There are many industries covered by embedded systems, and in the later stage, based on work, we will only focus on one direction. From a macro perspective, we will divide it into embedded software development and embedded hardware development. Software development is mainly based on application software development on systems (Linux, VxWorks, WinCE, etc.), and hardware development includes motherboard design, system porting, cutting, and writing low-level drivers
My personal experience started with microcontrollers. Firstly, I studied C and C++, digital and analog electronics, power electronics, circuit design, microcontroller principles, FreeRTOS, data structures, and computer operating systems. Later, due to work requirements, I relearned university automation control theory, signals and systems, complex functions, linear algebra, calculus, statistics, and compiler principles. These are all basics, and it is important to understand and thoroughly study them, This will bring help to the later research and development work, and there is also a need for more drawing board, drawing board, and practical operation. Without practicing optics, the efficiency is very low, and knowledge is repetitive. Only by repeatedly looking and using can we understand. We can buy some development boards to assist in learning. Now that the internet is developed, network resources can improve our learning efficiency.
Embedded development refers to developing under an embedded operating system, commonly used systems include WinCE, ucos, vxworks, Linux, Android, etc. In addition, develop using C, C++, or assembly; Using advanced processors such as arm7, arm9, arm11, powerpc, mips, mipsel, or operating systems also belongs to embedded development.
1. Basic knowledge:
Purpose: I can understand the working principles of hardware, but the focus is on embedded software, especially operating system level software, which will be my advantage.
Subjects: Digital Circuits, Principles of Computer Composition, and Embedded Microprocessor Architecture.
Assembly Language, C/C++, Compilation Principles, Discrete Mathematics.
Data structure and algorithms, operating systems, software engineering, networks, databases.
Method: Although there are many subjects, they are all relatively simple foundations and most of them have been mastered. Not all courses may be taught, but elective courses can be taken as needed.
Main books: The C++programming language (I haven”t had time to read it), Data Structure-C2.
2. Learning Linux:
Purpose: To gain a deeper understanding of the Linux system.
Method: Using Linux ->Linxu system programming development ->Driver development and analysis of the Linux kernel. Let”s take a closer look, then the main topic is principles. After reading it a few times, look at the scenario analysis and compare it deeply. The two books intersect, with depth being the outline and emotion being the purpose. Analysis is version 0.11, suitable for learning. Finally, delve into the code.
Main books: Complete Analysis of Linux Kernel, Advanced Programming in Unix Environment, Deep Understanding of Linux Kernel, Scenario Analysis, and Source Generation.
3. Learning embedded Linux:
Purpose: To master embedded processors and their systems.
Method: (1) Embedded microprocessor structure and application: Direct arm principle and assembly are sufficient, without repeating x86.
(2) Embedded operating system class: ucOS/II is simple, open source, and easy to get started. Then delve deeper into uClinux.
(3) Must have a development board (arm9 or above) and have the opportunity to participate in training (fast progress, able to meet some friends).
Main books: Mao Decao”s “Embedded Systems” and other arm9 manuals and arm assembly instructions.
What is the difference between remote IO and distributed IO
People often discuss the difference between remote IO and distributed IO. However, some people believe that they are the same and terms can be exchanged, while others believe the opposite. What is the difference between remote I/O and distributed I/O? The following is a guide from remote IO manufacturer Zhongshan Technology to understand the difference between remote IO and distributed IO.
Remote and distributed within the location range.3721C TRICONEX controller
Today”s DCS is a control system with many distributed autonomous controllers, each with many continuous operations. This controller is bundled together by a central monitoring controller. We have used the terms remote and distributed in the locations of I/O and controllers. It is easy to see how these terms are misunderstood.
From the perspective of PLC, remote I/O represents the actual distance that the I/O module is away from the control PLC. Distributed I/O is very intelligent, as mentioned earlier, remote I/O is sometimes referred to as distributed I/O. Let”s take a look at the definition of distributed I/O. This definition is different from remote I/O.
Generally speaking, distributed I/O has a brain or some computing power. By default, it is remote. As mentioned earlier, remote I/O is located physically far from the control PLC. Remote I/O has no brain and cannot perform any computational functions at all. It can be said with certainty that when you hear the term remote I/O, it only involves one controller or PLC, while distributed I/O has multiple controllers.
ZSR-Ethernet-2184 is a distributed Ethernet RTU that supports 4-way switch digital input (Di), 8-way analog input (Ai), 4-way relay (Do) output, 1-way RS485 serial port data acquisition to Ethernet, and Modbus RTU terminal. Merge 485 to Ethernet serial port server function, support Modbus to TCP/UDP protocol conversion, support virtual serial port, and interface with various configuration software. Supports signal acquisition in the range of 0-5V, 0-10V, 0-30V, or 0-20ma, 4-20ma, with built-in software and hardware watchdog, industrial grade components, and stable operation in an industrial environment of -40~85 ° C.
Building a High Channel Density Digital IO Module for the Next Generation Industrial Automation Controller
There are currently many articles introducing Industry 4.0, and smart sensors are becoming increasingly popular in factory environments (I and other authors have written about these topics). Although we have all noticed a significant increase in the use of sensors in factories, processing plants, and even some newly built automation systems, the widespread use of sensors has also brought about an important change, which is the need to handle a large amount of IO within these old controllers. These IOs may be digital or analog. This requires the construction of high-density IO modules with size and heat limitations.
Usually, digital IO in PLC consists of discrete devices such as resistors/capacitors or independent FET drives. In order to minimize the size of the controller as much as possible and to handle 2 to 4 times the number of channels, this has led to a shift from a separate approach to an integrated approach.3721C TRICONEX controller
We can use the entire article to illustrate the drawbacks of the split method, especially when the number of channels processed by each module reaches 8 or more. However, when it comes to high heat/power consumption, a large number of split components (from the perspective of size and mean time between failures (MTBF)), and the need for reliable system specifications, it is sufficient to demonstrate that the split method is not feasible.
Figure 1 shows the technical challenges faced in building high-density digital input (DI) and digital output (DO) modules. In both DI and DO systems, size and heat dissipation issues need to be considered.
Design a High Channel Density Digital Input Module
The traditional split design uses a resistive voltage divider network to convert 24V/48V signals into signals that can be used by microcontrollers. The front-end can also use discrete RC filters. If isolation is required, external optocouplers are sometimes used
For example, the current limiting value of DI devices in ADI is 3.5mA/channel. So, as shown in the figure, we use two channels in parallel. If the system must be connected to a Type 2 input, adjust the REFDI resistance and RIN resistance. For some newer components, we can also use pins or select current values through software.
To support a 48V digital input signal (not a common requirement), a similar process needs to be used, and an external resistor must be added to adjust the voltage threshold at one end of the field. Set the value of this external resistor so that the current limiting value * R+threshold of the pin meets the voltage threshold specification at one end of the field (see device data manual).
Finally, due to the connection between the digital input module and the sensor, the design must meet the requirements of reliable operating characteristics. When using a split type scheme, these protective functions must be carefully designed. When selecting integrated digital input devices, ensure that the following are determined according to industry standards:
Wide input voltage range (e.g. up to 40V).
Able to use on-site power supply (7V to 65V).
Capable of withstanding high ESD (± 15kV ESD air gap) and surges (usually 1KV).
Providing overvoltage and overheating diagnosis is also very useful for MCU to take appropriate actions.
Design a High Channel Density Digital Output Module
A typical discrete digital output design has a FET with a driving circuit driven by a microcontroller. Different methods can be used to configure FETs to drive microcontrollers.
The definition of a high-end load switch is that it is controlled by an external enable signal and connects or disconnects the power supply from a given load. Compared to low-end load switches, high-end switches provide current to the load, while low-end switches connect or disconnect the grounding connection of the load to obtain current from the load. Although they all use a single FET, the problem with low-end switches is that there may be a short circuit between the load and ground. High end switches protect the load and prevent short circuits to ground. However, the implementation cost of low-end switches is lower. Sometimes, the output driver is also configured as a push-pull switch, requiring two MOSFETs. Refer to Figure 4 below.
Integrated DO devices can integrate multiple DO channels into a single device. Due to the different FET configurations used for high-end, low-end, and push-pull switches, different devices can be used to achieve each type of output driver.
What are the types of integrated IO modules3721C TRICONEX controller
For a programmable logic controller, IO fulfills the responsibilities of data acquisition and instruction output. What control objectives can a PLC achieve, and the quantity and type of IO are crucial. For general integrated PLCs, the number and types of IO interfaces are constant. Some friends may ask, what if you encounter a complex control project with insufficient IO ports in the PLC? Don”t worry, nowadays PLCs have communication interfaces that can be connected to other IO couplers to achieve IO expansion. So, what are the types of IO modules that we can integrate in our daily lives? Actually, it can be mainly divided into four categories, namely:
1. Digital signal acquisition IO can achieve discontinuous signal acquisition, and a typical IO type is a counter input IO module.
Technology Oasis • Source: Guangcheng CAN Bus • Author: Guangcheng CAN Bus • 2022-05-09 09:52 • 1740 readings
For a programmable logic controller, IO fulfills the responsibilities of data acquisition and instruction output. What control objectives can a PLC achieve, and the quantity and type of IO are crucial. For general integrated PLCs, the number and types of IO interfaces are constant. Some friends may ask, what if you encounter a complex control project with insufficient IO ports in the PLC? Don”t worry, nowadays PLCs have communication interfaces that can be connected to other IO couplers to achieve IO expansion. So, what are the types of IO modules that we can integrate in our daily lives? Actually, it can be mainly divided into four categories, namely:
1. Digital signal acquisition IO can achieve discontinuous signal acquisition, and a typical IO type is a counter input IO module.
2. Digital output IO, which can send out command signals of digital quantities to control actuators, such as PWM IO, can send pulse signals to control servo motors and stepper motors. In addition to PWM IO, we often use relay output type IO.
3. After discussing digital IO, let”s talk about analog IO. Firstly, analog input IO includes voltage analog input IO, current analog input IO, temperature analog input IO, etc. They collect continuous signals.
4. Finally, there is the output type IO of analog quantity, mainly including voltage analog quantity output type IO and current analog quantity output type IO. Some friends may ask why there is no temperature this time, but there are relatively few applications, mainly based on voltage and current types.3721C TRICONEX controller
Industrial automation solutions, starting with remote IO modules!
The remote IO module is mainly used for collecting analog and digital signals on industrial sites, and can also output analog and digital signals to control equipment. It is possible to expand the input and output ports of data processing equipment such as PLCs and collection instruments. For example, a PLC only has 10 analog input interfaces, but if 30 analog quantities need to be collected on site, remote IO expansion needs to be added.
Furthermore, due to the distance between the equipment and the main control PLC or industrial computer, RS-485 bus is usually used for transmission. There are also some factories with high levels of automation that use industrial Ethernet to control remote IO modules. In the past, when laying lines between equipment and cabinets, people had to connect them one by one, which greatly increased the cost of cables and construction time. Moreover, if the distance was relatively long, they also faced problems such as voltage attenuation. And with the remote IO module, it effectively solves this problem. If your cabinet is 200 meters away from the site and you do not use remote IO, then you need to lay out each signal line for 200 meters. Installing the remote IO module on site can save you a lot of cable costs and reduce the complexity of construction from a cost perspective.
Simply put, sometimes some IO is set up in the on-site device cluster, which can be connected to the PLC through a communication cable to send the signal to any place where it is needed, saving wiring and PLC”s own IO points. Sometimes, the logical “remote” is because the allowed number of “local IO” cannot meet the actual needs, and it needs to be connected to the “remote IO template”, depending on the actual situation.
In addition, the general cabinet room is located on the device site. But some control signals, such as emergency stop and bypass, are implemented in the control room, so remote IO modules need to be used to send these signals to the control system in the cabinet room.
Why use remote I/O?
1. Because in some industrial applications, it is impossible to install PLCs with local I/O modules near on-site equipment due to harsh environments.
2. When you want to place the I/O module near the field device to eliminate long multi-core cables, you can receive signals from distant sensors and send remote control signals to control valves, motors, and other final actuators. The signal can be transmitted at any distance using various transmission protocols such as Ethernet and Profibus through high-speed media such as twisted pair and fiber optic.
3. Multiple transmission protocols such as Ethernet and Profibus can be used to send signals at any distance on high-speed media such as twisted pair and fiber optic.
The barium rhenium technology MXXT remote IO module uses industrial grade components with a wide working voltage of DC9-36V, which can operate normally within the range of -20~70 ℃. It supports RS485/232 communication mode, and the communication protocol adopts standard Modbus TCP protocol, Modbus RTU over TCP protocol, and MQTT protocol. We strive to fully meet the needs of our customers with an electrical and mechanical system that is anti-interference, resistant to harsh environments, and compatible with general use. It has stable performance, reliable quality, short delivery time, and fast response.
Advantages of Barium Rhenium Remote I/O Module
1. It can be controlled by remote commands.
2. Save the cost of using industrial control computers and IO cards, and Ethernet I/O modules can be directly connected to the upper computer system;
3. Replacing 4-20mA signal transmission with 10/100MHz Ethernet transmission has improved transmission speed;
4. Replacing various instrument controller signal lines with an Ethernet cable reduces the attenuation of remote signal transmission;
5. The signal cable of the instrument controller only needs to be connected to the Ethernet I/O module, greatly reducing cable costs and wiring workload.
6. Convenient installation method. Rail installation, high reliability, strong anti-interference ability, and more convenient on-site installation.
Modify the watchdog time of the PROFINET IO device under 16 STEP7
3.2 Check if the installation of PROFINET IO communication equipment meets the specifications
Most cases of PROFINET IO communication interference problems are caused by equipment installation that does not comply with the installation specifications for PROFINET IO communication, such as incomplete shielding, unreliable grounding, and being too close to interference sources. Installation that meets the specifications can avoid communication failures caused by electromagnetic interference. You can refer to the following brief installation requirements for PROFINET:
1. Wiring of PROFINET 3721C TRICONEX controller
In order to reduce the coupling of electric and magnetic fields, the larger the parallel distance between PROFINET and other power cable interference sources, the better. In accordance with IEC 61918, the minimum distance between PROFINET shielded cables and other cables can be referred to Table 1. PROFINET 3721C TRICONEX controller can be wired together with other data cables, network cables, and shielded analog cables. If it is an unshielded power cable, the minimum distance is 200mm.
Comprehensive analysis of the principle and application skills of microcontroller IO port
IO port operation is the most basic and important knowledge in microcontroller practice. This article takes a long time to introduce the principles of IO ports. I also consulted a lot of materials to ensure the accuracy of the content, and spent a long time writing it. The principle of IO ports originally required a lot of in-depth knowledge, but here it has been simplified as much as possible for easy understanding. This will be of great help in solving various IO port related problems in the future.
The IO port equivalent model is my original method, which can effectively reduce the difficulty of understanding the internal structure of the IO port. And after consulting and confirming, this model is basically consistent with the actual working principle.
I mentioned a lot earlier, and many people may already be eager to actually operate microcontrollers. The IO port, as the main means of communication between the microcontroller and the outside world, is the most basic and important knowledge for microcontroller learning. Previously, we programmed and implemented an experiment to light up the LED at the IO port. This article will continue to introduce the relevant knowledge of the IO port.
In order to better learn the operation of IO ports, it is necessary to understand the internal structure and related concepts of IO ports. These knowledge are very helpful for subsequent learning, with a focus on understanding and no need to memorize them intentionally. If you don”t remember, just come back and take a look. If you use it too much, you will naturally remember.
We have said that the most accurate and effective way to understand a chip is to refer to official chip manuals and other materials. But for beginners of microcontrollers, it may be difficult to understand the chip manual directly, especially when they see a bunch of English, unfamiliar circuits, and terminology. If it were me, I would definitely be crazy. But here I still provide a picture taken from Atmel”s official “Atmel 8051 Microcontrollers Hardware Manual”.
The purpose of giving this picture is not to dampen everyone”s enthusiasm for learning, but to help everyone understand how the various microcontroller materials we have seen come from and whether they are accurate. All of these can be clarified through official information, which will be helpful for everyone to further learn something in the future.
Introduction to the Second Function
The above figure is the authoritative 51 microcontroller IO port structure diagram provided by the official. It can be seen that the internal structure of the four sets of IO ports of the microcontroller is different, because some IO ports have a secondary function, as mentioned in the introductory section.
Do you remember this pin diagram? The second function name of the IO port is marked in parentheses. Except for P1, each interface has a second function. When introducing the microcontroller system module, I mentioned that the 51 microcontroller has an interface for reserved extended memory, which is the second function of P0 and P1 in the figure (while also using pins such as 29 and 30). Because it is not widely used and involves in-depth knowledge, no specific research will be conducted. By the way, the AD0~AD7 we see here are actually used for parallel ports. The second function of the P3 port, including serial port, will be introduced in detail later.
The drawbacks of network IO and the advantages of multiplexing IO
In order to talk about multiplexing, of course, we still need to follow the trend and adopt a whiplash approach. First, we will talk about the drawbacks of traditional network IO and use the pull and step method to grasp the advantages of multiplexing IO.
For the convenience of understanding, all the following code is pseudo code, and it is sufficient to know the meaning it expresses.
Blocking IO
The server wrote the following code to handle the data of client connections and requests.
Listenfd=socket()// Open a network communication port
Bind (listenfd)// binding
Listen (listenfd)// Listening while (1){
Connfd=accept (listenfd)// Blocking connection establishment
Int n=read (connfd, buf)// Blocking read data
DoSomeThing (buf)// What to do with the data you read
Close (connfd)// Close the connection and wait for the next connection in a loop
}
This code will be executed with stumbling blocks, just like this.
It can be seen that the thread on the server is blocked in two places, one is the accept function and the other is the read function.
If we expand on the details of the read function again, we will find that it is blocked in two stages.
This is traditional blocking IO.
The overall process is shown in the following figure.
So, if the client of this connection continues to not send data, the server thread will continue to block on the read function and not return, nor will it be able to accept other client connections.
This is definitely not feasible.
Non blocking IO
To solve the above problem, the key is to modify the read function.
A clever approach is to create a new process or thread every time, call the read function, and perform business processing.
While (1){
Connfd=accept (listenfd)// Blocking connection establishment
Pthread_ Create (doWork)// Create a new thread
}
Void doWork(){
Int n=read (connfd, buf)// Blocking read data
DoSomeThing (buf)// What to do with the data you read
Close (connfd)// Close the connection and wait for the next connection in a loop
}
In this way, once a connection is established for a client, it can immediately wait for a new client connection without blocking the read request from the original client.
However, this is not called non blocking IO, it just uses multithreading to prevent the main thread from getting stuck in the read function and not going down. The read function provided by the operating system is still blocked.
So true non blocking IO cannot be achieved through our user layer tricks, but rather by imploring the operating system to provide us with a non blocking read function.
The effect of this read function is to immediately return an error value (-1) when no data arrives (reaches the network card and is copied to the kernel buffer), rather than waiting for blocking.
The operating system provides this feature by simply setting the file descriptor to non blocking before calling read.
Fcntl (connfd, F_SETFL, O_NONBLOCK);
Int n=read (connfd, buffer)= SUCCESS;
In this way, the user thread needs to loop through the call to read until the return value is not -1, and then start processing the business.
We noticed a detail here.
Non blocking read refers to the stage where data is non blocking before it reaches the network card, or before it reaches the network card but has not been copied to the kernel buffer.
When the data has reached the kernel buffer, calling the read function is still blocked and requires waiting for the data to be copied from the kernel buffer to the user buffer before returning.
The overall process is shown in the following figure
IO multiplexing
Creating a thread for each client can easily deplete the thread resources on the server side.
Of course, there is also a clever solution. After accepting each client connection, we can put the file descriptor (connfd) into an array.
Fdlist. add (connfd);
Then create a new thread to continuously traverse the array and call the non blocking read method for each element.
While (1){
For (fd “- fdlist){
If (read (fd)!=- 1){
DoSomeThing();
}
}
}
In this way, we successfully processed multiple client connections with one thread.
Do you think this means some multiplexing?
But this is just like using multithreading to transform blocked IO into seemingly non blocking IO. This traversal method is just a small trick that our users have come up with, and every time we encounter a read that returns -1, it is still a system call that wastes resources.
Making system calls in a while loop is not cost-effective, just like making rpc requests while working on distributed projects.
So, we still need to plead with the operating system boss to provide us with a function that has such an effect. We will pass a batch of file descriptors to the kernel through a system call, and the kernel layer will traverse them to truly solve this problem.
1.Has been engaged in industrial control industry for a long time, with a large number of inventories.
2.Industry leading, price advantage, quality assurance
3.Diversified models and products, and all kinds of rare and discontinued products
4.15 days free replacement for quality problems
ABB — AC 800M controller, Bailey, PM866 controller, IGCT silicon controlled 5SHY 3BHB01 3BHE00 3HNA00 DSQC series
BENTLY — 3500 system/proximitor, front and rear card, sensor, probe, cable 3500/20 3500/61 3500/05-01-02-00-001 3500/40M 176449-01 3500/22M 138607-01
Emerson — modbus card, power panel, controller, power supply, base, power module, switch 1C31,5X00, CE400, A6500-UM, SE3008,1B300,1X00,
EPRO — PR6423 PR6424 PR6425 PR6426 PR9376 PR9268 Data acquisition module, probe, speed sensor, vibration sensor
FOXBORO — FCP270 FCP280 FCM10EF FBM207 P0914TD CP40B FBI10E FBM02 FBM202 FBM207B P0400HE Thermal resistance input/output module, power module, communication module, cable, controller, switch
GE —- IS200/215/220/230/420 DS200/215 IC693/695/697/698 VMICPCI VMIVME 369-HI-R-M-0-0-E 469 module, air switch, I/O module, display, CPU module, power module, converter, CPU board, Ethernet module, integrated protection device, power module, gas turbine card
HIMA — F3 AIO 8/4 01 F3231 F8627X Z7116 F8621A 984862160 F3236 F6217 F7553 DI module, processor module, AI card, pulse encoder
Honeywell — Secure digital output card, program module, analog input card, CPU module, FIM card
MOOG — D136-001-007 Servo valve, controller, module
NI — SCXI-1100 PCI – PXIE – PCIE – SBRIO – CFP-AO-210 USB-6525 Information Acquisition Card, PXI Module, Card
Westinghouse — RTD thermal resistance input module, AI/AO/DI/DO module, power module, control module, base module
Woodward — 9907-164 5466-258 8200-1300 9907-149 9907-838 EASYGEN-3500-5/P2 8440-2145 Regulator, module, controller, governor
YOKOGAWA – Servo module, control cabinet node unit
Main products:
PLC, DCS, CPU module, communication module, input/output module (AI/AO/DI/DO), power module, silicon controlled module, terminal module, PXI module, servo drive, servo motor, industrial display screen, industrial keyboard, controller, encoder, regulator, sensor, I/O board, counting board, optical fiber interface board, acquisition card, gas turbine card, FIM card and other automatic spare parts