CN106875664B - Exclusive data acquisition method based on CAN bus - Google Patents

Exclusive data acquisition method based on CAN bus Download PDF

Info

Publication number
CN106875664B
CN106875664B CN201710254614.6A CN201710254614A CN106875664B CN 106875664 B CN106875664 B CN 106875664B CN 201710254614 A CN201710254614 A CN 201710254614A CN 106875664 B CN106875664 B CN 106875664B
Authority
CN
China
Prior art keywords
data
terminal
acquisition
message
emergency
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
CN201710254614.6A
Other languages
Chinese (zh)
Other versions
CN106875664A (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.)
China Shipbuilding Digital Information Technology Co ltd
Original Assignee
Lianyungang Jari Shenruan Technology 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 Lianyungang Jari Shenruan Technology Co ltd filed Critical Lianyungang Jari Shenruan Technology Co ltd
Priority to CN201710254614.6A priority Critical patent/CN106875664B/en
Publication of CN106875664A publication Critical patent/CN106875664A/en
Application granted granted Critical
Publication of CN106875664B publication Critical patent/CN106875664B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C19/00Electric signal transmission systems
    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C17/00Arrangements for transmitting signals characterised by the use of a wireless electrical link
    • G08C17/02Arrangements for transmitting signals characterised by the use of a wireless electrical link using a radio link
    • 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
    • H04L12/40013Details regarding a bus controller
    • 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
    • H04L12/40039Details regarding the setting of the power status of a node according to activity on the bus
    • 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)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention relates to an exclusive data acquisition method based on a CAN bus, which is an exclusive data acquisition method based on a plurality of terminals of the CAN bus and realizes data communication between a set of data summarization end and N sets of acquisition terminals; the data summarization end and the acquisition terminal are intelligent devices; n sets of acquisition terminals are connected in parallel to a CAN bus in a hand-pulling mode through a CAN bus cable and finally connected to a data gathering end. The method comprises the following steps: exclusive "one-to-one" communication, exclusive "one-to-many" polling communication, and emergency communication. Two methods for mutually matching the 'emergency bit' and the 'command code' flag bit are designed, and real-time transmission and response of emergency data are ensured by adjusting the priority of the message under different conditions. The invention has wide application range, performance improvement of tens of times, strong real-time response capability to emergency data, and more acquisition terminals, more obvious technical effect.

Description

