CN114500151B - Motion control communication system and communication method based on CAN bus - Google Patents

Motion control communication system and communication method based on CAN bus Download PDF

Info

Publication number
CN114500151B
CN114500151B CN202210061203.6A CN202210061203A CN114500151B CN 114500151 B CN114500151 B CN 114500151B CN 202210061203 A CN202210061203 A CN 202210061203A CN 114500151 B CN114500151 B CN 114500151B
Authority
CN
China
Prior art keywords
message
station
communication
master station
slave
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
CN202210061203.6A
Other languages
Chinese (zh)
Other versions
CN114500151A (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.)
Nanjing Keyuan Intelligent Technology Group Co ltd
Original Assignee
Nanjing Keyuan Intelligent Technology Group 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 Nanjing Keyuan Intelligent Technology Group Co ltd filed Critical Nanjing Keyuan Intelligent Technology Group Co ltd
Priority to CN202210061203.6A priority Critical patent/CN114500151B/en
Publication of CN114500151A publication Critical patent/CN114500151A/en
Application granted granted Critical
Publication of CN114500151B publication Critical patent/CN114500151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/40006Architecture of a communication node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • 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
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses a motion control communication system and a communication method based on a CAN bus. The communication system comprises a master station, a plurality of slave stations and communication messages transmitted between the master station and the slave stations; the communication message is filled with all communication information and communication logic in the communication system. The communication method is carried out based on the communication system and comprises the steps of pre-configuration and master station polling. In the pre-configuration, only the communication baud rate of the master station, the communication baud rate of the slave station, the number of the slave station and the number of the slave station are carried out; and the data transmission can be directly carried out with each secondary station when the primary station polls, and the control is carried out on the data transmission. The communication system realizes all communication interaction between the master station and each slave station only through direct interaction transmission of communication messages between the master station and each slave station. The communication method is simpler in configuration process, simpler and quicker in communication logic and more beneficial to realizing the real-time performance of communication.

Description

