Electric quantity data single byte joint coding method and system for industrial endoscope
Patent Information
- Application Number
- CN202610776721.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-01
- Publication Date
- 2026-08-28
AI Technical Summary
1.单字节直接传输电量值(0~100):无法区分设备是否处于充电状态、是否已满充;上位机需要额外通过另一条命令获取状态,通信效率低
高效率:比传统双字节方案节省50%的通信带宽,适合与图像数据混传。
Smart Images

Figure CN122653564A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of technology, and more specifically, to a method and system for single-byte joint encoding of electrical data for industrial endoscopes. Background Technology
[0002] Industrial endoscopes are widely used in pipeline inspection, machinery maintenance, and other scenarios, and are typically battery-powered. The endoscope needs to report battery level information in real time to a host computer (such as a data recorder) via a serial port so that operators can monitor the remaining working time.
[0003] In existing technologies, electricity data reporting typically employs the following methods: 1. Single-byte direct transmission of power value (0-100): It cannot distinguish whether the device is charging or fully charged; the host computer needs to obtain the status through another command, resulting in low communication efficiency.
[0004] 2. Double-byte transmission (battery power + status flag): This consumes more bandwidth and increases communication overhead and protocol complexity in situations where endoscopic image data and a small amount of status data are mixed and transmitted.
[0005] 3. Use separate status bit bytes: For example, a single byte represents the charging status (0x00 / 0x01), which increases the data packet length.
[0006] Furthermore, when an endoscope is in operation (especially in a dark environment), the host may need to quickly determine whether the battery is fully charged or charging in order to decide whether to continue operation or replace the battery. Existing methods cannot simultaneously meet the requirements of power accuracy and status expression within a single byte. In particular, when the power reaches 100% but the full charge flag has not yet been triggered (e.g., the voltage has just reached the upper limit and the charging current is still greater than the trickle threshold), directly sending 100+128=228 will conflict with the full charge flag, causing ambiguity. Based on the above situation, there is an urgent need for a single-byte joint encoding method and system for power data of industrial endoscopes that can solve this problem. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a single-byte joint encoding method for electrical data of industrial endoscopes, and a single-byte joint encoding system for electrical data of industrial endoscopes, in view of the above-mentioned defects of the prior art.
[0008] The technical solution adopted by this invention to solve its technical problem is: A single-byte joint encoding method for electrical data in industrial endoscopes is constructed, wherein the method includes the following steps: Obtain the current battery percentage, charging status indicator, and full charge indicator; Determine whether the battery is in a discharging or charging state based on the charging status indicator. If the battery is in a discharging state, the current battery percentage will be directly mapped to a single-byte encoded value, with a value range of 0 to 100. If it is in a charging state, then further determine whether it is fully charged based on the full charge indicator: If the device is fully charged, the single-byte encoded value will be fixed at 228. If the battery is not fully charged, when the battery percentage is ≤99%, the single-byte encoded value is set to the sum of the battery percentage and 128, with a value range of 128 to 227; when the battery percentage is 100%, the single-byte encoded value is fixed at 227.
[0009] The single-byte joint encoding method for electrical data in industrial endoscopes according to the present invention further includes a decoding step: Receive single-byte encoded values; If the single-byte encoded value is ≤ 100, it is determined to be in a discharge state, and the power percentage = single-byte encoded value; If the single-byte encoded value is 228, it is determined to be fully charged, and the battery percentage is 100%. If the single-byte encoded value is in the range of 128 to 227, it is determined that the charging state is not fully charged, and the power percentage = encoded value. 128.
[0010] The present invention discloses a single-byte joint encoding method for electrical data of industrial endoscopes, wherein the decoding step is executed by the host computer of the industrial endoscope.
[0011] The single-byte joint encoding method for electrical data of industrial endoscopes described in this invention, wherein the value of 128 corresponds to the highest bit of the single byte being 1, which is used to distinguish between the discharge state and the charging state.
[0012] The single-byte joint encoding method for power data of industrial endoscopes described in this invention, wherein the range of 229 to 255 in the value space of the single-byte encoded value is reserved for expanding other status information of the battery or device.
[0013] The present invention discloses a single-byte joint encoding method for electrical data in industrial endoscopes, wherein the method is applied to a handheld terminal of an industrial endoscope, and the electrical data is transmitted through a serial communication interface and multiplexed with the image data using the same communication channel.
[0014] The present invention discloses a single-byte joint encoding method for electrical data of industrial endoscopes, wherein the method is periodically executed by the main control chip of the industrial endoscope, and the execution period is no more than 200 milliseconds.
[0015] The present invention discloses a single-byte joint encoding method for electrical data of industrial endoscopes, wherein the serial communication interface includes a UART, RS485, or CAN bus interface.
[0016] The single-byte joint encoding method for power data of industrial endoscopes described in this invention includes a charging status flag and a full charge flag, which are obtained by the main control chip of the handheld terminal of the industrial endoscope through a battery management circuit.
[0017] A single-byte joint encoding system for electrical data in industrial endoscopes, wherein the system comprises: The handheld end of the industrial endoscope is equipped with a controller for executing the above-mentioned coding method; A communication cable is used to connect the handheld end of the industrial endoscope to the host computer. The host computer is used to receive and decode the single-byte encoded value and display the battery level and charging status.
[0018] The beneficial effects of this invention are as follows: High efficiency: Saves 50% of communication bandwidth compared to traditional double-byte schemes, suitable for mixed transmission with image data.
[0019] Unambiguous: By reasonably dividing the numerical space, ensure that each state (discharging, charging not full and power <100%, charging not full and power =100%, fully charged) corresponds to a unique byte value.
[0020] Backward compatibility: The values (0-100) in the discharge state are fully compatible with the common single-byte power protocol, and older devices can parse them directly.
[0021] Expandability: 229-255 mm of space is reserved for future expansion to other states (such as battery failure, temperature alarm, etc.).
[0022] Especially suitable for industrial endoscopes: Endoscope probe cables are long and communication speed is limited. This method can provide key battery information with minimal overhead and improve system real-time performance. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort: Figure 1 This is a flowchart of a preferred embodiment of the present invention for a single-byte joint encoding method of electrical data for industrial endoscopes; Figure 2This is a block diagram illustrating the principle of a single-byte joint encoding system for electrical data in industrial endoscopes, according to a preferred embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, a clear and complete description will be provided below in conjunction with the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the protection scope of the present invention.
[0025] A preferred embodiment of the present invention provides a single-byte joint encoding method for electrical data in industrial endoscopes, such as... Figure 1 As shown, the steps include: S1: Obtain the current battery percentage, charging status indicator, and full charge indicator; The main control chip of the industrial endoscope handheld terminal can periodically obtain the current battery percentage (Show_Ca_percent), charging status flag (CHARGE_INOUT), and full charge flag (CharFull) through the battery management circuit.
[0026] The charging status flag is used to indicate whether the battery is connected to an external charging power source. Preferably, the full charge flag is obtained by comprehensively judging the battery voltage, charging current and time after de-jittering (or by other existing methods).
[0027] S2: Determine whether the battery is in a discharging or charging state based on the charging status indicator; The main control chip of the handheld endoscope in the industrial endoscope determines whether the battery is currently discharging or charging based on the charging status indicator.
[0028] S3: If the battery is in a discharging state, the current battery percentage will be directly mapped to a single-byte encoded value, with a value range of 0 to 100. If the battery is in a discharging state (CHARGE_INOUT = 0), the current battery percentage is directly mapped to a single-byte encoded value, with a value range of 0 to 100, corresponding to a battery percentage of 0% to 100%. S4: If it is in charging mode, further determine whether it is fully charged based on the full charge indicator: If the device is fully charged, the single-byte encoded value will be fixed at 228. If the battery is not fully charged, when the battery percentage is ≤99%, the single-byte encoded value is set to the sum of the battery percentage and 128, with a value range of 128 to 227; when the battery percentage is 100%, the single-byte encoded value is fixed at 227.
[0029] If the battery is in a charging state (CHARGE_INOUT = 1), then it will further determine whether it is fully charged based on the full charge flag: If it is fully charged (CharFull = 1), the single-byte encoded value will be fixed at 228 (0xE4), indicating that the battery is 100% and fully charged; If the battery is not fully charged (CharFull = 0): When the battery percentage is ≤ 99, the single-byte encoded value is set to the sum of the battery percentage and 128, with a value range of 128 to 227. When the battery percentage is 100%, the single-byte encoded value is fixed to 227 (0xE3) to avoid conflict with the fully charged status encoded value.
[0030] In this embodiment, the value of 128 corresponds to the highest bit of a single byte being 1, which is used to distinguish between the discharge state and the charging state.
[0031] Preferably, the main control chip executes the above encoding method at a period of no more than 200 milliseconds (e.g., 100 milliseconds) to ensure the real-time performance of the power display.
[0032] In the single-byte encoded value range, the interval from 229 to 255 is reserved and can be used to expand battery fault, temperature alarm or other device status information without affecting the existing encoding rules.
[0033] This embodiment also provides a decoding step corresponding to the above encoding method, which is executed by the host computer of the industrial endoscope (or equivalently replaced by other display terminals): The host computer receives a single-byte encoded value; If the single-byte encoded value is ≤ 100, it is determined to be in a discharge state, and the power percentage = single-byte encoded value; If the single-byte encoded value is 228, it is determined to be fully charged, and the battery percentage is 100%. If the single-byte encoded value is within the range of 128 to 227, it is determined that the charging state is not fully charged, and the power percentage = encoded value. 128.
[0034] Using the above decoding rules, the host computer can quickly obtain the battery level and charging status without parsing additional status bytes.
[0035] A single-byte joint encoding system for electrical data in industrial endoscopes, such as Figure 2 As shown, the system includes: The industrial endoscope handheld terminal 100 has a built-in main control chip and battery management circuit, and is equipped with a controller for executing the above-mentioned encoding method; Communication cable 101 is used to connect the handheld end of the industrial endoscope to the host computer, and supports UART, RS485 or CAN bus interface; The host computer 102 (which can be replaced by other display terminals) is used to receive single-byte encoded values and perform the above decoding steps to display the battery power and charging status on the user interface.
[0036] During the transmission of image data between the handheld device and the host computer, the aforementioned single-byte encoded value can be inserted into the communication frame to achieve multiplexing of power information and image data, significantly reducing communication bandwidth usage.
[0037] The solution applied in this application has at least the following advantages: High efficiency: Saves 50% of communication bandwidth compared to traditional double-byte schemes, suitable for mixed transmission with image data.
[0038] Unambiguous: By reasonably dividing the numerical space, ensure that each state (discharging, charging not full and power <100%, charging not full and power =100%, fully charged) corresponds to a unique byte value.
[0039] Backward compatibility: The values (0-100) in the discharge state are fully compatible with the common single-byte power protocol, and older devices can parse them directly.
[0040] Expandability: 229-255 mm of space is reserved for future expansion to other states (such as battery failure, temperature alarm, etc.).
[0041] Especially suitable for industrial endoscopes: Endoscope probe cables are long and communication speed is limited. This method can provide key battery information with minimal overhead and improve system real-time performance.
[0042] It should be understood that those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A single-byte joint encoding method for electrical data in industrial endoscopes, characterized in that, The method includes the following steps: Obtain the current battery percentage, charging status indicator, and full charge indicator; Determine whether the battery is in a discharging or charging state based on the charging status indicator. If the battery is in a discharging state, the current battery percentage will be directly mapped to a single-byte encoded value, with a value range of 0 to 100. If it is in a charging state, then further determine whether it is fully charged based on the full charge indicator: If the device is fully charged, the single-byte encoded value will be fixed at 228. If the battery is not fully charged, when the battery percentage is ≤99%, the single-byte encoded value is set to the sum of the battery percentage and 128, with a value range of 128 to 227; when the battery percentage is 100%, the single-byte encoded value is fixed at 227.
2. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 1, characterized in that, The method further includes a decoding step: Receive single-byte encoded values; If the single-byte encoded value is ≤ 100, it is determined to be in a discharge state, and the power percentage = single-byte encoded value; If the single-byte encoded value is 228, it is determined to be fully charged, and the battery percentage is 100%. If the single-byte encoded value is in the range of 128 to 227, it is determined that the charging state is not fully charged, and the power percentage = encoded value.
128.
3. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 2, characterized in that, The decoding step is executed by the host computer of the industrial endoscope.
4. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 1, characterized in that, The value of 128 corresponds to the highest bit of a single byte being 1, which is used to distinguish between the discharge state and the charging state.
5. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 1, characterized in that, In the value space of the single-byte encoded value, the range of 229 to 255 is reserved for expanding other status information of the battery or device.
6. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 1, characterized in that, The method is applied to the handheld end of an industrial endoscope, where power data is transmitted via the same communication channel as image data through a serial communication interface.
7. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 6, characterized in that, The method is executed periodically by the main control chip of the industrial endoscope, with an execution cycle of no more than 200 milliseconds.
8. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 6, characterized in that, The serial communication interface includes a UART, RS485, or CAN bus interface.
9. The single-byte joint encoding method for electrical data in industrial endoscopes according to claim 1, characterized in that, The charging status indicator and the full charge indicator are obtained by the main control chip of the industrial endoscope handheld terminal through the battery management circuit.
10. A single-byte joint encoding system for electrical data in industrial endoscopes, characterized in that, The system includes: An industrial endoscope handheld device is equipped with a controller for performing the method of claim 1; A communication cable is used to connect the handheld end of the industrial endoscope to the host computer. The host computer is used to receive and decode the single-byte encoded value and display the battery level and charging status.