A serial port waveform correction method and system

By calculating the high and low level ratios and offset points of the serial port sampling points, the abnormal waveform is adaptively corrected, which solves the problem of inaccurate waveform recognition in the existing technology and achieves efficient sampling of abnormal waveforms and data accuracy.

CN115982539BActive Publication Date: 2025-09-12SHANDONG YOU INTERNET OF THINGS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211727327.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2025-09-12
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

The existing serial port sampling mechanism has a low accuracy rate in identifying abnormal waveforms, especially when the waveform has baud rate deviation and phase deviation, it cannot correctly identify data.

Method used

By obtaining the values ​​of all sampling points of a byte, calculating the proportion of high and low levels, judging the baud rate status and the number of offset points, adaptively determining the second array, and calculating the value of the serial port waveform according to the changes in the values ​​in the array, the abnormal waveform can be corrected.

Benefits of technology

The sampling accuracy of abnormal waveforms is improved, and specific abnormal waveforms can be identified and corrected to ensure data accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115982539B_ABST
    Figure CN115982539B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of serial port sampling, and provides a serial port waveform correction method and system, comprising: if the values ​​of all sampling points of the nth bit in a byte change only once, calculating the high level ratio and low level ratio of each bit, and judging the baud rate status and the number of offset points of the byte based on the high level ratio and low level ratio of all bits, determining a second array of the nth bit in the byte based on the baud rate status and the number of offset points of the byte, and calculating the value of the nth bit based on the change of the value in the second array; if the values ​​of all sampling points of the nth bit in the byte change multiple times, calculating the value of the nth bit based on the position where the value changes, thereby ensuring the accuracy of the data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of serial port sampling, and in particular relates to a serial port waveform correction method and system. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] The current serial port sampling mechanism is to sample 8 or 16 points on one bit, and then take the value of the middle 3 points or 1 point as the value of the bit.

[0004] The above sampling method is only applicable to relatively standard waveforms. The sampling accuracy of some abnormal waveforms is low, especially for certain specific abnormal waveforms. Due to problems such as baud rate deviation and phase deviation in the waveform, the above sampling mechanism may not be able to identify the correct data. Summary of the Invention

[0005] In order to solve the technical problems existing in the above-mentioned background technology, the present invention provides a serial port waveform correction method and system, which can detect whether there is an abnormality in the waveform, and if so, determine the type of abnormality, and then adaptively correct the waveform to ensure the accuracy of the data.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] A first aspect of the present invention provides a serial port waveform correction method, comprising:

[0008] Get the values ​​of all sampling points of a byte;

[0009] If the values ​​of all sampling points of the nth bit in the byte change only once, then calculate the high level ratio and the low level ratio of each bit, and based on the high level ratio and the low level ratio of all bits, determine the baud rate status and the number of offset points of the byte, determine the second array of the nth bit in the byte according to the baud rate status and the number of offset points, and calculate the value of the nth bit based on the change of the value in the second array;

[0010] If the values ​​of all sampling points of the nth bit in the byte change multiple times, the value of the nth bit is calculated based on the position where the value changes.

[0011] Furthermore, the step of determining the second array of the n-th bit in the byte includes:

[0012] Among the high-level proportions of all bits, take out all non-zero values ​​in order and put them into the first vector;

[0013] Among the low-level proportions of all bits, take out all non-zero values ​​in order and put them into the second vector;

[0014] If the values ​​in the first vector and the second vector gradually decrease, and the high level ratio high[n] and the low level ratio low[n] of the nth bit are not 0, then the number of offset points P is (2 k -2 k *low[n+1]) / (n+1), if the number of offset points P is equal to (2 k -2 k *high[n+1]) / (n+1), then define a 2 k -The second array collect_check[n][] of size P is assigned the value collect[n][] of the n-th sampling point to the second array collect_check[n][], where k is the set value.

[0015] Furthermore, the step of determining the second array of the n-th bit in the byte further includes:

[0016] If the values ​​in the first vector and the second vector gradually increase, and the high level ratio high[n] and the low level ratio low[n] of the nth bit are not 0, then the number of offset points P is (2 k -2 k *low[n+1]) / (n+1), if the number of offset points P is equal to (2 k -2 k *high[n+1]) / (n+1), then define a 2 k +P size second array collect_check[n][], assign the value collect[n][] of the n-th sampling point to the second array collect_check[n][], where k is the set value.

[0017] Furthermore, if all the values ​​in the second array of the nth bit are consistent, the level value of the middle point of the nth bit is taken as the value of the nth bit.