Motion control communication system and communication method based on CAN bus
Technical Field
The invention relates to the technical field of motion control communication, in particular to a motion control communication system and a communication method based on a CAN bus.
Background
The CAN bus is a commonly used field bus, and has an important application in an operation control system in which high real-time data transmission and multiple slave nodes are required to be equal because the communication data block is directly encoded and has a multi-master competitive structure compared with other field buses.
In practical interface design, because the CAN bus communication interface only integrates a physical layer and a data link layer in the CAN protocol, in order to meet application requirements, a user needs to configure an application layer communication protocol based on the CAN bus again. Specifically, the CANopen protocol is a typical CAN application layer communication protocol. The method has the advantages of high compatibility, strong interoperability, small product size and the like, and becomes the most successful CAN application layer communication protocol based on the CAN bus and most widely applied.
The CANopen protocol, however, still has the following disadvantages when actually applied: 1. in order to realize normal communication between the master station and the slave stations, the SDO parameters and the PDO parameters of the motion control system with simple logic or complex logic are required to be configured, the communication configuration parameters are more, and the configuration process is complex; thus, there is a high need for the expertise of the relevant staff, whether for master station development or slave station configuration. 2. When the motion control system comprises a plurality of secondary stations, the problem of tedious IO wiring of the secondary stations exists.
Disclosure of Invention
The invention aims to provide a motion control communication system based on a CAN bus, which CAN directly realize all communication interaction between a master station and each slave station in communication message transmission interaction, so that complex communication configuration is not needed when the communication system is adopted for communication; the direct IO interaction between the master station and the slave station is realized in a communication mode, so that the physical wiring between the master station and the slave station is simplified, and the communication system is simpler.
The invention also provides a communication method of the motion control communication system based on the CAN bus, wherein the communication method is based on the communication system for communication interaction, and the direct polling of the master station to the slave station CAN be realized without complex communication configuration; therefore, the communication process is quicker and the real-time performance is higher.
In order to achieve the above purpose, the present invention proposes the following technical scheme:
a motion control communication system based on a CAN bus comprises a master station, a plurality of slave stations and communication messages, wherein the master station and the slave stations are connected based on a CAN network, and the communication messages are transmitted and interacted between the master station and the slave stations;
the master station comprises a read-write request module, a first switching value updating module and a motion calculating module, and the slave station comprises a read-write processing module, a second switching value updating module and a motion response module;
the communication message comprises a data message and a control message;
the data message is transmitted between the read-write request module and the read-write processing module and is used for realizing the reading and writing of the internal parameters of the slave station by the master station; the control message is transmitted between the motion calculation module and the motion response module and is used for directly realizing the motion control of the master station to the slave station;
the data message and the control message comprise a data area and a plurality of bit fields; the data area is used for transmitting the internal parameter quantity or the motion parameter quantity; the bit field comprises a function code bit, a master-slave identification bit, a mode bit and a slave station ID bit; the function code bit is used for a master station or a slave station to directly identify the type of a corresponding message, the master-slave identification bit is used for directly identifying the source of the master station or the slave station of the corresponding message, the mode bit is used for the master station or the slave station to directly identify the working mode of the slave station transmitted by the corresponding message, and the slave station ID bit is used for the master station to directly distinguish the slave stations;
the first switching value updating module is used for updating the switching value input value when the master station sends a communication message; the second switching value updating module is used for updating the switching value output quantity when the slave station sends a communication message; the bit field of the data message and the control message also comprises IO data bits; and the IO data bit is associated with the first switching value updating module and the second switching value updating module so as to realize communication connection between the master station and the slave station.
Further, the master station comprises a slave station monitoring module, and the slave station comprises a master station monitoring module; the communication message comprises a heartbeat message, and the bit field of the heartbeat message comprises functional code bits which are transmitted from the secondary station monitoring module to the primary station monitoring module and are used for monitoring the working state of the primary station by the secondary station.
Further, the bit fields of the data message and the control message also comprise message sequence number bits, and when the same corresponding message is sent and received, the message sequence number bits are the same; for monitoring whether the communication between the master station and the corresponding slave station matches.
Further, the master station comprises a synchronous control module, and the slave station comprises a synchronous processing module; the communication message comprises a synchronous message, and the bit field of the synchronous message comprises a function code bit which is transmitted from the synchronous control module to the synchronous processing module; the bit field of the control message comprises a corresponding synchronous identification bit; the synchronization identification bit is used for associating the control message with the synchronization message so as to perform synchronous control of the master station to the slave station.
Further, the priority of each communication message is sequentially from high to low: synchronous message, control message, data message, heartbeat message.
A communication method of a motion control communication system based on a CAN bus, which is based on the communication system to realize communication, comprises the following steps:
the master station and the slave stations are respectively preconfigured, the configuration items of the master station comprise the number of the slave stations and the communication baud rate of the master station, and the configuration items of the slave stations comprise the number of the slave stations and the communication baud rate of the slave stations; the number of the slave station corresponds to the number of the slave station; the communication baud rate of the master station is the same as that of the slave station and is related to a polling interval and a polling period;
the master station performs polling control on each slave station, builds a control message according to the calculation result of the motion calculation module, and sends the control message to the motion response module of the corresponding slave station; at the moment, the motion response module directly identifies the working mode through the mode bit and enables the slave station to execute motion according to the motion parameter number of the data area;
the master station checks the read-write request module, and if a read-write request to be processed exists, the master station sends a data message to the corresponding read-write processing module so as to complete the read-write of the internal parameters of the slave station;
and the master station receives the control message and the data message replied by each slave station and performs next polling according to the control message and the data message replied by each slave station.
Further, before the master station polls each slave station, the motion calculation module of the master station performs equal step interpolation calculation on the motion parameter quantity of each slave station in advance; at this time, the master station directly builds a control message according to the pre-calculated result.
Further, when the control message and the data message both include message sequence number bits,
when the master station polls each slave station, the master station sends a control message to the corresponding slave station once, and the message sequence number bit is updated once; when the slave station replies to the master station aiming at the control message, the message sequence number bit of the replied control message is consistent with the message sequence number bit of the control message;
when the master station processes the read-write request to the slave station, the master station sends a data message to the corresponding slave station once, and the message sequence number bit is updated once; when the corresponding slave station replies to the master station aiming at the data message, the message sequence number bit of the replied data message is consistent with the message sequence number bit of the data message.
Further, when the master station includes a slave station monitoring module, the slave station includes a master station monitoring module, the communication message includes a heartbeat message,
when pre-configuring a master station and a slave station, the configuration item of the master station further comprises a heartbeat period and a slave station timeout, and the configuration item of the slave station further comprises the master station timeout; the heartbeat period is used for setting the sending frequency of the heartbeat message; the slave station overtime is associated with the slave station monitoring module and is used for accumulating the duration of the communication message replied by the slave station and judging whether the corresponding slave station is abnormal according to the duration; the master station overtime is associated with the master station monitoring module and is used for accumulating the duration of the master station sending the communication message and enabling any slave station to judge whether the master station is abnormal or not according to the duration.
Further, when the master station comprises a synchronization control module, the slave station comprises a synchronization processing module; the communication message comprises a synchronous message, the bit field of the control message also comprises a corresponding synchronous identification bit,
when the master station polls each slave station, if synchronous control is performed, synchronous information is written into a synchronous identification bit of a control message; after receiving the control message, the slave station associates the synchronous information with a synchronous processing module of the slave station; at this time, the slave station is not triggered to execute movement under the action of the control message until the synchronous processing module receives the synchronous message.
The beneficial effects are that:
as CAN be seen from the above technical solutions, the technical solution of the present invention provides a motion control communication system based on a CAN bus, where a master station of the communication system includes a read-write request module, a motion calculation module, and a first switching value update module, and a slave station includes a read-write processing module, a motion response module, and a second switching value update module corresponding to each module of the master station. In order to meet the communication requirement, corresponding data messages and control messages are designed according to the module arrangement between the master station and the slave stations. Specifically, the data message and the control message comprise a data area and a plurality of bit fields, wherein the bit fields comprise function code bits, master-slave identification bits, mode bits and slave station ID bits. When communication is carried out, the master station and the slave station can directly confirm the message type according to the function code bits in the communication message so as to directly allocate corresponding function modules for processing; the slave station directly identifies the working mode of the slave station under the message according to the mode bit so as to avoid the complexity that the working mode of the slave station needs to be modified under the CANopen protocol and then the motion parameter quantity is transmitted; directly identifying the message source according to the master-slave identification bit and directly identifying and matching to the corresponding slave station according to the slave station ID bit so as to simplify the communication logic and ensure the correctness of the communication logic; the specific internal parameter quantity or the movement parameter quantity is transmitted according to the data area so as to realize the movement execution of the slave station. Therefore, the communication system builds the corresponding master station and master station functional module, the corresponding slave station and slave station functional module based on the CAN bus, and fills the communication information and the communication logic in the transmission process into the message for transmission interaction. Compared with the existing CAN application layer communication protocol, such as the CANopen communication protocol, the communication system has more concise and clear communication logic and communication process compared with the communication system which needs to realize the transmission of communication information by complex configuration and logic process. Therefore, in the aspect of development and configuration, the working difficulty of related staff is reduced no matter for master station development or slave station configuration; in the aspect of practical application, the embedded motion system has outstanding application advantages in various embedded motion systems, especially in small embedded motion systems.
For the communication system, the master station further comprises a first switching value updating module to update the switching value input value when the master station sends a communication message; the secondary station also comprises the second switching value updating module so as to update the switching value output quantity when the secondary station sends the communication message. The bit field of the data message and the control message also comprises IO data bits; the IO data bit is associated with the first switching value updating module and the second switching value updating module, so that communication connection between the master station and the slave station is realized in a communication mode. Compared with the existing communication system which is mostly realized by physical means, such as various data wires, the communication connection is favorable for reducing visible wire harnesses, thereby simplifying the complexity of the whole communication system.
The invention also provides a communication method of the motion control communication system based on the CAN bus, and the communication method is based on the communication system for communication. In the configuration process, only simple pre-configuration is needed before communication; specifically, the pre-configuration only includes the number of the slave station of the master station and the communication baud rate of the master station, and the number of the slave station and the communication baud rate of the slave station. Compared with the complex PDO parameter and SDO parameter configuration required in the CANopen protocol, the configuration parameters are fewer, and the configuration process is simpler. In the communication process, the slave station working mode identification can be realized and the slave station working mode can execute the movement only through a corresponding control message; compared with the CANopen protocol which needs to modify the working mode of the slave station first and then transmit the internal parameter quantity or the motion parameter quantity to control the slave station to execute the motion, the communication process is simpler and the communication logic is more convenient; thereby being more beneficial to realizing the real-time performance of communication.
It should be understood that all combinations of the foregoing concepts, as well as additional concepts described in more detail below, may be considered a part of the inventive subject matter of the present disclosure as long as such concepts are not mutually inconsistent.
The foregoing and other aspects, embodiments, and features of the present teachings will be more fully understood from the following description, taken together with the accompanying drawings. Other additional aspects of the invention, such as features and/or advantages of the exemplary embodiments, will be apparent from the description which follows, or may be learned by practice of the embodiments according to the teachings of the invention.
Drawings
The drawings are not intended to be drawn to scale. In the drawings, each identical or nearly identical component that is illustrated in various figures may be represented by a like numeral. For purposes of clarity, not every component may be labeled in every drawing. Embodiments of various aspects of the invention will now be described, by way of example, with reference to the accompanying drawings, in which:
fig. 1 is a schematic diagram of a communication system according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. It will be apparent that the described embodiments are some, but not all, embodiments of the invention. All other embodiments, which can be made by a person skilled in the art without creative efforts, based on the described embodiments of the present invention fall within the protection scope of the present invention. Unless defined otherwise, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this invention belongs.
The terms "first," "second," and the like in the description and in the claims, are not used for any order, quantity, or importance, but are used for distinguishing between different elements. Also, unless the context clearly indicates otherwise, singular forms "a," "an," or "the" and similar terms do not denote a limitation of quantity, but rather denote the presence of at least one. The terms "comprises," "comprising," or the like are intended to cover a feature, integer, step, operation, element, and/or component recited as being present in the element or article that "comprises" or "comprising" does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. "up", "down", "left", "right" and the like are used only to indicate a relative positional relationship, and when the absolute position of the object to be described is changed, the relative positional relationship may be changed accordingly.
The invention provides a motion control communication system based on a CAN bus, which fills all communication information and communication logic into a communication message, so that all communication interaction between a master station and each slave station is directly realized only through the interactive transmission of the communication message between the master station and each slave station. Compared with the communication system based on the existing CAN application layer communication protocol, the communication logic and the communication process of the communication system are simpler and clearer, and the physical wiring between the master station and the slave station is simplified.
The invention also provides a communication method of the motion control communication system based on the CAN bus, wherein the communication method is based on the communication system for communication and only needs simple pre-configuration before communication; when in communication, the communication can be directly realized only through the bit domain identification of the communication message. Therefore, the configuration process is simpler, the communication logic is quicker, and the real-time communication is realized more conveniently.
The motion control communication system based on the CAN bus disclosed by the invention is further specifically described below with reference to the embodiment shown in the drawings.
As shown in fig. 1, the communication system comprises a master station, a plurality of slave stations and communication messages for transmission interaction between the master station and the slave stations, wherein the master station and the slave stations are connected based on a CAN network. In particular implementations, the master station may be various logic controllers and the slave stations may be servo controllers, frequency converters, stepper controllers, and the like. The own numbers of the respective secondary stations are specified to be 1, 2, 3.
In order to realize communication, the master station comprises a read-write request module and a motion calculation module, and the slave station comprises a read-write processing module and a motion response module; correspondingly, the communication message comprises a data message and a control message.
The data message is transmitted between the read-write request module and the read-write processing module and is used for realizing the reading and writing of the internal parameters of the slave station by the master station; and the control message is transmitted between the motion calculation module and the motion response module and is used for directly controlling the motion of the master station to the slave station.
The data message and the control message both comprise a data area and a plurality of bit fields. The data area is used for transmitting the internal parameter or the motion parameter. The bit field comprises a function code bit, a master-slave identification bit, a mode bit and a slave station ID bit; the function code bit is used for a master station or a slave station to directly identify the type of a corresponding message, the master-slave identification bit is used for directly identifying the source of the master station or the slave station of the corresponding message, the mode bit is used for the master station or the slave station to directly identify the working mode of the slave station transmitted by the corresponding message, and the slave station ID bit is used for the master station to directly distinguish the slave stations.
In the implementation, the master station and the slave station can directly confirm the message type according to the function code bits in the communication message so as to directly allocate corresponding function modules for processing; the slave station directly identifies the working mode of the slave station under the message according to the mode bit so as to avoid the complexity that the working mode of the slave station needs to be modified under the CANopen protocol and then the motion parameter quantity is transmitted; the message source is directly identified according to the master-slave identification bit, and the message source is directly identified and matched to the corresponding slave station according to the slave station ID bit, so that the communication logic is simplified and the correctness of the communication logic is ensured; the specific internal parameter quantity or the movement parameter quantity is transmitted according to the data area so as to realize the movement execution of the slave station. Therefore, the communication system builds the corresponding master station and master station functional module, the corresponding slave station and slave station functional module based on the CAN bus, and fills the communication information and the communication logic in the transmission process into the message for transmission interaction. Compared with the existing CAN application layer communication protocol, such as the CANopen communication protocol, the communication system has the advantages that the configuration process and the communication logic of the communication system are simpler and clearer compared with the transmission of communication information by means of complex configuration and logic processes, so that the working difficulty of related staff is reduced in the aspects of development and configuration of a master station and a slave station; in the aspect of practical application, the embedded motion system has outstanding application advantages in various embedded motion systems, especially in small embedded motion systems.
The master station also comprises a first switching value updating module which is used for updating the switching value input value when the master station sends a communication message; the secondary station also comprises a second switching value updating module which is used for updating the switching value output quantity when the secondary station sends a communication message; the bit field of the data message and the control message also comprises IO data bits. And the IO data bit is associated with the first switching value updating module and the second switching value updating module so as to realize communication connection between the master station and the slave station. Compared with the existing communication system which is mostly realized by physical means, such as various data wires, the communication connection method is beneficial to reducing visible wire harnesses and simplifying complexity of system internal connection wires, thereby simplifying complexity of the whole communication system.
In the communication process, the master station is a control end, and the slave station is a controlled end, so that when the master station sends a communication message to the slave station, the master station can actively monitor the working state of the slave station by monitoring whether a reply message of the slave station is received. However, the slave station cannot actively monitor the master station, so that the slave station monitors the working state of the master station to ensure normal communication. Setting the master station to comprise a slave station monitoring module, wherein the slave station comprises a master station monitoring module; the communication message comprises a heartbeat message, and the bit field of the heartbeat message comprises a function code bit. At this time, the heartbeat message is transmitted from the secondary station monitoring module to the primary station monitoring module according to a fixed period, and the secondary station receives the heartbeat of the primary station to realize online monitoring.
Correspondingly, in order to ensure the accuracy of the communication logic and the accuracy of the control of each slave station. Setting the bit fields of the data message and the control message to further comprise message sequence number bits, wherein the message sequence number bits of the same corresponding message are the same when the same corresponding message is transmitted and received; and the communication interaction between the master station and the corresponding slave station is monitored to be normal. In the implementation, if the communication is normal, the message sequence number of the corresponding message sent by the master station to any slave station is sequentially increased; if the slave station fails to reply in time due to abnormality, the master station will attempt retransmission at the next polling, i.e. resend the corresponding message with the same message sequence number.
In this embodiment, the communication system support slave station includes the following operation modes: displacement mode, rotational speed mode, torque mode. When the slave station is in a displacement mode, the position change quantity is in the data area; when the slave station is in a rotating speed mode, the data area is a target rotating speed value; and when the station is in the torque mode, the target torque value is in the data area.
The three working modes are specifically divided into two control modes, namely synchronous control and asynchronous control. In order to realize the two control modes, the master station is further provided with a synchronous control module, and the slave station further comprises a synchronous processing module. The communication message also comprises a synchronous message, and the bit field of the synchronous message comprises a function code bit which is transmitted from the synchronous control module to the synchronous processing module. The bit field of the control message comprises a corresponding synchronous identification bit, so that the control message is associated with the synchronous message; for performing a synchronization control of the master station to the slave stations.
In this embodiment, for each communication packet, the data packet and the control packet are in a client-server mode, the master station initiates communication for the client, and the slave station receives the packet for the server and replies. The heartbeat message and the synchronous message are in a producer-consumer mode, the master station sends out the message for the producer, all the slave stations receive the message for the consumer, and the slave stations do not need to reply.
Based on the above configuration, this embodiment defines a specific communication message format, as shown in table 1 below.
Table 1 communication message format table
Based on the arbitration principle of the CAN bus, the priority of each communication message is set as follows from high to low in sequence: synchronous message, control message, data message, heartbeat message.
The communication method of the motion control communication system based on the CAN bus disclosed by the invention is further specifically described below with reference to the embodiment shown in the drawings.
The communication method realizes communication based on the communication system and comprises the following steps:
s102, the master station and the slave stations are respectively preconfigured, wherein the configuration items of the master station comprise the number of the slave stations and the communication baud rate of the master station, and the configuration items of the slave stations comprise the number of the slave stations and the communication baud rate of the slave stations; the number of the slave station corresponds to the number of the slave station; the communication baud rate of the master station is the same as that of the slave station and is related to a polling interval and a polling period;
in the communication method, the communication information and the communication logic are filled into the corresponding bit areas of the communication message, so that the master station can identify the source of a specific slave station and keep the communication in the same period or the same frequency only by simple pre-configuration. Compared with the existing communication method based on the CANopen protocol, the method has the advantages that the configuration parameters are fewer, the configuration process is simpler, and basic staff can finish the method.
In this step, the master station communication baud rate and the slave station communication baud rate are inversely proportional to the polling period. When N slave stations exist in the communication system, the communication baud rate of the master station and the communication baud rate of the slave stations are 1Mbps, as the master station polls any slave station, 6 communication messages, namely a heartbeat message, a synchronous message, a control message sent by the master station, a control message replied by the slave station, a data message sent by the master station and a data message replied by the slave station are simultaneously provided at most; the characteristic of the CAN bus shows that the time of the single communication message occupying the CAN bus is not more than 150us; so that each secondary station takes no more than 900us. For a small embedded operation system, the polling interval t between the master station and each slave station can be approximately calculated as t=1 ms; at this time, the polling period is approximately t=nms, which is obtained by the polling period being t=t×n.
S104, the master station performs polling control on each slave station, builds a control message according to the calculation result of the motion calculation module, and sends the control message to the motion response module of the corresponding slave station; at the moment, the motion response module directly identifies the working mode through the mode bit and enables the slave station to execute motion according to the motion parameter number of the data area;
in the step, the slave station can directly identify the working mode through the mode bit of the control message, and compared with the existing communication method based on the CANopen protocol, the control mode of the slave station does not need to be modified in advance through PDO or SDO, so that the communication process is more convenient and concise, and the real-time performance is higher.
S106, the master station checks the read-write request module, and if a read-write request to be processed exists, a data message is sent to a corresponding read-write processing module so as to complete the read-write of the internal variables of the slave station;
in this step, the internal parameter items of the slave stations are assigned by reading and writing the internal parameters. The internal parameter items comprise the internal parameter items of the slave stations, such as the switching value input and output function definition, the control gain and the like of the slave stations.
In this step and step S104, in order to keep the load balance of the CAN bus, the master station transmits at most one control message and one data message each time when polling any slave station.
S108, the master station receives the control message and the data message replied by each slave station, and performs next polling according to the control message and the data message.
In step S104, in order to prevent the time consumption of waiting for the motion calculation module to perform the instant calculation from being too long, the real-time performance of the communication is affected; and the time jitter of the transmission interval of the control message caused by the time jitter, which affects the communication accuracy. Before step S104 is carried out, namely before the master station polls each slave station, a motion calculation module of the master station carries out equal step interpolation calculation on the motion parameter quantity of each slave station in advance; at this time, the master station directly builds a control message according to the pre-calculated result.
In this step, the step-length interpolation computation firstly disperses the motion parameter quantity of each secondary station according to the polling period, and then the motion parameter quantity of each secondary station is computed in turn before the master station starts polling.
Specifically, when the control message and the data message both include message sequence number bits. When step S104 is carried out, the master station sends a control message to the corresponding slave station once, and the message sequence number bit is updated once; when the slave station replies to the master station aiming at the control message, the message sequence number bit of the replied control message is consistent with the message sequence number bit of the control message.
When step S106 is carried out, the master station sends a time of data message to the corresponding slave station, and the message sequence number bit is updated once; when the corresponding slave station replies to the master station aiming at the data message, the message sequence number bit of the replied data message is consistent with the message sequence number bit of the data message.
Specifically, when the master station includes a slave station monitoring module, the slave station includes a master station monitoring module, and the communication message includes a heartbeat message. When step S104 is carried out, the configuration item of the master station further comprises a heartbeat period and a slave station timeout, and the configuration item of the slave station further comprises a master station timeout; the heartbeat period is used for setting the sending frequency of the heartbeat message; the slave station overtime is associated with the slave station monitoring module and is used for accumulating the duration of the communication message replied by the slave station and judging whether the corresponding slave station is abnormal according to the duration; the master station overtime is associated with the master station monitoring module and is used for accumulating the duration of the master station sending the communication message and enabling any slave station to judge whether the master station is abnormal or not according to the duration.
Specifically, when the master station includes a synchronization control module, the slave station includes a synchronization processing module; the communication message comprises a synchronous message, and the bit field of the control message also comprises a corresponding synchronous identification bit. When step S104 is performed, if the synchronization control is performed, writing the synchronization information into a synchronization identification bit of the control message; after receiving the control message, the slave station associates the synchronous information with a synchronous processing module of the slave station; at this time, the slave station is not triggered to execute movement under the action of the control message until the synchronous processing module receives the synchronous message.
Specifically, the sending time of the synchronous message is after each polling is finished.
While the invention has been described with reference to preferred embodiments, it is not intended to be limiting. Those skilled in the art will appreciate that various modifications and adaptations can be made without departing from the spirit and scope of the present invention. Accordingly, the scope of the invention is defined by the appended claims.

