CN117240822B - Coding method and coding system applied to communication equipment group - Google Patents
Coding method and coding system applied to communication equipment group Download PDFInfo
- Publication number
- CN117240822B CN117240822B CN202311508188.6A CN202311508188A CN117240822B CN 117240822 B CN117240822 B CN 117240822B CN 202311508188 A CN202311508188 A CN 202311508188A CN 117240822 B CN117240822 B CN 117240822B
- Authority
- CN
- China
- Prior art keywords
- encoded
- information
- equipment
- encoding
- coding
- 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
Links
- 238000004891 communication Methods 0.000 title claims abstract description 105
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000006243 chemical reaction Methods 0.000 claims abstract description 20
- 230000007704 transition Effects 0.000 claims abstract description 17
- 238000012545 processing Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 description 17
- 238000010586 diagram Methods 0.000 description 6
- 230000008878 coupling Effects 0.000 description 4
- 238000010168 coupling process Methods 0.000 description 4
- 238000005859 coupling reaction Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000002035 prolonged effect Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 238000009434 installation Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Landscapes
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The invention discloses a coding method and a coding system applied to a communication equipment group, wherein the communication equipment group comprises at least one equipment which is sequentially connected, and when the high-level time length of an input signal of first equipment is larger than a first preset threshold value, the preset code is used as the code of the first equipment, so that the reference time length is determined; determining an update code based on the level transition time; when the reference time length is larger than a second preset threshold value and the difference between the high level time length of the input signal of the second equipment and the reference time length is not larger than a third preset threshold value, taking the updated code as the code of the second equipment; and taking the second equipment as the first equipment, taking the updated code as the preset code, and repeating the steps from the level conversion time to the step of taking the updated code as the code information of the second equipment until the preset condition is met to obtain the code of each equipment. The embodiment of the invention can realize automatic coding of a plurality of communication devices based on high-level pulse time, and improves coding efficiency and reliability.
Description
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a coding method and a coding system applied to a communication device group.
Background
In a communication system, before each communication device accesses a communication bus, an ID number needs to be configured for the communication device, and when a plurality of communication devices are in the system to work, the ID numbers of each device need to be different, so that data interaction of the plurality of communication devices on the communication bus is realized.
In the prior art, an ID number is usually required to be manually configured for each communication device, a plurality of communication devices are required to be encoded one by one, different ID numbers are required to be configured, when the number of the communication devices is large, the production efficiency or the device installation and debugging efficiency can be greatly reduced, and when a certain communication device needs to be maintained and replaced, the ID number is required to be reset, so that the cost is high, and the ID configuration efficiency is low.
Disclosure of Invention
In view of the above problems in the prior art, the present disclosure provides a coding method and a coding system applied to a communication device group, which can implement automatic coding of a plurality of communication devices based on high-level pulse time, thereby improving coding efficiency and reliability. The technical scheme disclosed by the invention is as follows:
according to an aspect of the disclosed embodiments of the present invention, there is provided an encoding method applied to a communication device group, including:
acquiring first high-level duration information corresponding to an input signal of a first device to be encoded, wherein the first device to be encoded is a first device to be encoded in the at least one device to be encoded;
Determining preset coding information as the coding information of the first equipment to be coded under the condition that the first high-level duration information is larger than a first preset threshold value;
determining updated coding information based on level transition time information corresponding to an input signal of the first device to be coded;
determining duration reference information based on the coding information of the first device to be coded;
determining the updated coding information as the coding information of the second equipment to be coded under the condition that the time length reference information is larger than a second preset threshold value and the difference information between the second high-level time length information and the time length reference information is not larger than a third preset threshold value; the second device to be encoded is the next device to be encoded of the first device to be encoded, and the second high-level duration information is high-level duration information corresponding to an input signal of the second device to be encoded;
and re-using the second equipment to be encoded as the first equipment to be encoded, re-using the updated encoding information as the preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second equipment to be encoded based on the level conversion time information corresponding to the input signal of the first equipment to be encoded until the preset condition is met, thereby obtaining the encoding information of each equipment to be encoded.
Optionally, when the duration reference information is greater than a second preset threshold and difference information between the second high-level duration information and the duration reference information is not greater than a third preset threshold, determining the updated encoding information as the encoding information of the second device to be encoded includes:
setting an output signal of the first device to be encoded as a high level signal in case that the duration reference information is greater than the second preset threshold;
acquiring the second high-level duration information;
and determining the updated coding information as the coding information of the second device to be coded under the condition that the difference information between the second high-level duration information and the duration reference information is not greater than the third preset threshold value.
Optionally, after determining the updated encoding information as the encoding information of the second device to be encoded, if the duration reference information is greater than a second preset threshold and the difference information between the second high-level duration information and the duration reference information is not greater than a third preset threshold, the method further includes:
updating the preset repeated indication information to obtain updated repeated indication information;
And the step of re-using the second device to be encoded as the first device to be encoded, re-using the updated encoding information as the preset encoding information, repeating the step of determining the updated encoding information as the encoding information of the second device to be encoded based on the level transition time information corresponding to the input signal of the first device to be encoded until the preset condition is satisfied, where the obtaining the encoding information of each device to be encoded includes:
and re-using the second device to be encoded as the first device to be encoded, re-using the updated encoding information as the preset encoding information, re-using the updated repetition indication information as the preset repetition indication information, and repeating the step of obtaining updated repetition indication information based on the level transition time information corresponding to the input signal of the first device to be encoded until the updated repetition indication information is smaller than a fourth preset threshold value, thereby obtaining the encoding information of each device to be encoded.
Optionally, the step of re-using the second device to be encoded as the first device to be encoded, re-using the updated encoding information as the preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second device to be encoded based on the level transition time information corresponding to the input signal of the first device to be encoded until the preset condition is met, where the obtaining the encoding information of each device to be encoded includes:
And re-using the second equipment to be encoded as the first equipment to be encoded, re-using the updated encoding information as the preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second equipment to be encoded based on the level conversion time information corresponding to the input signal of the first equipment to be encoded until the repetition times reach the preset times to obtain the encoding information of each equipment to be encoded.
Optionally, the determining the preset encoding information as the encoding information of the first device to be encoded when the first high-level duration information is greater than a first preset threshold includes:
under the condition that the first high-level duration information is not greater than the first preset threshold value, carrying out extension processing on the first high-level duration information to obtain extension high-level duration information;
and determining the preset coding information as the coding information of the first device to be coded under the condition that the prolonged high-level duration information is larger than the first preset threshold value.
Optionally, after determining preset encoding information as encoding information of the first device to be encoded, if the first high level duration information is greater than a first preset threshold, the method further includes:
And setting the output signal of the first device to be encoded as a low level signal.
According to another aspect of the disclosed embodiments of the present invention, there is provided an encoding system including a communication device group, a communication bus, and an encoding module;
the communication equipment group comprises at least one equipment to be encoded, wherein the equipment to be encoded comprises a signal input interface, a signal output interface and a communication interface, the signal output interface of each equipment to be encoded is connected with the signal input interface of the next equipment to be encoded, each equipment to be encoded is connected with the communication bus through the communication interface, the encoding module is in communication connection with each equipment to be encoded, and the encoding module is used for executing the encoding method of any one of the above.
Optionally, the encoding module includes:
the first acquisition unit is used for acquiring first high-level duration information corresponding to an input signal of a first device to be encoded, wherein the first device to be encoded is a first device to be encoded in the at least one device to be encoded;
a first encoding unit, configured to determine preset encoding information as encoding information of the first device to be encoded, where the first high-level duration information is greater than a first preset threshold;
An update encoding information determining unit, configured to determine update encoding information based on level transition time information corresponding to an input signal of the first device to be encoded;
a time length reference information determining unit, configured to determine time length reference information based on the coding information of the first device to be coded;
the second coding unit is used for determining the updated coding information as the coding information of the second equipment to be coded under the condition that the time length reference information is larger than a second preset threshold value and the difference information between the second high-level time length information and the time length reference information is not larger than a third preset threshold value; the second device to be encoded is the next device to be encoded of the first device to be encoded, and the second high-level duration information is high-level duration information corresponding to an input signal of the second device to be encoded;
and the repeating unit is used for re-using the second equipment to be encoded as the first equipment to be encoded, re-using the updated encoding information as the preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second equipment to be encoded based on the level conversion time information corresponding to the input signal of the first equipment to be encoded until the preset condition is met, so as to obtain the encoding information of each equipment to be encoded.
Optionally, the communication interface is a differential signal interface, and the encoding module includes a differential signal conversion unit, where the signal conversion unit is configured to convert a high-voltage differential signal transmitted through the differential signal interface into a low-voltage single-ended signal, and the low-voltage single-ended signal is transmitted through the signal input interface and the signal output interface.
Optionally, each device to be encoded further comprises a power interface.
The data processing method provided by the invention has the following technical effects:
the invention provides an encoding method applied to a communication equipment group, wherein the communication equipment group comprises at least one equipment to be encoded, which is sequentially connected, and acquires high-level duration information corresponding to an input signal of first equipment to be encoded, wherein the first equipment to be encoded is the first equipment to be encoded in the at least one equipment to be encoded, and when the high-level duration information corresponding to the first equipment to be encoded is greater than a first preset threshold value, preset encoding information is determined as encoding information of the first equipment to be encoded, and updating encoding information is determined based on level conversion time information corresponding to the input signal of the first equipment to be encoded; determining duration reference information based on the coding information of the first device to be coded, determining updated coding information as the coding information of the second device to be coded under the condition that the duration reference information is larger than a second preset threshold value and the difference information between second high-level duration information corresponding to the input signal of the second device to be coded and the duration reference information is not larger than a third preset threshold value, wherein the second device to be coded is the next device of the first device to be coded, further, the second device to be coded is re-used as the first device to be coded, the updated coding information is re-used as preset coding information, and repeating the steps of determining the updated coding information as the coding information of the second device to be coded based on the level conversion time information corresponding to the input signal of the first device to be coded until preset conditions are met, so that the coding information of each device to be coded is obtained, automatic coding of each device in a communication device group is realized based on the high-level pulse time corresponding to the input signal of each device, and further, the coding efficiency and the system debugging efficiency are improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow diagram illustrating an encoding method applied to a group of communication devices according to an exemplary embodiment;
fig. 2 is a flowchart illustrating a method for determining coding information of a first device to be coded according to an exemplary embodiment;
fig. 3 is a flowchart illustrating a method for determining coding information of a second device to be coded according to an exemplary embodiment;
FIG. 4 is a schematic diagram illustrating one method of generating encoded information for each device to be encoded, according to an example embodiment;
FIG. 5 is a schematic diagram of an encoding system according to an exemplary embodiment;
Fig. 6 is a schematic diagram illustrating a structure of an encoding module according to an exemplary embodiment.
Detailed Description
In order that those skilled in the art will better understand the disclosed embodiments of the present invention, a detailed description of the disclosed embodiments of the present invention will be provided with reference to the accompanying drawings. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the disclosed embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In a controller area network (Controller Area Network, CAN) communication system, when a plurality of CAN communication devices are in operation in the system, each CAN communication device needs to be configured with a unique ID number before being connected to a communication bus, so that data interaction of the plurality of CAN communication devices on the CAN communication bus is realized. At present, an ID number is usually required to be manually configured for each CAN communication device, a plurality of CAN communication devices are required to be encoded one by one, different ID numbers are required to be configured, time and labor are wasted, production or device installation and debugging efficiency is greatly reduced, and when a certain communication device needs to be maintained and replaced, the ID number is required to be reset, so that the cost is high, and the ID configuration efficiency is low. In addition, in the case where the CAN communication device has access to the enclosed space, there is a possibility that recoding is not allowed in terms of space conditions, thereby causing the whole communication system to fail to operate normally. Therefore, the invention provides the coding method applied to the communication equipment group, which can realize the automatic coding of each equipment in the communication equipment group without manual intervention, greatly improve the coding efficiency, save manpower expenditure, realize the automatic coding of each equipment in the communication equipment group based on the high-level pulse time corresponding to the input signal of each equipment, improve the reliability of the coding and further improve the stability of a communication system.
Referring to fig. 1, fig. 1 is a flow chart illustrating an encoding method applied to a communication device group according to an exemplary embodiment, and the present disclosure provides the method operation steps described in the examples or the flow charts, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. When implemented in a real system or server product, the methods illustrated in the embodiments or figures may be performed sequentially or in parallel (e.g., in a parallel processor or multithreaded environment). Specifically, as shown in fig. 1, the method may include:
s101: and acquiring first high-level duration information corresponding to the input signal of the first device to be encoded.
In a specific embodiment, the communication device group may include at least one device to be encoded, which is sequentially connected, and the first device to be encoded may be a first device to be encoded in the at least one device to be encoded; in practical application, can increase the code line in waiting to encode the connection pencil of equipment and receive the code signal, the code line can include input code line and output code line, and a plurality of waiting to encode the equipment and realize connecting gradually through input code line and output code line, and then realize the coding function. The number of code lines may be set according to practical application requirements, and each code line is associated with a specific circuit or device, so as to distinguish different devices when coding. Each device to be encoded in the group of communication devices follows the same communication protocol, for example CAN communication protocol, LIN (Local Interconnect Network ) communication protocol, flexRay communication protocol, etc.
In a specific embodiment, the input signal of each device to be encoded may be transmitted to the device to be encoded through the input encoding line, and then transmitted to the next device to be encoded through the output encoding line of the device to be encoded (i.e. the input encoding line of the next device to be encoded). The high-level duration information corresponding to the signal may be duration of the signal in a high-level state, where the first high-level duration information may be obtained through an optical coupling chip in the first device to be encoded, and the optical coupling chip may record the high-level duration of the signal.
S103: and determining preset coding information as the coding information of the first device to be coded under the condition that the first high-level duration information is larger than a first preset threshold value.
In a specific embodiment, the first preset threshold and the preset encoding information may be set according to actual application requirements, specifically, the preset encoding information may be set to 1, and the first preset threshold may be determined according to the following formula:
wherein,representing a first preset threshold value,/->Indicating the number of communication devices in the group of communication devices, etc.>Representing the signal time interval. Specifically, the->May be set to 10 milliseconds.
In an alternative embodiment, as shown in fig. 2, fig. 2 is a flowchart illustrating a method for determining coding information of a first device to be coded according to an exemplary embodiment, where determining preset coding information as the coding information of the first device to be coded may include:
S201: and under the condition that the first high-level duration information is not greater than a first preset threshold value, carrying out extension processing on the first high-level duration information to obtain extension high-level duration information.
In a specific embodiment, when the duration of the input signal of the first device to be encoded in the high level state is not greater than the first preset threshold, the duration may be subjected to at least one extension process to obtain duration information after the extension process; specifically, in the process of performing the extension processing on the duration, the preset duration may be extended each time, and the preset duration may be set according to the actual application requirement, for example, 1 millisecond.
S203: and determining preset coding information as the coding information of the first device to be coded under the condition that the prolonged high-level duration information is larger than a first preset threshold value.
In the above embodiment, when the duration of the input signal of the first device to be encoded in the high level state is not greater than the first preset threshold, the extension process is repeated for the high level duration until the duration is greater than the first preset threshold, and the preset encoding information can be used as the encoding information of the first device to be encoded.
In an optional embodiment, after determining the preset encoding information as the encoding information of the first device to be encoded, in a case where the first high level duration information is greater than the first preset threshold, the method may further include:
The output signal of the first device to be encoded is set to a low level signal.
Specifically, after determining the coding information of one device to be coded, the output signal of the device is set to a low level, and at this time, the input signal received by the next device to be coded is also a low level signal, so that the next device to be coded is not coded.
S105: the updated encoding information is determined based on level transition time information corresponding to an input signal of the first device to be encoded.
In one embodiment, the level transition time information corresponding to the signal may be the time required for the signal to transition between high and low states.
Specifically, updating the encoded information may be determined according to the following formula:
wherein,representing update coding information->Representing the level shift time information, +.>The time interval of the signal is represented,representing the adjustment factor.
In practical application, the above formula can enable the updated encoded information to be continuous with the preset encoded information, for example, in the case that the preset encoded information is 1, that is, the encoded information of the first device to be encoded is 1, the updated encoded information is 2, and so on; in particular, the method comprises the steps of,the number of the whole-number can be smaller than 5, and the setting can be specifically performed according to actual application requirements.
S107: and determining duration reference information based on the coding information of the first device to be coded.
In a specific embodiment, the duration reference information may be used to determine a start time node for encoding a next device to be encoded. Specifically, the duration reference information may be determined according to the following formula:
wherein,reference information indicating the above-mentioned duration,/-, etc>Representing encoded information->Representing the signal time interval.
S109: and determining the updated coding information as the coding information of the second device to be coded under the condition that the duration reference information is larger than a second preset threshold value and the difference information between the second high-level duration information and the duration reference information is not larger than a third preset threshold value.
In a specific embodiment, the second device to be encoded may be a device to be encoded next to the first device to be encoded, and the second high level duration information may be high level duration information corresponding to an input signal of the second device to be encoded.
In a specific embodiment, the second preset threshold and the third preset threshold may be set according to actual application requirements, and specifically, the second preset threshold and the third preset threshold may both be set to 0, that is, when the duration reference information is greater than 0 and the second high-level duration information is equal to the duration reference information, the updated coding information is used as the coding information of the second device to be coded.
In an optional embodiment, in a case where the duration reference information is greater than the second preset threshold and the difference information between the second high-level duration information and the duration reference information is not greater than the third preset threshold, determining the updated encoding information as the encoding information of the second device to be encoded may include:
s301: and setting the output signal of the first device to be encoded as a high level signal in the case that the duration reference information is greater than the second preset threshold.
In a specific embodiment, the duration reference information may be used to determine a setting condition of the high-low level signal, specifically, the signal may be set to the high level signal when the duration reference information is greater than the second preset threshold value, and the signal may be set to the low level signal when the duration reference information is less than the second preset threshold value.
S303: and acquiring second high-level duration information.
In a specific embodiment, the second high-level duration information may be obtained through an optical coupling chip in the second device to be encoded.
S305: and under the condition that the difference information between the second high-level duration information and the duration reference information is not greater than a third preset threshold value, determining the updated coding information as the coding information of the second equipment to be coded.
In the above embodiment, after the time length reference information is determined based on the encoding information of the first device to be encoded, the second device to be encoded is encoded only when the time length reference information and the high level time length information corresponding to the input signal of the second device to be encoded respectively meet the corresponding conditions, that is, when the signal received by the second device to be encoded is a high level signal and the high level time length corresponding to the signal meets the preset conditions, so as to ensure the order and reliability of encoding.
S111: and re-using the second equipment to be encoded as the first equipment to be encoded, re-using the updated encoding information as preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second equipment to be encoded based on the level conversion time information corresponding to the input signal of the first equipment to be encoded until the preset condition is met, thereby obtaining the encoding information of each equipment to be encoded.
In a specific embodiment, the encoding process of other devices to be encoded in the communication device group is the same as that of the second device to be encoded, and the encoding process is repeated until each device to be encoded in the communication device group is encoded, so as to obtain the encoding information of each device to be encoded.
In an optional embodiment, the step of re-using the second device to be encoded as the first device to be encoded, re-using the updated encoding information as the preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second device to be encoded based on the level transition time information corresponding to the input signal of the first device to be encoded until the preset condition is met, where obtaining the encoding information of each device to be encoded may include:
and re-using the second equipment to be encoded as the first equipment to be encoded, re-using the updated encoding information as preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second equipment to be encoded based on the level conversion time information corresponding to the input signal of the first equipment to be encoded until the repetition times reach the preset times, thereby obtaining the encoding information of each equipment to be encoded.
In a specific embodiment, the preset number of times may be determined according to the number of devices in the communication device group, for example, in the case where the number of devices in the communication device group is 10, the preset number of times may be set to 8.
In an optional embodiment, after determining the updated encoding information as the encoding information of the second device to be encoded in the case where the duration reference information is greater than the second preset threshold and the difference information between the second high level duration information and the duration reference information is not greater than the third preset threshold, the method may further include:
Updating the preset repeated indication information to obtain updated repeated indication information;
correspondingly, the step of re-using the second device to be encoded as the first device to be encoded, re-using the updated encoding information as the preset encoding information, and repeating the step of determining the updated encoding information as the encoding information of the second device to be encoded based on the level transition time information corresponding to the input signal of the first device to be encoded until the preset condition is satisfied, where the obtaining the encoding information of each device to be encoded may include:
and re-using the second equipment to be encoded as the first equipment to be encoded, re-using the updated encoding information as preset encoding information, re-using the updated repetition indication information as preset repetition indication information, and repeating the step of obtaining the updated repetition indication information based on the level conversion time information corresponding to the input signal of the first equipment to be encoded until the updated repetition indication information is smaller than a fourth preset threshold value, thereby obtaining the encoding information of each equipment to be encoded.
In a specific embodiment, updating the preset repetition indication information to obtain updated repetition indication information may include: subtracting a preset interval value from the preset repeated indication information to obtain updated repeated indication information, wherein the preset interval value and the fourth preset threshold value can be set according to actual application requirements, for example, the preset interval value and the fourth preset threshold value can be determined according to the preset repeated indication information.
In a specific embodiment, the preset repetition indication information may be set according to actual application requirements, and specifically, the duration reference information determined based on the coding information of the first device to be coded may be used as the preset repetition indication information, where in this case, the preset interval value may be a value indicating the duration, and the unit may be milliseconds; the preset repetition indication information may also be determined according to the number of devices in the communication device group, in which case the preset interval value may be a positive integer representing the number, for example, in the case where the number of devices in the communication device group is 10, the preset repetition indication information may be set to 8, the preset interval value may be set to 1, and the fourth preset threshold may be set to 0, and in each cycle, after determining the coding information of one device to be coded, the preset repetition indication information is subtracted by 1 until the repetition indication information is less than 0, that is, it indicates that each device in the communication device group is coded, thereby obtaining the coding information of each device to be coded.
In practical application, when the software of the communication equipment is compiled, a coding function can be added, and a specific message command is sent through a programming tool, so that the software can run on a computer or a control unit; when the user starts the coding, the command is sent to all connected communication devices, and each communication device receives the command through the corresponding coding line and performs coding and configuration according to the received command. After each communication device finishes encoding, all devices are successfully encoded and configured, normal communication can be started, and the control device or the upper computer device connected with each communication device can synchronously observe the ID numbers corresponding to all the devices.
In a specific implementation manner, the specific implementation process of the technical solution in the embodiment of the present application is as follows:
the CAN equipment group comprises at least one CAN equipment which is sequentially connected, each CAN equipment comprises a signal input interface, a signal output interface and a CAN communication interface, the signal output interface of each CAN equipment is connected with the signal input interface of the next equipment to be coded through a coding line, and each CAN equipment is connected with a CAN bus through the CAN communication interface.
When the software of the CAN equipment is compiled, a coding function is added, and a specific CAN message command is sent through the CAN box, so that the software CAN run on a computer or a control unit. The user starts the coding process, sends instructions to all connected CAN devices, and each CAN device receives the instructions through the corresponding coding line and performs coding and configuration according to the received instructions.
The method comprises the steps that a CAN device group comprises 10 CAN devices which are sequentially connected, a signal input interface of a first CAN device in the CAN device group receives PWM high-level signals, the time interval of the signals is 10 milliseconds, the time length of the signals in a high-level state is prolonged for a plurality of times under the condition that the time length of the signals is not more than 110 milliseconds, each time is prolonged for 1 millisecond, namely, the first CAN device is encoded to be 1 under the condition that the time length of the high-level signals corresponding to the signals received by the first CAN device is more than 110 milliseconds, the output signals of the first CAN device are set to be low level, and in the process, the code 2 which is prepared for setting for a second CAN device CAN be calculated according to the high-low level conversion time of the input signals of the first CAN device.
Then, according to the code calculation of the first CAN device, the reference time length is 20 ms, the reference time length is greater than 0, so that the output signal of the first CAN device is set to be high level, namely, the input signal of the second CAN device is high level signal at the moment, under the condition that the high level time length of the signal is equal to the reference time length of 20 ms, the code 2 is determined to be the code of the second CAN device, the output signal of the second CAN device is set to be low level, meanwhile, the reference time length is subtracted by 2 ms, namely, the current reference time length is 18 ms, and in the process, the code 3 which is ready to be set for the third CAN device CAN be calculated according to the high-low level conversion time of the input signal of the second CAN device.
Then, according to the coding calculation of the second CAN device, the reference time length for the next device is 30 ms, the reference time length is greater than 0, so that the output signal of the second CAN device is set to be high level, namely, the input signal of the third CAN device is high level signal at the moment, under the condition that the high level time length of the signal is equal to the reference time length of 30 ms, the code 3 is determined to be the code of the third CAN device, the output signal of the third CAN device is set to be low level, meanwhile, the reference time length is subtracted by 2 ms, namely, the current reference time length is 16 ms, in the process, the code 4 which is prepared for the fourth CAN device CAN be calculated according to the high-low level conversion time of the input signal of the third CAN device, then each CAN device repeats the process until the code of each device in the CAN device group is obtained, at the moment, the reference time length may not be less than 0, the processing of the reference time length is continuously repeated for 2 ms, the current reference time length is subtracted for each time length until the reference time length is less than 0, and finally, the code signal is set to be low level, and the coding process is finished.
After each CAN device finishes encoding, all CAN devices are successfully encoded and configured, normal communication CAN be started, and the control device or the upper computer device connected with each CAN device CAN synchronously observe the ID numbers corresponding to all CAN devices.
As can be seen from the technical solutions provided in the embodiments of the present disclosure, a communication device group in the present disclosure includes at least one device to be encoded, where the device to be encoded is a first device to be encoded in the at least one device to be encoded, and the preset encoding information is determined to be encoding information of the first device to be encoded when the high level duration information corresponding to the first device to be encoded is greater than a first preset threshold, and then update encoding information is determined based on level transition time information corresponding to the input signal of the first device to be encoded; determining duration reference information based on the coding information of the first device to be coded, determining updated coding information as the coding information of the second device to be coded under the condition that the duration reference information is larger than a second preset threshold value and the difference information between the second high-level duration information corresponding to the input signal of the second device to be coded and the duration reference information is not larger than a third preset threshold value, wherein the second device to be coded is the next device of the first device to be coded, further, the second device to be coded is re-used as the first device to be coded, the updated coding information is re-used as preset coding information, and repeating the step of determining the updated coding information as the coding information of the second device to be coded based on the level conversion time information corresponding to the input signal of the first device to be coded until the preset condition is met, so that the coding information of each device to be coded is obtained, automatic coding of each device in the communication device group can be realized, manual intervention is not needed, the system construction can be completed more rapidly, and the development period of communication products can be shortened, and manpower expenditure can be saved. Furthermore, based on the high-level pulse time corresponding to the input signal of each device, the automatic coding of each device in the communication device group is realized, the reliability of coding is improved, and the stability of a communication system and the system debugging efficiency are further improved.
The embodiment of the invention also provides an encoding system, as shown in fig. 5, which comprises a communication device group, a communication bus 20 and an encoding module 30;
the communication device group comprises at least one device to be encoded 10 which is sequentially connected, each device to be encoded 10 comprises a signal input interface 3, a signal output interface 4 and communication interfaces 1 and 2, the signal output interface 4 of each device to be encoded 10 is connected with the signal input interface 3 of the next device to be encoded 10, each device to be encoded 10 is connected with the communication bus 20 through the communication interfaces 1 and 2, the encoding module 30 is in communication connection with each device to be encoded 10, and the encoding module 30 is used for executing the encoding method.
Specifically, the signal output interface 4 of each device to be encoded 10 is connected to the signal input interface 3 of the next device to be encoded 10 through the encoding line 40.
Optionally, the communication interface may be a differential signal interface, and the encoding module may include a differential signal conversion unit, where the signal conversion unit may be configured to convert a high-voltage differential signal transmitted through the differential signal interface into a low-voltage single-ended signal, where the low-voltage single-ended signal may be transmitted through the signal input interface and the signal output interface.
In particular, in the case where the communication protocol to be followed by each device to be encoded is a CAN communication protocol, the differential signal interface may include a CAN-H (high level) interface and a CAN-L (low level) interface, through which each device to be encoded is connected to a CAN communication bus. The signal conversion unit may be an optical coupling chip, which may be used to convert the 24V differential signal into a 5V single-ended signal or a 3V single-ended signal, so as to implement the above encoding process through the transmission of the low-voltage single-ended signal.
Optionally, each device to be encoded may further comprise a power interface.
Optionally, as shown in fig. 6, fig. 6 is a schematic structural diagram of an encoding module according to an exemplary embodiment, where the encoding module includes:
a first obtaining unit 610, configured to obtain first high-level duration information corresponding to an input signal of a first device to be encoded, where the first device to be encoded is a first device to be encoded in the at least one device to be encoded;
a first encoding unit 620, configured to determine preset encoding information as encoding information of the first device to be encoded, where the first high-level duration information is greater than a first preset threshold;
An update encoding information determining unit 630, configured to determine update encoding information based on level transition time information corresponding to an input signal of the first device to be encoded;
a duration reference information determining unit 640, configured to determine duration reference information based on the coding information of the first device to be coded;
a second encoding unit 650, configured to determine the updated encoding information as encoding information of a second device to be encoded, where the duration reference information is greater than a second preset threshold, and difference information between second high-level duration information and the duration reference information is not greater than a third preset threshold; the second device to be encoded is the next device to be encoded of the first device to be encoded, and the second high-level duration information is high-level duration information corresponding to an input signal of the second device to be encoded;
and a first repeating unit 660, configured to re-use the second device to be encoded as the first device to be encoded, re-use the updated encoding information as the preset encoding information, and repeat the step of determining the updated encoding information as the encoding information of the second device to be encoded based on the level transition time information corresponding to the input signal of the first device to be encoded until the preset condition is satisfied, to obtain the encoding information of each device to be encoded.
Optionally, the second encoding unit 650 includes:
a first signal setting unit configured to set an output signal of the first device to be encoded as a high level signal, in a case where the duration reference information is greater than the second preset threshold;
a second acquiring unit, configured to acquire the second high-level duration information;
and a third encoding unit, configured to determine the updated encoding information as the encoding information of the second device to be encoded, where the difference information between the second high-level duration information and the duration reference information is not greater than the third preset threshold.
Optionally, the encoding module further includes:
the updating unit is used for updating the preset repeated indication information to obtain updated repeated indication information;
the first repeating unit 660 includes:
and the second repeating unit is used for re-using the second equipment to be encoded as the first equipment to be encoded, re-using the updated encoding information as the preset encoding information, re-using the updated repetition indication information as the preset repetition indication information, and repeating the step of obtaining the updated repetition indication information based on the level transition time information corresponding to the input signal of the first equipment to be encoded until the updated repetition indication information is smaller than a fourth preset threshold value, so as to obtain the encoding information of each equipment to be encoded.
Optionally, the first repeating unit 660 includes:
and a third repeating unit, configured to re-use the second device to be encoded as the first device to be encoded, re-use the updated encoding information as the preset encoding information, and repeat the step of determining the updated encoding information as the encoding information of the second device to be encoded based on the level transition time information corresponding to the input signal of the first device to be encoded until the repetition number reaches a preset number of times, thereby obtaining the encoding information of each device to be encoded.
Optionally, the first encoding unit 620 includes:
the extension processing unit is used for carrying out extension processing on the first high-level duration information to obtain extension high-level duration information under the condition that the first high-level duration information is not greater than the first preset threshold value;
and a fourth encoding unit, configured to determine the preset encoding information as the encoding information of the first device to be encoded, where the extended high-level duration information is greater than the first preset threshold.
Optionally, the encoding module further includes:
and a second signal setting unit configured to set an output signal of the first device to be encoded as a low level signal.
The specific manner in which the respective units perform the operations in the modules in the above embodiments has been described in detail in the embodiments related to the method, and will not be described in detail here.
It will be appreciated by those skilled in the art that the structures shown in fig. 5 or 6 are merely block diagrams of portions of structures related to the present disclosure and do not constitute a limitation of the electronic device to which the present disclosure is applied, and that a particular electronic device may include more or less components than those shown in the drawings, or may combine some components, or have a different arrangement of components.
In an exemplary embodiment, a computer program product containing instructions is also provided which, when run on a computer, cause the computer to perform the encoding method applied to a group of communication devices in the disclosed embodiments of the invention.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
Other embodiments of the disclosed invention will be apparent to those skilled in the art from consideration of the specification and practice of the disclosed invention. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (8)
1. A coding method applied to a communication device group including at least one device to be coded connected in sequence, characterized by comprising:
the method comprises the steps that a first device to be encoded receives a first high-level signal, wherein the first device to be encoded is a first device to be encoded in the at least one device to be encoded;
When the duration of the first high-level signal is longer than a first preset threshold value, determining preset coding information as the coding information of the first equipment to be coded, and setting an output signal of the first equipment to be coded as a low-level signal;
determining duration reference information based on the coding information of the first device to be coded;
setting an output signal of the first device to be encoded as a second high level signal when the duration reference information is greater than a second preset threshold;
determining updated coding information based on high-low level conversion time information corresponding to an output signal of the first device to be coded;
the second high-level signal output by the first equipment to be encoded is received by second equipment to be encoded, wherein the second equipment to be encoded is the next equipment to be encoded of the first equipment to be encoded;
determining the updated coding information as the coding information of the second device to be coded under the condition that the difference information between second high-level time length information and the time length reference information is not greater than a third preset threshold value, wherein the second high-level time length information is the time length information of the second high-level signal input into the second device to be coded;
And re-using the second equipment to be encoded as new first equipment to be encoded, re-using the updated encoding information as new preset encoding information, and repeating the step of encoding the second equipment to be encoded based on the output signal of the first equipment to be encoded until all the equipment to be encoded in the communication equipment group are encoded, so as to obtain the encoding information of each equipment to be encoded.
2. The method according to claim 1, wherein determining that each device to be encoded in the group of communication devices completes encoding based on preset repetition indication information, specifically comprises the steps of:
and subtracting the first preset interval value from the preset repeated indication information after determining the coding information of one device to be coded every time until the updated preset repeated information is smaller than a fourth preset threshold value, and determining that all the devices to be coded in the communication device group finish coding.
3. The method according to claim 1, characterized in that it determines that all devices to be coded in the group of communication devices have completed coding based on the number of repetitions, in particular comprising the steps of:
after the coding information of one device to be coded is determined, adding a second preset interval value to the repetition number until the updated repetition number reaches the preset number, and determining that all the devices to be coded in the communication device group finish coding.
4. The method according to claim 1, wherein the determining preset encoding information as the encoding information of the first device to be encoded in the case that the duration of the first high level signal is greater than a first preset threshold value includes:
when the duration of the first high-level signal is not greater than the first preset threshold value, the duration of the first high-level signal is subjected to extension processing, and the duration of the extended high-level signal is obtained;
and determining the preset coding information as the coding information of the first device to be coded under the condition that the duration of the extended high-level signal is greater than the first preset threshold value.
5. An encoding system is characterized by comprising a communication equipment group, a communication bus and an encoding module;
the communication equipment group comprises at least one equipment to be encoded, each equipment to be encoded comprises a signal input interface, a signal output interface and a communication interface, the signal output interface of each equipment to be encoded is connected with the signal input interface of the next equipment to be encoded, each equipment to be encoded is connected with the communication bus through the communication interface, the encoding module is in communication connection with each equipment to be encoded, and the encoding module is used for executing the encoding method of any one of claims 1 to 4.
6. The system of claim 5, wherein the encoding module comprises:
the first coding unit is used for determining preset coding information as the coding information of the first equipment to be coded and setting the output signal of the first equipment to be coded as a low-level signal under the condition that the first equipment to be coded receives a first high-level signal and the duration of the first high-level signal is longer than a first preset threshold value; the first device to be encoded is a first device to be encoded in the at least one device to be encoded;
a time length reference information determining unit, configured to determine time length reference information based on the coding information of the first device to be coded;
a first signal setting unit configured to set an output signal of the first device to be encoded as a second high level signal, in a case where the duration reference information is greater than a second preset threshold;
an update encoding information determining unit, configured to determine update encoding information based on high-low level transition time information corresponding to an output signal of the first device to be encoded;
the second coding unit is used for determining the updated coding information as the coding information of the second equipment to be coded under the condition that the second equipment to be coded receives the second high-level signal output by the first equipment to be coded and the difference information between second high-level time length information and the time length reference information is not larger than a third preset threshold value; the second device to be encoded is the next device to be encoded of the first device to be encoded, and the second high-level duration information is the duration information of the second high-level signal input into the second device to be encoded;
And the repeating unit is used for re-using the second equipment to be encoded as new first equipment to be encoded, re-using the updated encoding information as new preset encoding information, and repeating the step of encoding the second equipment to be encoded based on the output signal of the first equipment to be encoded until all the equipment to be encoded in the communication equipment group are encoded, so as to obtain the encoding information of each equipment to be encoded.
7. The system of claim 5, wherein the communication interface is a differential signal interface, and the encoding module comprises a differential signal conversion unit for converting a high voltage differential signal transmitted through the differential signal interface into a low voltage single ended signal, the low voltage single ended signal being transmitted through the signal input interface and the signal output interface.
8. The system of claim 5, wherein each device to be encoded further comprises a power interface.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311508188.6A CN117240822B (en) | 2023-11-14 | 2023-11-14 | Coding method and coding system applied to communication equipment group |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311508188.6A CN117240822B (en) | 2023-11-14 | 2023-11-14 | Coding method and coding system applied to communication equipment group |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117240822A CN117240822A (en) | 2023-12-15 |
CN117240822B true CN117240822B (en) | 2024-04-09 |
Family
ID=89098763
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311508188.6A Active CN117240822B (en) | 2023-11-14 | 2023-11-14 | Coding method and coding system applied to communication equipment group |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117240822B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6085259A (en) * | 1997-05-27 | 2000-07-04 | Robert Bosch Gmbh | Addressing apparatus and method |
CN105703885A (en) * | 2015-12-08 | 2016-06-22 | 重庆川仪自动化股份有限公司 | Analytical method and device based on Manchester encoding |
WO2019157711A1 (en) * | 2018-02-14 | 2019-08-22 | Lenovo (Beijing) Limited | Determining an encoding scheme for rsrp transmission |
CN111565236A (en) * | 2020-04-24 | 2020-08-21 | 广州通达汽车电气股份有限公司 | Automatic coding method and device for sensor of fire protection system |
WO2021056588A1 (en) * | 2019-09-29 | 2021-04-01 | 华为技术有限公司 | Method and device for configuration precoding |
CN114265352A (en) * | 2021-12-22 | 2022-04-01 | 深圳埃瑞斯瓦特新能源有限公司 | Automatic configuration system and method for CAN bus ID |
CN115189984A (en) * | 2022-08-11 | 2022-10-14 | 深圳市永航新能源技术有限公司 | Method for automatic distribution mechanism of battery CAN ID |
CN115529293A (en) * | 2022-08-17 | 2022-12-27 | 宁波德业储能科技有限公司 | Dynamic addressing method and system for combined battery pack |
CN115695590A (en) * | 2022-10-09 | 2023-02-03 | 北京国家新能源汽车技术创新中心有限公司 | CAN signal analysis method, equipment and storage medium |
-
2023
- 2023-11-14 CN CN202311508188.6A patent/CN117240822B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6085259A (en) * | 1997-05-27 | 2000-07-04 | Robert Bosch Gmbh | Addressing apparatus and method |
CN105703885A (en) * | 2015-12-08 | 2016-06-22 | 重庆川仪自动化股份有限公司 | Analytical method and device based on Manchester encoding |
WO2019157711A1 (en) * | 2018-02-14 | 2019-08-22 | Lenovo (Beijing) Limited | Determining an encoding scheme for rsrp transmission |
WO2021056588A1 (en) * | 2019-09-29 | 2021-04-01 | 华为技术有限公司 | Method and device for configuration precoding |
CN111565236A (en) * | 2020-04-24 | 2020-08-21 | 广州通达汽车电气股份有限公司 | Automatic coding method and device for sensor of fire protection system |
CN114265352A (en) * | 2021-12-22 | 2022-04-01 | 深圳埃瑞斯瓦特新能源有限公司 | Automatic configuration system and method for CAN bus ID |
CN115189984A (en) * | 2022-08-11 | 2022-10-14 | 深圳市永航新能源技术有限公司 | Method for automatic distribution mechanism of battery CAN ID |
CN115529293A (en) * | 2022-08-17 | 2022-12-27 | 宁波德业储能科技有限公司 | Dynamic addressing method and system for combined battery pack |
CN115695590A (en) * | 2022-10-09 | 2023-02-03 | 北京国家新能源汽车技术创新中心有限公司 | CAN signal analysis method, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN117240822A (en) | 2023-12-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111158680A (en) | Page construction method, device, equipment and storage medium | |
CN115277882B (en) | CAN message database establishment method and device, vehicle-mounted electronic equipment and storage medium | |
CN112000083A (en) | ECU data flashing method, flashing device, flashing equipment and storage medium | |
CN117240822B (en) | Coding method and coding system applied to communication equipment group | |
CN114201336A (en) | Configuration checking control method, system and equipment for online monitoring control function of master station | |
CN113189961A (en) | Forced state searching processing method | |
DE102014111061A1 (en) | Method, apparatus and system for communicating with a device | |
EP3855260A1 (en) | Method for configuring and parametrizing field bus users and engineering system | |
CN203643813U (en) | CANOPEN main control device based on PC104 bus | |
DE69217472T2 (en) | Method and arrangement for checking the standard adaptation of a cell, representing a circuit for transmission protocol management | |
CN115167760A (en) | Time sequence information compression method and device for intelligent operation and maintenance of signals | |
CN114640650A (en) | Automatic addressing method, equipment, medium and product for instrument equipment | |
CN101707541A (en) | Fault diagnosing method and device | |
EP1399831B1 (en) | Device and method for converting a diagnostic interface to spi standard | |
CN112636762B (en) | Battery management system, slave control coding method and device | |
EP0444535B1 (en) | Programmable controller having automatic control of interlock process | |
DE112015007040B4 (en) | Integrated device, communication method and communication program | |
CN111638905A (en) | Version number generation method and device, electronic equipment and readable storage medium | |
EP3387797B1 (en) | Bus arrangement with a subscriber with modules and method for operating a bus arrangement | |
CN109154803B (en) | Programmable logic controller | |
CN100530011C (en) | Automatic connection system of multiple machine station and method | |
CN112596677B (en) | Data storage method and device of electronic control unit and storage medium | |
CN117609116A (en) | Automatic addressing method and system for serial port equipment | |
CN110765667B (en) | Simulation method and system of laser printer | |
CN113542381B (en) | Message frame processing method and device |
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 |