Self-adaptive coding and decoding double-line information transmission method and device

文档序号:1315066 发布日期:2020-07-10 浏览:23次 中文

阅读说明:本技术 一种自适应编解码双线信息传输方法和装置 (Self-adaptive coding and decoding double-line information transmission method and device ) 是由 刘启伟 白钰 李涛 冯磊 陈岳 步晓明 于 2020-03-30 设计创作,主要内容包括:本发明涉及一种自适应编解码双线信息传输方法和装置。本发明在编码端包括以下步骤:接收来自外部的发送数据指令和待发送数据,并在收到发送数据指令后,对待发送数据进行编码;按照设定的脉冲宽度和频率发送时钟脉冲信号和数据脉冲信号,所述数据脉冲信号的值为编码后的待发送数据的值;在解码端包括以下步骤:以所述时钟脉冲信号作为中断信号,在接收到中断信号时开始接收所述数据脉冲信号,在中断间隔时间内完成所述数据脉冲信号的接收;在接收完成后对所述数据脉冲信号进行解码,并发送出去。本发明可提高传输效率,信号传输抗干扰能力强,适用于远距离传输数值量的场合。(The invention relates to a self-adaptive coding and decoding double-line information transmission method and a device. The invention comprises the following steps at the encoding end: receiving a data sending command and data to be sent from the outside, and coding the data to be sent after receiving the data sending command; sending a clock pulse signal and a data pulse signal according to a set pulse width and frequency, wherein the value of the data pulse signal is the value of the coded data to be sent; the method comprises the following steps at a decoding end: taking the clock pulse signal as an interrupt signal, starting to receive the data pulse signal when the interrupt signal is received, and finishing the reception of the data pulse signal within interrupt interval time; and after the receiving is finished, the data pulse signal is decoded and sent out. The invention can improve the transmission efficiency, has strong signal transmission anti-interference capability and is suitable for occasions of transmitting numerical values at long distance.)

1. A self-adaptive coding and decoding double-line information transmission method is characterized in that,

the method comprises the following steps at the encoding end:

receiving a data sending command and data to be sent from the outside, and coding the data to be sent after receiving the data sending command;

sending a clock pulse signal and a data pulse signal according to a set pulse width and frequency, wherein the value of the data pulse signal is the value of the coded data to be sent;

the method comprises the following steps at a decoding end:

taking the clock pulse signal as an interrupt signal, starting to receive the data pulse signal when the interrupt signal is received, and finishing the reception of the data pulse signal within interrupt interval time;

and after the receiving is finished, the data pulse signal is decoded and sent out.

2. The adaptive codec bi-wire information transmission method as claimed in claim 1, wherein the data burst signal is transmitted sequentially from the first non-zero data after encoding, from the upper to the lower bits.

3. The adaptive codec two-wire information transmission method according to claim 2, wherein the clock pulse signal is cyclically transmitted at a high level and a low level, and the number of bits to be transmitted is equal to the number of bits to be transmitted of the data pulse signal.

4. The adaptive codec two-wire information transmission method according to claim 3, wherein if the end of the clock pulse signal is high, the clock pulse signal transmission port is set to low after a predetermined time.

5. The adaptive codec two-wire information transmission method according to claim 1, wherein the clock pulse signal is used as an interrupt signal, and specifically includes: and taking the rising edge and the falling edge of the clock pulse signal as interrupt signals.

6. The adaptive codec two-wire information transmission method according to claim 1, wherein the clock pulse signal is used as an interrupt signal, and specifically includes: and taking the rising edge and the falling edge of the clock pulse signal as interrupt signals.

7. An adaptive coding and decoding two-wire information transmission device is characterized by comprising a coding module and a decoding module, wherein the coding module is connected with the decoding module;

the encoding module is used for encoding data to be transmitted and transmitting a clock pulse signal and a data pulse signal according to a set pulse width and frequency, wherein the value of the data pulse signal is the value of the encoded data to be transmitted;

the decoding module is used for taking the clock pulse signal as an interrupt signal, starting to receive the data pulse signal when the interrupt signal is received, and finishing the reception of the data pulse signal within interrupt interval time; and the data pulse signal is decoded and sent out after the receiving is finished.

8. The adaptive codec two-wire information transmission device according to claim 7, wherein the coding module is connected to an external communication module through an external interface for receiving a data transmission command and data to be transmitted from the outside.

9. The adaptive coding and decoding two-wire information transmission device according to claim 7, wherein the coding module is connected with the decoding module through a plurality of data lines, and both the coding module and the decoding module connected with the plurality of data lines are provided with optical coupling isolation.

10. The adaptive codec two-wire information transmission device according to claim 7, wherein the clock pulse signal receiving port of the decoding module is set to a rising edge and falling edge dual-triggering mode.

Technical Field

The invention relates to the technical field of information transmission, in particular to a self-adaptive coding and decoding double-line information transmission method and a device.

Background

In the field of wired data transmission, multi-line transmission technologies such as an RS485 bus, an RS422 bus, a CAN bus, an SPI bus, an IIC bus, and the like are mostly adopted at present. The transmission signal is below 10V, and the transmission line needs to be shielded to avoid interference. The above various signal transmission modes all use bytes as basic units, are irrelevant to the size of transmitted data, and inevitably cause the phenomenon of transmitting useless signals, so that the signal transmission efficiency is reduced.

