A method for changing the number of stations and the station rate of a remote device station based on a CC-LINK protocol

By using EEPROM storage and reconstructing the operating model, the number and scaling of CC-Link remote device stations can be flexibly switched, solving the problems of small data area and resource consumption caused by fixed configuration, improving device adaptability and configuration consistency, and reducing maintenance costs and anomaly risks.

CN122395050APending Publication Date: 2026-07-14NANJING SHIDIAN ELECTRONIC TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING SHIDIAN ELECTRONIC TECH CO LTD
Filing Date
2026-06-12
Publication Date
2026-07-14

Smart Images

  • Figure CN122395050A_ABST
    Figure CN122395050A_ABST
Patent Text Reader

Abstract

The application relates to a station number and rate change method of a remote equipment station based on a CC-LINK protocol, which comprises the following steps: receiving a station number enumeration value and a rate enumeration value and writing the values into an EEPROM; reading the station number enumeration value and the rate enumeration value and determining an occupied station number, an expansion rate, a DIVISION value and a data area size; writing the expansion rate into a register in a program initialization stage; reading a state bit, using a corresponding communication frame format according to a corresponding mode; receiving a data frame according to an SQ sequence corresponding to the expansion rate, and performing discarding or continuous assembly processing on an abnormal SQ data frame. The station number and rate change method of the remote equipment station based on the CC-LINK protocol can realize configurable switching of an occupied station number, an expansion rate, a data area size, an SQ sequence and PLC variable mapping of the remote equipment station without changing a CC-Link basic communication mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial fieldbus communication and control technology, specifically to a method for varying the number and rate of remote device stations based on the CC-LINK protocol. Background Technology

[0002] The CC-Link protocol is widely used in industrial control systems for data communication between PLC master stations and remote device stations. Remote device stations typically exchange digital and analog data with the PLC master station through the RX, RY, RWr, and RWw areas. In practical engineering, the number of remote device stations and the size of their communication data areas directly affect the number of slave stations the PLC master station can connect to and the number of data points that a single slave station can control. When the number of device points required, the number of devices deployed on-site, and the master station's resource capacity change, the configuration of the number of remote device stations and their data areas must be consistent with the PLC engineering side to ensure that the communication frame structure, variable area mapping, and data transmission and reception rules match.

[0003] Existing CC-Link remote device stations mostly adopt a fixed number of stations and fixed multiplier configuration. Different numbers of stations or different data capacity requirements usually require different device types or configuration files. When the number of stations is small, the data area available to a single remote device station is small, making it difficult to meet the control requirements of a large number of input / output points or a large amount of remote register data. When the number of stations is large, a single remote device station consumes more master station resources, resulting in a reduction in the number of slave stations that the PLC master station can connect to. At the same time, multiple fixed configurations correspond to multiple CSPP files, which can easily lead to duplicate configuration files, complex engineering maintenance, and inconsistencies between the master station configuration and the device operating status. Since the CC-Link protocol itself does not provide a universal configuration parameter channel for users, it is difficult to directly achieve flexible switching of the number of stations and multiplier by relying solely on the remote register area of ​​the PLC master station.

[0004] Therefore, existing technologies have shortcomings and need to be improved and developed. Summary of the Invention

[0005] The present invention provides a method for changing the number and scaling factor of remote equipment stations based on the CC-LINK protocol, which enables configurable switching of the number of remote equipment stations, scaling factor, data area size, SQ sequence and PLC variable mapping without changing the basic CC-Link communication mechanism.

[0006] This invention provides a method for varying the number of remote device stations and their multiplier based on the CC-LINK protocol. The method is applied to remote device stations including couplers, EEPROMs, and CC-Link communication protocol chips, and includes:

[0007] The system receives station count enumeration values ​​and multiplier enumeration values ​​from the host computer via serial communication and writes these values ​​into the EEPROM. The station count enumeration values ​​represent one, two, three, or four stations, and the multiplier enumeration values ​​represent one, two, four, or eight times the multiplier.

[0008] After the remote equipment station is powered on again, the coupler reads the station count enumeration value and the multiplier enumeration value stored in the EEPROM, and determines the number of occupied stations, the expansion multiplier, the DIVISION value and the data area size based on the reading results;

[0009] Configure the station number mode pin of the CC-Link communication protocol chip according to the number of occupied stations, and write the expansion ratio into the 0x49 register of the CC-Link communication protocol chip during the program initialization phase and before reading the protocol version status bit.

[0010] The system continuously reads the communication status bit and protocol version status bit of the CC-Link communication protocol chip. When the communication status bit is not set, the system remains in a disconnected state and data interaction is prohibited. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.1 mode, a communication frame format without extension ratio is used, and data interaction is performed according to the data area mapping rules corresponding to CC-Link protocol Ver.1 mode. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.2 mode, a communication frame format with extension ratio is used, and the corresponding SQ sequence parsing rules and PLC variable area mapping rules are enabled. The communication status bit is a status bit set by the CC-Link communication protocol chip when the communication conditions are met by the configuration on the PLC master station side and the remote device station side.

[0011] During communication in the CC-Link protocol Ver.2 mode, data frames are received according to the SQ sequence corresponding to the expansion ratio, and abnormal SQ data frames are discarded or continuously assembled.

[0012] Furthermore, the TYPE-C interface enables data interaction between the remote device station and the host computer via a serial port, which is used to transmit the station count enumeration value and the multiplier enumeration value issued by the host computer.

[0013] In the CC-Link protocol Ver.1 mode, the remote device station determines the number of stations to occupy based on the station number enumeration value. The expansion ratio does not participate in the communication frame expansion processing, and a communication frame format without expansion ratio is adopted.

[0014] In CC-Link protocol Ver.2 mode, the remote device station determines the number of occupied stations and the expansion ratio based on the station count enumeration value and the expansion ratio enumeration value. The expansion ratio participates in the communication frame expansion processing, and the DIVISION value is determined based on the expansion ratio. The DIVISION value is determined by the following formula: In the formula, This is the DIVISION value; The value corresponding to the expansion multiplier can be 1, 2, 4 or 8.

[0015] Furthermore, in CC-Link protocol Ver.1 mode, the data area size is determined based on the number of occupied stations:

[0016] When the number of stations occupied is one, the digital size of the RX and RY areas is 32 bits, and the word size of the RWr and RWw areas is 4 words.

[0017] When the number of stations occupied is two, the digital size of the RX area and the RY area is 64 bits, and the word size of the RWr area and the RWw area is 8 words.

[0018] When three stations are occupied, the digital size of the RX and RY areas is 96 bits, and the word size of the RWr and RWw areas is 12 words.

[0019] When four stations are occupied, the digital size of the RX and RY areas is 128 bits, and the word size of the RWr and RWw areas is 16 words.

[0020] Furthermore, in CC-Link protocol Ver.2 mode, the data area size is determined based on the number of occupied stations and the expansion ratio:

[0021] When the expansion ratio is 1 and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 32 bits, 64 bits, 96 bits and 128 bits respectively, and the word size of the RWr area and RWw area is 4 words, 8 words, 12 words and 16 words respectively.

[0022] When the expansion ratio is double and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 32 bits, 96 bits, 160 bits and 224 bits respectively, and the word size of the RWr area and RWw area is 8 words, 16 words, 24 words and 32 words respectively.

[0023] When the expansion ratio is four times and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 64 bits, 192 bits, 320 bits and 448 bits respectively, and the word size of the RWr area and RWw area is 16 words, 32 words, 48 ​​words and 64 words respectively.

[0024] When the expansion ratio is eight times and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area are 128 bits, 384 bits, 640 bits and 896 bits respectively, and the word size of the RWr area and RWw area are 32 words, 64 words, 96 words and 128 words respectively.

[0025] Furthermore, after reading the station count enumeration value and multiplier enumeration value stored in the EEPROM, the coupler generates the current operating model based on the number of occupied stations, expansion multiplier, DIVISION value, RX area size, RY area size, RWr area size and RWw area size, and configures the uplink digital quantity, downlink digital quantity, uplink analog quantity and downlink analog quantity that can be used by this remote device station according to the current operating model;

[0026] The current operating model includes the station number segment, expansion ratio field, DIVISION field, data area size field, CC-Link protocol Ver.1 mode mapping field, CC-Link protocol Ver.2 mode mapping field, SQ sequence field, and variable area mapping field. The coupler determines the level state of the station number mode pin, the 0x49 register write value, and the data area boundary under each protocol mode based on the current operating model. After reading the protocol version status bit of the CC-Link communication protocol chip, it selects the corresponding data frame parsing length and the tag offset of the PLC variable area.

[0027] Furthermore, a CSPP file matching the remote device station support mode is imported on the PLC engineering side. The CSPP file is used to limit the protocol version, number of stations occupied, expansion ratio, data area size and variable area label mapping on the PLC master station side, so that the PLC master station side forms a communication frame structure corresponding to the selected configuration.

[0028] The CSPP file includes vendor ID, product ID, vendor information, product name, protocol version, number of occupied stations, expansion ratio, version field, CRC field, parameter validity verification field, and a mapping table of tag name, offset, and length.

[0029] The CSPP file defines four configurations in the CC-Link protocol Ver.1 mode and sixteen configurations in the CC-Link protocol Ver.2 mode. Each configuration corresponds to a fixed number of occupied stations, expansion ratio, RX area size, RY area size, RWr area size, and RWw area size.

[0030] The CSPP file is used to configure the corresponding station number and multiplier parameters in the PLC project, and to map the variable parameters to the PLC variable area through standardized labels.

[0031] Furthermore, after the PLC master station completes the configuration based on the imported CSPP file and powers back on, the CC-Link communication protocol chip compares the configuration on the PLC master station side with the configuration on the coupler side. When the comparison is successful, the CC-Link communication protocol chip sets the communication status bit. After the coupler reads the communication status bit, it establishes communication and reads the protocol version status bit to determine whether the current CC-Link protocol Ver.1 mode or CC-Link protocol Ver.2 mode is used. When the protocol version status bit indicates CC-Link protocol Ver.1 mode, the coupler uses a communication frame format without extension ratio for data interaction; when the protocol version status bit indicates CC-Link protocol Ver.2 mode, the coupler uses a communication frame format with extension ratio for data interaction.

[0032] Furthermore, the SQ sequence parsing rules include: when the expansion ratio is eight times, the starting SQ sequence number is 7, and the SQ sequence cycles through 7, 6, 5, 4, 3, 2, 1, and 0; when the expansion ratio is four times, the starting SQ sequence number is 3, and the SQ sequence cycles through 3, 2, 1, and 0; when the expansion ratio is two times, the starting SQ sequence number is 1, and the SQ sequence cycles through 1 and 0; when the expansion ratio is one time, the SQ sequence number is always 0, and the data frame structure configured at one time in CC-Link protocol Ver.2 mode is consistent with the data frame structure in CC-Link protocol Ver.1 mode; the starting SQ sequence number is determined by the following formula: In the formula, The starting SQ serial number; The value corresponding to the expansion multiplier can be 1, 2, 4 or 8.

[0033] Furthermore, in multi-rate communication using the CC-Link protocol Ver.2 mode, a complete data area is assembled as follows: In the formula, For a complete data area; This is the first state field; This is the second status field; This is the third state field; For the serial number field; This is a numeric data field, corresponding to RX area data or RY area data; For remote register read word count field; Write a word field to a remote register; The fields are concatenated in the order of the communication frames; among them, and These are fields shared by both CC-Link protocol Ver.1 and CC-Link protocol Ver.2 modes. and For CC-Link protocol Ver.2 mode, the fields LoopbackSQ, ReceptionSQ, and TransmissionSQ change according to the current frame direction and SQ sequence during each polling.

[0034] Furthermore, the abnormal SQ data frame is subjected to either discarding or continuous assembly processing, which includes:

[0035] When an abnormal transition occurs in the SQ sequence, the corresponding data frame is discarded as an abnormal frame.

[0036] When the initial SQ data frame is lost, subsequent SQ data frames are discarded as abnormal frames until the next initial SQ data frame is received and normal processing resumes.

[0037] When subsequent SQ data frames are not continuous and there are duplicate SQ data frames, the last duplicate SQ data frame used to connect the previous normal SQ data frame and the next normal SQ data frame will be used as a normal data frame, and the remaining duplicate SQ data frames will be discarded.

[0038] When the stored value in the EEPROM is corrupted, missing, or fails to be verified, the coupler will run in four-station eight-times mode by default.

[0039] If communication fails after switching to a new configuration, the system will not revert to the most recent valid configuration; the value of the new configuration will overwrite the value of the previous configuration.

[0040] If a power failure occurs during a remote upgrade, the upgrade process will be aborted. After power is restored, the process will resume according to the original procedure.

[0041] If a power failure occurs during parameter writing, the parameter configuration will take effect according to the parameters written to the EEPROM at the time of power failure after power is restored.

[0042] Beneficial effects:

[0043] As can be seen from the above technical solutions, the present invention provides a method for changing the number of remote equipment stations and the multiplier based on the CC-LINK protocol, which has the following beneficial effects:

[0044] 1. Improve the adaptability of remote equipment stations to different field scales.

[0045] By using the number of stations and expansion ratio as storable, readable configuration parameters that can participate in communication initialization, remote device stations are no longer limited to fixed one-, two-, three-, or four-station configurations, nor to fixed expansion ratios of one, two, four, or eight times. Upon power-up, the coupler reconstructs the current operating model based on the station count enumeration and expansion ratio enumeration values ​​stored in the EEPROM, and further determines the DIVISION value, data area size, station mode pin status, 0x49 register write value, and SQ sequence rules. Thus, the same remote device station can select different configurations based on the number of field control points, master station resource margin, and remote register requirements. When more control points are needed in the field, a larger number of stations or a larger expansion ratio can be used; when more slave stations need to be connected in the field, a smaller number of stations or a lower expansion ratio can be used, thereby creating an adjustable engineering configuration relationship between single-station data capacity and the number of slave stations connected.

[0046] 2. Reduce the cost of repetitive development and maintenance of PLC project configuration files.

[0047] The CSPP file, with its variable configuration, describes various combinations of station counts and scaling ratios supported by remote device stations. Each configuration has a fixed number of stations, scaling ratio, RX area size, RY area size, RWr area size, and RWw area size, allowing PLC engineers to select the target mode based on a single configuration file. Compared to creating separate configuration files for different station counts or scaling ratios, this approach reduces the number of configuration files and mitigates engineering risks caused by inconsistent file versions, duplicate field maintenance, or misuse of configuration items. Furthermore, the vendor ID, product ID, protocol version, configuration items, version field, CRC field, parameter validity verification field, and tag mapping table in the CSPP file collectively form the basis for engineering configuration, enabling the PLC master station to establish a communication frame structure and variable area mapping relationship corresponding to the current operating model of the remote device station. This approach not only facilitates project import and station number configuration but also makes it easier for subsequent maintenance personnel to identify the data range of each slave station.