Claims (10)

1. The motion control communication system based on the CAN bus is characterized by comprising a master station, a plurality of slave stations and communication messages, wherein the master station and the slave stations are connected based on a CAN network, and the communication messages are transmitted and interacted between the master station and the slave stations;
the master station comprises a read-write request module, a first switching value updating module and a motion calculating module, and the slave station comprises a read-write processing module, a second switching value updating module and a motion response module;
the communication message comprises a data message and a control message;
the data message is transmitted between the read-write request module and the read-write processing module and is used for realizing the reading and writing of internal parameters between the master station and the slave station; the control message is transmitted between the motion calculation module and the motion response module and is used for directly realizing the motion control of the master station to the slave station;
the data message and the control message comprise a data area and a plurality of bit fields; the data area is used for transmitting the internal parameter quantity or the motion parameter quantity; the bit field comprises a function code bit, a master-slave identification bit, a mode bit and a slave station ID bit; the function code bit is used for a master station or a slave station to directly identify the type of a corresponding message, the master-slave identification bit is used for directly identifying the source of the master station or the slave station of the corresponding message, the mode bit is used for the master station or the slave station to directly identify the working mode of the slave station transmitted by the corresponding message, and the slave station ID bit is used for the master station to directly distinguish the slave stations;
the first switching value updating module is used for updating the switching value input value when the master station sends a communication message; the second switching value updating module is used for updating the switching value output quantity when the slave station sends a communication message; the bit field of the data message and the control message also comprises IO data bits; and the IO data bit is associated with the first switching value updating module and the second switching value updating module so as to realize communication connection between the master station and the slave station.
2. The communication system of claim 1, wherein the master station comprises a slave station monitoring module and the slave station comprises a master station monitoring module; the communication message comprises a heartbeat message, and the bit field of the heartbeat message comprises functional code bits which are transmitted from the secondary station monitoring module to the primary station monitoring module and are used for monitoring the working state of the primary station by the secondary station.
3. The communication system of claim 2, wherein the bit fields of the data message and the control message further comprise message sequence number bits, and the same corresponding message has the same message sequence number bits when transmitted and received; for monitoring whether the communication between the master station and the corresponding slave station matches.
4. A communication system according to claim 3, wherein the master station comprises a synchronization control module and the slave station comprises a synchronization processing module; the communication message comprises a synchronous message, and the bit field of the synchronous message comprises a function code bit which is transmitted from the synchronous control module to the synchronous processing module; the bit field of the control message comprises a corresponding synchronous identification bit; the synchronization identification bit is used for associating the control message with the synchronization message so as to perform synchronous control of the master station to the slave station.
5. The communication system of claim 4, wherein the priority of each communication message is, in order from high to low: synchronous message, control message, data message, heartbeat message.
6. A communication method of a motion control communication system based on a CAN bus, characterized in that the communication is realized based on the communication system according to any one of claims 1-5, comprising:
the master station and the slave stations are respectively preconfigured, the configuration items of the master station comprise the number of the slave stations and the communication baud rate of the master station, and the configuration items of the slave stations comprise the number of the slave stations and the communication baud rate of the slave stations; the number of the slave station corresponds to the number of the slave station; the communication baud rate of the master station is the same as that of the slave station and is related to a polling interval and a polling period;
the master station performs polling control on each slave station, builds a control message according to the calculation result of the motion calculation module, and sends the control message to the motion response module of the corresponding slave station; at the moment, the motion response module directly identifies the working mode through the mode bit and enables the slave station to execute motion according to the motion parameter number of the data area;
the master station checks the read-write request module, and if a read-write request to be processed exists, the master station sends a data message to the corresponding read-write processing module so as to complete the read-write of the internal parameters of the slave station;
and the master station receives the control message and the data message replied by each slave station and performs next polling according to the control message and the data message.
7. The communication method according to claim 6, wherein the motion calculation module of the master station performs an equal step interpolation calculation on the motion parameter number of each slave station in advance before the master station polls each slave station; at this time, the master station directly builds a control message according to the pre-calculated result.
8. The communication method of claim 6, wherein when the control message and the data message each include a message sequence number bit,
when the master station polls each slave station, the master station sends a control message to the corresponding slave station once, and the message sequence number bit is updated once; when the slave station replies to the master station aiming at the control message, the message sequence number bit of the replied control message is consistent with the message sequence number bit of the control message;
when the master station processes the read-write request to the slave station, the master station sends a data message to the corresponding slave station once, and the message sequence number bit is updated once; when the corresponding slave station replies to the master station aiming at the data message, the message sequence number bit of the replied data message is consistent with the message sequence number bit of the data message.
9. The communication method of claim 6, wherein when the master station comprises a slave station monitoring module, the slave station comprises a master station monitoring module, the communication message comprises a heartbeat message,
when pre-configuring a master station and a slave station, the configuration item of the master station further comprises a heartbeat period and a slave station timeout, and the configuration item of the slave station further comprises the master station timeout; the heartbeat period is used for setting the sending frequency of the heartbeat message; the slave station overtime is associated with the slave station monitoring module and is used for accumulating the duration of the communication message replied by the slave station and judging whether the corresponding slave station is abnormal according to the duration; the master station overtime is associated with the master station monitoring module and is used for accumulating the duration of the master station sending the communication message and enabling any slave station to judge whether the master station is abnormal or not according to the duration.
10. The communication method according to claim 9, wherein when the master station comprises a synchronization control module, the slave station comprises a synchronization processing module; the communication message comprises a synchronous message, the bit field of the control message also comprises a corresponding synchronous identification bit,
when the master station polls each slave station, if synchronous control is performed, synchronous information is written into a synchronous identification bit of a control message; after receiving the control message, the slave station associates the synchronous information with a synchronous processing module of the slave station; at this time, the slave station is not triggered to execute movement under the action of the control message until the synchronous processing module receives the synchronous message.
CN202210061203.6A 2022-01-19 2022-01-19 Motion control communication system and communication method based on CAN bus Active CN114500151B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210061203.6A CN114500151B (en) 2022-01-19 2022-01-19 Motion control communication system and communication method based on CAN bus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210061203.6A CN114500151B (en) 2022-01-19 2022-01-19 Motion control communication system and communication method based on CAN bus

