Fire detection electronic equipment ID coding method and system based on CAN communication

Through the chip ID segmented transmission method based on the CAN bus, automatic identification and coding of electronic devices are realized, solving the problems of low efficiency and conflict of device ID coding in the existing technology, improving coding efficiency and convenience, and ensuring the uniqueness of the device ID.

CN120705092APending Publication Date: 2025-09-26JIANGSU ZHIANXING ENERGY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510840839.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

When batch testing and deploying electronic devices based on CAN communication, existing technologies have low device ID coding efficiency and are prone to conflicts. Manual operations are complex, hardware costs are high, and it is difficult to achieve fast and accurate device identification and networking.

Method used

Connect electronic devices via the CAN bus and automatically identify and encode the device ID by sending the chip ID in segments. The uniqueness of the chip ID is used for automatic encoding, avoiding manual configuration and ensuring the uniqueness of the device ID and the accuracy of the encoding.

Benefits of technology

It improves the efficiency and convenience of device ID coding, reduces the difficulty of manual operation, prevents ID conflicts, and ensures the uniqueness of device ID and the accuracy of coding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705092A_ABST
    Figure CN120705092A_ABST
Patent Text Reader

Abstract

The invention discloses a fire detection electronic device ID coding method and system based on CAN communication, and the method comprises the steps: reporting a self chip ID and a device ID; the chip ID is loaded into a CAN communication frame in a segmented mode so as to be sent in multiple times, and the CAN communication frame comprises a first field representing the current equipment ID, a second field representing the number of chip ID segments and a plurality of third fields recording the chip ID content; reading a third field in sequence, and taking the number sum of chip IDs with different contents in the third field as an initial ID of the code; comparing the chip ID and the equipment ID with the own chip ID; if the comparison is passed, mapping and storing the chip ID and the equipment ID, otherwise, subtracting 1 from the equipment ID; and when the code ID decreases progressively to a limit number, reading the next third field. According to the invention, automatic superposition calculation can be carried out, automatic coding of the electronic equipment is realized, non-repeatability of the equipment can be fundamentally ensured, and ID conflicts are effectively prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a field, and in particular to an ID coding method and system for fire detection electronic equipment based on CAN communication. Background Art

[0002] In energy storage and automotive applications, most electronic devices typically use the CAN bus as their primary external communication interface. Before a product leaves the factory, it is usually necessary to perform batch testing / calibration / deployment on such electronic devices. At this point, they often need to be coded and networked before further calibration, setup, and other operations can be performed. Because these batches of electronic devices are completely identical in product architecture and electrical characteristics, and are limited by product costs and the need to simplify operational procedures, the message formats for external transmission and reception responses are also completely consistent. Therefore, quickly, efficiently, and accurately coding electronic devices is key to achieving large-scale product promotion and rapid installation and commissioning. To achieve coding and networking, it is first necessary to effectively distinguish individual electronic devices and be able to send CAN communication messages that can be effectively identified to a single electronic device in order to achieve unique ID coding networking for the electronic device.

[0003] Currently, when batch testing, calibration, and deployment of electronic devices that use CAN communication as an external communication interface require device ID coding and networking, the following two methods are commonly used: The first method is for on-site staff to operate the host computer to connect to a single device through a hard line and manually write the device ID to achieve the uniqueness of the device in the entire system. However, this method is inefficient and can easily lead to ID conflicts or configuration errors due to human errors, affecting the overall debugging progress and system accuracy and stability.

[0004] The second method uses a dedicated wiring harness with specific auxiliary identification as the basis for judgment, such as distinguishing by voltage difference, and forcibly assigning device IDs using physical characteristics, thereby realizing the identification of individual identities and the assignment of unique IDs in batches of devices; however, this method increases the requirements for wiring harness structure and production, increases hardware costs and operational complexity, and needs to ensure the reliability of the wiring harness. The reliability of the wiring harness needs to be guaranteed in abnormal vibration and dynamic practical scenarios, which increases the difficulty of engineering application.