[0048] 3. Improve the reliability of matching between the configuration of the main station and the operating status of the remote equipment station.

[0049] Instead of simply storing the station count and scaling parameters on the device side, the coupler transforms these parameters into communication operation rules upon power-up. After reading the EEPROM, the coupler determines the data area size and DIVISION value, writes the scaling factor to register 0x49 of the CC-Link communication protocol chip, and configures the station count mode pins based on the number of occupied stations. After the PLC master station completes its engineering configuration and powers back on, the communication protocol chip compares the master station configuration with the remote device station configuration. If the communication conditions are met, the corresponding status bit is set, and the coupler then enters the data interaction process based on the status bit. If the status bit is not set, it remains in an unconnected state and data interaction is prohibited. Through this process, incorrect station count configurations will not directly enter the data transmission and reception stage, thus avoiding variable misalignment, data area out-of-bounds errors, or incorrect control object correspondence caused by mismatched data frame structures. For cases where the scaling factor is greater than the coupler's current scaling factor and the number of stations is the same, the coupler limits interaction to the data range of its current operating model, also providing compatibility processing space for some engineering configurations.

[0050] 4. Improve the orderliness of data frame assembly and the ability to handle anomalies during high-rate communication.

[0051] In CC-Link protocol Ver.2 mode, the expansion ratio affects the value range and cycle period of the SQ sequence. The starting SQ sequence number is determined based on the expansion ratio, causing the 8x mode to cycle through 7, 6, 5, 4, 3, 2, 1, 0; the 4x mode through 3, 2, 1, 0; the 2x mode through 1, 0; and the 1x mode to keep the SQ at zero. During communication, the coupler uses this SQ sequence as the basis for assembling multi-frame data, continuously receiving and splicing complete data areas. When abnormal SQ transitions, loss of the starting SQ data frame, or duplicate SQ data frames occur, the scheme employs processing rules such as discarding the abnormal frame, waiting for the next starting SQ data frame to recover, or retaining the last duplicate SQ data frame used for splicing, respectively. Therefore, data frame assembly is not passively dependent on the communication chip output, but rather performs sequence verification and anomaly recovery based on the SQ cycle corresponding to the expansion ratio, helping to reduce the impact of out-of-order frames, lost frames, and duplicate frames on the data area assembly results of remote equipment stations.

[0052] 5. Improve predictability in scenarios involving abnormal configuration and power failure.

[0053] Handling rules are set for various abnormal situations, including corrupted or missing EEPROM stored values, failed verification, communication failures after switching to a new configuration, power outages during remote upgrades, and power outages during parameter writing. When the configuration in the EEPROM cannot be reliably read, the coupler defaults to a four-station, eight-fold multiplier mode, ensuring the device enters a defined configuration state rather than an unknown number of stations or unknown multiplier state. When communication fails after switching to a new configuration, it does not automatically revert to the most recent valid configuration; instead, the new configuration overwrites the previous configuration value, requiring the master station and device sides to re-establish a consistent configuration. This avoids automatic reversion on the device side, which could make it difficult for the engineering side to determine the current operating status. When a power outage occurs during an upgrade, the program executes according to the pre-upgrade procedure after power is restored. When a power outage occurs during parameter writing, the parameter configuration already written to the EEPROM at the time of power failure takes effect. These rules provide clear boundaries for the operating state after an anomaly, facilitating on-site troubleshooting and recovery.

[0054] It should be understood that all combinations of the foregoing concepts and the additional concepts described in more detail below can be considered part of the inventive subject matter of this disclosure, provided that such concepts do not contradict each other.

[0055] The foregoing and other aspects, embodiments, and features of the teachings of the present invention will be more fully understood from the following description in conjunction with the accompanying drawings. Other additional aspects of the invention, such as features and / or beneficial effects of exemplary embodiments, will become apparent from the following description or may be learned through practice of specific embodiments according to the teachings of the present invention. Attached Figure Description

[0056] The accompanying drawings are not drawn to scale. In the drawings, each identical or nearly identical component shown in the various figures may be denoted by the same reference numeral. For clarity, not every component is labeled in each figure. Embodiments of various aspects of the invention will now be described by way of example and with reference to the accompanying drawings, wherein:

[0057] Figure 1 This is a flowchart illustrating the overall process of changing the number and multiplier of remote device stations based on the CC-LINK protocol in an embodiment of this application.

[0058] Figure 2 A schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention. Unless otherwise defined, the technical or scientific terms used herein should have the ordinary meaning understood by those skilled in the art to which this invention pertains.

[0060] The terms "first," "second," and similar words used in the specification and claims of this patent application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Similarly, unless the context clearly indicates otherwise, the singular forms of "an," "a," or "the," etc., do not indicate a quantity limitation, but rather indicate the presence of at least one. Terms such as "comprising" or "including" mean that the element or object preceding "comprising" encompasses the features, integrals, steps, operations, elements, and / or components listed following "comprising" or "including," and do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or collections thereof. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; these relative positional relationships may change accordingly when the absolute position of the described object changes.

[0061] Existing CC-Link remote device stations mostly adopt a fixed number of stations and a fixed multiplier configuration. Different numbers of stations or different data capacity requirements usually require different device types or configuration files. When the number of stations is small, the data area available to a single remote device station is small, making it difficult to meet the control requirements of a large number of input / output points or a large amount of remote register data. When the number of stations is large, a single remote device station consumes more master station resources, resulting in a reduction in the number of slave stations that the PLC master station can connect to. At the same time, multiple fixed configurations correspond to multiple CSPP files, which can easily lead to duplicate configuration files, complex engineering maintenance, and inconsistencies between the master station configuration and the device's operating status. Since the CC-Link protocol itself does not provide a user-facing universal configuration parameter channel, it is difficult to directly achieve flexible switching of the number of stations and multipliers by relying solely on the PLC master station's remote register area. Therefore, a processing method is needed that can reconstruct the communication operation rules on the device side and match the PLC master station configuration.

[0062] Therefore, this invention provides a method for varying the number of remote device stations and their multiplier based on the CC-LINK protocol. This method is applied to remote device stations including couplers, EEPROMs, and CC-Link communication protocol chips. (Refer to...) Figure 1,include:

[0063] Step S102: Receive the station count enumeration value and multiplier enumeration value sent by the host computer through serial communication, and write the station count enumeration value and multiplier enumeration value into EEPROM; the station count enumeration value is used to represent one station, two stations, three stations or four stations, and the multiplier enumeration value is used to represent one times, two times, four times or eight times.

[0064] Step S104: After the remote device station is powered on again, the coupler reads the station number enumeration value and the multiplier enumeration value stored in the EEPROM, and determines the number of occupied stations, the expansion multiplier, the DIVISION value and the data area size based on the reading results.

[0065] Step S106: Configure the station number mode pin of the CC-Link communication protocol chip according to the number of occupied stations, and write the expansion ratio into the 0x49 register of the CC-Link communication protocol chip during the program initialization phase and before reading the protocol version status bit.