[0018] Further, based on all values ​​in the second array of the nth bit in a byte, a second high level ratio and a second low level ratio of the nth bit are calculated;

[0019] If in a byte, only the second highest level ratio of the nth bit is not 0, and the second lowest level ratios of all bits are 0, the waveform of the byte shifts to the left;

[0020] If in a byte, only the second lowest level ratio of the nth bit is not 0, and the second highest level ratios of all bits are 0, the waveform of the byte is shifted to the left.

[0021] Furthermore, if the values ​​of all sampling points of the nth bit change from 0 to 1 and then to 0 again, the position where 0 changes to 1 is recorded as x, and the position where 1 changes to 0 is recorded as y. If yx is less than the set value, the value of the nth bit is assigned to 0.

[0022] Furthermore, if the values ​​of all sampling points at the nth position change from 0 to 1 and then back to 0, the position where 0 changes to 1 is recorded as x, and the position where 1 changes to 0 is recorded as y. If yx is greater than the set value, the value of the nth position is assigned to value[n]=collect[n][x+(x+y) / 2], where collect[n][j] represents the value of the jth sampling point at the nth position.

[0023] A second aspect of the present invention provides a serial port waveform correction system, comprising:

[0024] A data acquisition module is configured to: acquire values ​​of all sampling points of a byte;

[0025] A first correction module is configured to: if the values ​​of all sampling points of the nth bit in the byte change only once, calculate the high level ratio and the low level ratio of each bit, and based on the high level ratio and the low level ratio of all bits, determine the baud rate status and the number of offset points of the byte, determine the second array of the nth bit in the byte according to the baud rate status and the number of offset points, and calculate the value of the nth bit based on the change of the value in the second array;

[0026] The second correction module is configured to: if the values ​​of all sampling points of the nth bit in the byte change multiple times, calculate the value of the nth bit according to the position where the value changes.

[0027] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the serial port waveform correction method as described above.

[0028] A fourth aspect of the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the serial port waveform correction method described above are implemented.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] The present invention provides a serial port waveform correction method, which can detect whether there is an abnormality in the waveform, determine the type of abnormality if there is an abnormality, and then adaptively correct the waveform to ensure data accuracy.

[0031] This embodiment provides a serial port waveform correction method, which increases the number of sampling points, outputs the value of each bit with a delay, uses a waveform error detection mechanism to determine whether the waveform is abnormal from the overall value collected by the entire byte, and then uses the waveform correction mechanism to ensure data accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0033] Figure 1 is a schematic diagram of data sampling in the first embodiment of the present invention;

[0034] Figure 2 This is a schematic diagram of a high baud rate in the first embodiment of the present invention;

[0035] Figure 3 This is a schematic diagram of a first embodiment of the present invention in which the baud rate is relatively low;

[0036] Figure 4 Schematic diagram of a waveform left-shifted according to the first embodiment of the present invention;

[0037] Figure 5 Schematic diagram of a waveform right-shifted according to the first embodiment of the present invention. DETAILED DESCRIPTION

[0038] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0039] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.

[0040] Example 1

[0041] This embodiment provides a serial port waveform correction method, including the following steps:

[0042] Step 1: Get the value of a byte sampling point and store it in the first array collect

[10] [2 k ]middle.

[0043] Each bit samples 2 to the power of k (k is a set value, k is 7 in this embodiment) points (i.e. 128 points), and starts sampling when a low level is detected. If the first 2 to the power of k / 2 (i.e. 64) points are all low levels, it is considered that the start pulse is detected, otherwise it is considered to be interference and re-detection is required.

[0044] like Figure 1As shown in the figure, one bit samples 128 sampling points, and one byte samples a total of 1280 sampling points (including the start bit and stop bit).

[0045] The value of a byte sampling point is stored in the array collect

[10]

[128] , and the array collect[n][] is traversed.