[0005] Therefore, providing a new encoding method to allocate device IDs and ensure the uniqueness of device IDs has become an urgent problem to be solved. Summary of the Invention

[0006] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a fire detection electronic equipment ID coding method and system based on CAN communication, which has the advantages of improving coding efficiency and convenience and reducing the difficulty of manual operation.

[0007] The purpose of the present invention is achieved by adopting the following technical solutions: According to a first aspect of an embodiment of the present disclosure, a method for encoding an ID of a fire detection electronic device based on CAN communication is provided, comprising: Step S100: After a batch of electronic devices are connected via the CAN bus and powered on, each electronic device reports its chip ID and device ID to the debugging device; Step S200: segment the chip ID into a CAN communication frame for multiple transmissions, wherein the CAN communication frame includes: a first field indicating the current device ID, a second field indicating the number of chip ID segments, and a third field recording a plurality of chip ID contents; Step S300, read one of the third fields in sequence, and use the number of chip IDs with different contents in the third field as the starting ID of the encoding; Step S400: After receiving the CAN communication frame, the electronic device compares the chip ID and device ID contained therein with its own chip ID and current device ID in sequence; if the comparison passes, the chip ID and device ID are mapped and stored; otherwise, the device ID is decremented by 1; Step S500: When the coded ID reaches a limit, read the next third field to obtain the maximum device ID currently coded successfully, and use the sum of the maximum device ID and the number of chip IDs with different contents in the third field as the starting ID again; Repeat steps S400 to S500 until all electronic devices have completed device ID encoding, and the chip IDs are mapped one-to-one with the device IDs.

[0008] To implement the above technical solution, when encoding device IDs, electronic devices are connected via the CAN bus for identification and networking. Since CAN communication transmits a maximum of 64 bits of data each time, while chip IDs are 128 bits, a single data transmission cannot transmit the entire chip ID. Therefore, the chip ID is segmented and loaded into the CAN communication frame and transmitted multiple times, allowing the chip ID to be fully transmitted and facilitating accurate correspondence between the device ID and the chip ID. Since each third field records a portion of the chip ID, and the chip ID of each electronic device is different, the content of each third field may be different, or only one third field may be different. Therefore, the number of chip IDs with different third field contents must be greater than or equal to the total number of electronic devices. When comparing, the contents of the third fields are read sequentially and automatically added and calculated to achieve automatic encoding of the electronic devices. By utilizing the unique chip ID inherent in the electronic device for automatic identification and encoding, the traditional method of manually configuring IDs one by one is replaced, effectively improving encoding efficiency and convenience. Furthermore, by utilizing the chip ID and the number of devices, the chip ID is automatically packaged and compared for automatic encoding, which can fundamentally ensure the non-repeatability of the device and effectively prevent ID conflicts.

[0009] In some exemplary embodiments, in step S300 , the third fields are read sequentially according to the arrangement order of the third fields in the CAN communication frame.

[0010] Implementing the above technical solution can improve the orderliness of coding.

[0011] In some exemplary embodiments, step S400 is specifically as follows: First, compare the device ID contained in the CAN communication frame with the current device ID. If the two are different, map the chip ID and device ID according to the segment number and store them. If the two are the same, subtract 1 from the current device ID as the new device ID, and then continue to compare the chip ID contained in the CAN communication frame with its own chip ID. If the two are different, map the chip ID and device ID according to the segment number and store them. Otherwise, re-read the CAN communication frame for comparison.

[0012] The above technical solution is implemented to realize the update of the device ID and the mapping storage of the device ID and the chip ID.

[0013] In some exemplary embodiments, step S400 further includes: After the chip ID and device ID are mapped and stored, the stored device ID is used to reply to the CAN communication frame to confirm that the encoding is successful.

[0014] Implement the above technical solution to facilitate coding confirmation.

[0015] In some exemplary embodiments, in step S400 , when the chip ID and the device ID are mapped and stored, the device ID that is stored first is synchronized.