[0066] The writing to register 0x49 is a pre-configuration operation before communication establishment and is not contingent on the CC-Link protocol Ver.2 mode being determined. After completing the writing to register 0x49, the coupler continues to read the communication status bit and protocol version status bit of the CC-Link communication protocol chip. If the subsequently read protocol version status bit indicates CC-Link protocol Ver.2 mode, the pre-written expansion ratio in register 0x49 is used for the communication frame format with expansion ratio, SQ sequence parsing rules, and PLC variable area mapping rules. If the subsequently read protocol version status bit indicates CC-Link protocol Ver.1 mode, the communication frame format without expansion ratio is used, and the expansion ratio does not participate in the communication frame expansion processing.

[0067] Step S108: Continuously read the communication status bit and protocol version status bit of the CC-Link communication protocol chip. When the communication status bit is not set, maintain the disconnected state and prohibit data interaction. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.1 mode, use the communication frame format without extension ratio and perform data interaction according to the data area mapping rules corresponding to CC-Link protocol Ver.1 mode. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.2 mode, use the communication frame format with extension ratio and enable the corresponding extension ratio SQ sequence parsing rules and PLC variable area mapping rules. The communication status bit is the status bit set by the CC-Link communication protocol chip when the configuration on the PLC master station side and the configuration on the remote device station side meet the communication conditions.

[0068] Step S110: During communication in CC-Link protocol Ver.2 mode, data frames are received according to the SQ sequence corresponding to the expansion ratio, and abnormal SQ data frames are discarded or continuously assembled; during communication in CC-Link protocol Ver.1 mode, data is received and sent according to the communication frame format without expansion ratio.

[0069] The station count enumeration value and expansion ratio enumeration value issued by the host computer are written into the EEPROM. After the remote device station is powered on again, the coupler reads this configuration to determine the number of occupied stations, expansion ratio, DIVISION value, and data area size. Subsequently, during the program initialization phase, the coupler configures the station count mode pin of the CC-Link communication protocol chip according to the number of occupied stations, and writes the initialization configuration information corresponding to the number of occupied stations and expansion ratio into the corresponding configuration bits or registers of the CC-Link communication protocol chip. Among them, the expansion ratio is written into register 0x49, so that the communication protocol chip completes the device-side configuration initialization before communication is established. After the status bit is set, the coupler further reads the protocol version status bit to determine whether the current CC-Link protocol Ver.1 mode or CC-Link protocol Ver.2 mode is used. When CC-Link protocol Ver.1 mode is used, the remote device station uses a communication frame format without extension factor, and the extension factor does not participate in the communication frame extension processing. When CC-Link protocol Ver.2 mode is used, the remote device station uses a communication frame format with extension factor and receives and processes data frames according to the SQ sequence corresponding to the extension factor.

[0070] Existing fixed-station remote equipment stations typically have their station count and data area size determined at the factory, and the PLC engineering side also needs to adopt a corresponding fixed configuration. This application, by re-powering on and reading stored values, enables the remote equipment station to generate its current operating status based on the saved configuration. After matching the configuration with the PLC master station, communication is established, avoiding the problem of modifying parameters only in the host computer interface without synchronized changes to the device communication rules. This allows the remote equipment station to change its resource usage and data capacity in the CC-Link network through software configuration, without needing to set independent hardware models for different station counts and scaling ratios. Before communication is established, the coupler first reconstructs its local operating rules based on the EEPROM configuration, and then uses the status bits of the communication protocol chip to determine whether the master station configuration meets the communication conditions, reducing the risk of data interaction still occurring when the master and slave station configurations are inconsistent. For field engineering, this method can select an appropriate configuration based on the actual number of control points and the number of slave stations that the master station can connect to, thereby improving the engineering adaptability of the remote equipment station and reducing communication errors and variable mapping errors caused by mismatched data area sizes.

[0071] In some embodiments, the TYPE-C interface enables data interaction between the remote device station and the host computer via a serial port. The serial port is used to carry the station count enumeration value and multiplier enumeration value issued by the host computer, so that the station count enumeration value and multiplier enumeration value can be written into the EEPROM of the remote device station via the TYPE-C interface.

[0072] In the CC-Link protocol Ver.1 mode, the remote device station determines the number of stations to occupy based on the station number enumeration value. The expansion ratio does not participate in the communication frame expansion processing, and a communication frame format without expansion ratio is adopted.

[0073] In CC-Link protocol Ver.2 mode, the remote device station determines the number of occupied stations and the expansion ratio based on the station count enumeration value and the expansion ratio enumeration value. The expansion ratio participates in the communication frame expansion processing, and the DIVISION value is determined based on the expansion ratio. The DIVISION value is determined by the following formula: In the formula, This is the DIVISION value; The value corresponding to the expansion multiplier can be 1, 2, 4 or 8.

[0074] The configuration parameters of CC-Link remote device stations are limited to an enumerated combination within the protocol's supported range, and these enumerated values ​​are used in communication initialization via a power-on readout process. This design does not simply state that the number of stations or the expansion ratio is variable; rather, it constrains the configuration input through valid enumerated values, preventing remote device stations from entering configuration states unsupported by the protocol. The fixed relationship between the DIVISION value and the expansion ratio provides a calculable basis for subsequent SQ sequence period and communication data area configuration.

[0075] By limiting the configuration input range through station count and rate enumeration values, the variable configuration of remote device stations always falls within the station count and rate combinations allowed by the CC-Link protocol, reducing the possibility of communication anomalies caused by illegal parameters. The TYPE-C interface, serving as the physical channel for serial communication, allows configuration parameters to be written to the EEPROM by the host computer before device operation and take effect upon the next power-on, facilitating station count and rate switching by field maintenance personnel without replacing the equipment. Simultaneously, the determination of the DIVISION value provides a unified rule for subsequent SQ sequence and data frame assembly, giving multi-rate communication processing a clear calculation basis.

[0076] In some embodiments, under CC-Link protocol Ver.1 mode, the data area size is determined based on the number of occupied stations:

[0077] When the number of stations occupied is one, the digital size of the RX and RY areas is 32 bits, and the word size of the RWr and RWw areas is 4 words.

[0078] When two stations are occupied, the digital size of the RX and RY areas is 64 bits, and the word size of the RWr and RWw areas is 8 words.

[0079] When three stations are occupied, the digital size of the RX and RY areas is 96 bits, and the word size of the RWr and RWw areas is 12 words.

[0080] When four stations are occupied, the digital size of the RX and RY areas is 128 bits, and the word size of the RWr and RWw areas is 16 words.

[0081] The RX area is used to carry digital data fed back from the remote device station to the PLC master station; the RY area is used to carry digital data sent from the PLC master station to the remote device station; the RWr area is used to carry analog data fed back from the remote device station to the PLC master station; and the RWw area is used to carry analog data sent from the PLC master station to the remote device station.

[0082] When the number of occupied stations increases from one to four, the digital size of the RX and RY areas are 32 bits, 64 bits, 96 bits, and 128 bits, respectively, and the word size of the RWr and RWw areas are 4 words, 8 words, 12 words, and 16 words, respectively. The change in the number of station enumeration values ​​is implemented as the specific reconstruction result of the size of the remote device station data area.

[0083] For the CC-Link protocol Ver.1 mode, the scaling factor is not involved in the expansion process; the number of stations is the primary parameter determining the data area size. This application exhaustively enumerates the data area capacity corresponding to each number of stations, and then determines the boundaries of the RX, RY, RWr, and RWw areas based on the station number configuration. In Ver.1 mode, remote devices can form a definite data area configuration based on the different station numbers occupied by one to four stations, avoiding inconsistencies in the understanding of data capacity between the PLC master and the device side. Since each number of stations corresponds to a fixed number of digital bits and words, the coupler can configure the local buffer, variable mapping length, and data read / write range accordingly. This approach helps ensure that the device still has multi-station adaptability even when the scaling factor is not enabled, thus balancing the number of slave stations connected in scenarios with smaller data capacities and the point control requirements in scenarios with larger data capacities.