Publications (2)

Publication Number Publication Date
CN114500151A CN114500151A (en) 2022-05-13
CN114500151B true CN114500151B (en) 2024-01-30

Family

ID=81473585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210061203.6A Active CN114500151B (en) 2022-01-19 2022-01-19 Motion control communication system and communication method based on CAN bus

Country Status (1)

Country Link
CN (1) CN114500151B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115037568B (en) * 2022-05-16 2024-05-07 中国人民解放军海军工程大学 Industrial bus transmission method based on IO mapping
CN115277295B (en) * 2022-07-29 2023-12-19 广东美的智能科技有限公司 Communication method of controller and controller
CN119865390B (en) * 2024-11-27 2025-11-11 西安航天赛能自动化科技有限公司 Reliable CANOpen communication software architecture design method based on embedded controller

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101626333A (en) * 2009-08-07 2010-01-13 北京和利时电机技术有限公司 Controller area network (CAN) bus system and application layer communication method in same
JP2010170435A (en) * 2009-01-24 2010-08-05 Tamagawa Seiki Co Ltd System and method for instructing motion control, and motion control system
CN101976074A (en) * 2010-11-03 2011-02-16 浙江工业大学 Industrial control system based on field bus and control network
CN102393702A (en) * 2011-10-14 2012-03-28 南京航空航天大学 Method and system for expanding motion control terminal
CN103425106A (en) * 2013-08-08 2013-12-04 华南理工大学 Linux-based Ethercat maser/slave station control system and method
CN107024875A (en) * 2017-04-21 2017-08-08 钟阳光 A kind of motion control real-time communication method based on CAN network
CN110505135A (en) * 2019-09-09 2019-11-26 上海外斯能源科技有限公司 CAN bus based battery system automatic network-building method
CN112929251A (en) * 2021-02-07 2021-06-08 深圳市显控科技股份有限公司 CAN-based slave station data refreshing method, device and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010170435A (en) * 2009-01-24 2010-08-05 Tamagawa Seiki Co Ltd System and method for instructing motion control, and motion control system
CN101626333A (en) * 2009-08-07 2010-01-13 北京和利时电机技术有限公司 Controller area network (CAN) bus system and application layer communication method in same
CN101976074A (en) * 2010-11-03 2011-02-16 浙江工业大学 Industrial control system based on field bus and control network
CN102393702A (en) * 2011-10-14 2012-03-28 南京航空航天大学 Method and system for expanding motion control terminal
CN103425106A (en) * 2013-08-08 2013-12-04 华南理工大学 Linux-based Ethercat maser/slave station control system and method
CN107024875A (en) * 2017-04-21 2017-08-08 钟阳光 A kind of motion control real-time communication method based on CAN network
CN110505135A (en) * 2019-09-09 2019-11-26 上海外斯能源科技有限公司 CAN bus based battery system automatic network-building method
CN112929251A (en) * 2021-02-07 2021-06-08 深圳市显控科技股份有限公司 CAN-based slave station data refreshing method, device and system