[0016] The implementation of the above technical solution does not affect the storage of the previous device ID, which is beneficial for subsequent query of historical data.

[0017] In some exemplary embodiments, in step S500, when the third field is read for the first time to compare the chip ID and the device ID, the limit number is 1. When the third field is read subsequently to compare the chip ID and the device ID, the limit number is the maximum device ID that has been successfully encoded.

[0018] Implement the above technical solution to achieve automatic superposition calculation and avoid duplication of device ID codes.

[0019] In some exemplary embodiments, the method further comprises: After the device IDs of all electronic devices are coded, the device IDs are sorted in order of size.

[0020] Implementing the above technical solution will facilitate the orderly progress of subsequent testing, deployment and other steps.

[0021] According to a second aspect of an embodiment of the present disclosure, there is provided a fire detection electronic device ID coding system based on CAN communication, comprising: The data upload unit is used to report the chip ID and device ID of each electronic device to the debugging device after the electronic devices are connected via the CAN bus and powered on uniformly; a data packaging unit, configured to package the chip ID into segments into a CAN communication frame for multiple transmissions, wherein the CAN communication frame includes: a first field indicating the current device ID, a second field indicating the number of chip ID segments, and a plurality of third fields recording chip ID contents; An initial encoding unit, configured to sequentially read one of the third fields and use the number of chip IDs with different contents in the third field as the starting ID for encoding; A comparison processing unit is used to compare the chip ID and device ID contained in the CAN communication frame with the electronic device's own chip ID and current device ID in sequence after the electronic device receives the frame; if the comparison is successful, the chip ID and device ID are mapped and stored; otherwise, the device ID is reduced by 1; The cumulative encoding unit is configured to read the next third field when the encoded ID is decremented to a limit number, obtain the maximum device ID currently encoded successfully, and use the sum of the maximum device ID and the number of chip IDs with different contents in the third field as the starting ID again; The comparison processing unit and the accumulation coding unit perform cyclic processing until all electronic devices complete device ID coding, and the chip IDs are mapped to the device IDs in a one-to-one correspondence.

[0022] According to a third aspect of an embodiment of the present disclosure, a computer device is provided, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the encoding method as described in the first aspect.

[0023] According to a fourth aspect of an embodiment of the present disclosure, a storage medium storing computer-readable instructions is provided. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the encoding method as described in the first aspect.

[0024] In summary, compared with the prior art, the present invention has the following beneficial effects: The embodiment of the present invention provides a method and system for encoding the ID of fire detection electronic equipment based on CAN communication. When encoding the device ID, the electronic equipment is connected via the CAN bus to perform identification and networking of the electronic equipment. Since a maximum of 64 bits of data are sent each time during CAN communication, and the chip ID is 128 bits of data, a single data transmission cannot transmit the entire chip ID. In this case, the chip ID is segmented and loaded into the CAN communication frame and transmitted multiple times, so that the chip ID can be completely transmitted and the device ID and the chip ID can be accurately matched. Since each third field records a portion of the chip ID, and the chip ID of each electronic device is different, the content of each third field may be different, or only one third field may be different. Therefore, the number of chip IDs with different third field contents must be greater than or equal to the total number of electronic devices. When comparing, the contents of the third fields are read in sequence and automatically superimposed and calculated to achieve automatic encoding of the electronic devices. By using the unique chip ID inherent in the electronic device for automatic identification and encoding, the traditional method of manually configuring the ID one by one is replaced, effectively improving encoding efficiency and convenience. At the same time, the chip ID and the number of devices are used to convert the chip ID into a single chip ID. Automatic coding through subpackaging and comparison can fundamentally ensure the non-repeatability of the equipment and effectively prevent ID conflicts. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 The figure is a flow chart of a method for ID encoding of a fire detection electronic device based on CAN communication in an embodiment of the present invention.

[0026] Figure 2 This is a coding flow chart of a specific example of the ID coding method for fire detection electronic equipment based on CAN communication in an embodiment of the present invention.

[0027] Figure 3 Schematic diagram of the structure of the ID coding system of the fire detection electronic equipment based on CAN communication in an embodiment of the present invention.

[0028] Figure 4 2 is a basic structural block diagram of a computer device in an embodiment of the present invention.

[0029] The numbers and letters in the figure represent the corresponding component names: 10. Data uploading unit; 20. Data packaging unit; 30. Initial encoding unit; 40. Comparison processing unit; 50. Accumulation encoding unit. DETAILED DESCRIPTION

[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0031] like Figures 1 to 2 As shown, a first aspect of an embodiment of the present invention provides an ID encoding method for a fire detection electronic device based on CAN communication, comprising: Step S100: After a batch of electronic devices are connected via the CAN bus and powered on uniformly, each electronic device reports its own chip ID and device ID to the debugging device.

[0032] Specifically, the chip ID is a unique identifier set by the chip manufacturer for the chip. It is generally 96 to 128 bits of hexadecimal data, which can ensure that each chip ID is unique among chips of the same type. By using the chip ID as a subsequent identification mark, while maintaining uniqueness, it eliminates the need for re-encoding and is more convenient to obtain.

[0033] Step S200: The chip ID is segmented and loaded into a CAN communication frame for multiple transmissions, wherein the CAN communication frame includes: a first field indicating the current device ID, a second field indicating the number of chip ID segments, and a third field for recording a plurality of chip ID contents.

[0034] Specifically, since the data field of each frame in the CAN bus can carry up to 8 bytes (64 bits) of data, and the length of the chip ID exceeds the data carrying capacity of a single CAN frame, it is necessary to perform segmented transmission, that is, the chip ID is divided into multiple segments and then placed in different CAN frames for transmission. Take a specific example: the chip ID is 128 bits of data, and the CAN communication frame is divided into four parts for transmission. In the CAN communication frame, data[0] is the first field, indicating the current device ID, and data[1] is the second field, indicating the number of chip ID segments. The segment number range is 0x00~0x03, and is sent in sequence according to the segment number. data[2], data[3], data[4], and data[5] are the third fields, used to record the chip ID content respectively. The CAN communication frame is divided into four parts and sent data[2]~data[5] respectively.

[0035] Step S300 , sequentially read one of the third fields, and use the number of chip IDs with different contents in the third field as the starting ID of the code.

[0036] Specifically, such as Figure 2 As shown, during encoding, the third field is read in sequence according to the arrangement order of the third field in the CAN communication frame to improve the orderliness of encoding. For example, the third field can be read in the order of data[2], data[3], data[4], and data[5], or the third field can be read in the order of data[5], data[4], data[3], and data[2]. Taking data[5] as an example, the number of different chip ID contents of data[5] is obtained, and this number is used as the starting ID of the encoding.

[0037] Step S400: After receiving the CAN communication frame, the electronic device compares the chip ID and device ID contained therein with its own chip ID and current device ID in sequence; if the comparison is successful, the chip ID and device ID are mapped and stored; otherwise, the device ID is reduced by 1.

[0038] Specifically: first compare the device ID contained in the CAN communication frame with the current device ID. If the two are different, the chip ID and the device ID are mapped and stored according to the segment number; if the two are the same, the current device ID is reduced by 1 as the new device ID, that is, the current device ID is updated, and then the chip ID contained in the CAN communication frame is compared with its own chip ID. If the two are different, the chip ID and the device ID are mapped and stored according to the segment number. Otherwise, the CAN communication frame is re-read for comparison, thereby realizing the update of the device ID and the mapping and storage of the device ID and the chip ID.

[0039] Among them, after the chip ID and the device ID are mapped and stored, the stored device ID is used to reply to the CAN communication frame to confirm the encoding success, so as to perform encoding confirmation. When the chip ID and the device ID are mapped and stored, the previous device ID is stored synchronously, so as not to affect the storage of the previous device ID, which is conducive to subsequent query of historical data.