[0084] In some embodiments, under CC-Link protocol Ver.2 mode, the data area size is determined based on the number of occupied stations and the expansion ratio:

[0085] When the expansion ratio is 1 and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 32 bits, 64 bits, 96 bits and 128 bits respectively, and the word size of the RWr area and RWw area is 4 words, 8 words, 12 words and 16 words respectively.

[0086] When the expansion ratio is doubled and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 32 bits, 96 bits, 160 bits and 224 bits respectively, and the word size of the RWr area and RWw area is 8 words, 16 words, 24 words and 32 words respectively.

[0087] When the expansion ratio is four times and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area are 64 bits, 192 bits, 320 bits and 448 bits respectively, and the word size of the RWr area and RWw area are 16 words, 32 words, 48 ​​words and 64 words respectively.

[0088] When the expansion ratio is eight times and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area are 128 bits, 384 bits, 640 bits and 896 bits respectively, and the word size of the RWr area and RWw area are 32 words, 64 words, 96 words and 128 words respectively.

[0089] The above lists the sizes of the RX, RY, RWr, and RWw zones for stations one through four under expansion ratios of 1x, 2x, 4x, and 8x, respectively, so that remote equipment stations can determine the communication data capacity according to the binary configuration combination in Ver.2 mode.

[0090] The Ver.2 mode expansion ratio is introduced into the remote device station operation model, so that the data area is no longer determined solely by the number of stations, but jointly by the number of stations and the expansion ratio. This configuration method can cover sixteen combinations of station count and expansion ratio in Ver.2 mode, and provides a clear data area size for each combination, thus providing a basis for subsequent buffer allocation, variable area mapping, and frame length parsing by the coupler. In the CC-Link protocol Ver.2 mode, a configuration table corresponding to the number of stations, expansion ratio, and data area size is preset within the remote device station; after the coupler reads the station count enumeration value and expansion ratio enumeration value, it calls the uniquely matching configuration item from the corresponding configuration table, and determines the RX area size, RY area size, RWr area size, and RWw area size accordingly.

[0091] In Ver.2 mode, remote device stations can flexibly select different data capacities according to field requirements. For example, with the number of stations remaining constant, a larger remote register space can be obtained by increasing the expansion ratio; with the expansion ratio remaining constant, digital and word resources can be adjusted by changing the number of stations. Since each combination corresponds to a specific data area size, the PLC master station configuration, CSPP file mapping, and coupler-side operating model can form a consistent data boundary. This approach reduces errors caused by engineers manually calculating data area capacity and allows the same remote device station to cover more field configuration needs.

[0092] In some embodiments, after reading the station count enumeration value and multiplier enumeration value stored in the EEPROM, the coupler generates the current operating model based on the number of occupied stations, the expansion multiplier, the DIVISION value, the RX area size, the RY area size, the RWr area size, and the RWw area size, and configures the uplink digital quantity, downlink digital quantity, uplink analog quantity, and downlink analog quantity that can be used by this remote device station according to the current operating model.

[0093] The current operating model includes the station number field, expansion ratio field, DIVISION field, data area size field, CC-Link protocol Ver.1 mode mapping field, CC-Link protocol Ver.2 mode mapping field, SQ sequence field, and variable area mapping field. The coupler determines the level state of the station number mode pin, the 0x49 register write value, and the data area boundary under each protocol mode based on the current operating model. After reading the protocol version status bit of the CC-Link communication protocol chip, it selects the corresponding data frame parsing length and the tag offset of the PLC variable area.

[0094] By limiting the number of stations and the multiplier enumeration value stored in the EEPROM by the coupler, the current operating model is generated based on the number of occupied stations, the expansion multiplier, the DIVISION value, the size of the RX area, the size of the RY area, the size of the RWr area, and the size of the RWw area. Based on the current operating model, the uplink digital quantity, downlink digital quantity, uplink analog quantity, and downlink analog quantity that can be used by this remote device station are configured. This emphasizes that the device side does not simply save parameters, but reconstructs the allocation of communication resources based on the parameters.

[0095] Traditionally, the number of stations, scaling factor, and data area size of fixed-configuration remote equipment stations are typically fixed in the equipment type or engineering configuration. This application, however, enables the coupler to generate a current operating model based on EEPROM parameters after each power-on, and determine the usable data area accordingly. This model unifies the number of stations, scaling factor, DIVISION value, and four types of data area sizes, supporting subsequent chip configuration, variable mapping, and data frame parsing, providing a traceable and executable intermediate state for the equipment-side configuration. After reading the EEPROM, the coupler first generates the current operating model, and then configures the data area and communication processing rules according to this model, avoiding logical inconsistencies caused by the scattered use of various parameters. For example, when the number of occupied stations changes, the data area size, chip pin status, and PLC variable area mapping all need to change synchronously; when the scaling factor changes, the DIVISION value, SQ sequence, and 0x49 register write value also need to change synchronously. Unified management through the current operating model improves consistency and maintainability during configuration switching.

[0096] In some embodiments, a CSPP file matching the remote device station support mode is imported on the PLC engineering side. The CSPP file is used to limit the protocol version, number of stations occupied, expansion ratio, data area size, and variable area label mapping on the PLC master station side, so that the PLC master station side forms a communication frame structure corresponding to the selected configuration.

[0097] The CSPP file includes vendor ID, product ID, vendor information, product name, protocol version, number of occupied stations, extension ratio, version field, CRC field, parameter validity verification field, and a mapping table for tag name, offset, and length.

[0098] The CSPP file defines four configurations in the CC-Link protocol Ver.1 mode and sixteen configurations in the CC-Link protocol Ver.2 mode. Each configuration corresponds to a fixed number of occupied stations, expansion ratio, RX area size, RY area size, RWr area size, and RWw area size.

[0099] The CSPP file is used to configure the corresponding station number and multiplier parameters in the PLC project, and to map the variable parameters to the PLC variable area through standardized labels.

[0100] The above content is limited to providing a variable-configuration CSPP file to the PLC project to match the variable station configuration of the coupler. This CSPP file includes vendor ID, product ID, vendor information, product name, protocol version, number of occupied stations, expansion ratio, version field, CRC field, parameter validity verification field, and a mapping table for tag name, offset, and length. It defines four configurations in Ver.1 mode and sixteen configurations in Ver.2 mode. Each configuration corresponds to a fixed number of occupied stations, expansion ratio, RX area size, RY area size, RWr area size, and RWw area size.

[0101] By mapping the variable operation model on the equipment side to the configuration file on the PLC engineering side, the twenty configurations supported by remote equipment stations can be presented and selected in a standardized manner within the PLC engineering. The PLC engineering side can manage multiple combinations of station numbers and multipliers for remote equipment stations through the same variable configuration file, reducing the repetitive maintenance of multiple configuration files for fixed-number equipment. Since the CSPP file defines a mapping table for the data area size and variable area for each configuration, engineers can directly identify the start address, end address, and tag length of each slave station when configuring multiple slave stations, reducing manual conversions. Version fields, CRC fields, and parameter validity verification fields further constrain file integrity and configuration validity at the engineering configuration level, thereby reducing the possibility of communication anomalies caused by engineering configuration errors.

