CN114500151A - 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
CN114500151A
CN114500151A CN202210061203.6A CN202210061203A CN114500151A CN 114500151 A CN114500151 A CN 114500151A CN 202210061203 A CN202210061203 A CN 202210061203A CN 114500151 A CN114500151 A CN 114500151A
Authority
CN
China
Prior art keywords
message
slave station
station
master station
communication
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.)
Granted
Application number
CN202210061203.6A
Other languages
Chinese (zh)
Other versions
CN114500151B (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

Images

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 master station communication baud rate, the slave station number and the self number are carried out; and when the master station polls, the data transmission can be directly carried out with each slave station, and the master station can carry out control on the slave stations. The communication system realizes all communication interaction between the master station and each slave station only through direct interactive transmission of the communication messages between the master station and each slave station. The communication method has the advantages that the configuration process is simpler, the communication logic is simpler and quicker, and the real-time performance of communication is more favorably realized.

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 motion control communication method based on a CAN bus.
Background
Compared with other field buses, the CAN bus is a common field bus, directly encodes a communication data block and has a multi-master station competition type structure, so that the CAN bus has important application in an operation control system with high real-time data transmission requirement and equal multi-slave station nodes.
In the actual interface design, because the CAN bus communication interface only integrates the physical layer and the data link layer in the CAN protocol, in order to meet the application requirements, the user needs to configure the application layer communication protocol based on the CAN bus again. Specifically, the CANopen protocol is a typical CAN application layer communication protocol. The CAN bus-based CAN application layer communication protocol which is most successful and widely applied has the advantages of high compatibility, strong interoperability, small product size and the like.
However, the CANopen protocol still has the following disadvantages when it is actually applied: 1. in order to realize normal communication between a master station and a slave station, no matter a motion control system with simple logic or complex logic, SDO parameters and PDO parameters need to be configured, the communication configuration parameters are more, and the configuration process is complex; therefore, the professional requirements on related workers are high whether the master station development or the slave station configuration is adopted. 2. The physical wiring mode is adopted between the master station and the slave station, and when the motion control system comprises a plurality of slave stations, the problem of complex IO wiring of the slave station 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 used for communication; direct IO interaction between the master station and the slave station is realized through a communication mode, so that 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, the communication method carries out communication interaction based on the communication system, and the direct polling of the master station to the slave station CAN be realized without carrying out complex communication configuration; therefore, the communication process is faster and the real-time performance is higher.
In order to achieve the above purpose, the invention provides 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 is 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 both comprise a data area and a plurality of bit fields; the data area is used for transmitting the internal parameter number or the motion parameter number; 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 directly identifying the type of a corresponding message by a master station or a slave station, 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 directly identifying the working mode of the slave station transmitted by the corresponding message by the master station or the slave station, and the ID bit of the slave station is used for directly distinguishing the slave station by the master station;
the first switching value updating module is used for updating the switching value input value when the master station sends the communication message; the second switching value updating module is used for updating the switching value output quantity when the slave station sends the communication message; the bit fields of the data message and the control message also comprise 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 function code bits which are transmitted from the slave station monitoring module to the master station monitoring module and used for monitoring the working state of the master station by the slave station.
Furthermore, the bit fields of the data message and the control message also comprise message sequence number bits, and the message sequence number bits of the same corresponding message are the same when the same corresponding message is sent and received; and the master station is used for monitoring whether the communication between the master station and the corresponding slave station is matched.
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 a 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; and the synchronous identification bit is used for associating the control message with a synchronous message so as to carry out synchronous control on the slave station by the master station.
Further, the priority of each communication message is, from high to low: a synchronization message, a control message, a data message, and a heartbeat message.
A communication method of a motion control communication system based on a CAN bus realizes communication based on the communication system, and comprises the following steps:
the master station and the slave station are respectively preconfigured, the configuration items of the master station comprise slave station numbers and master station communication baud rates, and the configuration items of the slave station comprise self numbers and slave station communication baud rates; the serial number of the slave station corresponds to the serial number of the slave station; the communication baud rate of the master station is the same as that of the slave station, and is associated with a polling interval and a polling period;
the master station performs polling control on each slave station, establishes 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 the read-write request is to be processed, 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 polls next time according to the control message and the data message.
Further, before the master station polls the slave stations, the motion calculation module of the master station performs equal-step interpolation calculation on the motion parameters of each slave station in advance; at this moment, the master station directly constructs a control message according to the pre-calculated result.
Further, when the control message and the data message both include a message sequence number bit,
when the master station polls each slave station, the master station updates the message sequence number once when sending a control message to the corresponding slave station; when the slave station replies to the master station for 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 of the slave station, the sequence number of the message is updated once when the master station sends a data message to the corresponding slave station; when the corresponding slave station replies to the master station for 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 comprises a slave station monitoring module, the slave station comprises a master station monitoring module, the communication message comprises a heartbeat message,
when the master station and the slave station are preconfigured, the configuration items of the master station further comprise a heartbeat period and slave station overtime, and the configuration items of the slave station further comprise master station overtime; 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 used for accumulating the time length of the slave station for replying the communication message and judging whether the corresponding slave station is abnormal or not according to the time length; the master station overtime is associated with the master station monitoring module and used for accumulating the time length of the master station for sending the communication message and enabling any slave station to judge whether the master station is abnormal or not according to the time length.
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 the slave station is synchronous control, synchronous information is written into a synchronous identification bit of a control message; after receiving the control message, the slave station associates the synchronization information with a synchronization processing module of the slave station; at this time, the slave station is not triggered to execute the movement under the action of the control message until the synchronous processing module receives the synchronous message.
Has the advantages that:
according to the technical scheme, the motion control communication system based on the CAN bus is provided, the master station of the communication system comprises a read-write request module, a motion calculation module and a first switching value updating module, and the slave station comprises a read-write processing module, a motion response module and a second switching value updating module which correspond to the modules 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 station. Specifically, the data packet and the control packet include a data area and a plurality of bit fields, where the bit fields include a function code bit, a master-slave identification bit, a mode bit, and a slave station ID bit. During communication, 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 distribute the 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 that the complexity that the working mode of the slave station needs to be modified firstly and then the motion parameter quantity is transmitted under a CANopen protocol is avoided; directly identifying a message source according to the master-slave identification bit and directly identifying and matching the message source to a 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; and transmitting specific internal parameters or motion parameters according to the data area so as to realize motion execution of the slave station. Therefore, the communication system builds the corresponding master station and master station functional modules, slave station and slave station functional modules based on the CAN bus, and fills the communication information and 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, which requires complex configuration and logic processes to realize the transmission of communication information, the communication logic and the communication process of the communication system are simpler and clearer. Therefore, in the aspect of development and configuration, the working difficulty of related workers is reduced no matter the master station is developed or the slave station is configured; in practical application, various embedded motion systems have outstanding application advantages, particularly in small embedded running systems.
For the communication system, the master station further comprises the first switching value updating module so as to update the switching value input value when the master station sends the communication message; the slave station also comprises the second switching value updating module so as to update the switching value output quantity when the slave station sends the communication message. The bit fields of the data message and the control message also comprise 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 prior communication system which mostly depends on physical modes, such as various data lines to realize communication connection, the method is beneficial to 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 carries out communication based on the communication system. In the configuration process, simple pre-configuration is only carried out before communication; specifically, the pre-configuration only includes the slave station number of the master station, the master station communication baud rate, the self number of the slave station, and the slave station communication baud rate. Compared with the CANopen protocol which needs to carry out complicated configuration of PDO parameters and SDO parameters, the configuration parameters are less, and the configuration process is simpler. In the communication process, the identification of the working mode of the slave station and the execution of the motion of the slave station can be realized only by the corresponding control message; compared with the CANopen protocol in which the working mode of the slave station needs to be modified and internal parameter quantity or motion parameter quantity transmission needs to be carried out to control the slave station to execute 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 and additional concepts described in greater detail below can be considered as part of the inventive subject matter of this disclosure unless such concepts are mutually inconsistent.
The foregoing and other aspects, embodiments and features of the present teachings can be more fully understood from the following description taken in conjunction with the accompanying drawings. Additional aspects of the present invention, such as features and/or advantages of exemplary embodiments, will be apparent from the description which follows, or may be learned by practice of specific embodiments in accordance with the teachings of the present 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 present 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 clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the drawings of the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the invention without any inventive step, are within the scope of protection of the invention. Unless defined otherwise, technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention belongs.
The use of "first," "second," and similar terms in the description and claims of the present application do not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another. Similarly, the singular forms "a," "an," or "the" do not denote a limitation of quantity, but rather denote the presence of at least one, unless the context clearly dictates otherwise. The terms "comprises," "comprising," or the like, mean that the elements or items listed before "comprises" or "comprising" encompass the features, integers, steps, operations, elements, and/or components listed after "comprising" or "comprising," and do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. "upper", "lower", "left", "right", and the like are used only to indicate relative positional relationships, and when the absolute position of the object to be described is changed, the relative positional relationships may also 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 by 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; during communication, communication can be directly realized only through bit field identification of the communication message. Therefore, the configuration process is simpler, the communication logic is quicker, and the real-time performance of communication is more favorably realized.
The motion control communication system based on the CAN bus disclosed in the present invention is further described in detail with reference to the embodiments shown in the drawings.
As shown in fig. 1, the communication system includes a master station connected based on a CAN network, a plurality of slave stations, and communication messages transmitted and interacted between the master station and the slave stations. In particular, the master station may be various logic controllers, and the slave station may be a servo controller, a frequency converter, a step controller, or the like. The serial numbers of the slave stations are regulated to be 1, 2 and 3.
In order to realize communication, the master station is arranged to comprise 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 realizing the control of the master station on the motion of 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 number or the motion parameter number. 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 bits are used for directly identifying the types of the corresponding messages by the master station or the slave station, the master-slave identification bits are used for directly identifying the sources of the master station or the slave station of the corresponding messages, the mode bits are used for directly identifying the working modes of the slave station transmitted by the corresponding messages by the master station or the slave station, and the ID bits of the slave station are used for directly distinguishing the slave station by the master station.
In specific 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 the 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 that the complexity that the working mode of the slave station needs to be modified firstly and then the motion parameter quantity is transmitted under the CANopen protocol is avoided; directly identifying the source of the message according to the master-slave identification bit and directly identifying and matching the source 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; and transmitting specific internal parameters or motion parameters according to the data area so as to realize motion execution of the slave station. Therefore, the communication system builds the corresponding master station and master station functional modules, slave station and slave station functional modules based on the CAN bus, and fills the communication information and 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, which needs to realize the transmission of communication information by means of complex configuration and logic processes, the configuration process and the communication logic of the communication system are simpler and clearer, so that the working difficulty of related workers is reduced in the aspects of development and configuration, no matter the master station is developed or the slave station is configured; in practical application, various embedded motion systems have outstanding application advantages, particularly in small embedded running systems.
The master station also comprises a first switching value updating module used for updating the switching value input value when the master station sends the communication message; the slave station also comprises a second switching value updating module which is used for updating the switching value output quantity when the slave station sends the communication message; the bit fields of the data message and the control message further include 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 prior communication system which mostly depends on physical modes, such as various data lines to realize communication connection, the method is beneficial to reducing visible wire harnesses and simplifying the complexity of system interconnection, thereby simplifying the 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. 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 function code bits. At this time, the heartbeat messages are transmitted from the slave station monitoring module to the master station monitoring module according to a fixed period, and the slave station receives the heartbeat of the master station to realize online monitoring of the heartbeat.
Correspondingly, in order to ensure the correctness 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 sent and received; and the system is used for monitoring whether the communication interaction between the master station and the corresponding slave station is normal. In specific implementation, if the communication is normal, the 'message serial numbers' of the corresponding messages sent to any slave station by the master station are sequentially increased; if the slave station is abnormal and does not reply in time, the master station tries to retransmit the message when polling next time, namely retransmits the corresponding message with the same message sequence number.
In this embodiment, the communication system supports the slave station including the following operation modes: displacement mode, speed mode, torque mode. When the slave station is in a displacement mode, the position variation is in the data area; when the slave station is in a rotating speed mode, the target rotating speed value is in the data area; when in the slave station torque mode, the target torque value is in the data field.
The three working modes are divided into two control modes, namely synchronous control and asynchronous control. In order to realize the two control modes, the master station further comprises a synchronous control module, and the slave station further comprises a synchronous processing module. The communication message further comprises a synchronous message, and the bit field of the synchronous message comprises function code bits which are 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; the method is used for performing synchronous control of the master station to the slave station.
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 and replies the packet for the server. The heartbeat message and the synchronous message are in a producer-consumer mode, the master station sends out messages for producers, all the slave stations receive the messages for consumers, and the slave stations do not need to reply.
Based on the above arrangement, the present embodiment defines a specific communication packet format, as shown in table 1 below.
Table 1 communication message format table
Figure BDA0003478430020000101
Based on the arbitration principle of the CAN bus, the priority of each communication message is set to be from high to low in sequence: a synchronization message, a control message, a data message, and a heartbeat message.
The communication method of the motion control communication system based on the CAN bus disclosed in the present invention is further described in detail with reference to the embodiments shown in the drawings.
The communication method is based on the communication system to realize communication, and comprises the following steps:
s102, the master station and the slave stations are respectively preconfigured, configuration items of the master station comprise slave station numbers and master station communication baud rates, and configuration items of the slave stations comprise self numbers and slave station communication baud rates; the serial number of the slave station corresponds to the serial number of the slave station; the communication baud rate of the master station is the same as that of the slave station, and is associated with a polling interval and a polling period;
in the communication method, because the communication information and the communication logic are all filled in the corresponding bit field of the communication message, the master station can identify the source of the specific slave station only by carrying out simple pre-configuration, and the communication is kept in the same period or the same frequency. 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 workers can complete 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 the communication system is provided with N slave stations, the communication baud rate of the master station and the communication baud rate of the slave stations are both 1Mbps, the master station has 6 communication messages at most at the same time when polling to any slave station, namely a heartbeat message, a synchronous message, a control message sent by the master station, a control message replied by the slave stations, a data message sent by the master station and a data message replied by the slave stations; according to the characteristics of the CAN bus, the time that the single communication message occupies the CAN bus is not more than 150 us; so that each slave station takes no more than 900 us. For a small embedded operation system, the polling interval t between the master station and each slave station can be approximately 1 ms; in this case, the polling period T-Nms can be obtained from the polling period T-tn.
S104, the master station performs polling control on each slave station, constructs 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 simpler, and the real-time performance is higher.
S106, the master station checks the read-write request module, and if the read-write request to be processed exists, the master station sends a data message to the corresponding read-write processing module to complete reading and writing of the internal variables of the slave station;
in the step, the internal parameter items of the slave station are assigned through reading and writing of the internal parameters. The internal parameter items comprise the slave station internal parameter items such as the definition of the switching value input and output function of the slave station, the control gain and the like.
In this step and step S104, in order to maintain the balance of the CAN bus load, the master station transmits at most one control packet and one data packet each time when polling any slave station.
And S108, the master station receives the control message and the data message replied by each slave station and polls next time according to the control message and the data message.
In step S104, in order to prevent the communication real-time performance from being affected by too long time consumption when the motion calculation module waits for the real-time calculation; and the time jitter of the control message sending interval caused by the time jitter affects the communication accuracy. Before step S104, that is, before the master station polls the slave stations, the motion calculation module of the master station performs equal-step interpolation calculation on the motion parameters of each slave station in advance; at this moment, the master station directly constructs a control message according to the pre-calculated result.
In this step, the equal-step interpolation calculation is to first disperse the motion parameter amount of each slave station according to the polling cycle, and then calculate the motion parameter amount of each slave station in sequence before the master station starts polling.
Specifically, when both the control packet and the data packet include a packet sequence number bit. When step S104 is performed, the master station updates the message sequence number once every time it sends a control message to the corresponding slave station; and when the slave station replies to the master station for 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 performed, the sequence number of the message is updated once every time the master station sends a data message to the corresponding slave station; when the corresponding slave station replies to the master station for 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 packet includes a heartbeat packet. In step S104, the configuration items of the master station further include a heartbeat cycle and a slave station timeout, and the configuration items of the slave station further include 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 used for accumulating the time length of the slave station for replying the communication message and judging whether the corresponding slave station is abnormal or not according to the time length; the master station overtime is associated with the master station monitoring module and used for accumulating the time length of the master station for sending the communication message and enabling any slave station to judge whether the master station is abnormal or not according to the time length.
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 control message is synchronous control, the synchronous information is written into a synchronous identification bit of the control message; after receiving the control message, the slave station associates the synchronization information with a synchronization processing module of the slave station; at this time, the slave station is not triggered to execute the movement under the action of the control message until the synchronous processing module receives the synchronous message.
Specifically, the sending time of the synchronization packet is after each polling is finished.
Although the present invention has been described with reference to the preferred embodiments, it is not intended to be limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, the protection scope of the present invention should be determined by the appended claims.

Claims (10)

1. A motion control communication system based on a 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;
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 both comprise a data area and a plurality of bit fields; the data area is used for transmitting the internal parameter number or the motion parameter number; 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 directly identifying the type of a corresponding message by a master station or a slave station, 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 directly identifying the working mode of the slave station transmitted by the corresponding message by the master station or the slave station, and the ID bit of the slave station is used for directly distinguishing the slave station by the master station;
the first switching value updating module is used for updating the switching value input value when the master station sends the communication message; the second switching value updating module is used for updating the switching value output quantity when the slave station sends the communication message; the bit fields of the data message and the control message also comprise 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 function code bits which are transmitted from the slave station monitoring module to the master station monitoring module and used for monitoring the working state of the master station by the slave 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 message sequence number bits of the same corresponding message are the same when the same corresponding message is transmitted and received; and the master station is used for monitoring whether the communication between the master station and the corresponding slave station is matched.
4. The communication system of claim 3, wherein the primary station comprises a synchronization control module and the secondary station comprises a synchronization processing module; the communication message comprises a synchronous message, and a 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; and the synchronous identification bit is used for associating the control message with a synchronous message so as to carry out synchronous control on the slave station by the master station.
5. The communication system according to claim 4, wherein the priority of each communication message is, in order from high to low: a synchronization message, a control message, a data message, and a heartbeat message.
6. A communication method of a motion control communication system based on a CAN bus, wherein the communication is realized based on the communication system of any one of claims 1 to 5, comprising:
the master station and the slave station are respectively preconfigured, the configuration items of the master station comprise slave station numbers and master station communication baud rates, and the configuration items of the slave station comprise self numbers and slave station communication baud rates; the serial number of the slave station corresponds to the serial number of the slave station; the communication baud rate of the master station is the same as that of the slave station, and is associated with a polling interval and a polling period;
the master station performs polling control on each slave station, establishes 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 the read-write request is to be processed, 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 polls next time according to the control message and the data message.
7. The communication method of claim 6, wherein before the master station polls the slave stations, the motion calculation module of the master station performs an equal step interpolation calculation on the motion parameters of each slave station in advance; at this moment, the master station directly constructs a control message according to the pre-calculated result.
8. The method of claim 6, wherein 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 updates the message sequence number once every time the master station sends a control message to the corresponding slave station; when the slave station replies to the master station for 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 of the slave station, the sequence number of the message is updated once when the master station sends a data message to the corresponding slave station; 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 according to claim 6, wherein 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 the master station and the slave station are preconfigured, the configuration items of the master station further comprise a heartbeat period and slave station overtime, and the configuration items of the slave station further comprise master station overtime; 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 used for accumulating the time length of the slave station for replying the communication message and judging whether the corresponding slave station is abnormal or not according to the time length; the master station overtime is associated with the master station monitoring module and used for accumulating the time length of the master station for sending the communication message and enabling any slave station to judge whether the master station is abnormal or not according to the time length.
10. The communication method according to claim 9, wherein when the master station includes a synchronization control module, the slave station includes 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 the slave station is synchronous control, synchronous information is written into a synchronous identification bit of a control message; after receiving the control message, the slave station associates the synchronization information with a synchronization processing module of the slave station; at this time, the slave station is not triggered to execute the 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 true CN114500151A (en) 2022-05-13
CN114500151B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115037568A (en) * 2022-05-16 2022-09-09 中国人民解放军海军工程大学 Industrial bus transmission method based on IO mapping
CN115277295A (en) * 2022-07-29 2022-11-01 广东美的智能科技有限公司 Communication method of controller and 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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115037568A (en) * 2022-05-16 2022-09-09 中国人民解放军海军工程大学 Industrial bus transmission method based on IO mapping
CN115037568B (en) * 2022-05-16 2024-05-07 中国人民解放军海军工程大学 Industrial bus transmission method based on IO mapping
CN115277295A (en) * 2022-07-29 2022-11-01 广东美的智能科技有限公司 Communication method of controller and controller
CN115277295B (en) * 2022-07-29 2023-12-19 广东美的智能科技有限公司 Communication method of controller and controller

Also Published As

Publication number Publication date
CN114500151B (en) 2024-01-30

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
US4888726A (en) Distributed processing in a cluster of industrial controls linked by a communications network
CN101341450B (en) Method, communication network, and control unit for the cyclical transmission of data
CN111030909B (en) Method for time synchronization among CAN bus multi-master device communication
Ferreira et al. The FTT-CAN protocol for flexibility in safety-critical systems
CN109995675B (en) Self-adaptive industrial Ethernet gateway system and method based on software definition
JPH02238544A (en) Protocol high speed processing system and network system
CN102932224A (en) CAN network-based data communication system and data communication method based on same
Kopetz A solution to an automotive control system benchmark
CN106873541A (en) A kind of EtherCAT Distributed Servo kinetic control systems based on DSP
CN114285695B (en) Communication method, device, apparatus, system and storage medium
CN108809949A (en) The method converted and dispatched between profinet, FF H1, CAN and profibus agreements
CN114338274A (en) Heterogeneous industrial field bus fusion method and system
Cena et al. A MODBUS extension for inexpensive distributed embedded systems
CN116980497B (en) Configurable CANopen master station system based on BLVDS bus and implementation method
CN105245424A (en) Interconnection method for PROFIBUS DP and PROFINET communication networks through sharing storage unit
Desai et al. Controller area network for intelligent vehicular systems
CN115657646B (en) Test method and device of CAN controller
CN106170937B (en) For synchronous communication device, communication system and the method for sending message
JP2003198572A (en) Deterministic field bas and process for management of such a bus
WO2020238764A1 (en) Time sequence management method, device and system
Xu et al. Profibus automation technology and its application in DP slave development
KR100583811B1 (en) The can message identifier allocation method and the can message transfer arbitration method for the humanoid robot
CN112994998A (en) Communication node, communication method, communication device 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