Also Published As

Publication number Publication date
CN114500151A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
CN114500151B (en) Motion control communication system and communication method based on CAN bus
US4747100A (en) Token passing network utilizing active node table
US4926375A (en) Multiple nodes broadcast communication method with receiver identification by bit position in transferred massage
CN102237718B (en) Method and device of operating wind power electric field power network with improved data transmission protocol
US20190020499A1 (en) Method for transmitting data via a serial communication bus, bus interface, and computer program
Ferreira et al. The FTT-CAN protocol for flexibility in safety-critical systems
EP0435037B1 (en) Master slave industrial token passing network
CN111030909B (en) Method for time synchronization among CAN bus multi-master device communication
US11564241B2 (en) Method for operating a radio communication system for an industrial automation system, radio communication system, base station and subscriber station
Kopetz A solution to an automotive control system benchmark
US7272152B2 (en) Method for real-time communication between a number of network subscribers in a communication system using ethernet physics, and a corresponding communication system using ethernet physics
US10193705B2 (en) Method, communication network, and control unit for the cyclical transmission of data
WO2020128683A1 (en) A device and method for scheduling data transmission for non-tsn devices over time sensitive networking (tsn)
JP4220208B2 (en) Deterministic fieldbus and method of managing such a bus
KR100583811B1 (en) Method of Approving Identifier of Can Message to Humanoid Robot and Arbitration Method of Can Message Transmission
Kapsalis et al. Implementation of a MAC-layer protocol (GIT-CSMA/CD) for industrial LAN's and its experimental performance
US20050141555A1 (en) Method for generating commands for network controller modules of peripheral devices
CN115914414A (en) Remote communication system and method based on SERCOS protocol
Ferreira et al. Controller area network
WO2020238764A1 (en) Time sequence management method, device and system
CN112260915A (en) Bus control method based on LINK networking mode of 10M 1553B avionics bus
CN113535413B (en) Transaction request processing method and semiconductor production system
Di Natale et al. Higher-Level Protocols
Rufino et al. Embedded platforms for distributed real-time computing: Challenges and results
CN118140456A (en) A network communication system and related 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