Exclusive data acquisition method based on CAN bus
Technical Field
The invention relates to a data acquisition method, in particular to an exclusive data acquisition method based on a CAN bus.
Background
Among a plurality of field buses, the CAN bus is more and more favored by people due to the advantages of outstanding reliability, instantaneity, flexibility and the like, and accordingly, the market of product requirements based on the CAN bus is increasingly expanded and the application is also more and more extensive.
Data acquisition is an interface technology in which data is acquired from the outside of a system by a device and input into the inside of the system, and the same point data is repeatedly acquired at intervals of a certain time (called a sampling period), and is widely applied to various fields. With the rapid development of the internet industry, data acquisition has been widely applied to the internet and distributed fields, bringing data acquisition into a new era.
The method comprises the steps that a working framework of a client/server is adopted for periodical data collection, a data summarizing end serves as the client, a collection terminal serves as the server, when the data summarizing end needs to collect data, a command request is sent to the collection terminal, and the collection terminal responds to the command request and returns the data to be collected. According to the communication flow, data acquisition of other residual acquisition terminals is completed in one sampling period. The defects are as follows: in a sampling period, the data center sends out the same command request for many times, and on the CAN bus, the same acquisition terminal receives the same command request for many times, plus the command processing time, the communication bandwidth is greatly wasted. In addition, when the acquisition terminal needs to send emergency data, the real-time response time of the data center is uncertain. The best response condition is that when the appointed acquisition terminal is inquired, the terminal just needs to send emergency data; the worst response situation is that the last acquisition terminal needs to send urgent data when inquiring the first acquisition terminal.
Disclosure of Invention
The invention aims to solve the technical problem of providing a real-time and efficient exclusive data acquisition method based on a CAN bus aiming at the defects of the prior art.
The technical problem to be solved by the present invention is achieved by the following technical means. The invention relates to a CAN bus-based exclusive data acquisition method, which is characterized in that:
the method is based on a CAN bus multi-terminal exclusive data acquisition method, and realizes data communication between a set of data summarization terminal and N sets of acquisition terminals, wherein N is a positive integer; the data summarization end and the acquisition terminal are intelligent equipment which is provided with a CAN hardware interface and CAN execute program code characteristics; n sets of acquisition terminals are connected in parallel to a CAN bus in a hand-in-hand mode through a CAN bus cable and finally connected to a data summarizing end;
the data acquisition method comprises the following steps: exclusive "one-to-one" communication; on the CAN bus, a data summarization end initiates a command request to an acquisition terminal with a designated identifier value, only the acquisition terminal responds to the command request, and returns response data;
exclusive "one-to-many" polling communications; the data acquisition process of one period can be completed by configuring a parent terminal and a data summarization terminal only by sending a command request once;
emergency communication; two methods for mutually matching the 'emergency bit' and the 'command code' flag bit are designed, and real-time transmission and response of emergency data are ensured by adjusting the priority of the message under different conditions.
The invention relates to a CAN bus-based exclusive data acquisition method, which further adopts the preferable technical scheme that: the intelligent device is a PC computer.
The invention relates to a CAN bus-based exclusive data acquisition method, which further adopts the preferable technical scheme that: the method supports CAN hardware of CAN2.0A or CAN2.0B protocol; m-bit identifiers are used, Y ≧ M ≧ 3, Y equals 11 for CAN2.0A hardware, and Y equals 29 for CAN2.0B hardware; the identifier is stored in the identifier field of the CAN message.
The invention relates to a CAN bus-based exclusive data acquisition method, which further adopts the preferable technical scheme that: the identifiers of the data summarizing end and the acquisition terminal are different in numerical value, and the numerical value of the identifier of the data summarizing end is the minimum; defining the lowest bit of the identifier as an emergency bit, defaulting to '1' to represent normal state communication and '0' to represent emergency data communication; using two bits of bit (M-2) | bit (M-1) of the identifier as a command code; bit0 represents the lowest order bit of the identifier, and bit (M-1) represents the highest order bit of the identifier.
The invention relates to a CAN bus-based exclusive data acquisition method, which further adopts the preferable technical scheme that: the command code is defined in the data summarization end by adopting the following method:
(1) "11 b" indicates that the data summarizing end sends out a data polling command and requests to return data collected by each terminal in sequence from the specified x-th collecting terminal, wherein x is the identifier of the collecting terminal and is stored in the data field of the CAN message;
(2) "10 b" indicates that the data summarization end sends a specific command request to the x-th acquisition terminal, wherein x is the identifier of the acquisition terminal, and x and the specific command request are stored in the data field of the CAN message;
the command code is defined in the acquisition terminal by adopting the following method:
A. "11 b" and "10 b" indicate that the "acquisition terminal" responds to the "11 b" data polling command request sent by the "data summarization terminal"; wherein "10 b" indicates that the current data transmission has not ended; "11 b" indicates that the current data transmission has ended;
B. when the emergency bit is "1", 00b "and 01 b" indicate that the "acquisition terminal" responds to the "10 b" specific command request sent by the "data summarization terminal"; where "00 b" indicates that the current data transmission has not ended; "01 b" indicates that the current data transmission has ended;
(3) when the emergency bit is '0', '00 b' and '01 b' indicate that the 'acquisition terminal' sends an emergency command request to the 'data summarization terminal'; where "00 b" indicates that the current data transmission has not ended; "01 b" indicates that the current data transmission has ended.
The invention relates to a CAN bus-based exclusive data acquisition method, which further adopts the preferable technical scheme that: the method adopts exclusive one-to-one communication, namely a data gathering end initiates a command request to an acquisition terminal with a designated identifier value, and only the acquisition terminal responds to the command request and returns response data; the process of configuring the father terminal belongs to one-to-one communication, the data summarizing end sends a '10 b' command request packet to a specified acquisition terminal, a data field of the command request packet contains an identifier value, the acquisition terminal with the identifier value of the command request is configured as the father terminal of the terminal, the terminal carries out response configuration after receiving the command request, and a configuration result is reported to the data summarizing end; the father terminal is configured, so that the acquisition terminal CAN receive the CAN message from the father terminal and is used for exclusive one-to-many polling communication.
The invention relates to a CAN bus-based exclusive data acquisition method, which further adopts the preferable technical scheme that: the method adopts exclusive one-to-many polling communication: the data summarization end initiates a query request to a plurality of acquisition terminals and requires the acquisition terminals to return respective acquired data to the data summarization end, and the one-to-many communication is a periodic data communication process; in a one-to-many communication period, the data gathering end only needs to send a command request once, and a plurality of acquisition terminals respond in sequence and return acquired data of the terminal;
(1) the data gathering end sends an 11b command request to the CAN bus, the data field of the message contains an identifier value of an acquisition terminal 1#, and the acquisition terminal 1# is required to return acquired data;
(2) all the acquisition terminals on the CAN bus CAN receive an 11b command request message of the data gathering terminal, and by judging the identifier value of the message data field, the acquisition terminal 1# meets the requirement, responds to the command request, returns acquired data to the data gathering terminal, and ignores the command message by other acquisition terminals;
(3) acquisition terminal 1# is a parent terminal of acquisition terminal 2#, acquisition terminal 2# receives a response message of acquisition terminal 1#, and acquisition terminal 1# judges whether an emergency bit of an identifier in the message is 0 or not, and ignores the message if the emergency bit is 0; if the message is "1", then the following processing is carried out through the "command code" for identifying the identifier in the response message:
(i) when the command code is not 11b, the message is ignored by the acquisition terminal 2#, and is not processed;
(ii) when the command code is 11b, the acquisition terminal 2# returns acquired data to the data gathering terminal;
the other acquisition terminals directly ignore the response message of the acquisition terminal 1#, and do not process the response message;
(4) acquisition terminal 2# is a parent terminal of acquisition terminal 3#, acquisition terminal 3# receives a response message of acquisition terminal 2#, and acquisition terminal 2# judges whether an emergency bit of an identifier in the message is 0 or not, and ignores the message if the emergency bit is 0; if the message is "1", then the following processing is carried out through the "command code" for identifying the identifier in the response message:
(i) when the command code is not 11b, the message is ignored by the acquisition terminal 2#, and is not processed;
(ii) when the command code is 11b, the acquisition terminal 2# returns acquired data to the data gathering terminal;
the other acquisition terminals directly ignore the response message of the acquisition terminal 2#, and do not process the response message;
(5) by analogy, the last acquisition terminal N # returns acquired data to the data gathering terminal, and the data acquisition process of one period is completed.
The invention relates to a CAN bus-based exclusive data acquisition method, which further adopts the preferable technical scheme that: the 'emergency communication' of the method is that the 'acquisition terminal' actively sends data to the 'data summarization terminal'; when the acquisition terminal a needs emergency communication, the emergency position of the identifier is set to be 0, and compared with the priority of polling communication, the acquisition terminal a has higher priority, so that the periodic polling communication process is interrupted, and the emergency data is guaranteed to be preferentially transmitted to the data summarizing end; after receiving the emergency message, the data summarizing end sets the emergency position of the identifier of the data summarizing end to be 0, the message of the data summarizing end has the highest priority, when the emergency data of other acquisition terminals are about to be transmitted on the CAN bus, the transmission process is interrupted, and after the response message is transmitted to the acquisition terminal a firstly, the interrupted acquisition terminal CAN continue to transmit the data;
and by analogy, the emergency communication process of other terminals is completed.
Under extreme conditions, a plurality of acquisition terminals are abnormal simultaneously, an emergency message is sent to a data gathering terminal, and the CAN bus enters an arbitration mechanism and sends data in sequence according to the priority level; after receiving the emergency message, the data summarizing end sets the emergency position of the identifier of the data summarizing end to be 0, the message of the data summarizing end has the highest priority, response messages are sequentially sent to corresponding acquisition terminals according to the sequence of receiving the emergency message, and finally emergency communication of all the acquisition terminals is completed.
Compared with the prior art, the invention and the further designed invention have the following remarkable advantages:
1. the data summarization end and the acquisition terminal are preferably selected from a PC (personal computer) but not limited to the PC, and the intelligent equipment which is provided with the CAN hardware interface and CAN execute the program code characteristics meets the technical requirements and has wide application range.
2. The invention can support more collection terminals, the performance is improved by tens of times, and the more the collection terminals, the more obvious the technical effect is.
3. Even in extreme cases, m acquisition terminals simultaneously require to send the emergency data, and the acquisition terminal with the lowest priority needs to wait for (m-1) × 0.4.4 ms (calculated at the rate of 250 kb/s) at the longest.
Drawings
FIG. 1 is a data collection type classification of an exclusive data collection method based on a CAN bus according to the present invention;
FIG. 2 is a hardware block diagram of the present invention;
FIG. 3 is a diagram of an identifier definition for a CAN message;
FIG. 4 is a communication process diagram of exclusive "one-to-many" polling communication;
fig. 5 is a communication process diagram corresponding to a plurality of "acquisition terminals" of emergency communication not initiating emergency communication at the same time;
fig. 6 is a communication process diagram of multiple "acquisition terminals" simultaneously initiating emergency communication corresponding to the emergency communication.
Detailed Description
The embodiments of the present invention will be further described with reference to the accompanying drawings so as to facilitate the further understanding of the present invention by those skilled in the art, and do not limit the right thereto.
Referring to fig. 1, an exclusive data acquisition method based on a CAN bus is an exclusive data acquisition method based on multiple terminals of the CAN bus, and realizes data communication between a set of data summarization terminals and N sets of acquisition terminals, where N is a positive integer; the data summarization end and the acquisition terminal are intelligent equipment which is provided with a CAN hardware interface and CAN execute program code characteristics; n sets of acquisition terminals are connected in parallel to a CAN bus in a hand-pulling mode through a CAN bus cable and finally connected to a data gathering end.
The method comprises the following steps:
exclusive one-to-one communication, on a CAN bus, a data gathering end initiates a command request to a collection terminal with a designated identifier value, and only the collection terminal responds to the command request and returns response data;
the exclusive one-to-many polling communication can complete the data acquisition process of one period by configuring a parent terminal and a data summarization terminal only needing to send a command request once;
in the emergency communication, two methods of mutually matching an emergency bit and a command code are designed, and the real-time transmission and response of emergency data are ensured by adjusting the priority of a message under different conditions.
Referring to fig. 2, a method for acquiring exclusive data based on a CAN bus: CAN hardware supporting CAN2.0A or CAN2.0B protocols. The whole hardware structure comprises: the CAN bus, N acquisition terminals and a data summarization terminal are all required to support CAN2.0A or CAN2.0B protocols.
Referring to FIG. 3, using an M-bit identifier (Y ≧ M ≧ 3), Y equals 11 for CAN2.0A hardware and 29 for CAN2.0B hardware. The identifier is stored in the identifier field of the CAN message.
The lowest bit0 of the identifier is an emergency bit, the default value is "1", indicating normal state communication, and the value "0" indicates emergency data communication; the highest bit of the identifier is bit (M-1), and the lowest two bits of the identifier (M-2) | bit (M-1) are used as the command code.
The identifiers of the data summarization end and the acquisition terminal are different in numerical value, and the numerical value of the identifier of the data summarization end is the minimum. The priority of the message is determined by the identifier value, and the smaller the identifier value, the higher the priority, and the right to use the CAN bus preferentially is provided.
According to the principle, a mutual matching method of the 'emergency bit' and the 'command code' zone bit is designed. The following is a definition of the use of command codes:
(1) the definition of command code is used in the "data summarization side":
and 11b indicates that the data summarizing end sends a data polling command to request that the data is collected by each terminal from the specified x-th collecting terminal, wherein x is the identifier of the collecting terminal and is stored in the data field of the CAN message.
"10 b" indicates that the "data summarization end" sends a specific command request to the x-th "acquisition terminal", wherein x is the identifier of the "acquisition terminal", and x and the specific command request are stored in the data field of the CAN message.
(2) The definition of command codes is used in "acquisition terminal":
"11 b" and "10 b" indicate that the "acquisition terminal" responds "to the" 11b "data polling command request sent by the data summarization terminal". Wherein "10 b" indicates that the current data transmission has not ended; "11 b" indicates that the current data transmission has ended.
When the emergency bit is "1", 00b "and 01 b" indicate that the "acquisition terminal" responds to the "10 b" specific command request issued by the "data summarization terminal". Where "00 b" indicates that the current data transmission has not ended; "01 b" indicates that the current data transmission has ended.
When the emergency bit is "0", 00b "and 01 b" indicate that the "acquisition terminal" sends an emergency command request to the "data summarization terminal". Where "00 b" indicates that the current data transmission has not ended; "01 b" indicates that the current data transmission has ended.
Referring to fig. 3-4, exclusive "one-to-many" polling communication, the steps are as follows:
the method comprises the following steps: the data gathering end sends an 11b command request to the CAN bus, the data field of the message contains an identifier value of an acquisition terminal 1#, and the acquisition terminal 1# is required to return acquired data;
step two: all the acquisition terminals on the CAN bus receive an 11b command request message of the data gathering terminal, and by judging the identifier value of the message data field, the acquisition terminal 1# meets the requirement, responds to the command request, returns acquired data to the data gathering terminal, and ignores the command message by other acquisition terminals;
step three: the ' acquisition terminal ' 1# ' is a ' parent terminal ' of the ' acquisition terminal 2# ', the ' acquisition terminal 2# ' simultaneously receives a response message of the ' acquisition terminal 1# ', the ' acquisition terminal 1# ' judges whether an emergency bit of an identifier in the message is ' 0 ', and if the emergency bit is ' 0 ', the message is ignored; if the message is "1", then the following processing is carried out through the "command code" for identifying the identifier in the response message:
(1) when the command code is not 11b, the message is ignored by the acquisition terminal 2#, and is not processed;
(2) when the command code is 11b, the acquisition terminal 2# returns acquired data to the data gathering terminal; other acquisition terminals ignore the response message of the acquisition terminal 1#, and do not process;
step four: and repeating the process according to the third step, and returning the acquired data to the data summarizing end by the last acquisition terminal N, namely completing the data acquisition process of one period.
Wherein, the configuration process of the parent terminal belongs to one-to-one communication. The data summarization end sends a 10b command request packet to a designated acquisition terminal, the data field of the command request packet contains an identifier value, the acquisition terminal with the identifier value is configured as a parent terminal of the terminal, the terminal receives the command request, then response configuration is carried out, and the configuration result is reported to the data summarization end. The "parent terminal" is configured to allow the "acquisition terminal" to receive the CAN packet from the "parent terminal" and thus apply to exclusive "one-to-many" polling communication.
Referring to fig. 5-6, the emergency communication includes the following steps:
(1) the acquisition terminal sets the identifier 'emergency position' of the transmitted message to '0' to obtain the current highest priority;
(2) after the data summarization end receives the message, the emergency position of the identifier of the response message is set as 0 to obtain the highest priority, and the real-time transmission and response of the emergency data are ensured.
Referring to fig. 5, in emergency communication, the "acquisition terminal" actively sends data to the "data summarization end", and when the "acquisition terminal a" needs emergency communication, the "emergency position" of the identifier is set to "0", and compared with the priority of polling communication, the "acquisition terminal a" has higher priority, so that the periodic polling communication process is interrupted, and the emergency data is guaranteed to be preferentially transmitted to the "data summarization end". After the data summarizing end receives the emergency message, the emergency position of the identifier of the data summarizing end is set to be 0, the message of the data summarizing end has the highest priority, if the emergency data of other acquisition terminals on the CAN bus are to be sent, the sending process is interrupted, and after the response message is sent to the acquisition terminal a firstly, the interrupted acquisition terminal CAN continue to send the data. And by analogy, the emergency communication process of other terminals is completed.
Referring to fig. 6, in an extreme case, a plurality of "acquisition terminals" may be abnormal at the same time, and an emergency message is sent to the "data summarization terminal", and at this time, the CAN bus enters an arbitration mechanism and sequentially sends data according to the priority level. After receiving the emergency message, the data summarizing end sets the emergency position of the identifier of the data summarizing end to be 0, the message of the data summarizing end has the highest priority, response messages are sequentially sent to corresponding acquisition terminals according to the sequence of receiving the emergency message, and finally emergency communication of all the acquisition terminals is completed. By adopting the method, the acquisition terminals with different priorities can report the emergency data to the data summarizing terminal in the shortest time and obtain priority processing.

Claims (3)

1. A exclusive data acquisition method based on a CAN bus is characterized in that:
the method is based on a CAN bus multi-terminal exclusive data acquisition method, and realizes data communication between a set of data summarization terminal and N sets of acquisition terminals, wherein N is a positive integer; the data summarization end and the acquisition terminal are intelligent equipment which is provided with a CAN hardware interface and CAN execute program code characteristics; n sets of acquisition terminals are connected in parallel to a CAN bus in a hand-in-hand mode through a CAN bus cable and finally connected to a data summarizing end;
the data acquisition method comprises the following steps:
exclusive "one-to-one" communication; on the CAN bus, a data summarization end initiates a command request to an acquisition terminal with a designated identifier value, only the acquisition terminal responds to the command request, and returns response data;
exclusive "one-to-many" polling communications; the data acquisition process of one period can be completed by configuring a parent terminal and a data summarization terminal only by sending a command request once;
emergency communication; two methods for mutually matching the 'emergency bit' and the 'command code' flag bit are designed, and the real-time transmission and response of emergency data are ensured by adjusting the priority of the message under different conditions;
the data acquisition method supports CAN hardware of CAN2.0A or CAN2.0B protocol; m bit identifiers are used, Y is more than or equal to M and more than or equal to 3, Y is equal to 11 for CAN2.0A hardware, and Y is equal to 29 for CAN2.0B hardware; the identifier is stored in an identifier field of the CAN message;
the identifiers of the data summarizing end and the acquisition terminal are different in numerical value, and the numerical value of the identifier of the data summarizing end is the minimum; defining the lowest bit of the identifier as an emergency bit, defaulting to '1' to represent normal state communication and '0' to represent emergency data communication; using two bits of bit (M-2) | bit (M-1) of the identifier as a command code; bit0 represents the lowest order bit of the identifier, bit (M-1) represents the highest order bit of the identifier;
the command code is defined in the data summarization end by adopting the following method:
(1) "11 b" indicates that the data summarizing end sends out a data polling command to request to return the collected data of each terminal in turn from the appointed x-th collecting terminal, wherein x is the identifier of the collecting terminal and is stored in the data field of the CAN message;
(2) "10 b" indicates that the data summarization end sends a specific command request to the x-th acquisition terminal, wherein x is the identifier of the acquisition terminal, and x and the specific command request are stored in the data field of the CAN message;
the command code is defined in the acquisition terminal by adopting the following method:
A. "11 b" and "10 b" indicate that the "acquisition terminal" responds to the "11 b" data polling command request sent by the "data summarization terminal"; wherein "10 b" indicates that the current data transmission has not ended; "11 b" indicates that the current data transmission has ended;
B. when the emergency bit is "1", 00b "and 01 b" indicate that the "acquisition terminal" responds to the "10 b" specific command request sent by the "data summarization terminal"; where "00 b" indicates that the current data transmission has not ended; "01 b" indicates that the current data transmission has ended;
C. when the emergency bit is '0', '00 b' and '01 b' indicate that the 'acquisition terminal' sends an emergency command request to the 'data summarization terminal'; where "00 b" indicates that the current data transmission has not ended; "01 b" indicates that the current data transmission has ended;
the exclusive one-to-one communication of the data acquisition method is that a data summarization end initiates a command request to an acquisition terminal with a designated identifier value, only the acquisition terminal responds to the command request and returns response data; the method comprises the steps that a parent terminal configuration process belongs to one-to-one communication, a data summarizing end sends a '10 b' command request packet to a designated acquisition terminal, a data field of the command request packet contains an identifier value, the acquisition terminal with the identifier value of the command request is configured as the parent terminal of the acquisition terminal receiving the command request packet, the acquisition terminal receiving the command request packet carries out response configuration after receiving the command request, and a configuration result is reported to the data summarizing end; the father terminal is configured, so that the acquisition terminal CAN receive the CAN message from the father terminal and is used for exclusive one-to-many polling communication;
the exclusive one-to-many polling communication of the data acquisition method is as follows: the data summarization end initiates a query request to a plurality of acquisition terminals and requires the acquisition terminals to return respective acquired data to the data summarization end, and the one-to-many communication is a periodic data communication process; in a one-to-many communication period, the data gathering end only needs to send a command request once, and a plurality of acquisition terminals respond in sequence and return acquired data of the terminal;
(1) the data gathering end sends an 11b command request to the CAN bus, the data field of the message contains an identifier value of an acquisition terminal 1#, and the acquisition terminal 1# is required to return acquired data;
(2) all the acquisition terminals on the CAN bus CAN receive an 11b command request message of the data gathering terminal, and by judging the identifier value of the message data field, the acquisition terminal 1# meets the requirement, responds to the command request, returns acquired data to the data gathering terminal, and ignores the command message by other acquisition terminals;
(3) acquisition terminal 1# is a parent terminal of acquisition terminal 2#, acquisition terminal 2# receives a response message of acquisition terminal 1#, and acquisition terminal 2# judges whether an emergency bit of an identifier in the message is 0 or not, and ignores the message if the emergency bit is 0; if the message is "1", then the following processing is carried out through the "command code" for identifying the identifier in the response message:
(i) when the command code is not 11b, the message is ignored by the acquisition terminal 2#, and is not processed;
(ii) when the command code is 11b, the acquisition terminal 2# returns acquired data to the data gathering terminal;
the other acquisition terminals directly ignore the response message of the acquisition terminal 1#, and do not process the response message;
(4) acquisition terminal 2# is a parent terminal of acquisition terminal 3#, acquisition terminal 3# receives a response message of acquisition terminal 2#, and acquisition terminal 3# judges whether an emergency bit of an identifier in the message is 0 or not, and ignores the message if the emergency bit is 0; if the message is "1", then the following processing is carried out through the "command code" for identifying the identifier in the response message:
(i) when the command code is not 11b, the acquisition terminal 3# ignores the message and does not process the message;
(ii) when the command code is 11b, the acquisition terminal 3# returns acquired data to the data gathering terminal;
the other acquisition terminals directly ignore the response message of the acquisition terminal 2#, and do not process the response message;
(5) by analogy, the last acquisition terminal N # returns acquired data to the data gathering terminal, and the data acquisition process of one period is completed;
the 'emergency communication' of the data acquisition method is that the 'acquisition terminal' actively sends data to the 'data summarization terminal'; when the acquisition terminal a needs emergency communication, the emergency position of the identifier is set to be 0, and compared with the priority of polling communication, the acquisition terminal a has higher priority, so that the periodic polling communication process is interrupted, and the emergency data is guaranteed to be preferentially transmitted to the data summarizing end; after receiving the emergency message, the data summarizing end sets the emergency position of the identifier of the data summarizing end to be 0, the message of the data summarizing end has the highest priority, when the emergency data of other acquisition terminals are about to be transmitted on the CAN bus, the transmission process is interrupted, and after the response message is transmitted to the acquisition terminal a firstly, the interrupted acquisition terminal CAN continue to transmit the data;
and by analogy, the emergency communication process of other terminals is completed.
2. The exclusive data acquisition method based on the CAN bus according to claim 1, wherein: the intelligent device is a PC computer.
3. The exclusive data acquisition method based on the CAN bus according to claim 1, wherein: under extreme conditions, a plurality of acquisition terminals are abnormal simultaneously, an emergency message is sent to a data gathering terminal, and the CAN bus enters an arbitration mechanism and sends data in sequence according to the priority level; after receiving the emergency message, the data summarizing end sets the emergency position of the identifier of the data summarizing end to be 0, the message of the data summarizing end has the highest priority, response messages are sequentially sent to corresponding acquisition terminals according to the sequence of receiving the emergency message, and finally emergency communication of all the acquisition terminals is completed.
CN201710254614.6A 2017-04-18 2017-04-18 Exclusive data acquisition method based on CAN bus Active CN106875664B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710254614.6A CN106875664B (en) 2017-04-18 2017-04-18 Exclusive data acquisition method based on CAN bus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710254614.6A CN106875664B (en) 2017-04-18 2017-04-18 Exclusive data acquisition method based on CAN bus