[0102] In some embodiments, after the PLC master station completes the configuration according to the imported CSPP file and powers back on, the CC-Link communication protocol chip compares the configuration on the PLC master station side and the configuration on the coupler side. When the comparison is successful, the CC-Link communication protocol chip sets the communication status bit. After the coupler reads the communication status bit, it establishes communication and reads the protocol version status bit to determine whether the current CC-Link protocol Ver.1 mode or CC-Link protocol Ver.2 mode is used. When the protocol version status bit indicates CC-Link protocol Ver.1 mode, the coupler uses a communication frame format without extension ratio for data interaction. When the protocol version status bit indicates CC-Link protocol Ver.2 mode, the coupler uses a communication frame format with extension ratio for data interaction.

[0103] Specifically, when the number of stations occupied configured on the PLC master station side is the same as the current number of stations occupied on the coupler side, and the expansion ratio configured on the PLC master station side is greater than the current expansion ratio on the coupler side, the data area allocated on the PLC master station side covers the data area required by the current operating model on the coupler side, and the coupler completes data reading and writing within the data range defined by its own current operating model.

[0104] This application combines the PLC master station configuration results, communication protocol chip status bits, and coupler-side communication establishment conditions to form a control logic that only performs data interaction after configuration matching. This logic prevents remote devices from entering communication mode when the number of stations on the master station side is inconsistent, thus establishing a clear correlation between communication establishment conditions and the number of stations and the multiplier configuration. If the number of stations on the PLC master station side and the coupler side is inconsistent, their understanding of station resource usage and data frame boundaries differs, and direct communication can easily lead to data misalignment. This application avoids this risk by using rules such as unset status bits and no communication establishment. If the number of stations is consistent but the PLC master station has a higher multiplier, the master station's data area can cover the actual usage range on the device side, and the coupler can perform data interaction within the limits of its current operating model, thereby balancing engineering configuration fault tolerance and communication security to a certain extent.

[0105] In some embodiments, the SQ sequence parsing rules include: when the expansion ratio is eight times, the starting SQ sequence number is 7, and the SQ sequence cycles through 7, 6, 5, 4, 3, 2, 1, and 0; when the expansion ratio is four times, the starting SQ sequence number is 3, and the SQ sequence cycles through 3, 2, 1, and 0; when the expansion ratio is two times, the starting SQ sequence number is 1, and the SQ sequence cycles through 1 and 0; when the expansion ratio is one times, the SQ sequence number is always 0, and the data frame structure configured at one times in CC-Link protocol Ver.2 mode is consistent with the data frame structure in CC-Link protocol Ver.1 mode; the starting SQ sequence number is determined by the following formula: In the formula, The starting SQ serial number; The value corresponding to the expansion multiplier can be 1, 2, 4 or 8.

[0106] When the expansion ratio is eight times, the starting SQ sequence number is 7, and the SQ sequence cycles through 7, 6, 5, 4, 3, 2, 1, 0; when the expansion ratio is four times, the starting SQ sequence number is 3, and the SQ sequence cycles through 3, 2, 1, 0; when the expansion ratio is two times, the starting SQ sequence number is 1, and the SQ sequence cycles through 1, 0; when the expansion ratio is one times, the SQ sequence number is always 0, and the data frame structure configured in Ver.2 mode is consistent with the data frame structure in Ver.1 mode.

[0107] This application binds the expansion ratio to the starting value of the SQ sequence, the cycle range, and the frame structure compatibility. Since multi-rate communication in Ver.2 mode requires identifying the data order of different polling frames through the SQ sequence, if only the expansion ratio is changed without altering the SQ parsing rules, the coupler will be unable to correctly assemble the complete data area. This application determines the starting SQ sequence number and limits the receiving order through a descending cycle rule, enabling the coupler to identify the position of each frame in the complete data area based on the expansion ratio, thus providing a definite sequence basis for data frame reception at different expansion ratios. In 8x, 4x, and 2x modes, the coupler can determine whether the received data frame belongs to the current cycle, whether a transition has occurred, and whether it can be used for continuous assembly based on the SQ sequence; in 1x mode, the SQ is always zero and compatible with the Ver.1 mode frame structure, avoiding unnecessary multi-frame assembly processing. This rule provides a basis for discarding abnormal SQ data frames, selecting duplicate frames, and recovering lost starting frames, thereby improving the orderliness of multi-rate data communication processing.

[0108] In some embodiments, in multi-rate communication using the CC-Link protocol Ver.2 mode, a complete data area is assembled as follows: In the formula, For a complete data area; This is the first state field; This is the second status field; This is the third state field; For the serial number field; This is a numeric data field, corresponding to RX area data or RY area data; For remote register read word count field; Write a word field to a remote register; The fields are concatenated in the order of the communication frames; among them, and These are fields shared by both CC-Link protocol Ver.1 and CC-Link protocol Ver.2 modes. and For CC-Link protocol Ver.2 mode, the fields LoopbackSQ, ReceptionSQ, and TransmissionSQ change according to the current frame direction and SQ sequence during each polling.

[0109] The complete data area is formed by concatenating the first status field, second status field, third status field, sequence number field, digital data field, remote register read word field, and remote register write word field in the order of the communication frames. The first and second status fields are shared by both Ver.1 and Ver.2 modes, while the third status field and SQ field are effective in Ver.2 mode. LoopbackSQ, ReceptionSQ, and TransmissionSQ change according to the current frame direction and SQ sequence during each polling. In the frame direction where the remote device station receives data from the PLC master station, the digital data field corresponds to the RY area data, and the remote register write word field corresponds to the RWw area data. In the frame direction where the remote device station feeds back data to the PLC master station, the digital data field corresponds to the RX area data, and the remote register read word field corresponds to the RWr area data.

[0110] By combining the data frame structure of multi-rate communication in Ver.2 mode with SQ sequence changes for constraint, the coupler can correctly identify status fields, sequence fields, and data fields under different protocol versions and frame directions, thereby improving the feasibility of data frame parsing and assembly. In Ver.2 mode, the coupler not only needs to identify the data content but also distinguish between status fields, SQ fields, and data area fields in different directions. By representing the complete data area as a field sequence concatenation structure, the program can parse the data according to fixed field boundaries and determine the position of the current frame within a complete cycle by combining the SQ sequence. This approach helps reduce parsing errors during protocol version switching, rate switching, or frame direction changes, and provides a clear data source for PLC variable area mapping.

[0111] In some embodiments, performing discarding or continuous assembly processing on abnormal SQ data frames includes:

[0112] When an abnormal transition occurs in the SQ sequence, the corresponding data frame is discarded as an abnormal frame. An abnormal transition refers to a non-continuous transition in the received SQ sequence number relative to the previous normal SQ sequence number.

[0113] When the initial SQ data frame is lost, subsequent SQ data frames are discarded as abnormal frames until the next initial SQ data frame is received and normal processing resumes.

[0114] In multi-rate SQ sequence communication scenarios, specific abnormal frame handling rules are set up, enabling the coupler to conditionally handle transitions, lost start frames, and duplicate frames, rather than simply terminating communication or indiscriminately receiving all frames. In particular, for duplicate SQ data frames, the last duplicate frame that can be connected to the preceding and following normal frames is retained, which helps maintain the continuity of data area assembly in partially repeated transmission scenarios.

[0115] When subsequent SQ data frames are not continuous and there are duplicate SQ data frames, the last duplicate SQ data frame used to connect the previous normal SQ data frame and the next normal SQ data frame will be used as a normal data frame, and the remaining duplicate SQ data frames will be discarded.

