CN109587215B - Data synchronization method from master station to slave station of CANopen - Google Patents

Data synchronization method from master station to slave station of CANopen Download PDF

Info

Publication number
CN109587215B
CN109587215B CN201811303689.XA CN201811303689A CN109587215B CN 109587215 B CN109587215 B CN 109587215B CN 201811303689 A CN201811303689 A CN 201811303689A CN 109587215 B CN109587215 B CN 109587215B
Authority
CN
China
Prior art keywords
data
slave
data synchronization
user variable
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811303689.XA
Other languages
Chinese (zh)
Other versions
CN109587215A (en
Inventor
文长明
文可
卢昌虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Baode Industrial Automation Co ltd
Original Assignee
Hefei Baode Industrial Automation Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei Baode Industrial Automation Co ltd filed Critical Hefei Baode Industrial Automation Co ltd
Priority to CN201811303689.XA priority Critical patent/CN109587215B/en
Publication of CN109587215A publication Critical patent/CN109587215A/en
Application granted granted Critical
Publication of CN109587215B publication Critical patent/CN109587215B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/403Bus networks with centralised control, e.g. polling

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a data synchronization method from a master station to a slave station of CANopen, which is used for synchronizing data of the master station to a plurality of slave stations. User variable parameters and data synchronization parameters of the master station and the plurality of slave stations are respectively defined. And respectively associating all the user variable parameters and the data synchronization parameters with related objects in the object dictionary and the mapping table. The data synchronization method comprises the following steps: step S1: polling each item of the process data object table of the master station; step S2: judging whether the current value of the related data in the object dictionary is consistent with the copy, if so, sending the user variable of the master station corresponding to the related data to a CAN bus, otherwise, skipping to the step S1; step S3: and the slave station receives the CAN message through the CAN bus, and updates the output of the user variable corresponding to the slave station according to the received CAN message. The invention realizes the data synchronization of a plurality of master stations and slave stations by judging whether the related data in the object dictionary changes and transmitting the changed data to the slave stations when the related data in the object dictionary changes.

Description

Data synchronization method from master station to slave station of CANopen
Technical Field
The invention relates to a data synchronization method in the technical field of communication, in particular to a data synchronization method from a master station to a slave station of CANopen.
Background
The PLC slave station and the PLC master station which communicate based on the CANopen protocol are limited by the number of the slave modules, need to be expanded, and are additionally provided with a plurality of PLC expansion modules. Due to the fact that specific hardware or application of the master station and the slave station is varied, the number and types of the extensible modules are random, the PLC extensible modules can input or output digital quantity or analog quantity, and existing data synchronization cannot meet requirements. Therefore, it is necessary to design a master-to-slave data synchronization method based on CANopen.
Disclosure of Invention
Technical problem to be solved
Aiming at the defects of the prior art, the invention provides a data synchronization method from a master station to a slave station of CANopen, which has the advantages of comprehensiveness, convenience and the like and solves the problem that the existing data synchronization method cannot meet the data synchronization requirement from the master station to the slave station.
(II) technical scheme
In order to achieve the comprehensive and convenient purposes, the invention provides the following technical scheme: a data synchronization method from a master station to a slave station of CANopen is used for synchronizing data of the master station to a plurality of slave stations; respectively defining a user variable parameter and a data synchronization parameter of a master station, and defining user variable parameters and data synchronization parameters of a plurality of slave stations corresponding to the user variable parameter and the data synchronization parameter of the master station; respectively associating all user variable parameters and data synchronization parameters with related objects in the object dictionary and the mapping table;
newly building a processing data object table and a communication object table in the master station and the plurality of slave stations; a specific field of each table entry of the processing data object table corresponds to a table entry of the communication object parameter table, and another specific field corresponds to a mapping of the mapping table;
the data synchronization method comprises the following steps:
step S1: polling each item of the process data object table of the master station;
step S2: judging whether the current value of the related data in the object dictionary is consistent with the copy, if so, sending the user variable of the master station corresponding to the related data to a CAN bus, otherwise, skipping to the step S1;
step S3: and the slave station receives the CAN message through the CAN bus, and updates the output of the user variable corresponding to the slave station according to the received CAN message.
As a further improvement of the scheme, a user variable parameter table and a data synchronization parameter table are newly built in the master station and all the slave stations; the user variable parameter table and the data synchronization parameter table comprise a plurality of table items which are respectively provided with a plurality of fields; the communication object table comprises a plurality of table entries which are respectively provided with a plurality of fields, a specific field in each table entry corresponds to one data structure CAN MSG, and each data structure CANMSG comprises a plurality of data fields.
Further, the method for judging whether the current value of the related data in the object dictionary is consistent with the copy comprises the following steps: polling all the entries of the processed data object table once in a polling process, and sequentially checking all the entries of the processed data object table; finding a mapping field according to each table entry of the processing data object table, mapping the mapping field to a related object in the object dictionary, and determining a corresponding user variable; setting the corresponding user variable to the data field of the corresponding data structure CAN MSG; and judging whether the data field of the CAN MSG of the data structure is the same as the copy of the table entry corresponding to the processed data object table, if so, judging that the current value of the related data in the object dictionary is consistent with the copy, and otherwise, judging that the current value of the related data in the object dictionary is inconsistent with the copy.
Further, after judging that the related data in the object dictionary changes, setting the state of the corresponding table entry of the processed data object table as a signal sending state; and sequentially detecting the states of all the table entries of the processed data object table again, and sending the user variable of the main station corresponding to the related data to the CAN bus when detecting that one table entry of the processed data object table is effective and in a signal sending state.
Still further, the method for updating the output of the user variable corresponding to the slave station comprises the following steps: assigning the corresponding user variable of the master station to the data field of the corresponding data structure CAN MSG, setting time records related to communication in the table items of the processing data object table, determining the structural body of the table items corresponding to the communication object table, filling the content of the data field of the corresponding data structure CAN MSG into a CAN hardware register, and sending a message to a CAN bus.
As a further improvement of the above scheme, in step S3, the CAN controller of the slave station receives the message and stores the message in the message area; the slave station processes the messages received by the slave station in the polling of the master station, and sequentially processes all the message messages in the message area until all the message messages are processed.
Further, the method for the slave station to process the message in the message area comprises the following steps: and searching data fragments of the data structure CAN MSG in all the table entries of the communication object table according to the CAN ID, finding out the data structure CAN MSG consistent with the CAN ID in the received message, finding out the table entry corresponding to the communication object table, and copying the data field in the received message to the data field of the corresponding data structure CAN MSG.
As a further improvement of the scheme, the slave station is provided with one data port of a digital quantity input end, a digital quantity output end, a digital quantity input and output end, an analog quantity input end, an analog quantity output end and an analog quantity input and output end.
As a further improvement of the above scheme, the object dictionary includes a primary mapping table, and the primary mapping table includes a plurality of entries in which a plurality of fields are respectively set; one field in each table entry of the primary mapping table corresponds to one secondary mapping table; the second-level mapping table comprises a plurality of table items with a plurality of fields respectively, and one field in each table item of each second-level mapping table corresponds to one dictionary variable or dictionary structure.
As a further improvement of the above solution, the data structure CAN MSG includes a plurality of fields, and the data structure CAN MSG is used to set a register of a CAN controller; when sending a message, hardware is arranged in the CAN controller through the corresponding data structure CAN MSG, and when receiving the message, the message is filled in the structure in the corresponding data structure CAN MSG.
(III) advantageous effects
Compared with the prior art, the invention provides a data synchronization method from a master station to a slave station of CANopen, which has the following beneficial effects:
the data synchronization method from the master station to the slave station of the CANopen comprises the steps of defining user variable parameters and data synchronization parameters of the master station and the plurality of slave stations, respectively associating the user variable parameters and the data synchronization parameters with related objects and mapping tables in an object dictionary, creating a user variable parameter table, a data synchronization parameter table, a processing data object table and a communication object table, carrying out internal mutual correspondence, judging whether related data in the object dictionary change or not, and sending changed data to the slave stations through a CAN bus when the related data change, so that data synchronization of the master station and the plurality of slave stations is realized. The invention can be comprehensively applied to the input and output of various types of data of the slave station, and is convenient for the data synchronization from the master station to the slave station based on the CANopen protocol. In addition, the invention can realize the data synchronization of the master station and the slave station only by modifying the parameters defined by the user, simplifies the data synchronization process of CANopen and improves the data synchronization efficiency.
Drawings
Fig. 1 is a schematic topology diagram between a PLC master module and a plurality of PLC extension modules in a master-to-slave data synchronization method of CANopen according to embodiment 1 of the present invention;
fig. 2 is a schematic structural diagram of an object dictionary of CANopen in embodiment 1 of the present invention;
fig. 3 is a schematic structural diagram of a user variable parameter table and a data synchronization parameter table of a data synchronization method from a master station to a slave station of CANopen according to embodiment 1 of the present invention;
fig. 4 is a schematic structural diagram of a PDO table of a master-to-slave data synchronization method of CANopen according to embodiment 1 of the present invention;
fig. 5 is a schematic structural diagram of a COB table of a master-to-slave data synchronization method of CANopen according to embodiment 1 of the present invention;
fig. 6 is an overall framework diagram of the master-to-master data synchronization method for CANopen according to embodiment 1 of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
Referring to fig. 1, the master-to-slave data synchronization method of CANopen of the present embodiment is used to synchronize data of a master to multiple slaves. The PLC extension module (slave station) is provided with a data port of a digital quantity input end, a digital quantity output end, a digital quantity input end, an analog quantity output end and an analog quantity input end. The PLC extension 1 inputs only digital quantity, and the PLC extension 2 outputs only digital quantity. The PLC extension 3 inputs and outputs digital values. The PLC extension 4 inputs only analog values, and the PLC extension 5 outputs only analog values. The PLC extension 5 inputs and outputs both analog quantities. The master PLC module (master station) acquires the input states of the PLC expansion modules 1, 3, 4 and 6 (slave stations with input functions), and simultaneously transmits output signals of the master PLC module to the PLC expansion modules 2, 3, 5 and 6 (slave stations with output functions) through the CAN bus and outputs the output signals respectively.
Referring to fig. 2, an object dictionary is a collection of a series of data objects distributed in a memory, and is designed as a data collection consisting of a primary mapping data structure (table), a secondary mapping data structure, and specific data objects. The object dictionary includes a first-level mapping table including a plurality of entries in which a plurality of fields are respectively set. One field in each table entry of the primary mapping table corresponds to one secondary mapping table. The secondary mapping table comprises a plurality of table entries with a plurality of fields respectively, and one field in each table entry of each secondary mapping table corresponds to one dictionary variable or dictionary structure. The data organization form of the object dictionary can conveniently set and inquire any data, a data object is searched for and needs to be searched by a first-level mapping table, a second-level mapping table pointed by the first-level mapping table is found, and then a specific data object is found by the second-level mapping table.
Referring to fig. 3, user variable parameters (including user variables, and also including callback processing, indexes, sub-indexes, validity, etc.) and data synchronization parameters of each PLC extension module are defined, and a user variable parameter table and a data synchronization parameter table are newly built in the PLC extension module. The user variables pointed to by these user variable parameters are related to hardware input and output of a specific extension module, and the pointed-to variables are called specific device variables, and then corresponding data synchronization parameters are defined for these specific device variables. The user variable parameter table and the data synchronization parameter table both comprise a plurality of table items which are respectively provided with a plurality of fields. And defining user variable parameters and data synchronization parameters of the PLC main module, wherein the user variable parameters and the data synchronization parameters of the PLC main module respectively correspond to the user variable parameters and the data synchronization parameters of each PLC expansion module.
And respectively associating all the user variable parameters and the data synchronization parameters with related objects and mapping tables in the object dictionary, so that the operation object dictionary is actually equal to the operation real equipment variable. In this embodiment, the number of synchronization objects in the object dictionary may be added by a preset amount through the macro.
The index and sub-index of the user variable parameter are two parameters for finding a specific object in the object dictionary, the user variable pointed to in the user variable parameter is a variable related to input and output of the equipment, the variable is bound to a structure or a variable in the object dictionary, and the pointer of the corresponding object in the object dictionary is exactly pointed to the variable defined by the user, and then the pointers in the object dictionary are operated to be equal to the variables which are defined by the user and are related to input and output.
The synchronization parameters are set to two parts of synchronization configuration and synchronization mapping in the object dictionary, the synchronization configuration is some parameters of synchronization control, such as timeout and the like, the synchronization mapping indicates which objects are synchronized, and the synchronization mapping is a mapping relation (the mapping is different from a primary and secondary mapping table in the object dictionary, the mapping is related to a processed data object table, and the processed data object table is a mapping of variables needing synchronization), and the objects can be found through indexes and sub-indexes.
Referring to fig. 4, a processed data object table (PDO table) is newly created in the PLC main module and the plurality of PLC extension modules, and a memory area for processing the data object table is opened up. Because the user variable parameter sets the relevant part in the object dictionary, the synchronous configuration and synchronous mapping part in the object dictionary are directly related to the PDO table, and when the user data synchronous parameter is set in the object dictionary in the step two, the PDO table is indirectly set for the first time. The processing data object table includes a plurality of entries in which a plurality of fields are respectively set. The process data object table sets a plurality of process parameters. The processing parameters are timeout, synchronized data type, size, number, CAN identification number, state, mode, current time, last receiving time and other parameters. The PDO table is used in a dynamic process for data synchronization and comprises a mapping relation of variables needing synchronization.
The PDO table generally has a plurality of entries (specifically, how many are determined by the number of macro declarations of the object dictionary related to the PDO), each entry is a structure of a PDO, and includes information for realizing control and synchronization of software, and the information plays a key role in the synchronization process through initialization, setting, modification of an intermediate state and the like. Each entry contains a COB parameter, which is a parameter related to setting a communication object table (COB table).
The entry of a PDO table contains at most 8 mapping parameters, that is, a PDO message may synchronize at most 8 data at one time, although in other embodiments, only one data may be synchronized.
Referring to fig. 5, a communication object table (COB table) is newly built in the PLC main module and the plurality of PLC extension modules. The communication object table comprises a plurality of table entries which are respectively provided with a plurality of fields, and a specific field in each table entry corresponds to one data structure CAN MSG. The specific field of each table entry of the processing data object table corresponds to one table entry of the communication object table.
The COB table contains the state and callback of the current communication object, a pointer pointing to the corresponding PDO table item, and a data structure CAN MSG closely related to the communication of the underlying CAN controller, and the data structure CAN be used for setting a CAN controller register carried by hardware.
The COB table plays a role in starting and stopping, and is connected with the corresponding PDO structure and the specific CAN message. And when the message is received, filling the message into the data structure CAN MSG structure of the table entry of the corresponding COB table. A specific field of each table entry of the processing data object table corresponds to a table entry of the communication object parameter table, and another specific field corresponds to a mapping of the mapping table.
Referring to fig. 6, data polling is performed between the PLC main module and the plurality of PLC extension modules.
Therefore, the method for synchronizing data from a master station to a slave station of CANopen of the present embodiment includes:
step S1: polling the master station for each entry of the process data object table.
Step S2: and judging whether the current value of the related data in the object dictionary is consistent with the copy, if so, sending the user variable of the main station corresponding to the related data to the CAN bus, and otherwise, jumping to the step S1.
Step S3: and the slave station receives the CAN message through the CAN bus, and updates the output of the user variable corresponding to the slave station according to the received CAN message.
The method for judging whether the related data in the object dictionary changes is as follows: polling all entries of the processed data object table once in a poll and sequentially checking all entries of the processed data object table. And finding a mapping field according to each table entry of the processing data object table, mapping the mapping field to a related object in the object dictionary, and determining a corresponding user variable. The corresponding user variable is set to the data field of the corresponding data structure CAN MSG. And judging whether the data field of the CAN MSG of the data structure is the same as the copy of the table entry corresponding to the processed data object table, if so, judging that the related data in the object dictionary changes, and otherwise, judging that the related data in the object dictionary does not change.
And after judging that the related data in the object dictionary changes, setting the state of the corresponding table entry of the processed data object table as a signal sending state. And sequentially detecting the states of all the table entries of the processed data object table again, and sending the user variable of the main station corresponding to the related data to the CAN bus when detecting that one table entry of the processed data object table is effective and in a signal sending state.
The method for sending the user variable of the master station corresponding to the relevant data to the CAN bus comprises the following steps: assigning the corresponding user variable of the master station to the data field of the corresponding data structure CAN MSG, setting time records related to communication in the table items of the processing data object table, determining the structural body of the table items corresponding to the communication object table, filling the content of the data field of the corresponding data structure CAN MSG into a CAN hardware register, and sending a message to a CAN bus.
In step S3, the CAN controller of the slave station receives the message and stores the message in the message area. The slave station processes the messages received by the slave station in the polling of the master station, and sequentially processes all the message messages in the message area until all the message messages are processed.
The method for the slave station to process the message in the message area comprises the following steps: and searching data fragments of the data structure CAN MSG in all the table entries of the communication object table according to the CAN ID, finding out the data structure CAN MSG consistent with the CAN ID in the received message, finding out the table entry corresponding to the communication object table, and copying the data field in the received message to the data field of the corresponding data structure CAN MSG.
In summary, compared with the conventional data synchronization method from the master station to the slave station of the CANopen, the data synchronization method from the master station to the slave station of the CANopen of the embodiment has the following advantages:
according to the data synchronization method from the master station to the slave station of the CANopen, the user variable parameters and the data synchronization parameters of the master station and the multiple slave stations are defined, the user variable parameters and the data synchronization parameters are respectively associated with related objects and mapping tables in an object dictionary, a user variable parameter table, a data synchronization parameter table, a processing data object table and a communication object table are newly established, internal mutual correspondence is carried out, whether related data in the object dictionary change or not is judged, and when the related data change occurs, the changed data are sent to the slave stations through a CAN bus, and data synchronization of the master station and the multiple slave stations is achieved. The embodiment can be comprehensively applied to various types of data input and output of the slave station, and is convenient for data synchronization from the master station to the slave station based on the CANopen protocol. In addition, the embodiment can realize data synchronization of the master station and the slave station only by modifying the parameters defined by the user, thereby simplifying the data synchronization process of CANopen and improving the data synchronization efficiency.
Example 2
The data synchronization method from a master station to a slave station of CANopen in this embodiment further discloses a data synchronization construction method of CANopen on the basis of embodiment 1.
The data synchronization construction method of CANopen comprises the following steps:
the method comprises the following steps: defining user variable parameters and data synchronization parameters of each PLC extension module, and newly building a user variable parameter table and a data synchronization parameter table in the PLC extension module; the user variable parameter table and the data synchronization parameter table comprise a plurality of table items which are respectively provided with a plurality of fields; defining user variable parameters and data synchronization parameters of the PLC main module, wherein the user variable parameters and the data synchronization parameters of the PLC main module respectively correspond to the user variable parameters and the data synchronization parameters of each PLC expansion module;
step two: respectively associating all user variable parameters and data synchronization parameters with related objects in the object dictionary and the mapping table;
step three: newly building a processed data object table in the PLC main module and the plurality of PLC expansion modules, and opening up a memory area for processing the data object table; the processing data object table comprises a plurality of table entries which are respectively provided with a plurality of fields;
step four: newly building a communication object table in the PLC main module and the plurality of PLC extension modules; the communication object table comprises a plurality of table entries which are respectively provided with a plurality of fields, and a specific field in each table entry corresponds to a data structure CAN MSG; the specific field of each table entry of the processing data object table corresponds to one table entry of the communication object table;
step five: and data polling is carried out between the PLC main module and the plurality of PLC extension modules.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.

Claims (10)

1. A data synchronization method from a master station to a slave station of CANopen is used for synchronizing data of the master station to a plurality of slave stations; the method is characterized in that: respectively defining a user variable parameter and a data synchronization parameter of a master station, and defining user variable parameters and data synchronization parameters of a plurality of slave stations corresponding to the user variable parameter and the data synchronization parameter of the master station; respectively associating all user variable parameters and data synchronization parameters with related objects in the object dictionary and the mapping table;
newly building a processing data object table and a communication object table in the master station and the plurality of slave stations; a particular field of each entry of said processed data object table corresponds to an entry of said communication object table, another particular field corresponds to a mapping of said mapping table;
the data synchronization method comprises the following steps:
step S1: polling each item of the process data object table of the master station;
step S2: judging whether the current value of the related data in the object dictionary is consistent with the copy, if so, sending the user variable of the master station corresponding to the related data to a CAN bus, otherwise, skipping to the step S1; step S3: the slave station receives the CAN message through the CAN bus, and updates the output of the user variable corresponding to the slave station according to the received CAN message;
when data synchronization construction from a master station to a slave station of CANopen is carried out, the adopted data synchronization construction method of CANopen comprises the following steps:
the method comprises the following steps: defining user variable parameters and data synchronization parameters of each PLC extension module, and newly building a user variable parameter table and a data synchronization parameter table in the PLC extension module; the user variable parameter table and the data synchronization parameter table comprise a plurality of table items which are respectively provided with a plurality of fields; defining user variable parameters and data synchronization parameters of a PLC main module, wherein the user variable parameters and the data synchronization parameters of the PLC main module respectively correspond to the user variable parameters and the data synchronization parameters of each PLC expansion module;
step two: respectively associating all user variable parameters and data synchronization parameters with related objects in the object dictionary and the mapping table;
step three: newly building a processed data object table in the PLC main module and the plurality of PLC expansion modules, and opening up a memory area for processing the data object table; the processing data object table comprises a plurality of table entries which are respectively provided with a plurality of fields;
step four: newly building a communication object table in the PLC main module and the plurality of PLC extension modules; the communication object table comprises a plurality of table entries which are respectively provided with a plurality of fields, and a specific field in each table entry corresponds to a data structure CAN MSG; a specific field of each entry of the processed data object table corresponds to an entry of the communication object table;
step five: and data polling is carried out between the PLC main module and the plurality of PLC extension modules.
2. The master-to-slave data synchronization method of CANopen of claim 1, wherein: a user variable parameter table and a data synchronization parameter table are newly built in the master station and all the slave stations; the user variable parameter table and the data synchronization parameter table comprise a plurality of table items which are respectively provided with a plurality of fields; the communication object table comprises a plurality of table entries which are respectively provided with a plurality of fields, a specific field in each table entry corresponds to one data structure CAN MSG, and each data structure CAN MSG comprises a plurality of data fields.
3. The master-to-slave data synchronization method of CANopen of claim 2, wherein: the method for judging whether the current value of the related data in the object dictionary is consistent with the copy comprises the following steps: polling all the entries of the processed data object table once in a polling process, and sequentially checking all the entries of the processed data object table; finding a mapping field according to each table entry of the processing data object table, mapping the mapping field to a related object in the object dictionary, and determining a corresponding user variable; setting the corresponding user variable to the data field of the corresponding data structure CAN MSG; and judging whether the data field of the CAN MSG of the data structure is the same as the copy of the table entry corresponding to the processed data object table, if so, judging that the current value of the related data in the object dictionary is consistent with the copy, and otherwise, judging that the current value of the related data in the object dictionary is inconsistent with the copy.
4. The master-to-slave data synchronization method of CANopen of claim 3, wherein: after judging that the related data in the object dictionary changes, setting the state of the corresponding table entry of the processed data object table as a signal sending state; and sequentially detecting the states of all the table entries of the processed data object table again, and sending the user variable of the main station corresponding to the related data to the CAN bus when detecting that one table entry of the processed data object table is effective and in a signal sending state.
5. The master-to-slave data synchronization method of CANopen according to claim 4, characterized in that: the method for updating the output of the user variable corresponding to the slave station comprises the following steps: assigning the corresponding user variable of the master station to the data field of the corresponding data structure CAN MSG, setting time records related to communication in the table items of the processing data object table, determining the structural body of the table items corresponding to the communication object table, filling the content of the data field of the corresponding data structure CAN MSG into a CAN hardware register, and sending a message to a CAN bus.
6. The master-to-slave data synchronization method of CANopen of claim 1, wherein: in step S3, the CAN controller of the slave station receives the message and stores the message in the message area; the slave station processes the messages received by the slave station in the polling of the master station, and sequentially processes all the message messages in the message area until all the message messages are processed.
7. The master-to-slave data synchronization method of CANopen of claim 6, wherein: the method for the slave station to process the message in the message area comprises the following steps: and searching data fragments of the data structure CAN MSG in all the table entries of the communication object table according to the CAN ID, finding out the data structure CAN MSG consistent with the CAN ID in the received message, finding out the table entry corresponding to the communication object table, and copying the data field in the received message to the data field of the corresponding data structure CAN MSG.
8. The master-to-slave data synchronization method of CANopen of claim 1, wherein: the slave station is provided with a data port of a digital quantity input end, a digital quantity output end, an analog quantity input end, an analog quantity output end and an analog quantity input end.
9. The master-to-slave data synchronization method of CANopen of claim 1, wherein: the object dictionary comprises a primary mapping table, and the primary mapping table comprises a plurality of table items which are respectively provided with a plurality of fields; one field in each table entry of the primary mapping table corresponds to one secondary mapping table; the second-level mapping table comprises a plurality of table items with a plurality of fields respectively, and one field in each table item of each second-level mapping table corresponds to one dictionary variable or dictionary structure.
10. The master-to-slave data synchronization method of CANopen of claim 1, wherein: the data structure CAN MSG comprises a plurality of fields and is used for setting a register of a CAN controller; when sending a message, hardware is arranged in the CAN controller through the corresponding data structure CAN MSG, and when receiving the message, the message is filled in the structure in the corresponding data structure CAN MSG.
CN201811303689.XA 2018-11-02 2018-11-02 Data synchronization method from master station to slave station of CANopen Active CN109587215B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811303689.XA CN109587215B (en) 2018-11-02 2018-11-02 Data synchronization method from master station to slave station of CANopen

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811303689.XA CN109587215B (en) 2018-11-02 2018-11-02 Data synchronization method from master station to slave station of CANopen

Publications (2)

Publication Number Publication Date
CN109587215A CN109587215A (en) 2019-04-05
CN109587215B true CN109587215B (en) 2021-07-30

Family

ID=65921415

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811303689.XA Active CN109587215B (en) 2018-11-02 2018-11-02 Data synchronization method from master station to slave station of CANopen

Country Status (1)

Country Link
CN (1) CN109587215B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117234993B (en) * 2023-11-15 2024-02-13 浙江禾川科技股份有限公司 Parameter synchronization method, device, equipment and storage medium
CN117931265B (en) * 2024-03-25 2024-06-18 英诺达(成都)电子科技有限公司 Command management method, device, electronic apparatus, storage medium, and program product

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101854300A (en) * 2010-06-02 2010-10-06 北京工业大学 Method for realizing CANopen slave station
CN102231679A (en) * 2011-06-29 2011-11-02 烽火通信科技股份有限公司 Method for realizing configuration synchronization of network elements and webmaster
CN102664902A (en) * 2012-05-15 2012-09-12 南京华兴数控技术有限公司 Hardware implementing method for kernels of POWERLINK communication protocol master and slave stations
CN102833141A (en) * 2012-08-23 2012-12-19 天津瑞能电气有限公司 CAN (control area network) open slave station system based on DSP (digital signal processor) 28335

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101854300A (en) * 2010-06-02 2010-10-06 北京工业大学 Method for realizing CANopen slave station
CN102231679A (en) * 2011-06-29 2011-11-02 烽火通信科技股份有限公司 Method for realizing configuration synchronization of network elements and webmaster
CN102664902A (en) * 2012-05-15 2012-09-12 南京华兴数控技术有限公司 Hardware implementing method for kernels of POWERLINK communication protocol master and slave stations
CN102833141A (en) * 2012-08-23 2012-12-19 天津瑞能电气有限公司 CAN (control area network) open slave station system based on DSP (digital signal processor) 28335

Also Published As

Publication number Publication date
CN109587215A (en) 2019-04-05

Similar Documents

Publication Publication Date Title
CN109587215B (en) Data synchronization method from master station to slave station of CANopen
CN104113774B (en) A kind of television devices control method, equipment and system
CN104202222A (en) Smart home controller and communication method thereof
CN109343453B (en) Data synchronization method of CANopen
CN103914973A (en) Method and system for infrared learning by using cloud server
CN103873451A (en) Data synchronization method, equipment and system
CN104349464A (en) Method and apparatus for sending synchronizing signal and method and apparatus for determining carrier type
EP1828932A1 (en) Database synchronization
CN103178998A (en) Test and control data transmission method and device
CN109495236B (en) CANopen-based data synchronization method from slave station to master station
CN108874950B (en) Data distribution storage method and device based on ER relationship
CN104868939A (en) Bluetooth-based synchronized method and device between terminals
CN106611062A (en) Database updating method and device
CN105635215B (en) Synchronous method, device and the Cloud Server of contact information
US9122327B2 (en) Method for syncing different touching systems
CN106021517A (en) Network data inputting method and device
CN116108094A (en) Data integration method and device, electronic equipment and storage medium
CN110399530A (en) Data matching method, device and computer equipment
CN109788034B (en) Configuration method for gateway access equipment, electronic equipment and storage medium
CN111209652A (en) Method and device for constructing time sequence of static equipment model of power system
CN103236894B (en) Clock synchronizing method and device in a kind of seamless redundant network
WO2012015439A1 (en) Distributed control system operation and configuration
CN104464246A (en) Serial port data processing method in remote meter reading system
CN102196061B (en) Address filter table generating method and device, and Ethernet frame receiving method and device
CN111339656A (en) Cabinet production method and system and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant