CN106131240B - CAN address allocation method and communication system based on sequential chain - Google Patents

CAN address allocation method and communication system based on sequential chain Download PDF

Info

Publication number
CN106131240B
CN106131240B CN201610646994.3A CN201610646994A CN106131240B CN 106131240 B CN106131240 B CN 106131240B CN 201610646994 A CN201610646994 A CN 201610646994A CN 106131240 B CN106131240 B CN 106131240B
Authority
CN
China
Prior art keywords
address
module
bus
stage
stage module
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
CN201610646994.3A
Other languages
Chinese (zh)
Other versions
CN106131240A (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.)
Zhengzhou Maochen Electronic Technology Co ltd
Original Assignee
Zhengzhou Maochen Electronic 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 Zhengzhou Maochen Electronic Technology Co ltd filed Critical Zhengzhou Maochen Electronic Technology Co ltd
Priority to CN201610646994.3A priority Critical patent/CN106131240B/en
Publication of CN106131240A publication Critical patent/CN106131240A/en
Application granted granted Critical
Publication of CN106131240B publication Critical patent/CN106131240B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5038Address allocation for local use, e.g. in LAN or USB networks, or in a controller area network [CAN]
    • 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
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Abstract

The invention relates to a CAN address allocation method and a communication system based on a sequential chain, and belongs to the technical field of CAN communication. The invention connects each module to be communicated in cascade through the CAN bus, each module after cascade is sequentially connected by an address line, the former module uses the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, meanwhile, the CAN address plus the set value is transmitted by the CAN bus as the CAN address of the latter module, the module transmits the auxiliary signal to the latter module through the address line, the latter module uses the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, thereby realizing the CAN address allocation of each stage of link module based on the sequential chain. The CAN address allocation mode is simple to realize, flexible in networking and convenient to expand, and CAN be well applied to a cascade CAN communication system.

Description

CAN address allocation method and communication system based on sequential chain
Technical Field
The invention relates to a CAN address allocation method and a communication system based on a sequential chain, and belongs to the technical field of CAN communication.
Background
As is known, CAN network nodes must have a legal and unique network address on the bus, and in CAN network control systems, the identification of each slave node by the master node is performed by means of the network address. In practice, such addresses are typically set by an operator interface provided to the user by the equipment manufacturer, such as a dial switch, knob, etc. However, when the node needs to be waterproof, dustproof or works in a severe and remote environment, in order to improve the protection level of the node, the node cannot keep a similar interface, and the network address of the node can only be set by software. Regardless of the manner in which the CAN node network address is configured, higher requirements are placed on the operating skills of field maintenance personnel and maintenance equipment. At present, the automatic allocation of network addresses by the CAN network node through software mainly comprises the following two types:
one is based on the mode of the virtual address of the module, realize the individual difference of the module; when each module is powered on, virtual addresses are generated through a certain random algorithm, the host computer searches the virtual addresses in a reduced range one by one after the power on, and judges whether the virtual addresses are repeated or not according to the response of the slave computers (the virtual addresses are required to be regenerated after the repetition), so that the unique virtual addresses of each module are finally determined, the host computer distributes the addresses through the difference of the virtual addresses, the reliability and the efficiency of the communication addresses of the slave computers and the algorithm of the virtual addresses are insufficient, and the physical positions of the modules cannot be quickly positioned according to the virtual addresses.
The other is based on the physical address mode, according to a certain rule, a unique 32-bit code (power-down memory) is written, the individual difference of each module is realized through the difference of the codes, and the first 29 bits of the 32-bit code are used as the communication address (29 bit identifier of the CAN communication frame) of the node. The disadvantage of this approach is: in the standard CAN extension frame, 8 bits PS in the 29 bit identifier are the destination address, 8 bits SA is the source address, and other bits are used to represent ID pages, message codes, etc., but in this way, due to the uncertainty of 32 bit encoding, any array combination of the 29 bit identifier may be used as the node address, so in this case, when the first 29 bits are used as the communication address of the node, the address length may exceed the 8 bits requirement of PS and SA, which results in that the CAN network cannot be used for other data and command processing, does not have versatility and compatibility, and cannot be introduced into other CAN networks.
Disclosure of Invention
The invention aims to provide a CAN address allocation method and a communication system based on a sequential chain, which are used for solving the problems that the current CAN address allocation mode is complex, the efficiency is low and the universality is not realized.
The invention provides a CAN address allocation method based on a sequential chain for solving the technical problems, which comprises the following steps:
1) The modules to be communicated are cascaded in a CAN bus mode, and the modules after the cascade connection are sequentially connected through address lines, namely, the address output port of the former-stage module is connected with the address input port of the latter-stage module through the address lines, and the modules are used for transmitting auxiliary signals for automatically writing addresses;
2) The former stage module uses the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, and uses the CAN address plus the set value as the CAN address of the latter stage module to be transmitted by the CAN bus, and the module transmits the auxiliary signal to the latter stage module through the address line, and the latter stage module uses the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, thereby realizing the CAN address allocation of each stage of link module based on the sequential chain.
The CAN bus and the address line are made into a wiring harness, and the interface of the wiring harness is the integration of a CAN bus wiring port and an address signal line wiring port.
The address information of the module at the forefront stage is provided by the industrial personal computer and the protocol module.
When a module is started, the CAN address of the module is not successfully obtained from the previous module, and the CAN address is sent to the next module.
When the last module successfully obtains its network address, it means that all modules in front of it also successfully obtain its CAN address.
And after the CAN addresses of the modules are successfully allocated, each module sends the type identification code to the industrial personal computer through a cascade CAN network, and the industrial personal computer judges whether the address of each module is matched with the preset module type position.
The invention also provides a CAN communication system, which comprises a CAN bus and at least two modules cascaded through the CAN bus, wherein the modules are sequentially connected through address lines, namely, the address output port of the former module is connected with the address input port of the latter module through the address lines, the address lines are used for transmitting auxiliary signals for automatically writing addresses by the modules, the former module takes the CAN address plus a set value as the CAN address of the latter module to be transmitted through the CAN bus, and the latter module stores the addresses on the CAN bus into an address memory as the addresses thereof according to the received auxiliary signals so as to realize the CAN address allocation of each cascade module based on a sequential chain.
The CAN bus and the address signal wire are made into a wiring harness, and the interface of the wiring harness is the integration of a CAN bus wiring port and an address signal wire wiring port.
The communication system also comprises an industrial personal computer, wherein the industrial personal computer is connected with the forefront stage module and provides a CAN address for the forefront stage module.
And after the CAN addresses of the modules are successfully allocated, each module sends the type identification code to the industrial personal computer through a cascade CAN network, and the industrial personal computer judges whether the address of each module is matched with the preset module type position.
The CAN address distribution method has the advantages that the modules to be communicated are cascaded in a CAN bus mode, the modules after the cascade connection are sequentially connected through an address line, the former-stage module takes the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, meanwhile, the CAN address plus a set value is taken as the CAN address of the latter-stage module to be transmitted by the CAN bus, the module transmits the auxiliary signal to the latter-stage module through the address line, and the latter-stage module takes the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, so that the CAN address distribution of each-stage link module based on a sequential chain is realized. The CAN address allocation mode is simple to realize, flexible in networking and convenient to expand, and CAN be well applied to a cascade CAN communication system.
Drawings
Fig. 1 is a schematic structural diagram of a CAN communication system in an embodiment of the present invention.
Detailed Description
The following describes the embodiments of the present invention further with reference to the drawings.
The CAN address allocation method based on the sequential chain is aimed at a cascade CAN communication system, and is used for automatically writing an auxiliary signal of an address by a transmission module by cascading the modules to be communicated in a CAN bus mode, namely connecting the CAN output port of the former-stage module with the CAN input port of the latter-stage module, and connecting the modules after cascading by using an address signal wire, namely connecting the address output port of the former-stage module with the address input port of the latter-stage module through the address signal wire. The former stage module uses the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, and uses the CAN address plus the set value as the CAN address of the latter stage module to be transmitted by the CAN bus, and the module transmits the auxiliary signal to the latter stage module through the address line, and the latter stage module uses the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, thereby realizing the CAN address allocation of each stage of link module based on the sequential chain.
As shown IN fig. 1, the communication system according to the embodiment includes an industrial personal computer and 7 modules, the 1# module is a protocol conversion module, the 2# module is a digital output module, the 3# module is an analog input module, the 4# module is a digital input module, the 5# module is an analog output module, the 6# module is a digital output module, the 7# module is an analog input module, the industrial personal computer is connected with the CAN IN port of the 1# module through the protocol conversion module, the CAN OUT port of the 1# module is connected with the CAN IN port of the 2# module, the CAN OUT port of the 2# module is connected with the CAN IN port of the 3# module, and so on, CAN cascading between 7 modules is realized, address information of each module is transmitted through a CAN bus, IN order to realize automatic allocation between the cascade modules, address lines for automatic writing of address auxiliary signals are also connected between the modules, the address output port of the previous stage module is connected with the address input port of the next stage module through the address lines, namely, the address output port of the 1# module is connected with the address input port of the 2# module through the address lines, the 2# module is connected with the address input port of the 2# module through the address lines, and the address output port of the 2# module is connected with the address port of the address module according to the address input port. In this embodiment, for convenience of connection, the CAN bus and the address line are made into a wire harness, the interface of the wire harness is the integration of the CAN bus connection port and the address signal line connection port, and the CAN port and the address port of each corresponding module CAN be designed together and are matched with the port of the wire harness. The CAN address allocation process of the system is as follows:
1. after the system is electrified for the first time, the industrial personal computer transmits a first address signal Add: #1 to a CAN bus through the RS 232-CAN protocol conversion module, and simultaneously transmits an auxiliary signal to the #1 module through an address line, wherein the auxiliary signal CAN be a 300Hz frequency signal.
The No. 2.1 module receives an auxiliary signal through an address wire, receives a first address Add: #1 from a CAN bus, stores the first address Add: #1 into an address memory as an address of the first address Add: #1, adds a set value to the address Add: #1, obtains an address Add: #1+1 in the embodiment in a mode of adding 1, sends the obtained address Add: #1+1 to the CAN bus through a CAN output port of the address Add: #1, and simultaneously sends the auxiliary signal to the No. 2 module through the address wire;
the #2 module receives an address Add: #1+1 from the CAN bus through the address wire after receiving the auxiliary signal, stores the address Add: #1+1 into the address memory as an address thereof, adds 1 to the address Add: #2, sends the address Add: #2 to the CAN bus through a CAN output port thereof as an address of the #3 module, and simultaneously the #2 module sends the auxiliary signal to the #3 module through the address wire;
4. similarly, each module in the system acquires its corresponding CAN address from the CAN bus according to the auxiliary signal sent by the previous module, the CAN address is stored in the module, then 1 is added to the address to send to the next module, and only one module receives the auxiliary signal at a time. Through the process, the CAN address allocation method and the CAN address allocation device CAN rapidly realize CAN address allocation based on the sequential chain.
When a module does not successfully obtain its network address from the previous module at start-up, it will terminate sending the address to the next module. If the last module successfully obtains its network address, it means that all modules in front of it also successfully obtain its network address. The RS 232-CAN protocol conversion module provides proper start for the whole CAN communication system, and the network system is terminated at the CAN OUT end of the last module.
In order to confirm whether the positions of the modules are matched with the preset module type positions in the industrial personal computer, the invention stores a corresponding type identification code in each module according to the type (digital input, digital output, analog input, analog output, protocol conversion and the like) of each module, after the sequential chain mechanism successfully distributes addresses, the industrial personal computer reads the type identification codes of each module in the network, determines whether the module type positions preset by the internal program of the industrial personal computer are matched, if the module type positions are not matched, displays module type error information, and timely adjusts the positions of the corresponding modules to achieve the consistency with the preset positions.
Each module comprises 8 to 16 input or output interfaces, and certain interfaces CAN be used or not used or the functions of the interfaces are all determined by application programs of the modules according to the requirements of internal network system programs of the modules, and the industrial personal computer downloads corresponding application programs to each module in the system through a CAN bus according to the requirements of the internal network system programs of the industrial personal computer so as to complete the designated tasks of the industrial personal computer.
The communication system is based on installation and maintenance, has a simple structure, is convenient to wire, is flexible to network, CAN communicate through the Ethernet, forms a wider communication network, and has independent CAN and RS232 interfaces on part of modules, thereby being convenient for expansion. The communication system has wide application range and strong portability, can be transplanted to different devices under the condition that the hardware composition is basically unchanged, and only needs to partially modify industrial computer software according to the requirement. The system has strong anti-interference, safety and reliability, certain fault tolerance and error correction capability, can avoid misoperation to the greatest extent, and has fast response time and the highest speed of 1Mbps.

Claims (10)

1. The CAN address allocation method based on the sequential chain is characterized by comprising the following steps:
1) Cascading the modules to be communicated in a CAN bus mode, wherein the cascading refers to the connection of a CAN output port of a former-stage module and a CAN input port of a latter-stage module; the modules after cascading are sequentially connected through the address lines, namely the address output port of the former-stage module is connected with the address input port of the latter-stage module through the address lines, and the module is used for transmitting auxiliary signals for automatically writing addresses;
2) After receiving the auxiliary signal through the address line, the former stage module takes the received address information transmitted by the CAN bus as the CAN address of the module, meanwhile, the CAN address plus a set value is taken as the CAN address of the latter stage module to be transmitted by the CAN bus, the module transmits the auxiliary signal to the latter stage module through the address line, the latter stage module takes the received address information transmitted by the CAN bus as the CAN address of the module according to the received auxiliary signal, and the like, each module in the system CAN firstly receive the auxiliary signal transmitted by the former stage module, then acquire the corresponding CAN address from the CAN bus and store the CAN address, then the set value is added on the CAN address to be transmitted to the CAN bus, and only one module CAN receive the auxiliary signal at each time, thereby realizing the CAN address allocation of each cascade module based on a sequential chain.
2. The method of claim 1, wherein the CAN bus and the address line are formed as a bundle, and the interface of the bundle is an integration of a CAN bus connection port and an address signal line connection port.
3. The CAN address allocation method based on sequential chain according to claim 1 or 2, wherein address information of a module at a forefront stage is provided by an industrial control computer and a protocol module.
4. The CAN address assignment method based on sequential chain of claim 1, wherein when a module does not successfully acquire its CAN address from a previous module at the time of start-up, the transmission of the CAN address to a next module is terminated.
5. The sequence-based CAN address allocation method of claim 1 wherein when the last module successfully obtains its network address, it is said that all modules in front of it also successfully obtain its CAN address.
6. The method for distributing CAN addresses based on sequential chains as claimed in claim 1, wherein each module stores a corresponding type identification code therein, and each module transmits the type identification code to the industrial personal computer through the cascade CAN network after the CAN addresses of each module are distributed successfully, and the industrial personal computer judges whether the address of each module is matched with the preset module type position.
7. The CAN communication system is characterized by comprising a CAN bus and at least two modules which are cascaded through the CAN bus, wherein the cascade connection means that a CAN output port of a former-stage module is connected with a CAN input port of a latter-stage module; the modules are sequentially connected through an address wire, namely an address output port of a former-stage module is connected with an address input port of a latter-stage module through the address wire, the address wire is used for transmitting an auxiliary signal for automatically writing an address by the module, the former-stage module adds a set value to the CAN address of the former-stage module to be used as the CAN address of the latter-stage module to be transmitted through a CAN bus, and the latter-stage module stores the address on the CAN bus into an address memory of the latter-stage module to be used as the address of the latter-stage module according to the received auxiliary signal, so that the CAN address distribution of each-stage link module based on a sequential chain is realized.
8. The CAN communication system of claim 7 wherein the CAN bus and the address signal line are formed as a single wire harness, the interface of the wire harness being an integration of the CAN bus wiring port and the address signal line wiring port.
9. The CAN communication system of claim 7 or 8, further comprising an industrial personal computer coupled to the first stage module, the industrial personal computer providing the first stage module with the CAN address.
10. The CAN communication system of claim 9, wherein each module stores a corresponding type identification code therein, and each module transmits its type identification code to the industrial personal computer via the cascade CAN network after the CAN address of each module is successfully allocated, and the industrial personal computer determines whether the address of each module matches with a preset module type position.
CN201610646994.3A 2016-08-09 2016-08-09 CAN address allocation method and communication system based on sequential chain Active CN106131240B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610646994.3A CN106131240B (en) 2016-08-09 2016-08-09 CAN address allocation method and communication system based on sequential chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610646994.3A CN106131240B (en) 2016-08-09 2016-08-09 CAN address allocation method and communication system based on sequential chain