[0040] Step S500: When the encoding ID decreases to a limit, read the next third field to obtain the maximum device ID currently encoded successfully, and use the sum of the maximum device ID and the number of chip IDs with different contents in the third field as the starting ID again.

[0041] The coding ID is determined by the starting ID used as the coding. Each time a device ID comparison is performed, the coding ID is reduced by 1. When the third field is read for the first time to compare the chip ID and the device ID, the limit number is 1. When the third field is read subsequently to compare the chip ID and the device ID, the limit number is the maximum device ID that has been successfully encoded. This achieves automatic superposition calculation and avoids repeated device ID coding.

[0042] Taking the reading of data[5] as an example, when the device ID code is decremented to 1, the chip ID content of data[4] is read, and the sum of the number of differences between the current maximum device ID successfully encoded and the chip ID content of data[4] is used as the new encoding starting ID. When the device ID is decremented to the current maximum device ID successfully encoded, if there is still a one-to-many relationship between the device ID and the chip ID, continue to read the chip ID content of data[3], and re-determine the current maximum device ID successfully encoded. And so on, repeat steps S400 to S500 until all electronic devices complete the device ID encoding, and the chip ID and device ID are mapped one-to-one.

[0043] Furthermore, it also includes: Step S501: After completing the device ID coding of all electronic devices, the device IDs are sorted in order of size, so as to facilitate the orderly execution of subsequent testing, deployment and other steps.

[0044] When encoding device IDs, electronic devices are connected via the CAN bus for identification and networking. Since CAN communication transmits a maximum of 64 bits of data each time, while chip IDs are 128 bits, a single transmission cannot fully transmit the chip ID. Therefore, the chip ID is segmented and enclosed in CAN communication frames and transmitted multiple times. This allows the chip ID to be fully transmitted and facilitates accurate correspondence between the device ID and the chip ID. Since each third field contains a portion of the chip ID, and each electronic device's chip ID is unique, the contents of each third field may be different, or only one third field may be different. Therefore, the number of chip IDs with different third field contents must be greater than or equal to the total number of electronic devices. When comparing, the contents of the third fields are read sequentially and automatically added together for automatic encoding of the electronic devices. Automatic identification and encoding using the unique chip ID inherent in each electronic device replaces the traditional method of manually configuring IDs one by one, effectively improving encoding efficiency and convenience. Furthermore, the chip ID is automatically segmented and compared using the chip ID and the number of devices for automatic encoding, fundamentally ensuring device non-repeatability and effectively preventing ID conflicts.

[0045] According to a second aspect of the embodiment of the present disclosure, a fire detection electronic device ID coding system based on CAN communication is provided, such as Figure 3 As shown, it includes: a data uploading unit 10, which is used to report the chip ID and device ID of each electronic device to the debugging device after a batch of electronic devices are connected via the CAN bus and powered on uniformly; a data subpackaging unit 20, which is used to segment the chip ID into a CAN communication frame for multiple transmissions, wherein the CAN communication frame includes: a first field indicating the current device ID, a second field indicating the number of chip ID segments, and a plurality of third fields recording the chip ID content; an initial encoding unit 30, which is used to sequentially read one of the third fields and use the number of chip IDs with different contents in the third field and the sum of them as the starting ID for encoding; The comparison processing unit 40 is used to compare the chip ID and device ID contained in the CAN communication frame with its own chip ID and current device ID in sequence after the electronic device receives the frame; if the comparison is successful, the chip ID and device ID are mapped and stored; otherwise, the device ID is reduced by 1; the cumulative coding unit 50 is used to read the next third field when the coding ID is decremented to a limit number, obtain the maximum device ID that is currently successfully coded, and use the sum of the maximum device ID and the cumulative number of chip IDs with different contents in the third field as the starting ID again; the comparison processing unit 40 and the cumulative coding unit 50 are cyclically processed until all electronic devices complete the device ID coding, and the chip ID and the device ID are mapped one-to-one.