Disclosure of Invention

Aiming at the defects in the prior art, the technical problem to be solved by the invention is to provide a self-adaptive coding and decoding double-wire information transmission method and device, which can improve the transmission efficiency while reducing the hardware requirement.

The technical scheme adopted by the invention for realizing the purpose is as follows: a self-adaptive coding and decoding double-line information transmission method,

the method comprises the following steps at the encoding end:

receiving a data sending command and data to be sent from the outside, and coding the data to be sent after receiving the data sending command;

sending a clock pulse signal and a data pulse signal according to a set pulse width and frequency, wherein the value of the data pulse signal is the value of the coded data to be sent;

the method comprises the following steps at a decoding end:

taking the clock pulse signal as an interrupt signal, starting to receive the data pulse signal when the interrupt signal is received, and finishing the reception of the data pulse signal within interrupt interval time;

and after the receiving is finished, the data pulse signal is decoded and sent out.

The data pulse signal is transmitted from the first non-zero data after being coded and from the high order to the low order.

The clock pulse signal is sent in a high-level and low-level cycle mode, and the sending bit number of the clock pulse signal is equal to the sending bit number of the data pulse signal.

And if the tail of the clock pulse signal is high level, waiting for a preset time, and setting the clock pulse signal transmitting port to be low level.

Taking the clock pulse signal as an interrupt signal, specifically: and taking the rising edge and the falling edge of the clock pulse signal as interrupt signals.

The receiving of the data pulse signal is completed within the interruption interval time, comprising the steps of:

judging whether the interruption time interval exceeds a limited time or not;

if not, storing the received data pulse signal into a receiving array;

otherwise, a new data pulse signal is received and stored in the receiving array.

An adaptive coding and decoding two-wire information transmission device comprises a coding module and a decoding module, wherein the coding module is connected with the decoding module;

the encoding module is used for encoding data to be transmitted and transmitting a clock pulse signal and a data pulse signal according to a set pulse width and frequency, wherein the value of the data pulse signal is the value of the encoded data to be transmitted;

the decoding module is used for taking the clock pulse signal as an interrupt signal, starting to receive the data pulse signal when the interrupt signal is received, and finishing the reception of the data pulse signal within interrupt interval time; and the data pulse signal is decoded and sent out after the receiving is finished.

The coding module is connected with an external communication module through an external interface and is used for receiving data sending instructions and data to be sent from the outside.

The encoding module is connected with the decoding module through a plurality of data lines, and the encoding module and the decoding module which are connected through the plurality of data lines are both provided with optical coupling isolation.

And a clock pulse signal receiving port of the decoding module is set to be in a rising edge and falling edge dual-trigger mode.

The invention has the following advantages and beneficial effects:

1. the invention self-adaptively encodes and decodes, eliminates the traditional concept of taking the byte length as a unit, effectively reduces the data volume of the sending signal and improves the data transmission efficiency.

2. The invention is suitable for double-wire signal transmission, occupies less hardware resources and is simple and convenient for field wiring.

3. The invention is suitable for data communication between any two devices, is particularly suitable for occasions with strong signal interference or outdoor remote communication transmission occasions, can transmit pulse signals of 5V, 9V, 12V or 24V and the like according to actual conditions, and has strong anti-interference capability.

4. The invention can reduce 30% of data transmission quantity and 20% of hardware consumption.

Drawings

FIG. 1 is a block diagram of the apparatus of the present invention;

FIG. 2 is a schematic diagram of a signaling process according to the present invention;

FIG. 3 is a schematic diagram of a signal receiving process according to the present invention;

FIG. 4 is a pulse signal diagram according to embodiment 1 of the present invention;

fig. 5 is a diagram of pulse signals according to embodiment 2 of the present invention.

Detailed Description

The present invention will be described in further detail with reference to the accompanying drawings and examples.

As shown in FIG. 1, the present invention includes a coding and transmitting module and a receiving and decoding module, and an embedded algorithm implementation therein. The coding and decoding module is provided with a built-in transceiving interface and a data transmission interface with other modules (such as MCU)

The system comprises an encoding module and a decoding module; in order to improve the anti-interference performance, the signal transmission port of the coding and decoding module adopts optical coupling isolation; the coding and decoding module is provided with an external interface circuit and is in data communication with an external module (such as an MCU); in order to improve the signal transmission distance and the anti-interference performance in the transmission process, 5V, 9V, 12V or 24V pulse coding signals can be transmitted according to the actual working conditions.

As shown in fig. 2, after the codec module is powered on, the system self-check and initialization operations are completed first, and the initialization result (success or failure) is sent to the external communication module.

And after the initialization of the coding module is finished, entering a main cycle, and waiting for a data sending instruction and data to be sent of an external communication module. After receiving a data sending command, if no task is sent currently, encoding data to be sent received from an external communication module, and then sending a data pulse signal and a clock pulse signal at a fixed frequency f according to an appointed pulse width Pw. The data coding signal is sent from high order to low order, and the clock pulse signal is sent from high order to low order circularly.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:色度块的预测方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类