JP2015049769A - Communication device, encoder device and serial communication method - Google Patents

Communication device, encoder device and serial communication method Download PDF

Info

Publication number
JP2015049769A
JP2015049769A JP2013181778A JP2013181778A JP2015049769A JP 2015049769 A JP2015049769 A JP 2015049769A JP 2013181778 A JP2013181778 A JP 2013181778A JP 2013181778 A JP2013181778 A JP 2013181778A JP 2015049769 A JP2015049769 A JP 2015049769A
Authority
JP
Japan
Prior art keywords
code
data
signal
bit
error
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.)
Pending
Application number
JP2013181778A
Other languages
Japanese (ja)
Inventor
喜二 高橋
Yoshiji Takahashi
喜二 高橋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nikon Corp
Original Assignee
Nikon Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Nikon Corp filed Critical Nikon Corp
Priority to JP2013181778A priority Critical patent/JP2015049769A/en
Publication of JP2015049769A publication Critical patent/JP2015049769A/en
Pending legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To reduce occurrence of errors.SOLUTION: A communication device performs a data transfer between a transmitter 1 and a receiver 2 by serial communication, and the transmitter 1 comprises: a first code generation part 15 that generates a first code (a CRC code) for performing a cyclic redundancy check of data; a second code generation part 15 that generates a second code (an ECC code) for performing an error detection and correction of the data; and a transmission part 15 that transmits a serial communication type signal including at least the data, the first code and the second code.

Description

本発明は、通信装置、エンコーダ装置、及びシリアル通信方法に関する。   The present invention relates to a communication device, an encoder device, and a serial communication method.

エンコーダ装置は、産業用ロボット等の回転位置変位を検出するセンサとして広く利用されている。エンコーダ装置を用いた制御システムでは、エンコーダ装置と制御装置との間で、双方向のシリアル通信方式によるデータ伝送を行う。この種の制御システムでは、エンコーダ装置が、検出した回転位置変位に対応するデータに対して巡回冗長検査を行うためのチェックコードを生成する。そして、エンコーダ装置が、生成したチェックコードをエンコード信号に付加して制御装置に送信する(例えば、特許文献1参照)。   The encoder device is widely used as a sensor for detecting a rotational position displacement of an industrial robot or the like. In a control system using an encoder device, data transmission is performed between the encoder device and the control device using a bidirectional serial communication method. In this type of control system, the encoder device generates a check code for performing a cyclic redundancy check on data corresponding to the detected rotational position displacement. Then, the encoder device adds the generated check code to the encoded signal and transmits it to the control device (see, for example, Patent Document 1).

特開2009−271592号公報JP 2009-271592 A

上記したような制御システムでは、制御装置がエンコード信号のチェックコードに基づいて巡回冗長検査を行う。これにより、制御装置が信頼性の高いデータに基づいて制御対象を制御することが可能となる。しかし、例えば伝送ラインの近くに大きなノイズ源があるような場合、信号の伝送中にノイズの影響を受けやすい。この場合、巡回冗長検査においてエラーが頻発し、制御装置を停止させてしまう事態に陥ることがある。   In the control system as described above, the control device performs a cyclic redundancy check based on the check code of the encode signal. As a result, the control device can control the control target based on highly reliable data. However, for example, when there is a large noise source near the transmission line, it is easily affected by noise during signal transmission. In this case, an error frequently occurs in the cyclic redundancy check, and the controller may be stopped.

本発明の態様では、エラーの発生を低減させることを目的とする。   An aspect of the present invention aims to reduce the occurrence of errors.

本発明の第1態様によれば、送信装置と受信装置との間でシリアル通信によりデータ伝送を行う通信装置であって、送信装置は、データに対して巡回冗長検査を行うための第1符号を生成する第1符号生成部と、データに対して誤り検出と誤り訂正を行うための第2符号を生成する第2符号生成部と、少なくとも、データ、第1符号、及び第2符号を含むシリアル通信方式の信号を送信する送信部と、を備える通信装置が提供される。   According to the first aspect of the present invention, there is provided a communication device that performs data transmission by serial communication between a transmission device and a reception device, and the transmission device performs a first code for performing a cyclic redundancy check on data. A first code generation unit for generating data, a second code generation unit for generating a second code for performing error detection and error correction on the data, and at least data, a first code, and a second code There is provided a communication device including a transmission unit that transmits a signal of a serial communication method.

本発明の第2態様によれば、データに対して巡回冗長検査を行うための第1符号を生成する第1符号生成部と、データに対して誤り検出と誤り訂正を行うための第2符号を生成する第2符号生成部と、少なくとも、データ、第1符号、及び第2符号を含むシリアル通信方式の信号を送信する送信部と、を備えるエンコーダ装置が提供される。   According to the second aspect of the present invention, a first code generation unit that generates a first code for performing cyclic redundancy check on data, and a second code for performing error detection and error correction on the data There is provided an encoder device including a second code generation unit that generates a signal and a transmission unit that transmits at least data, a first code, and a serial communication system signal including the second code.

本発明の第3態様によれば、シリアル通信によりデータ伝送を行うシリアル通信方法であって、データに対して巡回冗長検査を行うための第1符号を生成することと、データに対して誤り検出と誤り訂正を行うための第2符号を生成することと、少なくとも、データ、第1符号、及び第2符号を含むシリアル通信方式の信号を送信することと、含むシリアル通信方法が提供される。   According to a third aspect of the present invention, there is provided a serial communication method for performing data transmission by serial communication, wherein a first code for performing cyclic redundancy check on data is generated, and error detection is performed on data Generating a second code for performing error correction, transmitting a signal of a serial communication scheme including at least data, a first code, and a second code, and a serial communication method including the second code.

本発明の態様によれば、エラーの発生を低減させることができる。   According to the aspect of the present invention, the occurrence of errors can be reduced.

制御システムの構成を示すブロック図である。It is a block diagram which shows the structure of a control system. 図1に示すエンコーダ装置の構成を示すブロック図である。It is a block diagram which shows the structure of the encoder apparatus shown in FIG. 図1に示す上位制御装置の構成を示すブロック図である。It is a block diagram which shows the structure of the high-order control apparatus shown in FIG. 第1実施形態におけるエンコード信号のフォーマット構成を示す図である。It is a figure which shows the format structure of the encoding signal in 1st Embodiment. 各データフィールドのデータ割り付けを示す図である。It is a figure which shows the data allocation of each data field. 信号処理部によるエンコード信号の送信処理の一例を示すフローチャートである。It is a flowchart which shows an example of the transmission process of the encoding signal by a signal processing part. 制御部によるエンコード信号の受信処理の一例を示すフローチャートである。It is a flowchart which shows an example of the reception process of the encoding signal by a control part. 第2実施形態におけるエンコード信号のフォーマット構成を示す図である。It is a figure which shows the format structure of the encoding signal in 2nd Embodiment.

以下、本発明の実施形態について図面を参照して説明する。ただし、本発明はこれに限定されるものではない。また、図面においては、実施形態を説明するため、一部分を大きくまたは強調して記載するなど適宜縮尺を変更して表現することがある。   Embodiments of the present invention will be described below with reference to the drawings. However, the present invention is not limited to this. In the drawings, in order to describe the embodiment, the scale may be changed as appropriate, for example, by partially enlarging or emphasizing.

<第1実施形態>
図1は、制御システムの構成を示すブロック図である。図1に示す制御システムSYSは、複数(n個)のエンコーダ装置(送信装置、受信装置)1−1〜1−nと、上位制御装置(送信装置、受信装置、制御装置)2と、を備える。図1に示すように、複数のエンコーダ装置1−1〜1−nと上位制御装置2とは、伝送ライン(シリアル通信ライン)3を介して互いに接続されている。
<First Embodiment>
FIG. 1 is a block diagram showing the configuration of the control system. A control system SYS shown in FIG. 1 includes a plurality (n) of encoder devices (transmitting devices, receiving devices) 1-1 to 1-n and a higher-level control device (transmitting device, receiving device, control device) 2. Prepare. As shown in FIG. 1, the plurality of encoder devices 1-1 to 1-n and the upper control device 2 are connected to each other via a transmission line (serial communication line) 3.

複数のエンコーダ装置1−1〜1−nは、例えばロボットを駆動する複数のモータ(制御対象)に対してそれぞれ搭載されている。各エンコーダ装置1−1〜1−nは、それぞれ、各モータの回転位置変位(または、モータにより駆動される部材の回転位置変位又は位置変位)を検出する。そして、各エンコーダ装置1−1〜1−nは、それぞれ、各モータの回転位置変位を表す位置データを記憶する。また、各エンコーダ装置1−1〜1−nは、上位制御装置2から送信されるコマンドを通知するためのコマンド信号を受信する。そして、エンコーダ装置1−1〜1−nは、コマンド信号を受信することに応じて、伝送ライン3を介して、位置データを通知するためのエンコード信号を上位制御装置2に送信する。   The plurality of encoder devices 1-1 to 1-n are mounted on, for example, a plurality of motors (control objects) that drive the robot, for example. Each encoder device 1-1 to 1-n detects the rotational position displacement of each motor (or the rotational position displacement or position displacement of a member driven by the motor). Each encoder device 1-1 to 1-n stores position data representing the rotational position displacement of each motor. Each encoder device 1-1 to 1-n receives a command signal for notifying a command transmitted from the host control device 2. Then, in response to receiving the command signal, the encoder devices 1-1 to 1-n transmit an encode signal for notifying position data to the upper control device 2 via the transmission line 3.

上位制御装置2は、伝送ライン3を介して各エンコーダ装置1−1〜1−nにコマンド信号を送信する。また、上位制御装置2は、各エンコーダ装置1−1〜1−nから送信されるエンコード信号を受信する。そして、上位制御装置2は、エンコード信号に含まれる位置データに基づいて、各エンコーダ装置1−1〜1−nに対応する各モータを制御する。例えば、上位制御装置2は、各モータを所定量回転させる制御を行う。このような制御により、上位制御装置2は、ロボットの動作制御を行う。   The host control device 2 transmits command signals to the encoder devices 1-1 to 1-n via the transmission line 3. Further, the host control device 2 receives the encoded signals transmitted from the encoder devices 1-1 to 1-n. And the high-order control apparatus 2 controls each motor corresponding to each encoder apparatus 1-1 to 1-n based on the position data contained in an encoding signal. For example, the host control device 2 performs control to rotate each motor by a predetermined amount. By such control, the host control device 2 controls the operation of the robot.

伝送ライン3は、例えば、一対の差動伝送線路3a,3bにより構成されている。差動伝送線路(SD+)3aと差動伝送線路(SD−)3bとの間には終端抵抗4が接続される。このような一対の差動伝送線路3a,3bからなる伝送ライン3によって、コマンド信号やエンコード信号が差動シリアル通信(例えば、RS485規格準拠)により伝送される。また、上位制御装置2からの一対の電源線Vccとグランド線GNDとが各エンコーダ装置1−1〜1−nに対して接続されている。すなわち、エンコーダ装置1−1〜1−nの電源は、上位制御装置2から供給されている。   The transmission line 3 is composed of, for example, a pair of differential transmission lines 3a and 3b. A termination resistor 4 is connected between the differential transmission line (SD +) 3a and the differential transmission line (SD−) 3b. A command signal and an encode signal are transmitted by differential serial communication (for example, based on the RS485 standard) through the transmission line 3 including the pair of differential transmission lines 3a and 3b. A pair of power supply lines Vcc and ground lines GND from the host control device 2 are connected to the encoder devices 1-1 to 1-n. That is, power for the encoder devices 1-1 to 1-n is supplied from the host control device 2.