Publications (2)

Publication Number Publication Date
CN106131240A CN106131240A (en) 2016-11-16
CN106131240B true CN106131240B (en) 2024-01-09

Family

ID=57258183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610646994.3A Active CN106131240B (en) 2016-08-09 2016-08-09 CAN address allocation method and communication system based on sequential chain

Country Status (1)

Country Link
CN (1) CN106131240B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106647393A (en) * 2016-12-13 2017-05-10 东莞力朗电池科技有限公司 CAN bus automatic coding circuit and method
CN108038061B (en) * 2017-11-09 2020-09-25 深圳市亿维自动化技术有限公司 Address allocation method and PLC system
CN111431785A (en) * 2020-06-11 2020-07-17 南京北路自动化系统有限责任公司 CAN bus node ad hoc network method
CN112187598A (en) * 2020-09-03 2021-01-05 深圳市显控科技股份有限公司 Networking method, electronic device and storage medium
CN112235127B (en) * 2020-09-22 2023-01-20 深圳优地科技有限公司 Node fault reporting method and device, terminal equipment and storage medium
CN114531459B (en) * 2020-11-03 2024-05-07 深圳市明微电子股份有限公司 Cascade device parameter self-adaptive acquisition method, device, system and storage medium
CN113382094B (en) * 2021-05-20 2023-09-12 西安麦格米特电气有限公司 Module address determining method and device, power module and communication network
CN114500147B (en) * 2021-12-29 2023-12-26 深圳市英威腾电气股份有限公司 Method and device for distributing station numbers, electronic equipment and storage medium
CN114422479A (en) * 2021-12-30 2022-04-29 深圳市禾望科技有限公司 CAN bus address setting method
CN114827088A (en) * 2022-03-24 2022-07-29 珠海金电电源工业有限公司 Address assignment system, method, electronic device, storage medium, and program product
CN115550311B (en) * 2022-11-28 2023-03-10 永联智慧能源科技(常熟)有限公司 Address self-identification method, device, medium and electronic equipment based on CAN communication

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103941696A (en) * 2014-04-24 2014-07-23 安徽安凯汽车股份有限公司 Position recognition system of vehicle universal bus module and recognition method of position recognition system
CN104898500A (en) * 2015-04-25 2015-09-09 航天科技控股集团股份有限公司 Address distribution method and device of vehicle body control modules
CN205883321U (en) * 2016-08-09 2017-01-11 郑州市茂辰电子科技有限公司 CAN address distributing manner's communication system based on daisy chaining

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102010041810A1 (en) * 2010-09-30 2012-04-05 Robert Bosch Gmbh Method for automatic address assignment to similar bus subscribers

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103941696A (en) * 2014-04-24 2014-07-23 安徽安凯汽车股份有限公司 Position recognition system of vehicle universal bus module and recognition method of position recognition system
CN104898500A (en) * 2015-04-25 2015-09-09 航天科技控股集团股份有限公司 Address distribution method and device of vehicle body control modules
CN205883321U (en) * 2016-08-09 2017-01-11 郑州市茂辰电子科技有限公司 CAN address distributing manner's communication system based on daisy chaining

Also Published As

Publication number Publication date
CN106131240A (en) 2016-11-16

Similar Documents

Publication Publication Date Title
CN106131240B (en) CAN address allocation method and communication system based on sequential chain
CA2058704C (en) Communication system_with addressable functional modules.
CN106874237A (en) Method of data synchronization and system based on two lines bus
CN103822539B (en) A kind of rocket ground test control system based on redundancy structure
CN106130857A (en) Two-wire power supply and communication system and method
CN102098196B (en) The data transmission method of blade server
KR20060131489A (en) Device and method for performing multi- functions using unique port in wireless terminal
US20090240859A1 (en) Automatic address setting system
CN209962605U (en) LED display screen and display system
US8578077B2 (en) Group master communication system and method for serially transmitting data in automation systems
CN204031530U (en) A kind of control system based on DMX512 agreement
US5262771A (en) Method for addressing processor units
CN205883321U (en) CAN address distributing manner's communication system based on daisy chaining
CN107247683B (en) Positioning management system and method for rack server
CN113346983A (en) EPA equipment with mirror redundancy and EPA system
JPS62105594A (en) Plural equipments group control system
CN115297089B (en) Full-automatic address allocation system and method
US20030018824A1 (en) Method for generating commands to be interpreted by network controller modules of peripheral devices in electrical systems
KR101690187B1 (en) Opticasl fibre technical using input-output control card expansion device of the distributed control system
CN111092799A (en) Automatic ID setting method applied to battery management system BMS
US11184194B2 (en) Distributed processing of process data
RU192031U1 (en) HARDWARE DEVICE FOR SYNCHRONIZING TIME BETWEEN NETWORKS ACCORDING TO THE NTP PROTOCOL
CN112148321B (en) Anti-interference upgrading system and method for automobile intelligent electronic equipment microcontroller
CN210578569U (en) Novel optical coupler communication and automatic coding circuit
JPH10207856A (en) Decentralized computer system

Legal Events

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