[0046] Step 2: If the values ​​of all sampling points of the nth bit in the byte change only once, calculate the high level ratio and low level ratio of each bit, and judge the baud rate status of the byte and the number of offset points based on the high level ratio and low level ratio of all bits, and determine the second array collect_check[n][] of the nth bit according to the baud rate status of the byte and the number of offset points. The specific method of determining the second array of the nth bit in the byte is as follows: among the high level ratios of all bits, take out all non-zero values ​​in order and put them into the first vector; among the low level ratios of all bits, take out all non-zero values ​​in order and put them into the second vector; if the values ​​in the first vector and the second vector gradually decrease, and the high level ratio high[n] and the low level ratio low[n] of the nth bit are both non-zero, then the number of offset points P is (2 k -2 k *low[n+1]) / (n+1), if the number of offset points P is equal to (2 k -2 k *high[n+1]) / (n+1), then define a 2 k -P size second array collect_check[n][], assign the value of the n-th sampling point collect[n][] to the second array collect_check[n][]; if the values ​​in the first vector and the second vector gradually increase, and the high level ratio high[n] and the low level ratio low[n] of the n-th bit are not 0, then the number of offset points P is (2 k -2 k *low[n+1]) / (n+1), if the number of offset points P is equal to (2 k -2 k *high[n+1]) / (n+1), then define a 2 k +P size second array collect_check[n][], assign the value collect[n][] of the n-th sampling point to the second array collect_check[n][]; where k is the set value, high[n+1] is the high level ratio of the n+1-th bit, and low[n+1] is the low level ratio of the n+1-th bit.

[0047] Traverse the nth row collect[n][] in the array collect

[10]

[128] , that is, the value of the nth sampling point in the byte collect[n][], if the value in collect[n][] changes from 1 to 0 and there is only one value change, record the number m of the position where the last value is 1, and record the high level ratio high[n] = m / 128; otherwise, high[n] is 0.

[0048] If the value in collect[n][] changes from 0 to 1 and there is only one value change, record the number m of the last position where the value is 0 * , record the low level ratio low[n]=m * / 128; otherwise, low[n] is 0.

[0049] Traverse the values ​​of the array high[] and low[], if the values ​​of high[n] and low[n] that are not 0 gradually decrease and satisfy that when low[n] and high[n] are not 0, there is a constant value P of (128-128*low[n+1]) / (n+1), and P is equal to (128-128*high[n+1]) / (n+1), it means that the baud rate of the byte is too high and the number of offset points is P, such as Figure 2 As shown, a second array collect_check[n][128-P] is redefined, and the values ​​of the array collect[n][] are assigned to the array collect_check[n][] from front to back. The redundant values ​​are discarded, and the original collection frequency is kept unchanged. The number of collection points is changed to 128-P to adapt to the baud rate of the received waveform.

[0050] If the values ​​of high[n] and low[n] are not 0 and gradually increase, and when low[n] and high[n] are not 0, there is a constant value P of (128-128*low[n+1]) / (n+1), and P is equal to (128-128*high[n+1]) / (n+1), it means that the baud rate of the byte is too low and the number of offset points is P. Figure 3 As shown, a second array collect_check[n][128+P] is redefined, and the value of the array collect[n][] is assigned to the array collect_check[n][], and the insufficient value is padded with 1 (the last bit is the stop bit, and the value is 1), and the original collection frequency is kept unchanged, and the number of collection points is changed to 128+P to adapt to the baud rate of the received waveform.

[0051] Step 3: Calculate the value of the nth bit based on the change in the value of the second array at the nth bit in the byte.

[0052] Step 301, traverse the array collect_check[n][]. If the values ​​of all points in collect_check[n][] are consistent, take the level value of the middle point of the nth bit as the value of the nth bit, that is, the value of the nth bit value[n] = collect_check[n][(128±P) / 2].

[0053] Step 302: If the value in collect_check[n][] changes from 1 to 0 and there is only one value change, record the position m1 where the last value is 1 and record the second highest level proportion high * [n]=m1 / 128.

[0054] If the value in collect_check[n][] changes from 0 to 1 and there is only one value change, record the position m2 where the last value is 0, and record the second lowest level proportion low * [n]=m2 / 128.

[0055] If a byte has only high * The value of [n] is not 0, low * The value of [n] is all 0, and the high value of multiple bits of this byte is not 0 * If the [n] values ​​are equal, the byte waveform is considered to be shifted to the left, such as Figure 4 As shown, the point where the nth bit is taken should also be shifted to the left, taking the middle position of the valid value, that is, value[n]=collect_check[n][(128±P) / 2*high * [n]].

[0056] If a byte has only low * The value of [n] is not 0, high * The value of [n] is all 0, and the low bits of multiple bits of this byte are not 0 * If the [n] values ​​are equal, the byte waveform is considered to be shifted to the right, such as Figure 5 As shown, the point where the nth bit is taken should also be shifted to the right to take the middle position of the valid value, that is, value[n]=collect_check[n][(128±P) / 2+(128±P) / 2*low * [n]].

[0057] Step 4: If the values ​​of all sampling points of the nth bit in the byte change multiple times, calculate the value of the nth bit based on the position where the value changes.

[0058] If the value in collect[n][] changes from 0 to 1 and then back to 0, the position where 0 changes to 1 is recorded as x, and the position where 1 changes to 0 is recorded as y. If yx is less than 2 k*0.3, that is, less than 38 (128*0.3), it is considered that noise occurs, and the values ​​in collect[n][] are reset to 0. If yx is greater than 38, the nth bit is considered to be high, but the waveform output time is insufficient or an irregular offset occurs, then the value point of the nth bit should be the middle position of the valid waveform, that is, value[n]=collect[n][x+(x+y) / 2].

[0059] Step 5. If value[0] is 0 and value[9] is 1, then all value[n] values ​​are considered correct, and the values ​​of value[1] to value[8] are the values ​​of bits 1 to 8 of the byte.

[0060] Compared with conventional waveform sampling methods, the serial port waveform correction method provided in this embodiment can better adapt to the sampling of abnormal waveforms, especially certain specific abnormal waveforms. Conventional sampling methods cannot identify correct data, but this embodiment can correctly analyze them.

[0061] The present embodiment provides a serial port waveform correction method that can detect whether there is an abnormality in the waveform, determine the type of abnormality if there is an abnormality, and then adaptively correct the waveform to ensure data accuracy.

[0062] This embodiment provides a serial port waveform correction method that increases the number of sampling points, outputs the value of each bit with a delay, uses a waveform error detection mechanism to determine whether the waveform is abnormal based on the values ​​collected from the entire byte, and then uses the waveform correction mechanism to ensure data accuracy.

[0063] Example 2

[0064] This embodiment provides a serial port waveform correction system, which specifically includes:

[0065] A data acquisition module is configured to: acquire values ​​of all sampling points of a byte;

[0066] A first correction module is configured to: if the values ​​of all sampling points of the nth bit in the byte change only once, calculate the high level ratio and the low level ratio of each bit, and based on the high level ratio and the low level ratio of all bits, determine the baud rate status and the number of offset points of the byte, determine the second array of the nth bit in the byte according to the baud rate status and the number of offset points, and calculate the value of the nth bit based on the change of the value in the second array;

[0067] The second correction module is configured to: if the values ​​of all sampling points of the nth bit in the byte change multiple times, calculate the value of the nth bit according to the position where the value changes.

[0068] It should be noted here that the various modules in this embodiment correspond one-to-one to the various steps in Example 1, and the specific implementation processes are the same, which will not be repeated here.

[0069] Example 3

[0070] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the steps of the serial port waveform correction method described in the first embodiment are implemented.

[0071] Example 4

[0072] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the serial port waveform correction method described in the first embodiment are implemented.

[0073] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.

[0074] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0075] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0076] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0077] 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 related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0078] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A serial port waveform correction method, characterized in that: include: Get the values ​​of all sampling points of a byte and store them in the first array collect[10][2 k ]middle; If the values ​​of all sampling points of the nth bit in the byte change only once, then calculate the high level ratio and low level ratio of each bit, and based on the high level ratio and low level ratio of all bits, judge the baud rate status and the number of offset points of the byte, and determine the second array collect_check[n][] of the nth bit in the byte according to the baud rate status and the number of offset points of the byte, and calculate the value of the nth bit based on the change of the value in the second array, specifically: traverse the array collect_check[n][], if the values ​​of all points in collect_check[n][] are the same, then take the level value of the middle point of the nth bit as the value of the nth bit, that is, the value of the nth bit value[n]=collect_check[n][(128±P) / 2], where P is the number of offset points; if the value in collect_check[n][] changes from 1 to 0 and there is only one value change, record the position m1 where the last value is 1, and record the second highest level ratio high * [n] = m1 / 128; if the value in collect_check[n][] changes from 0 to 1 and there is only one value change, record the position m2 where the last value is 0, and record the second lowest level proportion low * [n] = m2 / 128; if a byte has only high * The value of [n] is not 0, low * The value of [n] is all 0, and the high value of multiple bits of this byte is not 0 * [n] values ​​are equal, the byte waveform is considered to be shifted to the left; if a byte has only low * The value of [n] is not 0, high * The value of [n] is all 0, and the low bits of multiple bits of this byte are not 0 * If the [n] values ​​are equal, the byte waveform is considered to be shifted to the right; If the values ​​of all sampling points of the nth bit in the byte change multiple times, the value of the nth bit is calculated according to the position where the value changes. Specifically, if the values ​​of all sampling points of the nth bit change from 0 to 1 and then to 0, the position where 0 changes to 1 is recorded as x, and the position where 1 changes to 0 is recorded as y. If yx is less than the set value, the value of the nth bit is assigned to 0. If yx is greater than the set value, the value of the nth bit is assigned to value[n]=collect[n][x+(x+y) / 2], where collect[n][j] represents the value of the jth sampling point of the nth bit.

2. A serial port waveform correction method as claimed in claim 1, characterized in that, The step of determining the second array of n-th bits in the byte comprises: Among the high-level proportions of all bits, take out all non-zero values ​​in order and put them into the first vector; Among the low-level proportions of all bits, take out all non-zero values ​​in order and put them into the second vector; If the values ​​in the first vector and the second vector gradually decrease, and the high level ratio high[n] and the low level ratio low[n] of the nth bit are not 0, then the number of offset points P is (2 k -2 k *low[n+1]) / (n+1), if the number of offset points P is equal to (2 k -2 k *high[n+1]) / (n+1), then define a 2 k -The second array collect_check[n][] of size P is assigned the value collect[n][] of the n-th sampling point to the second array collect_check[n][], where k is the set value.

3. A serial port waveform correction method as claimed in claim 2, characterized in that, The step of determining the second array of n-th bits in the byte further comprises: If the values ​​in the first vector and the second vector gradually increase, and the high level ratio high[n] and the low level ratio low[n] of the nth bit are not 0, then the number of offset points P is (2 k -2 k *low[n+1]) / (n+1), if the number of offset points P is equal to (2 k -2 k *high[n+1]) / (n+1), then define a 2 k +P size second array collect_check[n][], assign the value collect[n][] of the n-th sampling point to the second array collect_check[n][], where k is the set value.

4. A serial port waveform correction method as claimed in claim 1, characterized in that, If all the values ​​in the second array of the nth bit are consistent, the level value of the middle point of the nth bit is taken as the value of the nth bit.

5. A serial port waveform correction system, characterized in that: include: The data acquisition module is configured to: obtain the values ​​of all sampling points of a byte and store them in the first array collect[10][2 k ]middle; The first correction module is configured as follows: if the values ​​of all sampling points of the nth bit in the byte change only once, then calculate the high level ratio and low level ratio of each bit, and based on the high level ratio and low level ratio of all bits, judge the baud rate status of the byte and the number of offset points, determine the second array collect_check[n][] of the nth bit in the byte according to the baud rate status of the byte and the number of offset points, and calculate the value of the nth bit based on the change of the value in the second array, specifically: traverse the array collect_check[n][], if the values ​​of all points in collect_check[n][] are the same, then take the level value of the middle point of the nth bit as the value of the nth bit, that is, the value of the nth bit value[n]=collect_check[n][(128±P) / 2], where P is the number of offset points; if the value in collect_check[n][] changes from 1 to 0 and there is only one value change, record the position m1 where the last value is 1, and record the second highest level ratio high * [n] = m1 / 128; if the value in collect_check[n][] changes from 0 to 1 and there is only one value change, record the position m2 where the last value is 0, and record the second lowest level proportion low * [n] = m2 / 128; if a byte has only high * The value of [n] is not 0, low * The value of [n] is all 0, and the high value of multiple bits of this byte is not 0 * [n] values ​​are equal, the byte waveform is considered to be shifted to the left; if a byte has only low * The value of [n] is not 0, high * The value of [n] is all 0, and the low bits of multiple bits of this byte are not 0 * If the [n] values ​​are equal, the byte waveform is considered to be shifted to the right; The second correction module is configured to: if the values ​​of all sampling points of the nth bit in the byte change multiple times, calculate the value of the nth bit according to the position where the value changes, specifically: if the values ​​of all sampling points of the nth bit change from 0 to 1 and then to 0, record the position where 0 changes to 1 as x, and record the position where 1 changes to 0 as y, if yx is less than the set value, assign the value of the nth bit to 0, if yx is greater than the set value, assign the value of the nth bit to value[n]=collect[n][x+(x+y) / 2], where collect[n][j] represents the value of the jth sampling point of the nth bit.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the serial port waveform correction method according to any one of claims 1 to 4 are implemented.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the serial port waveform correction method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Baud rate self-adaptation method and device based on CPLD

    CN104199799A

  • Serial-port communication baud rate self-adapting method, system and device

    CN108170630A