[0046] When encoding the device ID, the data upload unit 10 connects the electronic device through the CAN bus to identify and network the electronic device. Since a maximum of 64 bits of data are sent each time during CAN communication, and the chip ID is 128 bits of data, the chip ID cannot be sent in a single data transmission. At this time, the data sub-packaging unit 20 segments the chip ID into the CAN communication frame and sends it multiple times, so that the chip ID can be sent completely and it is easy to achieve accurate correspondence between the device ID and the chip ID; since each third field records a part of the chip ID, and the chip ID of each electronic device is different, it may be that the content of each third field is different. are different, or it is possible that only one third field content is different, so the number of chip IDs with different third field contents must be greater than or equal to the total number of electronic devices. When making comparisons, the initial encoding unit 30 reads the content of the third field in turn, the comparison processing unit 40 compares the chip ID and the device ID, and the cumulative encoding unit 50 automatically performs superposition calculations to achieve automatic encoding of the electronic device. By utilizing the inherent unique chip ID of the electronic device for automatic identification and encoding, it replaces the traditional method of manually configuring the ID one by one, effectively improving the encoding efficiency and convenience. At the same time, by utilizing the chip ID and the number of devices, the chip ID is subpackaged and compared for automatic encoding, which can fundamentally ensure the non-repeatability of the device and effectively prevent ID conflicts.

[0047] The third aspect of the embodiment of the present invention also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0048] like Figure 4 As shown, a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a non-volatile storage medium, a memory and a network interface connected via a system bus. The non-volatile storage medium of the computer device stores an operating system, a database and computer-readable instructions, and the database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor may implement a fire detection electronic device ID encoding method based on CAN communication. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor may execute a fire detection electronic device ID encoding method based on CAN communication. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art will understand that Figure 4The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0049] In this embodiment, the processor is used to execute Figure 3 The data upload unit 10, data packaging unit 20, initial encoding unit 30, comparison processing unit 40, and cumulative encoding unit 50 are specifically configured. The memory stores the program code and various data required to execute these modules. The network interface is used to transmit data to user terminals or servers. The server can call the server's program code and data to execute the functions of all submodules.

[0050] When encoding a device ID, a computer device connects to electronic devices via the CAN bus for identification and networking. Since CAN communication transmits a maximum of 64 bits of data each time, while a chip ID is 128 bits, a single data transmission cannot fully transmit the chip ID. Therefore, the chip ID is segmented and enclosed in CAN communication frames and transmitted multiple times. This allows the chip ID to be fully transmitted and facilitates accurate correspondence between the device ID and the chip ID. Since each third field contains a portion of the chip ID, and each electronic device has a different chip ID, the contents of each third field may be different, or only one third field may be different. Therefore, the number of chip IDs with different third field contents must be greater than or equal to the total number of electronic devices. When comparing, the contents of the third fields are read sequentially and automatically added together to achieve automatic encoding of the electronic devices. Automatic identification and encoding using the unique chip ID inherent to the electronic device replaces the traditional method of manually configuring IDs one by one, effectively improving encoding efficiency and convenience. Furthermore, the chip ID is automatically segmented and compared using the chip ID and the number of devices for automatic encoding, fundamentally ensuring device non-repeatability and effectively preventing ID conflicts.

[0051] The present invention also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the ID encoding method for fire detection electronic equipment based on CAN communication in any of the above embodiments.

[0052] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed, the program can include the processes in the above-described method embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0053] The above embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patented invention. It should be noted that those skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention. These variations and improvements are equivalent modifications and improvements to the above embodiments based on the essential technology of the present invention and fall within the scope of protection of the present invention.

Claims

1. A fire detection electronic equipment ID coding method based on CAN communication, characterized in that: include: Step S100: After a batch of electronic devices are connected via the CAN bus and powered on, each electronic device reports its chip ID and device ID to the debugging device; Step S200: segment the chip ID into a CAN communication frame for multiple transmissions, wherein the CAN communication frame includes: a first field indicating the current device ID, a second field indicating the number of chip ID segments, and a third field recording a plurality of chip ID contents; Step S300, read one of the third fields in sequence, and use the number of chip IDs with different contents in the third field as the starting ID of the encoding; Step S400: After receiving the CAN communication frame, the electronic device compares the chip ID and device ID contained therein with its own chip ID and current device ID in sequence; if the comparison passes, the chip ID and device ID are mapped and stored; otherwise, the device ID is decremented by 1; Step S500: When the coded ID reaches a limit, read the next third field to obtain the maximum device ID currently coded successfully, and use the sum of the maximum device ID and the number of chip IDs with different contents in the third field as the starting ID again; Repeat steps S400 to S500 until all electronic devices have completed device ID encoding, and the chip IDs are mapped one-to-one with the device IDs.

2. The ID coding method for fire detection electronic equipment based on CAN communication according to claim 1, characterized in that: In step S300 , the third fields are read sequentially according to the arrangement order of the third fields in the CAN communication frame.

3. The ID coding method for fire detection electronic equipment based on CAN communication according to claim 1 or 2, characterized in that: The step S400 is specifically as follows: First, compare the device ID contained in the CAN communication frame with the current device ID. If the two are different, map the chip ID and device ID according to the segment number and store them. If the two are the same, subtract 1 from the current device ID as the new device ID, and then continue to compare the chip ID contained in the CAN communication frame with its own chip ID. If the two are different, map the chip ID and device ID according to the segment number and store them. Otherwise, re-read the CAN communication frame for comparison.

4. The ID coding method for fire detection electronic equipment based on CAN communication according to claim 3, characterized in that: The step S400 further includes: After the chip ID and device ID are mapped and stored, the stored device ID is used to reply to the CAN communication frame to confirm that the encoding is successful.

5. The ID coding method for fire detection electronic equipment based on CAN communication according to claim 3, characterized in that: In step S400, when the chip ID and the device ID are mapped and stored, the device ID that is stored first is synchronized.

6. The ID coding method for fire detection electronic equipment based on CAN communication according to claim 1, characterized in that: In step S500, when the third field is read for the first time to compare the chip ID and the device ID, the limit number is 1. When the third field is read subsequently to compare the chip ID and the device ID, the limit number is the maximum device ID that has been successfully encoded.

7. The ID coding method for fire detection electronic equipment based on CAN communication according to claim 1, characterized in that: Also includes: After the device IDs of all electronic devices are coded, the device IDs are sorted in order of size.

8. A fire detection electronic equipment ID coding system based on CAN communication, characterized in that: include: The data upload unit is used to report the chip ID and device ID of each electronic device to the debugging device after the electronic devices are connected via the CAN bus and powered on uniformly; a data packaging unit, configured to package the chip ID into segments into a CAN communication frame for multiple transmissions, wherein the CAN communication frame includes: a first field indicating the current device ID, a second field indicating the number of chip ID segments, and a plurality of third fields recording chip ID contents; An initial encoding unit, configured to sequentially read one of the third fields and use the number of chip IDs with different contents in the third field as the starting ID for encoding; A comparison processing unit is used to compare the chip ID and device ID contained in the CAN communication frame with the electronic device's own chip ID and current device ID in sequence after the electronic device receives the frame; if the comparison is successful, the chip ID and device ID are mapped and stored; otherwise, the device ID is reduced by 1; The cumulative encoding unit is configured to read the next third field when the encoded ID is decremented to a limit number, obtain the maximum device ID currently encoded successfully, and use the sum of the maximum device ID and the number of chip IDs with different contents in the third field as the starting ID again; The comparison processing unit and the accumulation coding unit perform cyclic processing until all electronic devices complete device ID coding, and the chip IDs are mapped to the device IDs in a one-to-one correspondence.

9. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor performs the steps of the encoding method according to any one of claims 1 to 7.

10. A storage medium storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors are caused to perform the steps of the encoding method according to any one of claims 1 to 7.