[0116] In some embodiments, when the stored value in the EEPROM is corrupted, missing, or fails to be verified, the coupler defaults to running in a four-station eight-times mode and generates the current running model.

[0117] If communication fails after switching to a new configuration, the system will not revert to the most recent valid configuration; instead, the value of the new configuration will overwrite the value of the previous configuration.

[0118] If a power failure occurs during the remote upgrade process, the upgrade process will be aborted. After power is restored, the process will resume according to the original procedure.

[0119] If a power failure occurs during parameter writing, the parameter configuration will take effect according to the parameters written to the EEPROM at the time of power failure after power is restored.

[0120] By implementing abnormal frame handling rules and classifying EEPROM anomalies, communication failures without rollback, upgrade power-offs, and parameter write power-offs as configuration anomalies, this application improves the deterministic handling of abnormal communication and configuration scenarios by remote equipment stations. If SQ anomaly transitions and start frame loss are not handled, data areas may be assembled in the wrong order; if duplicate frames are all discarded or all received, the connection between preceding and following frames may be disrupted. This application uses categorized processing to enable the coupler to resume normal cycle processing after the arrival of the next start SQ data frame. For EEPROM anomalies and power-off anomalies, this application defines deterministic operating rules after power-on, preventing the equipment from entering an unpredictable state and helping field maintenance personnel troubleshoot communication failures and restore configuration consistency according to established rules.

[0121] Another embodiment of the present invention provides a device for varying the number of remote device stations and their multiplier based on the CC-LINK protocol, applied to a remote device station including a coupler, an EEPROM, and a CC-Link communication protocol chip, comprising:

[0122] The receiving module is used to receive the station count enumeration value and multiplier enumeration value sent by the host computer through serial communication, and write the station count enumeration value and multiplier enumeration value into EEPROM; the station count enumeration value is used to represent one station, two stations, three stations or four stations, and the multiplier enumeration value is used to represent one times, two times, four times or eight times.

[0123] The first reading module is used to read the station count enumeration value and the multiplier enumeration value stored in the EEPROM after the remote device station is powered on again, and to determine the number of occupied stations, the expansion multiplier, the DIVISION value and the data area size based on the reading results.

[0124] The write module is used to configure the station number mode pin of the CC-Link communication protocol chip according to the number of occupied stations, and write the expansion ratio into the 0x49 register of the CC-Link communication protocol chip during the program initialization phase and before reading the protocol version status bit.

[0125] The second reading module continuously reads the communication status bit and protocol version status bit of the CC-Link communication protocol chip. When the communication status bit is not set, it remains in a disconnected state and prohibits data interaction. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.1 mode, it uses a communication frame format without extension ratio and performs data interaction according to the data area mapping rules corresponding to CC-Link protocol Ver.1 mode. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.2 mode, it uses a communication frame format with extension ratio and enables the corresponding SQ sequence parsing rules and PLC variable area mapping rules. The communication status bit is the status bit set by the CC-Link communication protocol chip when the configuration on the PLC master station side and the configuration on the remote device station side meet the communication conditions.

[0126] The processing module is used to receive data frames according to the SQ sequence corresponding to the expansion ratio during communication in the CC-Link protocol Ver.2 mode, and to perform discarding or continuous assembly processing on abnormal SQ data frames.

[0127] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.

[0128] Based on the same inventive concept as the above method embodiments, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it enables the electronic device to implement the control method described in the above embodiments.

[0129] In one embodiment, the electronic device may be a server, and in this embodiment, the structure of the electronic device may be as follows: Figure 2 As shown, it includes a memory, a communication module, and one or more processors.

[0130] Memory is used to store computer programs executed by the processor. Memory can be mainly divided into a program storage area and a data storage area. The program storage area can store the operating system and programs required to run instant messaging functions, etc.; the data storage area can store various instant messaging information and operation instruction sets, etc.

[0131] Memory can be volatile memory, such as random access memory (RAM); memory can also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory can be any other medium capable of carrying or storing a desired computer program having the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory can be a combination of the above-mentioned types of memory.

[0132] A processor may include one or more central processing units (CPUs) or digital processing units, etc. A processor is used to implement the aforementioned data processing methods when a computer program stored in memory is invoked.

[0133] The communication module is used to communicate with terminal devices and other servers.

[0134] This application embodiment does not limit the specific connection medium between the above-described memory, communication module, and processor. This application embodiment... Figure 2 The memory and processor are connected via a bus, and the bus is in... Figure 2 The connections between other components are illustrated with arrows and are for illustrative purposes only, not as limiting information. Buses can be categorized as address buses, data buses, control buses, etc. For ease of description, Figure 2 The text uses only one arrow to describe it, but does not indicate that there is only one bus or one type of bus.

[0135] Based on the same inventive concept as the above-described method embodiments, embodiments of the present invention also provide a computer-readable storage medium for storing a computer program. When the computer program is run on a computer, it enables an electronic device to implement the control methods described in the above embodiments. The computer-readable storage medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.

[0136] Based on the same inventive concept as the above-described method embodiments, embodiments of the present invention also provide a computer program product. The computer program product includes a computer program that, when run on an electronic device, causes the electronic device to perform the steps of the control methods described above according to various exemplary embodiments of this application. The program product may take the form of any combination of one or more readable media. These computer program commands can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the commands executed by the processor of the computer or other programmable data processing device generate a process for implementing... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0137] While the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the invention. Those skilled in the art can make various modifications and refinements without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention shall be determined by the claims.

Claims

1. A method for varying the number of remote device stations and their multiplier based on the CC-LINK protocol, applied to a remote device station including a coupler, EEPROM, and a CC-Link communication protocol chip, characterized in that... include: The system receives station count enumeration values ​​and multiplier enumeration values ​​from the host computer via serial communication and writes these values ​​into the EEPROM. The station count enumeration values ​​represent one, two, three, or four stations, and the multiplier enumeration values ​​represent one, two, four, or eight times the multiplier. After the remote equipment station is powered on again, the coupler reads the station count enumeration value and the multiplier enumeration value stored in the EEPROM, and determines the number of occupied stations, the expansion multiplier, the DIVISION value and the data area size based on the reading results; Configure the station number mode pin of the CC-Link communication protocol chip according to the number of occupied stations, and write the expansion ratio into the 0x49 register of the CC-Link communication protocol chip during the program initialization phase and before reading the protocol version status bit. The system continuously reads the communication status bit and protocol version status bit of the CC-Link communication protocol chip. When the communication status bit is not set, the system remains in a disconnected state and data interaction is prohibited. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.1 mode, a communication frame format without extension ratio is used, and data interaction is performed according to the data area mapping rules corresponding to CC-Link protocol Ver.1 mode. When the communication status bit is set and the protocol version status bit indicates CC-Link protocol Ver.2 mode, a communication frame format with extension ratio is used, and the corresponding SQ sequence parsing rules and PLC variable area mapping rules are enabled. The communication status bit is a status bit set by the CC-Link communication protocol chip when the communication conditions are met by the configuration on the PLC master station side and the remote device station side. During communication in the CC-Link protocol Ver.2 mode, data frames are received according to the SQ sequence corresponding to the expansion ratio, and abnormal SQ data frames are discarded or continuously assembled.

2. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 1, characterized in that, The TYPE-C interface enables data interaction between the remote device station and the host computer via a serial port. The serial port is used to transmit the station number enumeration value and the multiplier enumeration value issued by the host computer. In the CC-Link protocol Ver.1 mode, the remote device station determines the number of stations to occupy based on the station number enumeration value. The expansion ratio does not participate in the communication frame expansion processing, and a communication frame format without expansion ratio is adopted. In CC-Link protocol Ver.2 mode, the remote device station determines the number of occupied stations and the expansion ratio based on the station count enumeration value and the expansion ratio enumeration value. The expansion ratio participates in the communication frame expansion processing, and the DIVISION value is determined based on the expansion ratio. The DIVISION value is determined by the following formula: In the formula, This is the DIVISION value; The value corresponding to the expansion multiplier can be 1, 2, 4 or 8.

3. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 2, characterized in that, In CC-Link protocol Ver.1 mode, the data area size is determined based on the number of occupied stations: When the number of stations occupied is one, the digital size of the RX and RY areas is 32 bits, and the word size of the RWr and RWw areas is 4 words. When the number of stations occupied is two, the digital size of the RX area and the RY area is 64 bits, and the word size of the RWr area and the RWw area is 8 words. When three stations are occupied, the digital size of the RX and RY areas is 96 bits, and the word size of the RWr and RWw areas is 12 words. When four stations are occupied, the digital size of the RX and RY areas is 128 bits, and the word size of the RWr and RWw areas is 16 words.

4. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 2, characterized in that, In CC-Link protocol Ver.2 mode, the data area size is determined based on the number of occupied stations and the expansion ratio: When the expansion ratio is 1 and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 32 bits, 64 bits, 96 bits and 128 bits respectively, and the word size of the RWr area and RWw area is 4 words, 8 words, 12 words and 16 words respectively. When the expansion ratio is double and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 32 bits, 96 bits, 160 bits and 224 bits respectively, and the word size of the RWr area and RWw area is 8 words, 16 words, 24 words and 32 words respectively. When the expansion ratio is four times and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area is 64 bits, 192 bits, 320 bits and 448 bits respectively, and the word size of the RWr area and RWw area is 16 words, 32 words, 48 ​​words and 64 words respectively. When the expansion ratio is eight times and the number of stations occupied is one, two, three or four, the digital size of the RX area and RY area are 128 bits, 384 bits, 640 bits and 896 bits respectively, and the word size of the RWr area and RWw area are 32 words, 64 words, 96 words and 128 words respectively.

5. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 1, characterized in that, After reading the station count enumeration value and multiplier enumeration value stored in the EEPROM, the coupler generates the current operating model based on the number of occupied stations, expansion multiplier, DIVISION value, RX area size, RY area size, RWr area size and RWw area size, and configures the uplink digital quantity, downlink digital quantity, uplink analog quantity and downlink analog quantity that can be used by this remote device station according to the current operating model; The current operating model includes the station number segment, expansion ratio field, DIVISION field, data area size field, CC-Link protocol Ver.1 mode mapping field, CC-Link protocol Ver.2 mode mapping field, SQ sequence field, and variable area mapping field. The coupler determines the level state of the station number mode pin, the 0x49 register write value, and the data area boundary under each protocol mode based on the current operating model. After reading the protocol version status bit of the CC-Link communication protocol chip, it selects the corresponding data frame parsing length and the tag offset of the PLC variable area.

6. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 1, characterized in that, Import a CSPP file that matches the remote device station support mode on the PLC engineering side. The CSPP file is used to limit the protocol version, number of stations occupied, expansion ratio, data area size and variable area label mapping on the PLC master station side, so that the PLC master station side forms a communication frame structure corresponding to the selected configuration. The CSPP file includes vendor ID, product ID, vendor information, product name, protocol version, number of occupied stations, expansion ratio, version field, CRC field, parameter validity verification field, and a mapping table of tag name, offset, and length. The CSPP file defines four configurations in the CC-Link protocol Ver.1 mode and sixteen configurations in the CC-Link protocol Ver.2 mode. Each configuration corresponds to a fixed number of occupied stations, expansion ratio, RX area size, RY area size, RWr area size, and RWw area size. The CSPP file is used to configure the corresponding station number and multiplier parameters in the PLC project, and to map the variable parameters to the PLC variable area through standardized labels.

7. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 6, characterized in that, After the PLC master station completes the configuration based on the imported CSPP file and powers back on, the CC-Link communication protocol chip compares the configuration on the PLC master station side with the configuration on the coupler side. When the comparison is successful, the CC-Link communication protocol chip sets the communication status bit. After the coupler reads the communication status bit, it establishes communication and reads the protocol version status bit to determine whether the current CC-Link protocol Ver.1 mode or CC-Link protocol Ver.2 mode is used. When the protocol version status bit indicates CC-Link protocol Ver.1 mode, the coupler uses a communication frame format without extension ratio for data interaction. When the protocol version status bit indicates CC-Link protocol Ver.2 mode, the coupler uses a communication frame format with extension ratio for data interaction.

8. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 1, characterized in that, The SQ sequence parsing rules include: when the expansion ratio is eight times, the starting SQ sequence number is 7, and the SQ sequence cycles through 7, 6, 5, 4, 3, 2, 1, and 0; when the expansion ratio is four times, the starting SQ sequence number is 3, and the SQ sequence cycles through 3, 2, 1, and 0; when the expansion ratio is two times, the starting SQ sequence number is 1, and the SQ sequence cycles through 1 and 0; when the expansion ratio is one time, the SQ sequence number is always 0, and the data frame structure configured at one time in CC-Link protocol Ver.2 mode is consistent with the data frame structure in CC-Link protocol Ver.1 mode; the starting SQ sequence number is determined by the following formula: In the formula, The starting SQ serial number; The value corresponding to the expansion multiplier can be 1, 2, 4 or 8.

9. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 8, characterized in that, In multi-rate communication using the CC-Link protocol Ver.2 mode, a complete data area is assembled as follows: In the formula, For a complete data area; This is the first state field; This is the second status field; This is the third state field; For the serial number field; This is a numeric data field, corresponding to RX area data or RY area data; For remote register read word count field; Write a word field to a remote register; The fields are concatenated in the order of the communication frames; among them, and These are fields shared by both CC-Link protocol Ver.1 and CC-Link protocol Ver.2 modes. and For CC-Link protocol Ver.2 mode, the fields LoopbackSQ, ReceptionSQ, and TransmissionSQ change according to the current frame direction and SQ sequence during each polling.

10. The method for varying the number and multiplier of remote equipment stations based on the CC-LINK protocol according to claim 1, characterized in that, The abnormal SQ data frame is subjected to either discarding or continuous assembly processing, including: When an abnormal transition occurs in the SQ sequence, the corresponding data frame is discarded as an abnormal frame. When the initial SQ data frame is lost, subsequent SQ data frames are discarded as abnormal frames until the next initial SQ data frame is received and normal processing resumes. When subsequent SQ data frames are not continuous and there are duplicate SQ data frames, the last duplicate SQ data frame used to connect the previous normal SQ data frame and the next normal SQ data frame will be used as a normal data frame, and the remaining duplicate SQ data frames will be discarded. When the stored value in the EEPROM is corrupted, missing, or fails to be verified, the coupler will run in four-station eight-times mode by default. If communication fails after switching to a new configuration, the system will not revert to the most recent valid configuration; the value of the new configuration will overwrite the value of the previous configuration. If a power failure occurs during a remote upgrade, the upgrade process will be aborted. After power is restored, the process will resume according to the original procedure. If a power failure occurs during parameter writing, the parameter configuration will take effect according to the parameters written to the EEPROM at the time of power failure after power is restored.