なお、上記したように、各エンコーダ装置1−1〜1−nは、エンコード信号を送信するとともにコマンド信号を受信する。このことから各エンコーダ装置1−1〜1−nは、通信装置における送信装置及び受信装置として機能する。また、上位制御装置2は、コマンド信号を送信するとともにエンコード信号を受信する。このことから上位制御装置2も、通信装置における送信装置及び受信装置として機能する。   As described above, each of the encoder apparatuses 1-1 to 1-n transmits an encode signal and receives a command signal. From this, each encoder apparatus 1-1 to 1-n functions as a transmission apparatus and a reception apparatus in the communication apparatus. The host control device 2 transmits a command signal and receives an encoded signal. Therefore, the host control device 2 also functions as a transmission device and a reception device in the communication device.

図2は、図1に示すエンコーダ装置の構成を示すブロック図である。なお、図1に示すエンコーダ装置1−1〜1−nは、それぞれ同一の構成を有している。このため、以降の説明においては、エンコーダ装置1−1〜1−nのうちのいずれか1つをエンコーダ装置1として説明する。図2に示すように、エンコーダ装置1は、発光部11、回転円板12、受光部13、波形整形回路14、信号処理部(第1符号生成部、第2符号生成部、信号生成部、送信部)15、送受信ドライバ部16、及び記憶部17を有している。   FIG. 2 is a block diagram showing a configuration of the encoder device shown in FIG. The encoder devices 1-1 to 1-n shown in FIG. 1 have the same configuration. Therefore, in the following description, any one of the encoder devices 1-1 to 1-n will be described as the encoder device 1. As shown in FIG. 2, the encoder device 1 includes a light emitting unit 11, a rotating disk 12, a light receiving unit 13, a waveform shaping circuit 14, a signal processing unit (a first code generation unit, a second code generation unit, a signal generation unit, A transmission unit) 15, a transmission / reception driver unit 16, and a storage unit 17.

発光部11は、回転円板12に対して光を発光する。回転円板12は、モータの回転軸の回転変位(又は、このモータにより駆動される部材の回転変位又は位置変位)に応じて、直接又はギア装置などの動力伝達機構を介して回転する。回転円板12には微小なスリットが形成されている。発光部11が発光した光は、回転円板12の回転変位に応じて、回転円板12のスリットを通過し、また回転円板12のスリットのない部分で遮光される。受光部13は、回転円板12が所定の回転変位のときに、発光部11が発光した光を回転円板12のスリットを経て受光する。また、受光部13は、光の受光に応じて出力信号を波形整形回路14に出力する。波形整形回路14は、受光部13からの出力信号を波形整形する。また、波形整形回路14は、波形整形した信号を信号処理部15に出力する。信号処理部15は、波形整形回路14からの信号に対して所定の演算処理を施すことにより、回転円板12の回転位置変位を検出する。このように、エンコーダ装置1は、回転円板12の回転位置変位を検出することにより、モータの回転位置変位(又は、このモータにより駆動される部材の回転位置変位又は位置変位)を検出する。   The light emitting unit 11 emits light to the rotating disk 12. The rotating disk 12 rotates directly or via a power transmission mechanism such as a gear device in accordance with the rotational displacement of the rotating shaft of the motor (or the rotational displacement or positional displacement of a member driven by the motor). A minute slit is formed in the rotating disk 12. The light emitted from the light emitting unit 11 passes through the slit of the rotating disk 12 according to the rotational displacement of the rotating disk 12, and is blocked by the portion of the rotating disk 12 where there is no slit. The light receiving unit 13 receives the light emitted from the light emitting unit 11 through the slit of the rotating disk 12 when the rotating disk 12 is in a predetermined rotational displacement. In addition, the light receiving unit 13 outputs an output signal to the waveform shaping circuit 14 in response to light reception. The waveform shaping circuit 14 shapes the output signal from the light receiving unit 13. The waveform shaping circuit 14 outputs the waveform-shaped signal to the signal processing unit 15. The signal processing unit 15 detects the rotational position displacement of the rotating disk 12 by performing predetermined arithmetic processing on the signal from the waveform shaping circuit 14. Thus, the encoder device 1 detects the rotational position displacement of the motor (or the rotational position displacement or position displacement of the member driven by the motor) by detecting the rotational position displacement of the rotating disk 12.

送受信ドライバ部16は、上位制御装置2との間で信号の送受信する処理を行う。本実施形態では、送受信ドライバ部16は、エンコード信号を上位制御装置2に送信する処理を行う。また、送受信ドライバ部16は、上位制御装置2から送信されるコマンド信号を受信する処理を行う。記憶部17は、信号処理部15が検出した回転円板12の回転位置変位を表す位置データを記憶する。   The transmission / reception driver unit 16 performs a process of transmitting / receiving a signal to / from the host control device 2. In the present embodiment, the transmission / reception driver unit 16 performs a process of transmitting the encoded signal to the host control device 2. In addition, the transmission / reception driver unit 16 performs a process of receiving a command signal transmitted from the host control device 2. The storage unit 17 stores position data representing the rotational position displacement of the rotating disk 12 detected by the signal processing unit 15.

信号処理部15は、上位制御装置2から送信されるコマンド信号を受信することに応じて、記憶部17に記憶されている位置データを読み出す。そして、信号処理部15は、読み出した位置データについて、巡回冗長検査(Cyclic Redundancy Check)を行うためのCRC符号を生成する。ここで、巡回冗長検査とは、主にシリアル通信のデジタルデータの伝送において、伝送中に誤り(エラー)が発生していないかどうかを検出する方法である。データの送信側(本実施形態においてエンコーダ装置1又は上位制御装置2)では、伝送するデータに対して巡回的なアルゴリズム(生成多項式)を用いてCRC符号と呼ばれる冗長データを生成する。そして、データの送信側は、生成した冗長データを本来のデータに付加して送信する。データの受信側(本実施形態においてエンコーダ装置1又は上位制御装置2)は、送信側と同一のアルゴリズムをデータに適用して、冗長データを算出する。受信側は、送信側において算出したCRC符号と、受信側で算出したCRC符号とが一致しているか否かを判定することにより、データの誤りがなく伝送されたか否かを判断する。なお、本実施形態では、CRC符号のことを「第1符号」ということがある。   The signal processing unit 15 reads the position data stored in the storage unit 17 in response to receiving the command signal transmitted from the host control device 2. Then, the signal processing unit 15 generates a CRC code for performing a cyclic redundancy check on the read position data. Here, the cyclic redundancy check is a method of detecting whether or not an error has occurred during transmission mainly in transmission of digital data in serial communication. On the data transmission side (the encoder device 1 or the host control device 2 in the present embodiment), redundant data called CRC code is generated using a cyclic algorithm (generation polynomial) for the data to be transmitted. Then, the data transmitting side adds the generated redundant data to the original data and transmits it. The data receiving side (the encoder device 1 or the host control device 2 in the present embodiment) applies the same algorithm as the transmitting side to the data to calculate redundant data. The receiving side determines whether or not the data is transmitted without error by determining whether or not the CRC code calculated on the transmitting side matches the CRC code calculated on the receiving side. In the present embodiment, the CRC code may be referred to as a “first code”.

また、信号処理部15は、読み出した位置データについて、誤り検出訂正(Error Detection and Correction)を行うためのECC符号(ECC:Error Correcting Code:誤り訂正符号)を生成する。ECC符号とは、データのビット誤り(エラー)を訂正するために本来のデータとは別に付加される冗長データのことをいう。本実施形態において、信号処理部15は、ECC符号としてハミングコードを生成する。ここで、ハミングコードは、データの誤りを検出し訂正することができる線形誤り訂正符号である。なお、本実施形態では、ECC符号のことを「第2符号」ということがある。また、ECC符号の詳細については後述する(図5参照)。   Further, the signal processing unit 15 generates an ECC code (ECC: Error Correcting Code) for performing error detection and correction on the read position data. The ECC code refers to redundant data added separately from the original data in order to correct a bit error (error) of the data. In the present embodiment, the signal processing unit 15 generates a Hamming code as an ECC code. Here, the Hamming code is a linear error correction code capable of detecting and correcting data errors. In the present embodiment, the ECC code may be referred to as a “second code”. Details of the ECC code will be described later (see FIG. 5).

また、信号処理部15は、位置データ、ECC符号、及びCRC符号に基づいて、シリアル通信のフォーマット構成のエンコード信号を生成する。そして、信号処理部15は、生成したエンコード信号を送受信ドライバ部16を介して上位制御装置2に送信する。   Further, the signal processing unit 15 generates an encoded signal having a serial communication format configuration based on the position data, the ECC code, and the CRC code. Then, the signal processing unit 15 transmits the generated encoded signal to the host control device 2 via the transmission / reception driver unit 16.

図3は、図1に示す上位制御装置の構成を示すブロック図である。図3に示すように、上位制御装置2は、送受信ドライバ部21、制御部(受信部、誤り検出部、誤り訂正部、巡回冗長検査部)22、及びメモリ23を有している。送受信ドライバ部21は、各エンコーダ装置1−1〜1−nとの間で信号の送受信する処理を行う。本実施形態では、送受信ドライバ部21は、コマンド信号を各エンコーダ装置1−1〜1−nに送信する処理を行う。また、送受信ドライバ部21は、各エンコーダ装置1−1〜1−nから送信されるエンコード信号を受信する処理を行う。   FIG. 3 is a block diagram showing a configuration of the host controller shown in FIG. As shown in FIG. 3, the host controller 2 includes a transmission / reception driver unit 21, a control unit (reception unit, error detection unit, error correction unit, cyclic redundancy check unit) 22, and a memory 23. The transmission / reception driver unit 21 performs a process of transmitting / receiving a signal to / from each encoder device 1-1 to 1-n. In the present embodiment, the transmission / reception driver unit 21 performs a process of transmitting command signals to the encoder apparatuses 1-1 to 1-n. In addition, the transmission / reception driver unit 21 performs a process of receiving encoded signals transmitted from the encoder apparatuses 1-1 to 1-n.

制御部22は、シリアル通信のフォーマット構成のコマンド信号を生成する。そして、制御部22は、生成したコマンド信号を送受信ドライバ部21を介してエンコーダ装置1−1〜1−nに送信する。また、制御部22は、エンコーダ装置1−1〜1−nから送信されるエンコード信号を送受信ドライバ部21を介して受信する。そして、制御部22は、受信したエンコード信号に含まれるECC符号に基づいて、そのエンコード信号に含まれる位置データやECC符号の誤り検出処理を行う。また、制御部22は、誤り検出処理により位置データやECC符号における1ビットの誤りが検出された場合は、その1ビットの誤りを訂正する誤り訂正処理を行う。なお、誤り検出処理と誤り訂正処理とをまとめて誤り検出訂正処理ということがある。   The control unit 22 generates a command signal having a serial communication format configuration. Then, the control unit 22 transmits the generated command signal to the encoder devices 1-1 to 1-n via the transmission / reception driver unit 21. Further, the control unit 22 receives encoded signals transmitted from the encoder devices 1-1 to 1-n via the transmission / reception driver unit 21. Then, based on the ECC code included in the received encoded signal, the control unit 22 performs error detection processing on the position data and ECC code included in the encoded signal. In addition, when a 1-bit error is detected in the position data or the ECC code by the error detection process, the control unit 22 performs an error correction process for correcting the 1-bit error. Note that error detection processing and error correction processing may be collectively referred to as error detection correction processing.

また、制御部22は、誤り検出処理により誤りを検出しなかった場合、及び誤り訂正処理により1ビットの誤りを訂正した場合は、位置データ(誤り訂正処理を実行した場合は、誤り訂正処理後の位置データ)に対して巡回冗長検査を行う。また、制御部22は、巡回冗長検査により誤りが無いと判断した場合は、位置データに基づいて各エンコーダ装置1−1〜1−nに対応する各モータの回転量を制御する。また、制御部22は、誤り検出処理により2ビット以上の誤りを検出した場合、及び巡回冗長検査により誤りがあると判断した場合は、エンコード信号を正常に受信していないと判断する。この場合、制御部22は、エンコード信号に含まれる位置データに基づくモータの回転量の制御を実行しない。又は、制御部22は、エンコーダ装置1に対してエンコード信号の再送を要求するコマンド信号を送信する。   In addition, when no error is detected by the error detection process, and when a 1-bit error is corrected by the error correction process, the control unit 22 performs positional data (if error correction process is executed, after error correction process) Cyclic redundancy check is performed on (position data). Further, when it is determined by the cyclic redundancy check that there is no error, the control unit 22 controls the rotation amount of each motor corresponding to each encoder device 1-1 to 1-n based on the position data. The control unit 22 determines that the encoded signal is not normally received when an error of 2 bits or more is detected by the error detection process and when it is determined that there is an error by the cyclic redundancy check. In this case, the control unit 22 does not control the rotation amount of the motor based on the position data included in the encode signal. Alternatively, the control unit 22 transmits a command signal requesting the encoder apparatus 1 to retransmit the encoded signal.

メモリ23は、エンコード信号のデータ(位置データ、ECC符号、及びCRC符号などの情報)を記憶する。制御部22は、メモリ23に記憶した位置データ、ECC符号、及びCRC符号に基づいて、誤り検出処理、誤り訂正処理、及び巡回冗長検査を行う。   The memory 23 stores encoded signal data (information such as position data, ECC code, and CRC code). The control unit 22 performs error detection processing, error correction processing, and cyclic redundancy check based on the position data, ECC code, and CRC code stored in the memory 23.

このように、本実施形態では、CRC符号を用いて巡回冗長検査によるデータの誤り検出を行うとともに、ECC符号を用いて誤り検出と誤り訂正を行う。CRC符号を用いた誤り検出(巡回冗長検査)は、ECC符号を用いた誤り検出よりもビット誤りの検出能力が高い反面、ビット誤りの訂正を行うことができない。一方、ECC符号を用いた誤り検出と誤り訂正は、ビット誤りの訂正が可能であるが、ビット誤りの検出能力が低い。また、ECC符号を用いた誤り検出と誤り訂正だけでは、バースト誤り(連続して出現する誤り)や複数ビットの誤りが発生した場合、間違って誤り訂正を行ってしまう場合があり、誤りの訂正能力に欠ける。このため、本実施形態では、誤りの訂正を行うことができるように、ECC符号を用いた誤り検出と誤り訂正を行う。これとともに、誤りの検出能力を低下させないために、CRC符号を用いた誤り検出を行う。   As described above, in this embodiment, error detection and error correction are performed using an ECC code as well as data error detection using a cyclic redundancy check using a CRC code. Although error detection (cyclic redundancy check) using a CRC code has a higher bit error detection capability than error detection using an ECC code, it cannot correct a bit error. On the other hand, error detection and error correction using ECC codes can correct bit errors, but have a low bit error detection capability. Also, error detection and error correction using an ECC code alone may cause error correction if a burst error (a continuously appearing error) or a multi-bit error occurs. Lack of ability. For this reason, in this embodiment, error detection and error correction using an ECC code are performed so that error correction can be performed. At the same time, error detection using a CRC code is performed in order not to reduce the error detection capability.

次に、エンコード信号の構成の具体例について説明する。図4は、第1実施形態におけるエンコード信号のフォーマット構成を示す図である。図4においては、コマンドAを通知するためのコマンド信号と、そのコマンドAに対応するデータA(例えばモータの位置データ)を通知するためのエンコード信号と、コマンドBを通知するためのコマンド信号と、そのコマンドBに対応するデータB(例えばモータの位置データ)を通知するためのエンコード信号と、が伝送ライン3上に伝送されている状態を示している。また、図4は、データAを通知するためのエンコード信号を拡大表示するとともに、エンコード信号を構成するデータフィールドDF0内のデータを拡大表示している。   Next, a specific example of the configuration of the encode signal will be described. FIG. 4 is a diagram showing the format configuration of the encoded signal in the first embodiment. In FIG. 4, a command signal for notifying the command A, an encoding signal for notifying the data A (for example, motor position data) corresponding to the command A, and a command signal for notifying the command B The encoding signal for notifying data B (for example, motor position data) corresponding to the command B is transmitted on the transmission line 3. 4 enlarges and displays the encode signal for notifying the data A and enlarges and displays the data in the data field DF0 constituting the encode signal.

図4に示す例では、エンコード信号は、4つのデータフィールドDF0〜DF3で構成されている。また、図4に示すように、データフィールドDF0は23ビットで構成されている。具体的には、データフィールドDF0は、1ビットのスタートビット(図4中の「Start bit」)、1ビットのストップビット(図4中の「Stop bit」)、16ビットのデータビット(図4中の「D0〜D15:Data bit」)、及び5ビットのパリティビット(図4中の「P1,P2,P4,P8,P16:Parity bit for ECC」)で構成されている。   In the example shown in FIG. 4, the encode signal is composed of four data fields DF0 to DF3. As shown in FIG. 4, the data field DF0 is composed of 23 bits. Specifically, the data field DF0 includes a 1-bit start bit (“Start bit” in FIG. 4), a 1-bit stop bit (“Stop bit” in FIG. 4), and a 16-bit data bit (FIG. 4). "D0 to D15: Data bit") and 5 parity bits ("P1, P2, P4, P8, P16: Parity bit for ECC" in FIG. 4).

ここで、スタートビットは、データフィールドDF0の開始(すなわち最初)を示すビットである。スタートビットは、2進数で「0」のデータであり、データフィールドDF0の先頭のビットに設定される。また、ストップビットは、データフィールドDF0の終了(すなわち最終)を示すビットである。ストップビットは、2進数で「1」のデータであり、データフィールドDF0の最終のビットに設定される。   Here, the start bit is a bit indicating the start (that is, the first) of the data field DF0. The start bit is binary “0” data, and is set to the first bit of the data field DF0. The stop bit is a bit indicating the end (that is, the last) of the data field DF0. The stop bit is binary “1” data, and is set to the last bit of the data field DF0.

また、データビット(D0〜D15)は上位制御装置2に通知される2進数のデータ(位置データ)などを設定するためのビットである。データビット(D0〜D15)は、それぞれ、スタートビットの次のビットから順にストップビットの前のビットまで設定される。なお、データビットの先頭のビットをLSB(Least Significant Bit:最下位ビット)という。また、データビットの最終のビットをMSB(Most Significant Bit:最上位ビット)という。   The data bits (D0 to D15) are bits for setting binary data (position data) to be notified to the host controller 2. The data bits (D0 to D15) are set from the bit next to the start bit to the bit before the stop bit, respectively. The leading bit of the data bit is referred to as LSB (Least Significant Bit). The last bit of the data bits is called MSB (Most Significant Bit).

また、パリティビット(P1,P2,P4,P8,P16)は、ECC用のビット(すなわち、ECC符号)である。パリティビット(P1)は、ストップビットの1つ前のビットに挿入される。また、パリティビット(P2)は、パリティビット(P1)の1つ前のビットに挿入される。また、パリティビット(P4)は、データビット(D14)とデータビット(D15)の間に挿入される。また、パリティビット(P8)は、データビット(D11)とデータビット(D12)の間に挿入される。また、パリティビット(P16)は、データビット(D4)とデータビット(D5)の間に挿入される。   The parity bits (P1, P2, P4, P8, P16) are ECC bits (that is, ECC codes). The parity bit (P1) is inserted into the bit immediately before the stop bit. The parity bit (P2) is inserted into the bit immediately before the parity bit (P1). The parity bit (P4) is inserted between the data bit (D14) and the data bit (D15). The parity bit (P8) is inserted between the data bit (D11) and the data bit (D12). The parity bit (P16) is inserted between the data bit (D4) and the data bit (D5).

なお、データフィールドDF1〜DF3においても、データフィールドDF0と共通のデータ構成(共通のビット長で、共通のビット配置)となっている。すなわち、データフィールドDF1〜DF3においても、1ビットのスタートビット、1ビットのストップビット、16ビットのデータビット、及び5ビットのパリティビットで構成され、これらのビットの配置もデータフィールドDF0と共通となっている。   Note that the data fields DF1 to DF3 also have a data configuration common to the data field DF0 (a common bit length and a common bit arrangement). That is, the data fields DF1 to DF3 are also composed of 1 start bit, 1 stop bit, 16 data bits, and 5 parity bits, and the arrangement of these bits is also common to the data field DF0. It has become.

図5は、各データフィールドのデータ割り付けを示す図である。図5に示すように、データフィールドDF0において、データビットの最初の3ビット(D0〜D2)は、シリアル通信の同期のために用いられる同期用コード(シンクコード、Sync.Code)として「001」という固定の値が設定される。また、データフィールドDF0において、データビットの4ビット目以降(D3〜D15)には位置データが設定される。また、データフィールドDF1,DF2においては、すべてのビット(D0〜D15)に位置データが設定される。また、データフィールドDF3において、データビットの最初の8ビット(D0〜D7)には位置データが設定される。また、データフィールドDF3において、データビットの9ビット目以降(D8〜D15)には信号処理部15により生成されるCRC符号が設定される。CRC符号は、信号処理部15により、各データフィールドDF0〜DF3におけるスタートビット、ストップビット、及びECC用のパリティビット(P1,P2,P4,P8,P16)を除いたデータ、すなわち各データフィールドDF0〜DF3のデータビット(D0〜D15)に対して生成される。   FIG. 5 is a diagram showing data allocation of each data field. As shown in FIG. 5, in the data field DF0, the first three bits (D0 to D2) of the data bits are “001” as a synchronization code (sync code, Sync. Code) used for synchronization of serial communication. A fixed value is set. In the data field DF0, position data is set in the fourth and subsequent bits (D3 to D15) of the data bits. In the data fields DF1 and DF2, position data is set in all bits (D0 to D15). In the data field DF3, position data is set in the first 8 bits (D0 to D7) of the data bits. In the data field DF3, the CRC code generated by the signal processing unit 15 is set in the ninth and subsequent bits (D8 to D15) of the data bits. The CRC code is obtained by the signal processor 15 by removing the start bit, stop bit, and ECC parity bits (P1, P2, P4, P8, P16) in each data field DF0 to DF3, that is, each data field DF0. Generated for data bits (D0 to D15) of DF3.

また、図5に示すように、ECC符号を構成するパリティビット(P1)は、信号処理部15がデータビット(D15,D14,D12,D11,D9,D7,D5,D4,D2,D0)の排他的論理和をとることにより算出される。また、パリティビット(P2)は、信号処理部15がデータビット(D15,D13,D12,D10,D9,D6,D5,D3,D2)の排他的論理和をとることにより算出される。また、パリティビット(P4)は、信号処理部15がデータビット(D14,D13,D12,D8,D7,D6,D5,D1,D0)の排他的論理和をとることにより算出される。また、パリティビット(P8)は、信号処理部15がデータビット(D11,D10,D9,D8,D7,D6,D5)の排他的論理和をとることにより算出される。また、パリティビット(P16)は、信号処理部15がデータビット(D4,D3,D2,D1,D0)の排他的論理和をとることにより算出される。   Further, as shown in FIG. 5, the parity bit (P1) constituting the ECC code is generated by the signal processing unit 15 as data bits (D15, D14, D12, D11, D9, D7, D5, D4, D2, D0). Calculated by taking exclusive OR. The parity bit (P2) is calculated by the signal processing unit 15 taking an exclusive OR of the data bits (D15, D13, D12, D10, D9, D6, D5, D3, D2). The parity bit (P4) is calculated by the signal processing unit 15 taking an exclusive OR of the data bits (D14, D13, D12, D8, D7, D6, D5, D1, D0). The parity bit (P8) is calculated by the signal processing unit 15 taking an exclusive OR of the data bits (D11, D10, D9, D8, D7, D6, D5). The parity bit (P16) is calculated by the signal processing unit 15 taking an exclusive OR of the data bits (D4, D3, D2, D1, D0).

図4及び図5に示すように、ECC符号を構成するパリティビット(P1,P2,P4,P8,P16)は、シリアル通信の同期のために用いられる同期用コードと重複しない位置に付加される。すなわち、同期用コードは、データフィールドDF0におけるデータビットの最初の3ビット(D0〜D2)に付加されるのに対し、パリティビット(P1,P2,P4,P8,P16)は、それぞれ、各データフィールドDF0〜DF3におけるMSB側から1ビット目、2ビット目、4ビット目、8ビット目、16ビット目に付加される。   As shown in FIGS. 4 and 5, the parity bits (P1, P2, P4, P8, P16) constituting the ECC code are added at positions that do not overlap with the synchronization code used for serial communication synchronization. . That is, the synchronization code is added to the first three bits (D0 to D2) of the data bits in the data field DF0, whereas the parity bits (P1, P2, P4, P8, P16) It is added to the 1st bit, 2nd bit, 4th bit, 8th bit and 16th bit from the MSB side in fields DF0 to DF3.

同期用コードは、信号の受信開始時に同期をとる必要があるため、常に、データフィールドDF0におけるデータビットの最初の3ビット(D0〜D2)に付加される。仮に、パリティビット(P1,P2,P4,P8,P16)を、それぞれ、各データフィールドDF0〜DF3におけるLSB側から1ビット目、2ビット目、4ビット目、8ビット目、16ビット目に付加すると、データフィールドDF0において同期用コードが配置されるべき位置にパリティビット(P1,P2)が配置されることになる。この場合、エンコーダ装置1と上位制御装置2との間で信号の受信開始時に同期がとれなくなってしまう。このような事態が生じることを回避するために、パリティビット(P1,P2,P4,P8,P16)は、それぞれ、各データフィールドDF0〜DF3においてMSB側から1ビット目、2ビット目、4ビット目、8ビット目、16ビット目に付加される。   Since the synchronization code needs to be synchronized at the start of signal reception, it is always added to the first 3 bits (D0 to D2) of the data bits in the data field DF0. Temporarily, parity bits (P1, P2, P4, P8, P16) are added to the 1st, 2nd, 4th, 8th, and 16th bits from the LSB side in each data field DF0 to DF3, respectively. Then, the parity bits (P1, P2) are arranged at the position where the synchronization code should be arranged in the data field DF0. In this case, synchronization cannot be established between the encoder device 1 and the host control device 2 at the start of signal reception. In order to avoid such a situation, the parity bits (P1, P2, P4, P8, P16) are the first bit, the second bit, the fourth bit from the MSB side in each data field DF0 to DF3, respectively. It is added to the 8th, 16th and 16th bits.

次に、制御システムSYSによるシリアル通信方法について説明する。   Next, a serial communication method using the control system SYS will be described.

図6は、信号処理部によるエンコード信号の送信処理の一例を示すフローチャートである。図6に示す処理において、まず、信号処理部15は、上位制御装置2から送信されるコマンド信号を受信したか否かを判定する(ステップS1)。信号処理部15は、ステップS1の処理を、コマンド信号を受信するまで繰り返し実行する。信号処理部15は、コマンド信号を受信したと判定した場合は、記憶部17に記憶しているコマンド信号に対応する2進数のデジタル信号である位置データを読み出す(ステップS2)。そして、信号処理部15は、位置データについての8ビットのCRC符号を生成する(ステップS3)。上述したように、信号処理部15は、予め上位制御装置2との間で取り決めた生成多項式を用いて、各データフィールドDF0〜DF3のデータビット(D0〜D15)に対する8ビットのCRC符号を生成する。   FIG. 6 is a flowchart illustrating an example of an encoding signal transmission process by the signal processing unit. In the process shown in FIG. 6, first, the signal processing unit 15 determines whether or not a command signal transmitted from the host controller 2 has been received (step S1). The signal processing unit 15 repeatedly executes the process of step S1 until a command signal is received. When determining that the command signal has been received, the signal processing unit 15 reads position data, which is a binary digital signal corresponding to the command signal stored in the storage unit 17 (step S2). Then, the signal processing unit 15 generates an 8-bit CRC code for the position data (step S3). As described above, the signal processing unit 15 generates an 8-bit CRC code for the data bits (D0 to D15) of the data fields DF0 to DF3, using a generator polynomial previously determined with the host controller 2. To do.

また、信号処理部15は、データフィールド毎に位置データ(ステップS3で生成したCRC符号を含む)についての5ビットのECC符号(P1,P2,P4,P8,P16)を生成する(ステップS4)。上述したように、信号処理部15は、各データフィールドDF0〜DF3における所定のデータビットに対して排他的論理和の演算(XOR演算)を行うことにより、5ビットのECC符号を生成する。   Further, the signal processing unit 15 generates a 5-bit ECC code (P1, P2, P4, P8, P16) for the position data (including the CRC code generated in step S3) for each data field (step S4). . As described above, the signal processing unit 15 generates a 5-bit ECC code by performing an exclusive OR operation (XOR operation) on predetermined data bits in each of the data fields DF0 to DF3.

次に、信号処理部15は、位置データ、CRC符号、及びECC符号に基づいて、シリアル通信のフォーマット構成のエンコード信号を生成する(ステップS5)。具体的には、信号処理部15は、各データフィールドDF0〜DF3のスタートビットに「0」を挿入し、各データフィールドDF0〜DF3のストップビットに「1」を挿入する。また、信号処理部15は、データフィールドDF0におけるデータビットの最初の3ビット(D0〜D2)に同期用コードとして「001」を挿入する。また、信号処理部15は、各データフィールドDF0〜DF3におけるデータビット(同期用コードのビット位置を除く)に位置データを挿入する。また、信号処理部15は、最終データフィールドDF3におけるデータビットの後半8ビット(D8〜D15)に、ステップS3で生成した8ビットのCRC符号を挿入する。また、信号処理部15は、各データフィールドDF0〜DF3における所定のビット位置(図4参照)に、ステップS4で生成した5ビットのECC符号を挿入する。その後、信号処理部15は、ステップS5で生成したエンコード信号を送受信ドライバ部16を介して上位制御装置2に送信する(ステップS6)。   Next, the signal processing unit 15 generates an encoded signal having a serial communication format configuration based on the position data, the CRC code, and the ECC code (step S5). Specifically, the signal processing unit 15 inserts “0” into the start bits of the data fields DF0 to DF3 and inserts “1” into the stop bits of the data fields DF0 to DF3. Further, the signal processing unit 15 inserts “001” as a synchronization code in the first three bits (D0 to D2) of the data bits in the data field DF0. In addition, the signal processing unit 15 inserts position data into data bits (except for the bit position of the synchronization code) in each of the data fields DF0 to DF3. Further, the signal processing unit 15 inserts the 8-bit CRC code generated in step S3 into the last 8 bits (D8 to D15) of the data bits in the final data field DF3. In addition, the signal processing unit 15 inserts the 5-bit ECC code generated in step S4 into predetermined bit positions (see FIG. 4) in the data fields DF0 to DF3. Thereafter, the signal processing unit 15 transmits the encoded signal generated in step S5 to the host control device 2 via the transmission / reception driver unit 16 (step S6).

図7は、制御部によるエンコード信号の受信処理の一例を示すフローチャートである。図7に示す処理において、制御部22は、エンコード信号の最初のデータフィールドDF0におけるスタートビットを検出した後に(ステップS11)、同期用コード(「001」)を検出する(ステップS12)。制御部22は、同期用コードを検出すると、同期用コード以降のシリアルデータ(各データフィールドDF0〜DF3のデジタルデータ)を順次受信する(ステップS13)。具体的には、制御部22は、同期用コードの検出後にデータフィールドDF0のデータビットやパリティビットのデータを受信する。その後、制御部22は、ストップビットと次のデータフィールドのスタートビットを検出することによりデータフィールドの切り替わりを認識した上で、各データフィールドのデータビットやパリティビットのデータを受信する。制御部22は、受信したシリアルデータをメモリ23に記憶する。このように、制御部22が同期用コードの検出後にシリアルデータを順次受信することにより、エンコーダ装置1との間でシリアル通信の同期をとることができる。従って、エンコーダ装置1と上位制御装置2との間の同期ずれが生じるのを防止することができる。   FIG. 7 is a flowchart illustrating an example of an encoding signal reception process performed by the control unit. In the process shown in FIG. 7, after detecting the start bit in the first data field DF0 of the encoded signal (step S11), the control unit 22 detects the synchronization code (“001”) (step S12). When detecting the synchronization code, the control unit 22 sequentially receives serial data after the synchronization code (digital data of the data fields DF0 to DF3) (step S13). Specifically, the control unit 22 receives data bits and parity bit data of the data field DF0 after detecting the synchronization code. After that, the control unit 22 recognizes the switching of the data field by detecting the stop bit and the start bit of the next data field, and then receives the data bit and parity bit data of each data field. The control unit 22 stores the received serial data in the memory 23. In this way, the serial communication can be synchronized with the encoder device 1 by sequentially receiving the serial data after the control unit 22 detects the synchronization code. Therefore, it is possible to prevent the synchronization deviation between the encoder device 1 and the host control device 2 from occurring.

次に、制御部22は、受信したシリアルデータに基づいてデータフィールド毎にECC符号によるエラー検出(誤り検出)を実行する(ステップS14)。具体的には、制御部22は、以下のC1,C2,C4,C8,C16の値を算出する。   Next, the control unit 22 performs error detection (error detection) using an ECC code for each data field based on the received serial data (step S14). Specifically, the control unit 22 calculates the following values of C1, C2, C4, C8, and C16.

C1は、パリティビット(P1)とデータビット(D15,D14,D12,D11,D9,D7,D5,D4,D2,D0)との排他的論理和をとることにより算出される。すなわち、制御部22が、C1=XOR of bits(P1,D15,D14,D12,D11,D9,D7,D5,D4,D2,D0)のXOR演算を行うことにより、C1の値を算出する。また、C2は、パリティビット(P2)とデータビット(D15,D13,D12,D10,D9,D6,D5,D3,D2)との排他的論理和をとることにより算出される。すなわち、制御部22が、C2=XOR of bits(P2,D15,D13,D12,D10,D9,D6,D5,D3,D2)のXOR演算を行うことにより、C2の値を算出する。また、C4は、パリティビット(P4)とデータビット(D14,D13,D12,D8,D7,D6,D5,D1,D0)との排他的論理和をとることにより算出される。すなわち、制御部22が、C4=XOR of bits(P4,D14,D13,D12,D8,D7,D6,D5,D1,D0)のXOR演算を行うことにより、C4の値を算出する。また、C8は、パリティビット(P8)とデータビット(D11,D10,D9,D8,D7,D6,D5)との排他的論理和をとることにより算出される。すなわち、制御部22が、C8=XOR of bits(P8,D11,D10,D9,D8,D7,D6,D5)のXOR演算を行うことにより、C8の値を算出する。また、C16は、パリティビット(P16)とデータビット(D4,D3,D2,D1,D0)との排他的論理和をとることにより算出される。すなわち、制御部22が、C16=XOR of bits(P16,D4,D3,D2,D1,D0)のXOR演算を行うことにより、C16の値を算出する。   C1 is calculated by taking the exclusive OR of the parity bit (P1) and the data bits (D15, D14, D12, D11, D9, D7, D5, D4, D2, D0). That is, the control unit 22 calculates the value of C1 by performing an XOR operation of C1 = XOR of bits (P1, D15, D14, D12, D11, D9, D7, D5, D4, D2, D0). C2 is calculated by taking the exclusive OR of the parity bit (P2) and the data bits (D15, D13, D12, D10, D9, D6, D5, D3, D2). That is, the control unit 22 calculates the value of C2 by performing an XOR operation of C2 = XOR of bits (P2, D15, D13, D12, D10, D9, D6, D5, D3, D2). C4 is calculated by taking the exclusive OR of the parity bit (P4) and the data bits (D14, D13, D12, D8, D7, D6, D5, D1, D0). That is, the control unit 22 calculates the value of C4 by performing an XOR operation of C4 = XOR of bits (P4, D14, D13, D12, D8, D7, D6, D5, D1, D0). C8 is calculated by taking the exclusive OR of the parity bit (P8) and the data bits (D11, D10, D9, D8, D7, D6, D5). That is, the control unit 22 calculates the value of C8 by performing an XOR operation of C8 = XOR of bits (P8, D11, D10, D9, D8, D7, D6, D5). C16 is calculated by taking the exclusive OR of the parity bit (P16) and the data bits (D4, D3, D2, D1, D0). That is, the control unit 22 calculates the value of C16 by performing an XOR operation of C16 = XOR of bits (P16, D4, D3, D2, D1, D0).

そして、制御部22は、C=C16*16+C8*8+C4*4+C2*2+C1の計算式に、C16,C8,C4,C2,C1の値を代入することによりCの値を算出する。例えば、Cの値が0のときは、データフィールド内におけるスタートビット及びストップビットを除くすべてのビット(21ビット)においてビット誤りが生じていないことを意味する。また、Cの値が1のときは、データフィールド内におけるスタートビット及びストップビットを除くビットのうちの1ビット目(すなわちD0のビット)においてビット誤りが生じていることを意味する。また、Cの値が10のときは、データフィールド内におけるスタートビット及びストップビットを除くビットのうちの10ビット目(すなわちD8のビット)においてビット誤りが生じていることを意味する。また、Cの値が21のときは、データフィールド内におけるスタートビット及びストップビットを除くビットのうちの21ビット目(すなわちP1のビット)においてビット誤りが生じていることを意味する。さらに、Cの値が22以上のときは、データフィールド内におけるスタートビット及びストップビットを除くビットにおいて2ビット以上のビット誤りが生じていることを意味する。   Then, the control unit 22 calculates the value of C by substituting the values of C16, C8, C4, C2, and C1 into the calculation formula of C = C16 * 16 + C8 * 8 + C4 * 4 + C2 * 2 + C1. For example, when the value of C is 0, it means that no bit error has occurred in all bits (21 bits) except the start bit and stop bit in the data field. In addition, when the value of C is 1, it means that a bit error has occurred in the first bit (that is, the bit of D0) of the bits other than the start bit and the stop bit in the data field. Further, when the value of C is 10, it means that a bit error has occurred in the 10th bit (that is, the bit of D8) of the bits excluding the start bit and stop bit in the data field. In addition, when the value of C is 21, it means that a bit error has occurred in the 21st bit (that is, the bit of P1) of the bits other than the start bit and the stop bit in the data field. Further, when the value of C is 22 or more, it means that a bit error of 2 bits or more has occurred in the bits other than the start bit and stop bit in the data field.

制御部22は、ステップS14で算出したCの値が0であるか否かを判定する(ステップS15)。制御部22は、Cの値が0であると判定した場合は、ステップS16の処理に移行する。また、制御部22は、Cの値が0でないと判定した場合は、Cの値が1から21のいずれかであるか否かを判定する(ステップS17)。制御部22は、Cの値が1から21のいずれかであると判定した場合は、1ビットの誤りが発生していると判断し、1ビットのエラー訂正処理(誤り訂正処理)を行う(ステップS18)。具体的には、制御部22は、Cの値に基づいて誤りのあるビットの位置を特定し、そのビットの値を反転させる。すなわち、「1」を「0」にし、「0」を「1」にする。そして、制御部22は、ステップS16の処理に移行する。制御部22は、Cの値が1から21のいずれでもないと判定した場合、つまり、Cの値が22以上であると判定した場合は、2ビット以上の誤り(エラー)が存在していると判断する(ステップS20)。この場合は、制御部22は、受信したデータが不正常であるため、そのデータに基づくモータ(制御対象)の制御を停止する。又は、制御部22は、エンコーダ装置1に対してエンコード信号の再送を要求するコマンド信号を送信する。   The control unit 22 determines whether or not the value of C calculated in step S14 is 0 (step S15). When the control unit 22 determines that the value of C is 0, the control unit 22 proceeds to the process of step S16. Further, when determining that the value of C is not 0, the control unit 22 determines whether or not the value of C is any one of 1 to 21 (step S17). When it is determined that the value of C is any of 1 to 21, the control unit 22 determines that a 1-bit error has occurred and performs a 1-bit error correction process (error correction process) ( Step S18). Specifically, the control unit 22 specifies the position of an erroneous bit based on the value of C, and inverts the value of the bit. That is, “1” is set to “0”, and “0” is set to “1”. And the control part 22 transfers to the process of step S16. If the control unit 22 determines that the value of C is not any of 1 to 21, that is, if it is determined that the value of C is 22 or more, an error (error) of 2 bits or more exists. Is determined (step S20). In this case, since the received data is abnormal, the control unit 22 stops the control of the motor (control target) based on the data. Alternatively, the control unit 22 transmits a command signal requesting the encoder apparatus 1 to retransmit the encoded signal.

制御部22は、以上のようなステップS15,S17,S18の処理をデータフィールド毎に実行する。4つのデータフィールドDF0〜DF3のうち、すべてのデータフィールドにおいて2ビット以上のエラーが検出されなかった場合に限り(ステップS15のYes、ステップS17のYes)、制御部22はステップS16の処理を実行する。すなわち、4つのデータフィールドDF0〜DF3のうち、1つのデータフィールドにおいて2ビット以上のエラーが検出された場合は(ステップS17のNo)、制御部22はステップS16の処理を実行しない。   The control unit 22 executes the processes in steps S15, S17, and S18 as described above for each data field. Only when an error of 2 bits or more is not detected in all of the four data fields DF0 to DF3 (Yes in Step S15, Yes in Step S17), the control unit 22 executes the process of Step S16. To do. That is, when an error of 2 bits or more is detected in one data field among the four data fields DF0 to DF3 (No in step S17), the control unit 22 does not execute the process in step S16.

制御部22は、ステップS15の処理(誤り検出処理)でビット誤りが生じていないと判断した場合(ステップS15のYes)は、正常な各データフィールドDF0〜DF3のデータビットのデータ(D0〜D15)に対して巡回冗長検査(CRCチェック)を実行する(ステップS16)。また、制御部22は、ステップS17の処理(誤り検出処理)で1ビットのビット誤りを検出したことに基づいて1ビットのエラー訂正処理を実行した場合は(ステップS17のYes、ステップS18)、エラー訂正処理後における各データフィールドDF0〜DF3のデータビットのデータ(D0〜D15)に対して巡回冗長検査を実行する(ステップS16)。   When the control unit 22 determines that no bit error has occurred in the process of step S15 (error detection process) (Yes in step S15), the data bit data (D0 to D15) in each normal data field DF0 to DF3. ) Is executed (step S16). In addition, when the control unit 22 performs a 1-bit error correction process based on the detection of a 1-bit bit error in the process of step S17 (error detection process) (Yes in step S17, step S18), A cyclic redundancy check is performed on the data bits data (D0 to D15) of the data fields DF0 to DF3 after the error correction process (step S16).

このステップS16の処理では、制御部22は、予めエンコーダ装置1との間で取り決めた生成多項式を用いて、各データフィールドDF0〜DF3のデータビット(D0〜D15)に対する8ビットのCRC符号を生成する。そして、制御部22は、生成したCRC符号と、エンコード信号のデータフィールドDF3に付加されているCRC符号とが一致しているか否かを判定する。制御部22は、CRC符号が一致していると判定した場合は、各データフィールドDF0〜DF3のデータビット(D0〜D15)において誤り(エラー)が存在しないと判断する(ステップS16のNo、ステップS19)。この場合、制御部22は、正常なデータ(位置データ)に基づいてモータ(制御対象)の制御を実行する。   In the process of step S16, the control unit 22 generates an 8-bit CRC code for the data bits (D0 to D15) of the data fields DF0 to DF3, using a generator polynomial previously determined with the encoder device 1. To do. Then, the control unit 22 determines whether or not the generated CRC code matches the CRC code added to the data field DF3 of the encoded signal. When it is determined that the CRC codes match, the control unit 22 determines that no error (error) exists in the data bits (D0 to D15) of the data fields DF0 to DF3 (No in step S16, step S16). S19). In this case, the control part 22 performs control of a motor (control object) based on normal data (position data).

一方、制御部22は、CRC符号が一致していないと判定した場合は、各データフィールドDF0〜DF3のデータビット(D0〜D15)において誤り(エラー)が存在していると判断する(ステップS16のYes、ステップS20)。この場合は、制御部22は、受信したデータが不正常であるため、そのデータに基づくモータの制御を停止する。又は、制御部22は、エンコーダ装置1に対してエンコード信号の再送を要求するコマンド信号を送信する。   On the other hand, when determining that the CRC codes do not match, the control unit 22 determines that an error exists in the data bits (D0 to D15) of the data fields DF0 to DF3 (step S16). Yes, step S20). In this case, since the received data is abnormal, the control unit 22 stops the control of the motor based on the data. Alternatively, the control unit 22 transmits a command signal requesting the encoder apparatus 1 to retransmit the encoded signal.

以上に説明したように、第1実施形態によれば、送信装置(上記した例ではエンコーダ装置1)と受信装置(上記した例では上位制御装置2)との間でシリアル通信によりデータ伝送を行う通信装置であって、送信装置1は、データに対して巡回冗長検査を行うための第1符号(CRC符号)を生成する第1符号生成部(信号処理部15の一部の処理部)と、データに対して誤り検出と誤り訂正を行うための第2符号(ECC符号)を生成する第2符号生成部(信号処理部15の一部の処理部)と、少なくとも、データ、第1符号、及び第2符号を含むシリアル通信方式の信号を送信する送信部(信号処理部15の一部の処理部)と、を備える。このような構成によれば、エラー(ビット誤り)の発生を低減させることができる。すなわち、信号にECC符号を付加することにより、ECC符号の誤り訂正能力の範囲内で誤りの訂正を行うことができる。また、CRC符号を信号に付加することにより、ECC符号よりも高い検出能力で誤りの検出を行うことができる。   As described above, according to the first embodiment, data transmission is performed by serial communication between the transmission device (encoder device 1 in the above example) and the reception device (higher level control device 2 in the above example). The communication device, the transmission device 1, includes a first code generation unit (a part of the signal processing unit 15) that generates a first code (CRC code) for performing cyclic redundancy check on data. A second code generation unit (a part of the signal processing unit 15) for generating a second code (ECC code) for performing error detection and error correction on the data, and at least the data, the first code And a transmission unit (a part of the processing unit of the signal processing unit 15) that transmits a serial communication system signal including the second code. According to such a configuration, the occurrence of errors (bit errors) can be reduced. That is, by adding an ECC code to a signal, it is possible to correct an error within the range of error correction capability of the ECC code. Further, by adding a CRC code to a signal, it is possible to detect an error with a higher detection capability than the ECC code.

また、上記した第1実施形態では、受信装置2は、送信装置1から送信された信号を受信する受信部(制御部22の一部の処理部)と、第2符号に基づいてデータの誤り検出を実行する誤り検出部(制御部22の一部の処理部)と、誤り検出部によりデータの誤りが検出された場合に、その誤りを訂正する誤り訂正部(制御部22の一部の処理部)と、第1符号に基づいて、データの巡回冗長検査を実行する巡回冗長検査部(制御部22の一部の処理部)と、を備える。このような構成によれば、データの誤り訂正を行った後に、データの巡回冗長検査を行うことができる。従って、巡回冗長検査において誤りが頻発するような事態に陥ることを防止することができる。   In the first embodiment described above, the receiving device 2 receives a signal transmitted from the transmitting device 1 (a part of the processing unit of the control unit 22), and the data error based on the second code. An error detection unit (a part of the control unit 22) that performs detection, and an error correction unit (a part of the control unit 22) that corrects an error when a data error is detected by the error detection unit And a cyclic redundancy check unit (a part of the control unit 22) that performs a cyclic redundancy check of data based on the first code. According to such a configuration, it is possible to perform a cyclic redundancy check on data after performing error correction on the data. Therefore, it is possible to prevent a situation in which errors frequently occur in the cyclic redundancy check.

また、上記した第1実施形態では、信号は複数のフィールドで構成され、第2符号生成部は、各フィールドのデータに対する第2符号をそれぞれ生成する。このような構成によれば、フィールド単位で誤りの検出と訂正を行うことができる。従って、誤りの検出能力と誤りの訂正能力が向上する。また、第1符号生成部は、複数のフィールドのデータに対する第1符号を生成する。このような構成によれば、高い誤り検出能力を確保することができるとともに、フィールド毎に第1符号を生成する場合に比べて第1符号の生成処理を簡略化することができる。その結果、送信装置及び受信装置の処理負担が高くならない。   In the first embodiment described above, the signal includes a plurality of fields, and the second code generation unit generates a second code for the data of each field. According to such a configuration, it is possible to detect and correct errors in units of fields. Accordingly, the error detection capability and the error correction capability are improved. Further, the first code generation unit generates a first code for data of a plurality of fields. According to such a configuration, high error detection capability can be ensured, and the first code generation process can be simplified as compared with the case where the first code is generated for each field. As a result, the processing burden on the transmission device and the reception device does not increase.

また、上記した第1実施形態によれば、シリアル通信方式の信号を生成する信号生成部(制御部22の一部の処理部)を備え、信号生成部は、信号において、通信の同期のために用いられる同期用コード(シンクコード)と重複しない位置に第2符号を付加する。このような構成によれば、同期用コードを付加できずに、送信装置1と受信装置2との間で同期がとれなくなるような事態が生じることを回避することができる。   In addition, according to the first embodiment described above, the signal generation unit (part of the processing unit of the control unit 22) that generates a serial communication method signal is provided, and the signal generation unit is configured to synchronize communication in the signal. The second code is added at a position that does not overlap with the synchronization code (sync code) used in the above. According to such a configuration, it is possible to avoid a situation in which synchronization cannot be added between the transmission device 1 and the reception device 2 without adding a synchronization code.

また、上記した第1実施形態では、信号生成部は、第2符号を信号の最上位側から付加するので、確実に同期用コードと重複しない位置に第2符号を配置することができる。また、第2符号はハミングコードであるので、1フィールドあたり1ビットの誤りを訂正することができる。   In the first embodiment described above, the signal generation unit adds the second code from the most significant side of the signal, so that the second code can be surely arranged at a position that does not overlap with the synchronization code. Further, since the second code is a Hamming code, an error of 1 bit per field can be corrected.

また、上記した第1実施形態では、送信装置は、データとしての位置データを含むエンコード信号を送信するエンコーダ装置1であり、受信装置は、位置データに基づいて制御対象(例えばモータ)を制御する制御装置(上位制御装置2)である。このような構成によれば、エンコーダ装置を用いた制御システムSYSにおいて、シリアル通信で伝送されるデータのエラー(ビット誤り)の発生を低減させることができる。   In the first embodiment described above, the transmission device is the encoder device 1 that transmits an encoded signal including position data as data, and the reception device controls a control target (for example, a motor) based on the position data. It is a control device (high-order control device 2). According to such a configuration, it is possible to reduce the occurrence of errors (bit errors) in data transmitted by serial communication in the control system SYS using the encoder device.

上記した第1実施形態では、エンコーダ装置1から上位制御装置2に送信されるエンコード信号においてCRC符号とECC符号を付加することについて説明した。しかし、上位制御装置2からエンコーダ装置1に送信されるコマンド信号においてもCRC符号とECC符号を付加するようにしてもよい。すなわち、送信装置は、データとしてのコマンドを含むコマンド信号を送信する制御装置(上位制御装置2)であり、受信装置は、コマンドに応じてエンコード信号を送信するエンコーダ装置1であってもよい。   In the first embodiment described above, the addition of the CRC code and the ECC code in the encoded signal transmitted from the encoder apparatus 1 to the upper control apparatus 2 has been described. However, a CRC code and an ECC code may also be added to a command signal transmitted from the host control device 2 to the encoder device 1. That is, the transmission device may be a control device (higher-order control device 2) that transmits a command signal including a command as data, and the reception device may be the encoder device 1 that transmits an encode signal in response to the command.

このような構成を実現するためには、上位制御装置2は、図2に示した信号処理部(第1符号生成部、第2符号生成部、信号生成部、送信部)15に相当する構成を備えればよい。また、エンコーダ装置1は、図3に示した制御部(受信部、誤り検出部、誤り訂正部、巡回冗長検査部)22に相当する構成を備えればよい。また、コマンド信号のデータ構成も、図4及び図5に示したエンコード信号のデータ構成又はそれに近いデータ構成とすればよい。   In order to realize such a configuration, the host controller 2 corresponds to the signal processing unit (first code generation unit, second code generation unit, signal generation unit, transmission unit) 15 shown in FIG. Should be provided. In addition, the encoder apparatus 1 may have a configuration corresponding to the control unit (reception unit, error detection unit, error correction unit, cyclic redundancy check unit) 22 illustrated in FIG. The data structure of the command signal may be the data structure of the encode signal shown in FIGS. 4 and 5 or a data structure close thereto.

<第2実施形態>
上記した第1実施形態では、ECC符号が同期用コードと重ならないように、信号処理部15がECC符号をデータビットの最上位側から付加するように構成していた。しかし、第2実施形態では、信号処理部15がECC符号をデータビットの最下位側から付加するように構成したものである。
Second Embodiment
In the first embodiment described above, the signal processing unit 15 is configured to add the ECC code from the most significant side of the data bits so that the ECC code does not overlap with the synchronization code. However, in the second embodiment, the signal processing unit 15 is configured to add the ECC code from the least significant side of the data bits.

図8は、第2実施形態におけるエンコード信号のフォーマット構成を示す図である。図8に示すエンコード信号のデータフィールドDF0においては、図4に示したエンコード信号のデータフィールドDF0と異なり、スタートビットとして3ビット「000」をデータフィールドDF0の先頭に付加している。3ビットのスタートビット「000」は、データフィールドDF0の開始(すなわち最初)を示す役割を果たすとともに、同期用コードの役割を果たす。このデータ構成の場合、データフィールドDF0のビット長は2ビット増えて25ビットとなる。   FIG. 8 is a diagram illustrating a format configuration of an encode signal in the second embodiment. In the data field DF0 of the encode signal shown in FIG. 8, unlike the data field DF0 of the encode signal shown in FIG. 4, 3 bits “000” are added to the head of the data field DF0 as a start bit. The 3-bit start bit “000” serves to indicate the start (that is, the first) of the data field DF0 and also serves as a synchronization code. In the case of this data configuration, the bit length of the data field DF0 is increased by 2 bits to 25 bits.

このような構成において、制御部22は、エンコード信号の最初のデータフィールドDF0におけるスタートビット「000」を検出した後に、スタートビット「000」以降のシリアルデータ(各データフィールドDF0〜DF3のデジタルデータ)を順次受信する。これにより、エンコーダ装置1との間でシリアル通信の同期をとることができるとともに、ECC符号をデータビットの最下位側から付加することができる。   In such a configuration, the control unit 22 detects the start bit “000” in the first data field DF0 of the encode signal, and then serial data after the start bit “000” (digital data of each data field DF0 to DF3). Are received sequentially. Thereby, it is possible to synchronize serial communication with the encoder device 1 and to add an ECC code from the least significant side of the data bits.

なお、図8に示すエンコード信号のデータフィールドDF0のスタートビットだけを3ビットとし、その他のデータフィールドDF1〜DF3のスタートビットは1ビット「0」とする。しかし、このような構成に限らず、すべてのデータフィールドDF0〜DF3のスタートビットを3ビット「000」としてもよい。また、上位制御装置2からエンコーダ装置1に送信されるコマンド信号においても図8に示すようにスタートビットを3ビット「000」としてもよい。   Note that only the start bit of the data field DF0 of the encoded signal shown in FIG. 8 is 3 bits, and the start bits of the other data fields DF1 to DF3 are 1 bit “0”. However, the present invention is not limited to this configuration, and the start bits of all the data fields DF0 to DF3 may be 3 bits “000”. Also, in the command signal transmitted from the host control device 2 to the encoder device 1, the start bit may be set to 3 bits “000” as shown in FIG.

以上、本発明を実施の形態を用いて説明したが、本発明の技術的範囲は、上記実施の形態に記載の範囲には限定されない。本発明の趣旨を逸脱しない範囲で、上記実施の形態に、多様な変更または改良を加えることが可能である。また、上記の実施形態で説明した要件の1つ以上は、省略されることがある。そのような変更または改良、省略した形態も本発明の技術的範囲に含まれる。また、上記した実施形態や変形例の構成を適宜組み合わせて適用することも可能である。   As mentioned above, although this invention was demonstrated using embodiment, the technical scope of this invention is not limited to the range as described in the said embodiment. Various modifications or improvements can be added to the above-described embodiment without departing from the spirit of the present invention. In addition, one or more of the requirements described in the above embodiments may be omitted. Such modifications, improvements, and omitted forms are also included in the technical scope of the present invention. In addition, the configurations of the above-described embodiments and modifications can be applied in appropriate combinations.

上記した図1に示す制御システムSYSは、1つの上位制御装置2が伝送ライン3を介して複数のエンコーダ装置1−1〜1−nと接続されるバス接続型(Multi-Point)の制御システムであった。しかし、このような接続形態の制御システムに限られず、1つの上位制御装置が伝送ラインを介して1つのエンコーダ装置と接続される1対1の接続形態(Point-to-point)の制御システムであってもよい。例えば、エンコーダ装置が制御対象としてのサーボモータの回転位置変位を計測し、上位制御装置としてのサーボアンプがエンコーダ装置からのエンコード信号(位置データ)に基づいてサーボモータの駆動を制御するようなシステムである。   The above-described control system SYS shown in FIG. 1 is a bus-connected (Multi-Point) control system in which one host control device 2 is connected to a plurality of encoder devices 1-1 to 1-n via a transmission line 3. Met. However, the control system is not limited to such a connection type control system, but is a one-to-one connection type (Point-to-point) control system in which one host control device is connected to one encoder device via a transmission line. There may be. For example, a system in which an encoder device measures the rotational position displacement of a servo motor as a control target, and a servo amplifier as a host control device controls the drive of the servo motor based on an encode signal (position data) from the encoder device It is.

上記した第1実施形態で説明した図7において、制御部22は、ECC符号による誤り検出と誤り訂正を行った後に(ステップS15,S17,S18参照)、CRC符号による誤り検出(巡回冗長検査:ステップS16)を行うように構成していた。しかし、制御部22は、CRC符号による誤り検出をECC符号による誤り検出と誤り訂正よりも先に実行するようにしてもよい。この場合は、制御部22は、CRC符号による誤り検出において誤りを検出しなかった場合は、ECC符号による誤り検出を実行せずにエラー無と判断する。一方、制御部22は、CRC符号による誤り検出において誤りを検出した場合は、ECC符号による誤り検出を実行する。そして、制御部22は、ECC符号による誤り検出において1ビットの誤りを検出した場合は、1ビットの誤り訂正処理を実行する。そして、制御部22は、再度、誤り訂正処理後のデータに基づいてCRC符号による誤り検出を実行する。また、制御部22は、ECC符号による誤り検出において2ビット以上の誤りを検出した場合は、エラー有と判断する。このような構成によれば、CRC符号による誤り検出でエラー有との判断が頻発しないような場合に、ECC符号による誤り検出の処理の実行回数を減らすことができ、処理負担を低減させることができる。   In FIG. 7 described in the first embodiment, the control unit 22 performs error detection and error correction using an ECC code (see steps S15, S17, and S18), and then error detection using a CRC code (cyclic redundancy check: Step S16) is performed. However, the control unit 22 may perform error detection using the CRC code before error detection and error correction using the ECC code. In this case, when no error is detected in the error detection using the CRC code, the control unit 22 determines that there is no error without executing the error detection using the ECC code. On the other hand, when an error is detected in error detection using the CRC code, the control unit 22 performs error detection using the ECC code. When the controller 22 detects a 1-bit error in the error detection using the ECC code, the controller 22 executes a 1-bit error correction process. Then, the control unit 22 again performs error detection using a CRC code based on the data after error correction processing. Further, the control unit 22 determines that there is an error when an error of 2 bits or more is detected in the error detection by the ECC code. According to such a configuration, when the error detection by the CRC code does not frequently determine that there is an error, the number of executions of the error detection process by the ECC code can be reduced, and the processing load can be reduced. it can.

また、上記した各実施形態では、エンコーダ装置1は、上位制御装置2から送信されるコマンド信号を受信することに応じて、記憶部17に記憶されている位置データを読み出すように構成していた。しかし、エンコーダ装置1は、上位制御装置2から送信されるコマンド信号を受信することに応じて、モータの回転位置変位を検出し、検出した回転位置変位に応じた位置データを取得するようにしてもよい。   In each of the above embodiments, the encoder device 1 is configured to read the position data stored in the storage unit 17 in response to receiving the command signal transmitted from the host control device 2. . However, the encoder device 1 detects the rotational position displacement of the motor in response to receiving the command signal transmitted from the host control device 2, and obtains position data corresponding to the detected rotational position displacement. Also good.

また、上記した各実施形態において、複数のエンコーダ装置1−1〜1−nは、それぞれの装置を識別するための識別情報が割り当てられ、各エンコーダ装置1−1〜1−nは、エンコーダ信号に識別情報を付加するようにしてもよい。   In each of the above-described embodiments, the plurality of encoder devices 1-1 to 1-n are assigned identification information for identifying each device, and each of the encoder devices 1-1 to 1-n includes an encoder signal. You may make it add identification information to.

また、上記した各実施形態において、エンコード信号のデータフィールドは4つとされていたが、4つ未満でも5以上であってもよい。また、上記した第1実施形態では、エンコード信号の各データフィールドDF0〜DF3のビット長(ビット数)が23ビットとされていたが、23ビット未満でも24ビット以上でもよい。   In each of the above embodiments, the number of data fields of the encode signal is four, but it may be less than four or five or more. In the first embodiment described above, the bit length (number of bits) of each of the data fields DF0 to DF3 of the encode signal is 23 bits, but may be less than 23 bits or 24 bits or more.

また、エンコード信号とコマンド信号のデータ構成は同じであっても異なる構成であってもよい。例えば、エンコード信号のデータフィールド数とコマンド信号のデータフィールド数とが異なってもよいし、各データフィールドのビット長も異なってもよい。また、信号処理部15(又は制御部22)は、CRC符号をデータフィールド毎に生成してもよい。また、信号処理部15(又は制御部22)は1つのデータフィールドを2以上の区間に分け、それぞれの区間においてECC符号を生成するようにしてもよい。また、CRC符号は、最終データフィールドの後半部分に挿入されていたが、最終データフィールドとは異なるデータフィールドなどに挿入されてもよい。また、ECC符号としてハミング符号を用いていたが、ハミング符号以外のECC符号(例えば、巡回ハミング符号など)であってもよい。   Further, the data configuration of the encode signal and the command signal may be the same or different. For example, the number of encoded signal data fields may be different from the number of command signal data fields, and the bit length of each data field may be different. Further, the signal processing unit 15 (or the control unit 22) may generate a CRC code for each data field. Further, the signal processing unit 15 (or the control unit 22) may divide one data field into two or more sections and generate an ECC code in each section. The CRC code is inserted in the latter half of the final data field, but may be inserted in a data field different from the final data field. Further, although the Hamming code is used as the ECC code, an ECC code other than the Hamming code (for example, a cyclic Hamming code) may be used.

1…エンコーダ装置(送信装置、受信装置)、2…上位制御装置(送信装置、受信装置、制御装置)、3…伝送ライン、15…信号処理部(第1符号生成部、第2符号生成部、信号生成部、送信部)、17…記憶部、22…制御部(受信部、誤り検出部、誤り訂正部、巡回冗長検査部)、23…メモリ   DESCRIPTION OF SYMBOLS 1 ... Encoder apparatus (transmission apparatus, reception apparatus), 2 ... High-order control apparatus (transmission apparatus, reception apparatus, control apparatus), 3 ... Transmission line, 15 ... Signal processing part (1st code generation part, 2nd code generation part) , Signal generation unit, transmission unit), 17 ... storage unit, 22 ... control unit (reception unit, error detection unit, error correction unit, cyclic redundancy check unit), 23 ... memory

Claims (12)

送信装置と受信装置との間でシリアル通信によりデータ伝送を行う通信装置であって、
前記送信装置は、
データに対して巡回冗長検査を行うための第1符号を生成する第1符号生成部と、
前記データに対して誤り検出と誤り訂正を行うための第2符号を生成する第2符号生成部と、
少なくとも、前記データ、前記第1符号、及び前記第2符号を含むシリアル通信方式の信号を送信する送信部と、を備える通信装置。
A communication device that performs data transmission by serial communication between a transmission device and a reception device,
The transmitter is
A first code generator for generating a first code for performing cyclic redundancy check on the data;
A second code generation unit for generating a second code for performing error detection and error correction on the data;
And a transmission unit that transmits a signal of a serial communication method including at least the data, the first code, and the second code.
前記受信装置は、
前記送信装置から送信された前記信号を受信する受信部と、
前記第2符号に基づいて前記データの誤り検出を実行する誤り検出部と、
前記誤り検出部により前記データの誤りが検出された場合に、その誤りを訂正する誤り訂正部と、
前記第1符号に基づいて、前記データの前記巡回冗長検査を実行する巡回冗長検査部と、を備える請求項1記載の通信装置。
The receiving device is:
A receiver for receiving the signal transmitted from the transmitter;
An error detection unit that performs error detection of the data based on the second code;
When an error in the data is detected by the error detection unit, an error correction unit that corrects the error; and
The communication apparatus according to claim 1, further comprising: a cyclic redundancy check unit that executes the cyclic redundancy check of the data based on the first code.
前記信号は複数のフィールドで構成され、
前記第2符号生成部は、各フィールドのデータに対する前記第2符号をそれぞれ生成する請求項1または請求項2記載の通信装置。
The signal is composed of a plurality of fields,
The communication apparatus according to claim 1, wherein the second code generation unit generates the second code for each field of data.
前記第1符号生成部は、前記複数のフィールドのデータに対する前記第1符号を生成する請求項3記載の通信装置。   The communication apparatus according to claim 3, wherein the first code generation unit generates the first code for the data of the plurality of fields. 前記シリアル通信方式の信号を生成する信号生成部を備え、
前記信号生成部は、前記信号において、通信の同期のために用いられる同期用コードと重複しない位置に前記第2符号を付加する請求項1〜4のいずれか一項に記載の通信装置。
A signal generation unit for generating a signal of the serial communication method;
The communication apparatus according to claim 1, wherein the signal generation unit adds the second code to a position in the signal that does not overlap with a synchronization code used for communication synchronization.
前記信号生成部は、前記第2符号を前記信号の最上位側から付加する請求項5記載の通信装置。   The communication apparatus according to claim 5, wherein the signal generation unit adds the second code from the most significant side of the signal. 前記第2符号はハミングコードである請求項1〜6のいずれか一項に記載の通信装置。   The communication apparatus according to claim 1, wherein the second code is a Hamming code. 前記送信装置は、前記データとしての位置データを含むエンコード信号を送信するエンコーダ装置であり、
前記受信装置は、前記位置データに基づいて制御対象を制御する制御装置である請求項1〜7のいずれか一項に記載の通信装置。
The transmission device is an encoder device that transmits an encoding signal including position data as the data,
The communication device according to claim 1, wherein the reception device is a control device that controls a control target based on the position data.
前記送信装置は、前記データとしてのコマンドを含むコマンド信号を送信する制御装置であり、
前記受信装置は、前記コマンドに応じてエンコード信号を送信するエンコーダ装置である請求項1〜7のいずれか一項に記載の通信装置。
The transmission device is a control device that transmits a command signal including a command as the data,
The communication device according to claim 1, wherein the reception device is an encoder device that transmits an encoded signal in response to the command.
データに対して巡回冗長検査を行うための第1符号を生成する第1符号生成部と、
前記データに対して誤り検出と誤り訂正を行うための第2符号を生成する第2符号生成部と、
少なくとも、前記データ、前記第1符号、及び前記第2符号を含むシリアル通信方式の信号を送信する送信部と、を備えるエンコーダ装置。
A first code generator for generating a first code for performing cyclic redundancy check on the data;
A second code generation unit for generating a second code for performing error detection and error correction on the data;
An encoder apparatus comprising: a transmission unit that transmits at least a signal of a serial communication method including the data, the first code, and the second code.
シリアル通信によりデータ伝送を行うシリアル通信方法であって、
データに対して巡回冗長検査を行うための第1符号を生成することと、
前記データに対して誤り検出と誤り訂正を行うための第2符号を生成することと、
少なくとも、前記データ、前記第1符号、及び前記第2符号を含むシリアル通信方式の信号を送信することと、含むシリアル通信方法。
A serial communication method for transmitting data by serial communication,
Generating a first code for performing a cyclic redundancy check on the data;
Generating a second code for performing error detection and error correction on the data;
A serial communication method including transmitting a signal of a serial communication method including at least the data, the first code, and the second code.
前記信号を受信することと、
前記第2符号に基づいて前記データの誤り検出を実行することと、
前記誤り検出により前記データの誤りが検出された場合に、その誤りを訂正することと、
前記第1符号に基づいて、前記データの前記巡回冗長検査を実行することと、を含む請求項11記載のシリアル通信方法。
Receiving the signal;
Performing error detection of the data based on the second code;
If an error in the data is detected by the error detection, correcting the error;
The serial communication method according to claim 11, further comprising: executing the cyclic redundancy check of the data based on the first code.
JP2013181778A 2013-09-03 2013-09-03 Communication device, encoder device and serial communication method Pending JP2015049769A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013181778A JP2015049769A (en) 2013-09-03 2013-09-03 Communication device, encoder device and serial communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013181778A JP2015049769A (en) 2013-09-03 2013-09-03 Communication device, encoder device and serial communication method

Publications (1)

Publication Number Publication Date
JP2015049769A true JP2015049769A (en) 2015-03-16

Family

ID=52699713

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013181778A Pending JP2015049769A (en) 2013-09-03 2013-09-03 Communication device, encoder device and serial communication method

Country Status (1)

Country Link
JP (1) JP2015049769A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105182909A (en) * 2015-10-10 2015-12-23 东北林业大学 Error identification method and apparatus for continuous flat press cluster control system
WO2016165091A1 (en) * 2015-04-16 2016-10-20 深圳市海浦蒙特科技有限公司 Apparatus and method for processing signal of absolute value encoder
US20160344429A1 (en) * 2015-05-22 2016-11-24 Kabushiki Kaisha Yaskawa Denki Encoder, controller, method for processing data
JP2016217950A (en) * 2015-05-22 2016-12-22 株式会社安川電機 Encoder, controller, motor control system, robot control system, robot, data transmission method and rotation number comparison method
CN106257436A (en) * 2015-06-16 2016-12-28 Arm 有限公司 Transmitter, receptor, data transmission system and data transferring method
JP2017147841A (en) * 2016-02-17 2017-08-24 富士電機株式会社 Power conversion device
CN112954523A (en) * 2021-01-29 2021-06-11 佳禾智能科技股份有限公司 TWS earphone calibration method and structure thereof

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07184275A (en) * 1993-12-24 1995-07-21 Tokyo Gas Co Ltd Radio equipment for automatic metering
JP2000004171A (en) * 1998-06-15 2000-01-07 Oki Electric Ind Co Ltd Mobile communication method
US20020184590A1 (en) * 2001-05-29 2002-12-05 Kumar Ramaswamy Hierarchical block coding for a packet-based communications system
JP2004088246A (en) * 2002-08-23 2004-03-18 Toyota Industries Corp Wireless communication method and wireless communication device
JP2004318439A (en) * 2003-04-15 2004-11-11 Sendai Nikon:Kk Encoder device and robot system
JP2006101061A (en) * 2004-09-29 2006-04-13 Toyota Industries Corp Communication method
JP2009271592A (en) * 2008-04-30 2009-11-19 Nikon Corp Encoder device and serial communication method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07184275A (en) * 1993-12-24 1995-07-21 Tokyo Gas Co Ltd Radio equipment for automatic metering
JP2000004171A (en) * 1998-06-15 2000-01-07 Oki Electric Ind Co Ltd Mobile communication method
US20020184590A1 (en) * 2001-05-29 2002-12-05 Kumar Ramaswamy Hierarchical block coding for a packet-based communications system
JP2005512352A (en) * 2001-05-29 2005-04-28 トムソン ライセンシング ソシエテ アノニム Hierarchical block coding for packet-based communication systems.
JP2004088246A (en) * 2002-08-23 2004-03-18 Toyota Industries Corp Wireless communication method and wireless communication device
JP2004318439A (en) * 2003-04-15 2004-11-11 Sendai Nikon:Kk Encoder device and robot system
JP2006101061A (en) * 2004-09-29 2006-04-13 Toyota Industries Corp Communication method
JP2009271592A (en) * 2008-04-30 2009-11-19 Nikon Corp Encoder device and serial communication method

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016165091A1 (en) * 2015-04-16 2016-10-20 深圳市海浦蒙特科技有限公司 Apparatus and method for processing signal of absolute value encoder
US20160344429A1 (en) * 2015-05-22 2016-11-24 Kabushiki Kaisha Yaskawa Denki Encoder, controller, method for processing data
JP2016218867A (en) * 2015-05-22 2016-12-22 株式会社安川電機 Encoder, controller, motor control system, robot control system, robot, data transmission method and information processing method
JP2016217950A (en) * 2015-05-22 2016-12-22 株式会社安川電機 Encoder, controller, motor control system, robot control system, robot, data transmission method and rotation number comparison method
US10072948B2 (en) 2015-05-22 2018-09-11 Kabushiki Kaisha Yaskawa Denki Encoder, controller, method for processing data
CN106257436A (en) * 2015-06-16 2016-12-28 Arm 有限公司 Transmitter, receptor, data transmission system and data transferring method
CN106257436B (en) * 2015-06-16 2022-04-26 Arm 有限公司 Transmitter, receiver, data transmission system, and data transmission method
CN105182909A (en) * 2015-10-10 2015-12-23 东北林业大学 Error identification method and apparatus for continuous flat press cluster control system
JP2017147841A (en) * 2016-02-17 2017-08-24 富士電機株式会社 Power conversion device
CN112954523A (en) * 2021-01-29 2021-06-11 佳禾智能科技股份有限公司 TWS earphone calibration method and structure thereof
CN112954523B (en) * 2021-01-29 2023-06-02 佳禾智能科技股份有限公司 TWS earphone checking method

Similar Documents

Publication Publication Date Title
JP2015049769A (en) Communication device, encoder device and serial communication method
JP5974997B2 (en) Electronic control system
US8667375B2 (en) Method and apparatus for error management
US10759470B2 (en) Sensor device and electric power steering apparatus using same
JP4995605B2 (en) Abnormality detection device for rotary absolute encoder
US10594440B2 (en) SPC sensor interface with partial parity protection
US20100138576A1 (en) Data transmission method between master and slave devices
JP5104523B2 (en) Encoder device and serial communication method
KR20150145710A (en) Absolute encoder and method of transmitting rotational position data
JP2008092620A (en) Encoder communication circuit
JP2013137708A (en) Memory controller, data storage device, and memory control method
JP2013046147A (en) Communication method and communication system, transmission device and reception device, and tire air pressure monitoring system
JP2016127369A (en) Decoding device, program and information transmission system
US7254770B2 (en) Sensor apparatus and monitoring method of control system using detected data from sensor apparatus
US9571231B2 (en) In-band status encoding and decoding using error correction symbols
US20170077952A1 (en) Sensor interface that provides a long package crc to improve functional safety
JPS5846741A (en) Decoder
JP5193665B2 (en) Contactless master controller and failure detection method for contactless master controller
JP2009141453A (en) Data transmission equipment, data transmitter, data receiver, and data transmission system
JP2020051816A (en) Encoder and control system
CN110324112B (en) Signal pattern checksum
US20090150727A1 (en) Data transmission method
Juan et al. FPGA implementation of hamming code for increasing the frame rate of CAN communication
JP5906145B2 (en) Transmission device, transmission system, and self-diagnosis method thereof
JP6781226B2 (en) Encoder and control system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160725

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170406

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20170411

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20170526

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20170406

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20171017

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20180410