Publications (2)

Publication Number Publication Date
CN106875664A CN106875664A (en) 2017-06-20
CN106875664B true CN106875664B (en) 2020-07-03

Family

ID=59163090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710254614.6A Active CN106875664B (en) 2017-04-18 2017-04-18 Exclusive data acquisition method based on CAN bus

Country Status (1)

Country Link
CN (1) CN106875664B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107483313B (en) * 2017-10-14 2023-09-08 中船重工信息科技有限公司 Data acquisition method and system based on cascade Ethernet equipment
CN111262766B (en) * 2020-01-17 2021-11-23 北京汽车股份有限公司 Method, device and system for transmitting multi-packet application message data
CN112165420A (en) * 2020-08-27 2021-01-01 深圳市优必选科技股份有限公司 Message processing method, message processing device, robot system and CAN (controller area network) equipment

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4232603B2 (en) * 2003-10-24 2009-03-04 富士ゼロックス株式会社 Communication system, control device, CAN bus connection node, CAN bus communication method, and program
CN100424605C (en) * 2006-04-04 2008-10-08 西安电子科技大学 Intelligent management apparatus and management method for distributed control network based on CAN bus
CN101626333B (en) * 2009-08-07 2011-11-23 北京和利时电机技术有限公司 Controller area network (CAN) bus system and application layer communication method in same
CN101867570B (en) * 2010-05-13 2012-12-05 浙江大学 CAN-based communication method in embedded software reliability test
CN102984096B (en) * 2012-10-12 2015-05-13 中国船舶重工集团公司第七一九研究所 Assembling method for controller area network (CAN) data frames applied in ship dynamic information acquisition device
CN104333517A (en) * 2014-09-28 2015-02-04 航天科工深圳(集团)有限公司 Automation equipment communication method based on CAN bus
KR101622516B1 (en) * 2015-04-20 2016-05-18 엘에스산전 주식회사 Data trasmitting/receiving system
CN104950765B (en) * 2015-06-23 2017-09-22 合肥工业大学 A kind of inverter parallel system and its carrier synchronization method based on CAN
CN105119793B (en) * 2015-07-20 2019-03-08 电子科技大学 A kind of identifier allocation method of sensor network CAN bus frame format
CN106125716A (en) * 2016-06-27 2016-11-16 淮安信息职业技术学院 Vehicle teaching device line intelligent fault checking system workflow based on CAN
CN106205013B (en) * 2016-07-14 2018-10-26 中车青岛四方车辆研究所有限公司 Smoke detector based on automatic addressing mode and the means of communication
CN106330643A (en) * 2016-10-31 2017-01-11 威胜电气有限公司 Communication method of one-host and multi-slave communication network and communication device

Also Published As

Publication number Publication date
CN106875664A (en) 2017-06-20

Similar Documents

Publication Publication Date Title
US10715639B2 (en) Data processing method and apparatus for performing protocol parsing in a cloud
CN106875664B (en) Exclusive data acquisition method based on CAN bus
CN110808948B (en) Remote procedure calling method, device and system
CN105101370B (en) Data connection method and device and WIFI module
KR20160065206A (en) Camera control interface slave device to slave device communication
CN104243611A (en) Distribution thought based message service middleware system
CN110601943B (en) Communication system based on RS485 bus and communication method thereof
CN105389278A (en) CAN bus based serial communication method for master and slave machines
CN107483313B (en) Data acquisition method and system based on cascade Ethernet equipment
CN110971533B (en) Method, server apparatus, client apparatus, and medium for data communication
CN109263581A (en) A kind of real-time commitment method for automatic driving vehicle
CN109039731B (en) Network management northbound interface alarm self-adapting method
CN107528798B (en) RS485 bus system-based optimal scheduling method
CN106953809B (en) 485 time-sharing communication-based equipment resource acquisition method
CN109217986A (en) A kind of data transmission method and system based on Internet of Things
CN103685480A (en) Transmission control protocol (TCP) network implementing method and server
CN111092952B (en) Data interaction method and related product
CN112165420A (en) Message processing method, message processing device, robot system and CAN (controller area network) equipment
CN105210349A (en) Wireless communication quality information processing apparatus and communication system
CN107171915B (en) Communication protocol changing method and device
CN114567673B (en) Method for quickly broadcasting blocks by block chain nodes
CN110557331A (en) User offline control method, controller, forwarding equipment and user access system
CN102043397A (en) Network communication method for building automation system
CN107172582B (en) M2M communication equipment and method based on NodeJS
CN110557728A (en) short message sending method, device and network 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
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Haizhou District of Jiangsu city of Lianyungang province Lian Hai road 222000 No. 42

Patentee after: CSIC Information Technology Co.,Ltd.

Address before: Haizhou District of Jiangsu city of Lianyungang province Lian Hai road 222000 No. 42

Patentee before: LIANYUNGANG JARI SHENRUAN TECHNOLOGY Co.,Ltd.

CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 222000 No.42, Hailian East Road, Haizhou District, Lianyungang City, Jiangsu Province

Patentee after: China Shipbuilding Digital Information Technology Co.,Ltd.

Address before: 222000 No.42, Hailian East Road, Haizhou District, Lianyungang City, Jiangsu Province

Patentee before: CSIC Information Technology Co.,Ltd.