JP2010178199A - Serial communication system and communication method - Google Patents

Serial communication system and communication method Download PDF

Info

Publication number
JP2010178199A
JP2010178199A JP2009020570A JP2009020570A JP2010178199A JP 2010178199 A JP2010178199 A JP 2010178199A JP 2009020570 A JP2009020570 A JP 2009020570A JP 2009020570 A JP2009020570 A JP 2009020570A JP 2010178199 A JP2010178199 A JP 2010178199A
Authority
JP
Japan
Prior art keywords
transmission
data
node
control circuit
waiting
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.)
Withdrawn
Application number
JP2009020570A
Other languages
Japanese (ja)
Inventor
Takahiro Yamamuro
貴裕 山室
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.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics 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 Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2009020570A priority Critical patent/JP2010178199A/en
Publication of JP2010178199A publication Critical patent/JP2010178199A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Bidirectional Digital Transmission (AREA)
  • Communication Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To improve the processing efficiency of an arithmetic processing unit in a node that performs half duplex communication. <P>SOLUTION: This serial communication system includes a node 2 for performing serial communication with another node through a communication bus 10. The node 2 includes an arithmetic processing unit 14 for generating transmission data to the another node, a transmission buffer 32 for storing the transmission data 200, and a transmission control circuit 31 for transmitting, when performing half duplex communication, the transmission data 200 to the another node after keeping the transmission data 200 stored by the transmission buffer 32 waiting for a predetermined period. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、シリアル通信システム、及び通信方法に関し、特に半二重通信を行なう複数のノードを有するシリアル通信システム、及び通信方法に関する。   The present invention relates to a serial communication system and a communication method, and more particularly to a serial communication system having a plurality of nodes performing half-duplex communication and a communication method.

非同期シリアル通信として半二重通信方式がある。半二重通信方式では、1つの伝送路で送信と受信を同時に行なうため、自ノードが送信を行なっている間は他のノードからのデータの受信することはできない。又、自ノードが受信を行なっている間は送信を行なうことはできない。よって複数のノードで送信されると通信経路(通信バス)上で競合が起きて正しいデータが伝送されなくなる。従って、半二重通信方式において各ノードが送信する場合には、受信動作を行なっていないときに送信を行なう必要がある。又、受信中の場合、受信の終了を確認してから送信を行なう必要がある。このため、受信を終了したことを示すために受信完了割込みや受信中を示すステータスフラグを用いることが一般的である。   There is a half-duplex communication method as asynchronous serial communication. In the half-duplex communication method, since transmission and reception are performed simultaneously on one transmission path, data from other nodes cannot be received while the node is transmitting. Further, transmission cannot be performed while the node is receiving. Therefore, when transmitted by a plurality of nodes, contention occurs on the communication path (communication bus) and correct data cannot be transmitted. Therefore, when each node transmits in the half-duplex communication method, it is necessary to perform transmission when the reception operation is not performed. When receiving, it is necessary to transmit after confirming the end of reception. For this reason, it is common to use a reception completion interrupt or a status flag indicating reception in order to indicate that reception has ended.

一方、各ノードはそれぞれの動作クロックを基にボーレートを生成しているのが一般的である。動作クロックの周波数の違いや動作クロック生成部の精度により各ノードのボーレート間で誤差が生じている。このため非同期シリアル通信を行なうシステムでは、ノード(ユニット)毎に許容ボーレート誤差範囲が設定されている。このため、データビットを受信するタイミングは各ノードによって異なり、データの最終ビットを受信するタイミングは、ノード間において最悪条件下で1ビット近くの差が生じることがある。   On the other hand, each node generally generates a baud rate based on its operation clock. An error occurs between the baud rates of the nodes due to the difference in the frequency of the operation clock and the accuracy of the operation clock generation unit. For this reason, in a system that performs asynchronous serial communication, an allowable baud rate error range is set for each node (unit). For this reason, the timing at which data bits are received differs depending on each node, and the timing at which the last bit of data is received may have a difference of nearly 1 bit between the nodes under worst conditions.

例えば、ノードAからデータが送信され、ボーレートの誤差が許容範囲の早い側にあるノードBが当該データの受信完了割込みを受けてデータの送信を行なう場合、ボーレートの誤差が許容範囲の遅い側にあるノードCは、ノードAからのデータを受信完了する前に、ノードBから送信されたデータを先に受信してしまい、受信エラーとなることがある。   For example, when data is transmitted from the node A and the node B whose baud rate error is on the side with a fast allowable range receives the data reception completion interrupt and transmits data, the baud rate error is on the slow side of the allowable range. A node C may receive the data transmitted from the node B before receiving the data from the node A, resulting in a reception error.

図1を参照して、上述のようにデータの受信から送信に切り替わる際に、他のノードにおいて受信エラーとなる場合の動作の詳細を説明する。ここで、ノードAのサンプリング信号を標準とし、ノードBのサンプリングタイミングは許容誤差における最小値、ノードCのサンプリングタイミングは許容誤差における最大値であるものとする。   With reference to FIG. 1, details of the operation when a reception error occurs in another node when switching from reception to transmission of data as described above will be described. Here, it is assumed that the sampling signal of the node A is a standard, the sampling timing of the node B is the minimum value in the allowable error, and the sampling timing of the node C is the maximum value in the allowable error.

データ通信バスにデータが送信され、時刻T1においてノードBがストップビットを検出すると、ノードBにおいて受信割込み信号が出力される(受信割込みがハイレベルに遷移する)。時刻T2においてノードBでは、受信割込み信号に応じて送信データが送信バッファに書き込まれた後、データ通信バスに送出される。   When data is transmitted to the data communication bus and node B detects a stop bit at time T1, a reception interrupt signal is output at node B (the reception interrupt transitions to a high level). At time T2, at node B, transmission data is written to the transmission buffer in response to the reception interrupt signal, and then transmitted to the data communication bus.

データ通信バス上のストップビットは、ノードBから送出されたデータ(スタートビット)によって変更される。これによりストップビットのビット長Tstは、1ビットよりも短くなる場合がある。ノードBのサンプリングタイミングとノードCのサンプリングタイミングの差が、例えば1ビットである場合、ノードCがストップビットを受信する前にデータ通信バス上にスタートビットが送出されてしまう。この場合、ノードCは、ストップビットを検出するタイミング(時刻T3)でスタートビットのデータをサンプリングするためフレーム受信エラーとなり、システム全体のエラーを誘発してしまう。   The stop bit on the data communication bus is changed by the data (start bit) sent from the node B. As a result, the bit length Tst of the stop bit may be shorter than 1 bit. If the difference between the sampling timing of the node B and the sampling timing of the node C is, for example, 1 bit, the start bit is transmitted on the data communication bus before the node C receives the stop bit. In this case, since node C samples the data of the start bit at the timing (time T3) when detecting the stop bit, a frame reception error occurs, and an error of the entire system is induced.

すなわち、ノードBからデータが送出される時刻T2より、ノードCにおけるストップビットを検出するタイミング(時刻T3)が遅れる場合、ノードCは受信エラーを起こしてしまう。このようなエラーの発生を防ぐため、受信から送信に切り替わる際にも、通信バス上のストップビットのビット長Tstが所定の長さ(例えば1ビット分の長さ)となるように制御する必要がある。   That is, if the timing (time T3) for detecting the stop bit in node C is delayed from time T2 when data is transmitted from node B, node C causes a reception error. In order to prevent such an error from occurring, it is necessary to perform control so that the bit length Tst of the stop bit on the communication bus becomes a predetermined length (for example, a length corresponding to 1 bit) when switching from reception to transmission. There is.

以上のような問題を回避するため、受信完了割込み処理を遅延させてノードBからのデータの送信を遅延させる方法が知られている。例えば、ソフトウェア処理によって受信割込み処理や受信中のステータスフラグの立上りを確認し、それを基点にソフトカウンタを利用してデータ送信を遅延させる時間を計測する方法がある。しかし、この方法では、システム周波数に依存する場合や、ノード毎にドライバソフトの共通化(共用化)ができない場合、CPUの処理負荷が増大し処理効率が悪化する。一方、ソフトカウンタにより充分な時間を取ってドライバソフトを共通化した場合、通信バスの空き時間が増加するため、通信バス効率が悪化してしまう。   In order to avoid the above problem, a method of delaying the transmission of data from the node B by delaying the reception completion interrupt process is known. For example, there is a method of measuring reception delay processing by software processing or rising of a status flag being received, and measuring a time for delaying data transmission using a software counter based on the reception interrupt processing. However, with this method, when the system frequency depends or when the driver software cannot be shared (shared) for each node, the processing load on the CPU increases and the processing efficiency deteriorates. On the other hand, when the driver software is shared by taking a sufficient time by the software counter, the communication bus efficiency is deteriorated because the idle time of the communication bus increases.

このような効率の悪化を回避するため、モード設定によって受信割込みを遅延させる技術が特開2001−237811に記載されている(特許文献1参照)。図2は、特許文献1に記載のシリアル通信装置の構成を示す図である。図2を参照して、特許文献1に記載のノード10は、受信制御回路51、遅延用シフトレジスタ52、セレクタ53、割込み制御回路54、CPU55を備える。受信制御回路51はストップビットを検出して受信終了フラグを立てる。遅延用シフトレジスタ52は受信終了フラグを遅延させてセレクタ53にセットする。セレクタ53は、モード信号に応じて受信制御回路51からの受信終了フラグと、遅延用シフトレジスタ52からの受信終了フラグの一方を選択して割込み制御回路54にセットする。割込み制御回路54は、セットされた受信終了フラグに応じて割込み要求信号をCPU55に出力する。CPU55は、割込み要求信号に応じて送信データを出力する。   In order to avoid such a deterioration in efficiency, a technique for delaying a reception interrupt by mode setting is described in Japanese Patent Laid-Open No. 2001-237811 (see Patent Document 1). FIG. 2 is a diagram illustrating a configuration of the serial communication device described in Patent Document 1. In FIG. With reference to FIG. 2, the node 10 described in Patent Document 1 includes a reception control circuit 51, a delay shift register 52, a selector 53, an interrupt control circuit 54, and a CPU 55. The reception control circuit 51 detects a stop bit and sets a reception end flag. The delay shift register 52 delays the reception end flag and sets it in the selector 53. The selector 53 selects one of the reception end flag from the reception control circuit 51 and the reception end flag from the delay shift register 52 according to the mode signal, and sets it in the interrupt control circuit 54. The interrupt control circuit 54 outputs an interrupt request signal to the CPU 55 according to the set reception end flag. The CPU 55 outputs transmission data in response to the interrupt request signal.

半二重モードのとき、セレクタ53は、遅延された受信終了フラグを割込み制御回路54にセットする。これによりCPU55からのデータの出力は遅延し、ストップビットのビット長が1ビットを超える時刻に通信バス上にデータが送出される。この結果、通信バス上におけるストップビットのビット長が送信データによって短くなることを回避できる。   In the half duplex mode, the selector 53 sets the delayed reception end flag in the interrupt control circuit 54. As a result, the output of data from the CPU 55 is delayed, and the data is sent on the communication bus at the time when the bit length of the stop bit exceeds 1 bit. As a result, it can be avoided that the bit length of the stop bit on the communication bus is shortened by the transmission data.

特開2001−237811JP 2001-237811 A

このように、特許文献1に記載のシリアル通信装置では、モード設定により受信完了割込みを遅延させているため、モード設定した際には必ず受信割込みが遅れて発生し、CPUの受信処理時間が遅延するため効率が悪化してしまう。   As described above, in the serial communication device described in Patent Literature 1, since the reception completion interrupt is delayed by the mode setting, the reception interrupt is always delayed when the mode is set, and the reception processing time of the CPU is delayed. Therefore, efficiency will deteriorate.

図3を参照して、特許文献1に記載のシリアル通信装置では、時刻T1において通信バス上のストップビットを検出(サンプリング)してから、次のサンプリング(時刻T3)までの間、受信完了割込み信号の発行が遅延される。このため、ストップビットの検出後の受信データが確定する時刻T2から受信割込み信号の発行後の時刻T4までの期間TB、CPU55は、送信データの準備及び出力処理を実行できない。例えば、受信データの1フレームが、データ(8ビット)、スタートビット(1ビット)、ストップビット(1ビット)で構成されている場合、1フレームに対して1割の時間を送信データの準備及び送信に利用できないことになる。   Referring to FIG. 3, in the serial communication device described in Patent Document 1, a reception completion interrupt is detected during a period from detection (sampling) of a stop bit on the communication bus at time T1 until the next sampling (time T3). The signal issuance is delayed. Therefore, during the period TB from the time T2 when the reception data after the detection of the stop bit is determined to the time T4 after the reception interrupt signal is issued, the CPU 55 cannot execute the preparation and output processing of the transmission data. For example, when one frame of received data is composed of data (8 bits), start bit (1 bit), and stop bit (1 bit), 10% of the time for one frame is prepared for transmission data and It cannot be used for transmission.

又、CPUは割込み信号が入力されるとすぐにその割込み信号に応じた処理を行なうとは限らない。割込み信号の優先順位にも依存するがCPUにおいて複数の割込み処理が行なわれる場合、送信データの準備や出力(送信データ用シフトレジスタへの書き込み)には、1ビット長以上を費やすこともある。この場合では割込み信号を遅らせる意味がなく、通信バス上のデータもストップビットが1ビット長以上となるため通信バス効率も悪くなる。更に、近年では、様々な周辺機器が追加されており、割込み処理も多様化している。このため、少しでも、CPUの処理効率や、データの受信から送信までにかかる時間を短縮する必要がある。   Further, the CPU does not always perform processing according to the interrupt signal as soon as the interrupt signal is input. Although depending on the priority order of interrupt signals, when a plurality of interrupt processes are performed in the CPU, transmission data preparation and output (writing to the transmission data shift register) may take 1 bit or more. In this case, there is no point in delaying the interrupt signal, and the data on the communication bus has a stop bit length of 1 bit or more, so the communication bus efficiency is also deteriorated. Furthermore, in recent years, various peripheral devices have been added, and interrupt processing has also been diversified. For this reason, it is necessary to reduce the processing efficiency of the CPU and the time taken from the reception to the transmission of data even a little.

以下に、[発明を実施するための形態]で使用される番号・符号を括弧付きで用いて、[課題を解決するための手段]を説明する。この番号・符号は、[特許請求の範囲]の記載と[発明を実施するための形態]の記載との対応関係を明らかにするために付加されたものであるが、[特許請求の範囲]に記載されている発明の技術的範囲の解釈に用いてはならない。   [Means for Solving the Problems] will be described below by using the numbers and symbols used in [Mode for Carrying Out the Invention] in parentheses. The numbers and symbols are added to clarify the correspondence between the description of [Claims] and the description of [Mode for Carrying Out the Invention]. [Claims] It should not be used for the interpretation of the technical scope of the invention described in.

本発明によるシリアル通信システムは、通信バス(10)を介して他のノードとシリアル通信を行なうノード(2)を具備する。ノード(2)は、他のノードへの送信データを生成する演算処理装置(14)と、送信データ(200)を保持する送信バッファ(32)と、半二重通信を行なう際、送信バッファ(32)が保持する送信データ(200)を所定の期間待機させた後、他のノードに送信する送信制御回路(31)とを備える。   The serial communication system according to the present invention includes a node (2) that performs serial communication with another node via a communication bus (10). The node (2) includes a processing unit (14) that generates transmission data to other nodes, a transmission buffer (32) that holds transmission data (200), and a transmission buffer ( A transmission control circuit (31) for transmitting transmission data (200) held by 32) to another node after waiting for a predetermined period.

本発明による通信方法は、通信バス(10)を介して他のノードとシリアル通信を行なうノード内で行なわれる。本発明による通信方法は、演算処理装置(14)が、他のノードへの送信データ(200)を生成するステップと、送信バッファ(32)が、送信データ(200)を保持するステップと、半二重通信を行なう際、保持する送信データ(200)を所定の期間待機させた後、他のノードに送信するステップを備える。   The communication method according to the present invention is performed in a node that performs serial communication with another node via a communication bus (10). The communication method according to the present invention includes a step in which an arithmetic processing unit (14) generates transmission data (200) to another node, a transmission buffer (32) holds transmission data (200), When duplex communication is performed, the transmission data (200) to be held is waited for a predetermined period and then transmitted to another node.

以上のように、本発明では、演算処理装置(14)におけるデータの出力処理を待機させずに、他のノードへの送信タイミングを変更することができる。   As described above, according to the present invention, the transmission timing to another node can be changed without waiting for the data output process in the arithmetic processing unit (14).

従って、本発明によれば、半二重通信を行なうシリアル通信システムにおいて、データの送信に係るCPUの処理効率を向上させることができる。   Therefore, according to the present invention, it is possible to improve the processing efficiency of the CPU related to data transmission in a serial communication system that performs half-duplex communication.

又、他のノードにおけるデータ受信を妨げないように、受信データと送信データのフレーム間のビット長を確保可能となり、通信エラーを回避できる。   In addition, the bit length between the frames of the reception data and the transmission data can be secured so as not to prevent the data reception at other nodes, and a communication error can be avoided.

図1は、一般的なシリアル通信方式の問題点を示すタイミングチャートである。FIG. 1 is a timing chart showing problems of a general serial communication system. 図2は、従来技術によるシリアル通信装置の構成を示す図である。FIG. 2 is a diagram showing a configuration of a serial communication device according to the prior art. 図3は、図2に示すシリアル通信装置の問題点を示すタイミングチャートである。FIG. 3 is a timing chart showing problems of the serial communication device shown in FIG. 図4は、本発明によるシリアル通信システムの構成を示す図である。FIG. 4 is a diagram showing a configuration of a serial communication system according to the present invention. 図5は、本発明によるシリアル通信装置(ノード)の実施の形態における構成を示す図である。FIG. 5 is a diagram showing a configuration of an embodiment of a serial communication device (node) according to the present invention. 図6は、本発明によるシリアル通信システムの第1の実施の形態における動作の一例を示すタイミングチャートである。FIG. 6 is a timing chart showing an example of operation in the first embodiment of the serial communication system according to the present invention. 図7は、本発明によるシリアル通信システムの第1の実施の形態における動作の他の一例を示すタイミングチャートである。FIG. 7 is a timing chart showing another example of the operation in the first embodiment of the serial communication system according to the present invention. 図8は、本発明によるシリアル通信システムの第2の実施の形態における動作を示すタイミングチャートである。FIG. 8 is a timing chart showing an operation in the second embodiment of the serial communication system according to the present invention.

以下、添付図面を参照して、本発明によるシリアル通信システムの実施の形態を詳細に説明する。一般的に非同期シリアル通信を採用した通信システムでは全二重通信方式にも半二重方式にも対応可能となっている。この場合、製品仕様やユーザのニーズに応じてどちらか一方が選択使用される。このため、本実施の形態では、半二重通信方式と全二重通信方式を切り換え可能な非同期シリアル通信システムについて説明する。本発明は、それぞれが演算処理装置を備える複数のノードをシリアル通信で接続したマイクロコンピュータに好適に利用される。   Embodiments of a serial communication system according to the present invention will be described below in detail with reference to the accompanying drawings. In general, a communication system that employs asynchronous serial communication can support both a full-duplex communication method and a half-duplex method. In this case, either one is selected and used according to product specifications or user needs. Therefore, in this embodiment, an asynchronous serial communication system capable of switching between a half-duplex communication method and a full-duplex communication method will be described. The present invention is preferably used for a microcomputer in which a plurality of nodes each having an arithmetic processing unit are connected by serial communication.

1.第1の実施の形態
(構成)
図4から図7を参照して、本発明によるシリアル通信システムの第1の実施の形態における構成を説明する。図4は、本発明によるシリアル通信システムの構成を示すブロック図である。図4を参照して、シリアル通信システムは、通信バス10(データバス)を介して接続される複数のシリアル通信装置(ノード)1、2、3、…を具備する。複数のノード1、2、3、…のそれぞれは、通信バス10に接続される受信端子11及び送信端子12を備える。ノード1、2、3、…のそれぞれの受信端子11及び送信端子12は、半二重通信方式のとき共通の伝送線に接続される。又、全二重通信方式のときは自ノードの受信端子11と他のノードの送信端子12、自ノードの送信端子12と他のノードの受信端子11とが相互に接続される。
1. First Embodiment (Configuration)
The configuration of the serial communication system according to the first embodiment of the present invention will be described with reference to FIGS. FIG. 4 is a block diagram showing the configuration of the serial communication system according to the present invention. 4, the serial communication system includes a plurality of serial communication devices (nodes) 1, 2, 3,... Connected via a communication bus 10 (data bus). Each of the plurality of nodes 1, 2, 3,... Includes a reception terminal 11 and a transmission terminal 12 connected to the communication bus 10. The reception terminal 11 and the transmission terminal 12 of each of the nodes 1, 2, 3,... Are connected to a common transmission line in the half duplex communication system. In the full-duplex communication system, the reception terminal 11 of the own node and the transmission terminal 12 of another node, and the transmission terminal 12 of the own node and the reception terminal 11 of another node are connected to each other.

図5は、本発明によるシリアル通信装置(ノード)2の実施の形態における構成を示す図である。図5を参照してノード2の構成を説明する。尚、ノード1、3の構成はノード2と同様なので、説明を省略する。図5を参照して、ノード2は、それぞれが通信バス13を介して接続される演算処理装置(CPU)14、割込み制御回路U1、受信ユニットU2、送信ユニットU3と、ボーレートジェネレータ34とを具備する。   FIG. 5 is a diagram showing a configuration in the embodiment of the serial communication device (node) 2 according to the present invention. The configuration of the node 2 will be described with reference to FIG. Since the configuration of the nodes 1 and 3 is the same as that of the node 2, the description thereof is omitted. Referring to FIG. 5, node 2 includes a processing unit (CPU) 14, an interrupt control circuit U 1, a receiving unit U 2, a transmitting unit U 3, and a baud rate generator 34, each of which is connected via a communication bus 13. To do.

受信ユニットU2は、ボーレートジェネレータ34で生成されたボーレートに応じて動作し、受信端子11から入力されるデータ100を、通信バス13を介してCPU14に入力する。詳細には、受信ユニットU2は、受信制御回路21、受信シフトレジスタ22、受信バッファ23、受信サンプリング回路24を備える。   The receiving unit U2 operates in accordance with the baud rate generated by the baud rate generator 34, and inputs data 100 input from the receiving terminal 11 to the CPU 14 via the communication bus 13. Specifically, the reception unit U2 includes a reception control circuit 21, a reception shift register 22, a reception buffer 23, and a reception sampling circuit 24.

受信端子11から入力されたデータ100は、受信サンプリング回路24から出力される受信サンプリング信号101に応じて、受信シフトレジスタ22に取り込まれる。受信サンプリング回路24は、ボーレートジェネレータ34からのボーレートに応じたタイミングで受信サンプリング信号101を生成する。ボーレートジェネレータ34は、図示しないクロック信号に応じた周期のボーレートを生成する。クロック信号は、例えばノード固有に生成される。このため、ノード1、2、3…のそれぞれのボーレートは、動作クロックの周波数の違いや受信サンプリング回路24の精度差により誤差が生じている。従って、本発明によるシリアル通信システムでは、従来と同様にノード毎に許容ボーレート誤差範囲が設定されている。   Data 100 input from the reception terminal 11 is taken into the reception shift register 22 in accordance with the reception sampling signal 101 output from the reception sampling circuit 24. The reception sampling circuit 24 generates the reception sampling signal 101 at a timing corresponding to the baud rate from the baud rate generator 34. The baud rate generator 34 generates a baud rate with a period corresponding to a clock signal (not shown). The clock signal is generated unique to a node, for example. Therefore, the baud rate of each of the nodes 1, 2, 3,... Therefore, in the serial communication system according to the present invention, the allowable baud rate error range is set for each node as in the conventional case.

受信制御回路21は、受信シフトレジスタ22で取り込まれたデータのデータ形式を検出する。受信端子11で受信されるデータフレームは、スタートビット、データビット、ストップビットを含む。受信制御回路21は、ストップビットを検出すると割込み制御回路U1及び送信ユニットU3(待機制御回路(Wait Tim制御回路)40)に通知するとともに、受信シフトレジスタ22を制御してデータフレームを受信バッファ23に転送させる。   The reception control circuit 21 detects the data format of the data fetched by the reception shift register 22. The data frame received at the receiving terminal 11 includes a start bit, a data bit, and a stop bit. When detecting the stop bit, the reception control circuit 21 notifies the interrupt control circuit U1 and the transmission unit U3 (standby control circuit (Wait Time control circuit) 40), and controls the reception shift register 22 to receive the data frame as a reception buffer 23. To be transferred.

受信制御回路21はストップビットを検出すると受信完了通知信号102を割込み制御回路U1及び送信ユニットU3(待機制御回路40)に出力する。あるいは、受信制御回路21はストップビットを検出すると受信完了を示す受信完了フラグを立てても良い。この場合、割込み制御回路U1及び送信ユニットU3(待機制御回路40)は、受信完了フラグによって受信完了を確認することができる。受信バッファ23に書き込まれたデータフレームは通信バス13を介してCPU14に出力される。   When the reception control circuit 21 detects the stop bit, it outputs a reception completion notification signal 102 to the interrupt control circuit U1 and the transmission unit U3 (standby control circuit 40). Alternatively, the reception control circuit 21 may set a reception completion flag indicating completion of reception when detecting the stop bit. In this case, the interrupt control circuit U1 and the transmission unit U3 (standby control circuit 40) can confirm the reception completion by the reception completion flag. The data frame written in the reception buffer 23 is output to the CPU 14 via the communication bus 13.

割込み制御回路U1は、データフレームの受信完了の通知に応じてCPU14に対し受信割込みを設定する。CPU14は受信割込みに応じた割込み処理を実行する。例えば、CPU14は、割込み処理として受信に応じて他のノードに送信するデータフレーム(送信データ)の生成及び出力処理を行なう。   The interrupt control circuit U1 sets a reception interrupt to the CPU 14 in response to the notification of completion of data frame reception. The CPU 14 executes an interrupt process corresponding to the reception interrupt. For example, the CPU 14 generates and outputs a data frame (transmission data) to be transmitted to another node in response to reception as interrupt processing.

送信ユニットU3は、CPU13から出力されたデータフレームを、ボーレートに応じたタイミングで送信端子12を介して送信する。詳細には、送信ユニットU3は、送信制御回路31、送信シフトレジスタ32、送信タイミング生成回路33、待機制御回路40、及びアドレス検出回路(アドレスチェック)41を備える。   The transmission unit U3 transmits the data frame output from the CPU 13 via the transmission terminal 12 at a timing corresponding to the baud rate. Specifically, the transmission unit U3 includes a transmission control circuit 31, a transmission shift register 32, a transmission timing generation circuit 33, a standby control circuit 40, and an address detection circuit (address check) 41.

送信シフトレジスタ32には、半二重通信用の第1アドレスと全二重用の第2アドレスが割り当てられている。CPU32は、半二重通信を行なう際、第1アドレスを宛先として送信データを出力し、全二重通信を行なう際、第2アドレスを宛先として送信データを出力する。CPU14から出力されたデータは、送信タイミング生成回路33で生成される送信タイミングに応じて、送信シフトレジスタ32に取り込まれる。送信タイミング生成回路33は、ボーレートジェネレータ34からのボーレートに応じたタイミングで送信タイミングを決定する。   The transmission shift register 32 is assigned a first address for half duplex communication and a second address for full duplex. The CPU 32 outputs transmission data with the first address as the destination when performing half-duplex communication, and outputs transmission data with the second address as the destination when performing full-duplex communication. The data output from the CPU 14 is taken into the transmission shift register 32 in accordance with the transmission timing generated by the transmission timing generation circuit 33. The transmission timing generation circuit 33 determines the transmission timing at a timing corresponding to the baud rate from the baud rate generator 34.

アドレス検出回路41は、CPU14が送信シフトレジスタにアクセスする際の宛先アドレス(書き込みアドレス)を検出して、待機制御回路40に通知するともに、送信データ100の送信要求信号104を待機制御回路40に出力する。書き込みアドレスの通知は、例えばフラグを用いて行なわれる。アドレス検出回路41は、フラグのレベルを第1アドレスを検出すると半二重通信方式を示す第1レベル(例えばハイレベル)に設定し、第2アドレスを検出すると全二重通信方式を示す第2レベル(例えばローレベル)に設定する。すなわち、本発明ではアドレス検出回路41によって、シリアル通信システムで使用される通信方式を検出することができる。   The address detection circuit 41 detects a destination address (write address) when the CPU 14 accesses the transmission shift register, notifies the standby control circuit 40, and sends the transmission request signal 104 of the transmission data 100 to the standby control circuit 40. Output. The notification of the write address is performed using a flag, for example. The address detection circuit 41 sets the flag level to the first level (for example, high level) indicating the half-duplex communication method when detecting the first address, and the second indicating the full-duplex communication method when detecting the second address. Set to level (for example, low level). That is, in the present invention, the address detection circuit 41 can detect the communication method used in the serial communication system.

待機制御回路40は、受信制御回路21からの受信完了の通知と、アドレス検出回路41において検出された書き込みアドレス(通信方式)とに応じて送信データの送信待機時間(待機期間)を設定する。待機制御回路40は、全二重通信方式で通信する場合、アドレス検出回路41から出力された送信要求信号104をそのまま送信開始信号105として送信制御回路31に出力する。一方、半二重通信方式で通信する場合、待機制御回路40は、アドレス検出回路41から出力された送信要求信号104を、所定の期間(待機期間)待機させてから送信開始信号105として送信制御回路31に出力する。待機制御回路40は、送信タイミング生成回路33からの送信タイミングに基づき待機期間を設定する。すなわち、送信タイミングに応じて送信開始信号105を出力する時刻が待機期間の終了時刻となる。   The standby control circuit 40 sets the transmission standby time (standby period) of transmission data according to the notification of reception completion from the reception control circuit 21 and the write address (communication method) detected by the address detection circuit 41. The standby control circuit 40 outputs the transmission request signal 104 output from the address detection circuit 41 to the transmission control circuit 31 as it is as the transmission start signal 105 when communicating by the full-duplex communication method. On the other hand, when communicating by the half-duplex communication method, the standby control circuit 40 controls the transmission request signal 104 output from the address detection circuit 41 as a transmission start signal 105 after waiting for a predetermined period (waiting period). Output to the circuit 31. The standby control circuit 40 sets a standby period based on the transmission timing from the transmission timing generation circuit 33. That is, the time when the transmission start signal 105 is output according to the transmission timing is the end time of the standby period.

送信制御回路31は、送信シフトレジスタ32に書き込まれた送信データ200を、待機制御回路40からの送信開始信号105に応じて送信端子12(通信バス10)に送出させる。この際、送信データ200は、ボーレートに基づく送信タイミングで送出される。   The transmission control circuit 31 sends the transmission data 200 written in the transmission shift register 32 to the transmission terminal 12 (communication bus 10) in response to the transmission start signal 105 from the standby control circuit 40. At this time, the transmission data 200 is transmitted at a transmission timing based on the baud rate.

(動作)
図6及び図7を参照して、本発明によるシリアル通信システムの半二重通信方式による通信動作の詳細を説明する。図6は、本発明によるシリアル通信システムの第1の実施の形態における動作の一例を示すタイミングチャートである。第1の実施の形態では、待機期間Tsは予め設定されており、ストップビットの検出(データ100の受信完了)に応じて待機期間Tsの開始時刻が設定される(開始時刻の設定に応じて待機期間の終了時刻も決定する)。図6を参照して、予め設定された待機期間Ts中にCPU14から送信データが出力された場合のシリアル通信システムの動作を説明する。
(Operation)
With reference to FIG.6 and FIG.7, the communication operation | movement by the half duplex communication system of the serial communication system by this invention is demonstrated. FIG. 6 is a timing chart showing an example of operation in the first embodiment of the serial communication system according to the present invention. In the first embodiment, the waiting period Ts is set in advance, and the start time of the waiting period Ts is set according to the detection of the stop bit (reception of the data 100 is completed) (according to the setting of the start time). The end time of the waiting period is also determined). With reference to FIG. 6, the operation of the serial communication system when transmission data is output from the CPU 14 during a preset waiting period Ts will be described.

ここでは、ノード1から送信されたデータ100の受信に応じて送信データ200を送出するノード2の動作について説明する。ノード1は、スタートビット、データビット(8ビット)、ストップビットを含むフレームデータ(データ100)を通信バス10に送出する。時刻T1において、ノード2はストップビットを検出する。この際、ハイレベルの受信完了通知信号102が待機制御回路40にセットされる。時刻T2において、待機制御回路40には、受信完了通知信号102に応じてハイレベルの待機制御信号103がセットされる。これによりデータ送信の待機期間が設定される。本実施の形態では、待機制御信号103は、予め設定された期間(待機期間Ts)ハイレベルにセットされる。すなわち、時刻T2から待機期間Tsだけ経過した時刻T5が待機期間の終了時刻となる。   Here, the operation of node 2 that transmits transmission data 200 in response to reception of data 100 transmitted from node 1 will be described. The node 1 sends frame data (data 100) including a start bit, data bits (8 bits), and stop bits to the communication bus 10. At time T1, node 2 detects a stop bit. At this time, a high-level reception completion notification signal 102 is set in the standby control circuit 40. At time T2, the standby control circuit 40 is set with the standby control signal 103 at a high level in response to the reception completion notification signal 102. Thereby, a waiting period for data transmission is set. In the present embodiment, standby control signal 103 is set to a high level for a preset period (standby period Ts). That is, the time T5 when the standby period Ts has elapsed from the time T2 is the end time of the standby period.

一方、ストップビットの受信が検出されると、受信完了割込みが発生し、時刻T3においてCPU14から送信データ200が送信シフトレジスタ(送信バッファ)32に出力されるとともに、アドレス検出回路41を介して送信要求信号104が出力される。この際、アドレス検出回路41は、送信シフトレジスタ32への書き込みアドレスが第1アドレスであることを検出し、検出結果を待機制御回路40に通知する。これにより待機制御回路40は、待機期間中に入力される送信要求信号104を待機させる制御を行なう。詳細には、送信要求信号104の出力された時刻T3が待機期間Ts内である場合、すなわち、待機期間Ts中にCPU14からデータ200が出力された場合、待機制御回路40は、送信要求信号104の立下り時刻T4から待機期間Tsが終了する時刻T5までの間(期間Tw)、送信要求信号104を待機させた後、送信開始信号105として送信制御回路31に出力する。   On the other hand, when reception of the stop bit is detected, a reception completion interrupt occurs, and at time T3, the transmission data 200 is output from the CPU 14 to the transmission shift register (transmission buffer) 32 and transmitted via the address detection circuit 41. A request signal 104 is output. At this time, the address detection circuit 41 detects that the write address to the transmission shift register 32 is the first address, and notifies the standby control circuit 40 of the detection result. Thereby, the standby control circuit 40 performs control for waiting for the transmission request signal 104 input during the standby period. Specifically, when the time T3 when the transmission request signal 104 is output is within the standby period Ts, that is, when the data 200 is output from the CPU 14 during the standby period Ts, the standby control circuit 40 transmits the transmission request signal 104. During the period from the falling time T4 to the time T5 when the waiting period Ts ends (period Tw), the transmission request signal 104 is made to wait and then output to the transmission control circuit 31 as the transmission start signal 105.

時刻T6において、送信制御回路31は、送信開始信号105に応じて送信シフトレジスタ32に書き込まれた送信データ200を送信端子11から通信バス10上に送出させる。ノード1から送出された通信バス10上のストップビットは、時刻T6においてデータ200のスタートビットに置き換わるが、そのデータ幅は、待機期間Ts以上となる。ここで、待機期間Tsを1ビット長以上に設定することで、データ100のストップビットのビット長Tstを1ビット長以上とすることができる。すなわち、本発明によれば、データ100の受信完了に応じてデータ200を送信しても、データ100のストップビットのデータ幅を短縮させることがない。これにより、ノード2と他のノード3とのサンプリングタイミングに大きな誤差(許容範囲内の誤差)があっても、ストップビットのデータ長が1ビット以上確保され、ノード3は受信エラーを起こすことなくデータ100を受信することができる。   At time T <b> 6, the transmission control circuit 31 sends the transmission data 200 written in the transmission shift register 32 in response to the transmission start signal 105 from the transmission terminal 11 onto the communication bus 10. The stop bit sent from the node 1 on the communication bus 10 is replaced with the start bit of the data 200 at time T6, but the data width is equal to or longer than the waiting period Ts. Here, by setting the waiting period Ts to 1 bit length or more, the bit length Tst of the stop bit of the data 100 can be set to 1 bit length or more. That is, according to the present invention, even if data 200 is transmitted in response to completion of reception of data 100, the data width of stop bits of data 100 is not shortened. As a result, even if there is a large error (error within an allowable range) in the sampling timing between the node 2 and the other node 3, the data length of the stop bit is secured at least 1 bit, and the node 3 does not cause a reception error. Data 100 can be received.

又、本発明では、CPU14から送信シフトレジスタ32に書き込まれたデータ200を所定の期間Tw待機している。このため、CPU14は、受信完了後速やかに出力される受信完了割込み信号に応じて、送信データの準備及び出力処理を行なうことができる。すなわち、CPU14は、受信完了後すぐに送信データを送信するための割込み処理を行なうことが可能となる。従来問題となっていたCPUの処理効率の低下や、データの受信から送信までにかかる時間の長大化を解消することができる。   In the present invention, the data 200 written from the CPU 14 to the transmission shift register 32 is on standby for a predetermined period Tw. For this reason, the CPU 14 can perform transmission data preparation and output processing in accordance with a reception completion interrupt signal that is output promptly after completion of reception. That is, the CPU 14 can perform an interrupt process for transmitting transmission data immediately after reception is completed. It is possible to eliminate the reduction in the processing efficiency of the CPU and the increase in the time taken from data reception to transmission, which have been problems in the past.

更に、本発明によるシリアル通信装置2では、送信シフトレジスタ32に2つのアドレスを割り当て、書き込みアドレスの相違に応じて、全二重通信方式と半二重通信方式とを切り換えている。例えば、全二重通信方式用の第2アドレスにアクセスがある場合、待機制御回路40は、待機期間Tsの有無に関わらず送信要求信号104をそのまま送信開始信号105として送信制御回路31に出力する。これにより、ノード2は、データの受信完了の有無に関わらず、CPU14からの送信データ200を送出し全二重通信を行なうことが可能となる。   Furthermore, in the serial communication device 2 according to the present invention, two addresses are assigned to the transmission shift register 32, and the full-duplex communication method and the half-duplex communication method are switched according to the difference in the write address. For example, when there is an access to the second address for the full-duplex communication method, the standby control circuit 40 outputs the transmission request signal 104 as it is to the transmission control circuit 31 as the transmission start signal 105 regardless of the presence or absence of the standby period Ts. . As a result, the node 2 can transmit the transmission data 200 from the CPU 14 and perform full-duplex communication regardless of whether or not data reception is completed.

図7は、本発明によるシリアル通信システムの第1の実施の形態における動作の他の一例を示すタイミングチャートである。図7を参照して、予め設定された待機期間Tsが経過した後にCPU14から送信データが出力された場合のシリアル通信システムの動作を説明する。   FIG. 7 is a timing chart showing another example of the operation in the first embodiment of the serial communication system according to the present invention. With reference to FIG. 7, the operation of the serial communication system when transmission data is output from the CPU 14 after a preset standby period Ts has elapsed will be described.

ここでは、図6と同様に、ノード1は、スタートビット、データビット(8ビット)、ストップビットを含むフレームデータ(データ100)を通信バス10に送出する。時刻T1において、ノード2はストップビットを検出する。この際、ハイレベルの受信完了通知信号102が待機制御回路40にセットされる。時刻T2において、待機制御回路40には、受信完了通知信号102に応じてハイレベルの待機制御信号103がセットされる。これによりデータ送信の待機期間が設定される。本実施の形態では、待機制御信号103は、予め設定された期間(待機期間Ts)ハイレベルにセットされる。すなわち、時刻T2から待機期間Tsだけ経過した時刻T3が待機期間の終了時刻となる。   Here, as in FIG. 6, the node 1 sends frame data (data 100) including a start bit, a data bit (8 bits), and a stop bit to the communication bus 10. At time T1, node 2 detects a stop bit. At this time, a high-level reception completion notification signal 102 is set in the standby control circuit 40. At time T2, the standby control circuit 40 is set with the standby control signal 103 at a high level in response to the reception completion notification signal 102. Thereby, a waiting period for data transmission is set. In the present embodiment, standby control signal 103 is set to a high level for a preset period (standby period Ts). That is, the time T3 when the standby period Ts has elapsed from the time T2 is the end time of the standby period.

ストップビットの受信が検出されると、受信完了割込みが発生し、時刻T4においてCPU14から送信データ200が送信シフトレジスタ(送信バッファ)32に出力されるとともに、アドレス検出回路41を介して送信要求信号104が出力される。この際、アドレス検出回路41は、送信シフトレジスタ32への書き込みアドレスが第1アドレスであることを検出し、検出結果を待機制御回路40に通知する。これにより待機制御回路40は、待機期間中に入力される送信要求信号104を待機させる制御を行なう。   When reception of the stop bit is detected, a reception completion interrupt is generated. At time T4, the transmission data 200 is output from the CPU 14 to the transmission shift register (transmission buffer) 32, and a transmission request signal is transmitted via the address detection circuit 41. 104 is output. At this time, the address detection circuit 41 detects that the write address to the transmission shift register 32 is the first address, and notifies the standby control circuit 40 of the detection result. Thereby, the standby control circuit 40 performs control for waiting for the transmission request signal 104 input during the standby period.

ここで、送信要求信号104の出力された時刻T4が、待機期間Tsの終了後である場合、すなわち、待機期間Tsの経過後にCPU14からデータ200が出力された場合、待機制御回路40は、送信要求信号104を待機させずに(スルーして)送信開始信号105として送信制御回路31に出力する。   Here, when the time T4 when the transmission request signal 104 is output is after the end of the standby period Ts, that is, when the data 200 is output from the CPU 14 after the standby period Ts has elapsed, the standby control circuit 40 transmits The request signal 104 is output to the transmission control circuit 31 as a transmission start signal 105 without waiting (through).

時刻T5において、送信制御回路31は、送信開始信号105に応じて送信シフトレジスタ32に書き込まれた送信データ200を送信端子11から通信バス10上に送出させる。すなわち、本発明では、CPU14からのデータ200の送出が、所定の期間(待機期間Ts)だけ経過した後に行なわれた場合、データ200を待機させずに通信バス10に送出することができる。この場合も、ノード1から送出された通信バス10上のストップビットは、時刻T5においてデータ200のスタートビットに置き換わるが、そのデータ幅は、待機期間Ts以上となる。ここで、待機期間Tsを1ビット長以上に設定することで、データ100のストップビットのビット長Tstは、1ビット長以上となる。   At time T5, the transmission control circuit 31 sends the transmission data 200 written in the transmission shift register 32 in response to the transmission start signal 105 from the transmission terminal 11 onto the communication bus 10. That is, in the present invention, when the data 200 is sent from the CPU 14 after a predetermined period (waiting period Ts) has elapsed, the data 200 can be sent to the communication bus 10 without waiting. Also in this case, the stop bit sent from the node 1 on the communication bus 10 is replaced with the start bit of the data 200 at time T5, but the data width is equal to or longer than the waiting period Ts. Here, by setting the waiting period Ts to 1 bit length or longer, the bit length Tst of the stop bits of the data 100 becomes 1 bit length or longer.

又、CPU14は割込み信号が入力されるとすぐにその割込み信号に応じた処理を行なうとは限らず、データ200を送出してもストップビットのビット長Tstは1ビット以上を確保している場合がある。このような場合、本発明では、受信割込み信号及びCPU14からの出力されたデータ200も遅延させていないため、受信からCPU14によるデータ200の送信まで最短の時間で処理することができる。このため、ストップビットのビット長Tstが充分確保されている場合、データの送信を従来よりも早めることができ、通信バス効率を向上させることができる。更に、近年では、様々な周辺機器が追加されており、割込み処理も多様化している。   In addition, the CPU 14 does not always perform processing according to the interrupt signal as soon as the interrupt signal is input, and the bit length Tst of the stop bit is 1 bit or more even if the data 200 is transmitted. There is. In such a case, in the present invention, since the reception interrupt signal and the data 200 output from the CPU 14 are not delayed, processing can be performed in the shortest time from reception to transmission of the data 200 by the CPU 14. For this reason, when the bit length Tst of the stop bit is sufficiently secured, data transmission can be accelerated compared to the conventional case, and the communication bus efficiency can be improved. Furthermore, in recent years, various peripheral devices have been added, and interrupt processing has also been diversified.

以上のように、本発明では、データ100の受信からデータ200の送出までの間、CPU14の処理を遅滞させることがないため、CPUの処理効率を向上させることができる。例えば、受信データの1フレームが、データ(8ビット)、スタートビット(1ビット)、ストップビット(1ビット)で構成されている場合、従来技術では利用できなかった1フレームに対して1割の時間を送信データの準備及び送信に利用できる。又、本発明では、受信完了時を基準として終了時刻が決まる待機期間Ts内にCPU14から送出されたデータを待機させ、待機期間Ts経過後に送出させたデータを遅滞なく送信する。これにより、CPU14の処理に関わらず設定可能な待機期間Ts以上に通信バス10上のストップビットのビット長Tstを効率良く確保することができる。   As described above, in the present invention, since the processing of the CPU 14 is not delayed from the reception of the data 100 to the transmission of the data 200, the processing efficiency of the CPU can be improved. For example, if one frame of received data consists of data (8 bits), start bit (1 bit), and stop bit (1 bit), 10% of one frame that could not be used in the prior art Time can be used for preparation and transmission of transmission data. In the present invention, the data sent from the CPU 14 is put on standby within the waiting period Ts in which the end time is determined with reference to the completion of reception, and the sent data is transmitted without delay after the waiting period Ts has elapsed. As a result, the bit length Tst of the stop bits on the communication bus 10 can be efficiently ensured over the settable standby period Ts regardless of the processing of the CPU 14.

更に、本発明では、アドレスを用いて全二重通信方式と半二重通信方式との切り換えが行なわれる。このため、従来技術によるモード切り替えと異なり、送信シフトレジスタ32(送信バッファ)に割り当てるアドレスを変更するだけで、ソフトウェアの大幅な変更を必要としない。ソフトウェアを改良する場合、ノード毎に対応する変更を必要とするとともにシステム全体に整合した改良を行なう必要がある。このため、ソフトウェアの改良には多くのコストを要する。本発明では簡易な変更によって半二重通信と全二重通信を切り換え可能なシリアル通信システムを提供できるため、開発コストを削減することができる。   Furthermore, in the present invention, switching between the full-duplex communication method and the half-duplex communication method is performed using the address. For this reason, unlike mode switching according to the prior art, only the address assigned to the transmission shift register 32 (transmission buffer) is changed, and no significant software change is required. When improving the software, it is necessary to make a change corresponding to each node and to make an improvement consistent with the entire system. For this reason, a lot of cost is required to improve the software. According to the present invention, a serial communication system capable of switching between half-duplex communication and full-duplex communication can be provided by a simple change, so that development costs can be reduced.

2.第2の実施の形態
図8を参照して、本発明によるシリアル通信システムの第2の実施の形態における動作を説明する。図8は、本発明によるシリアル通信システムの第2の実施の形態における動作を示すタイミングチャートである。第2の実施の形態におけるシリアル通信システムの構成は第1の実施の形態と同様であるので説明は省略する。第2の実施の形態では、スタートビットの検出(データ100の受信開始)に応じて待機期間Tsの開始時刻が設定され、ストップビットの検出(データ100の受信完了)に応じて待機期間Tsの終了時刻が設定される。
2. Second Embodiment With reference to FIG. 8, the operation of the serial communication system according to the second embodiment of the present invention will be described. FIG. 8 is a timing chart showing an operation in the second embodiment of the serial communication system according to the present invention. Since the configuration of the serial communication system according to the second embodiment is the same as that of the first embodiment, description thereof is omitted. In the second embodiment, the start time of the waiting period Ts is set according to detection of the start bit (reception of data 100), and the waiting period Ts is determined according to detection of the stop bit (reception of data 100). End time is set.

ここでは、図6と同様に、ノード1は、スタートビット、データビット(8ビット)、ストップビットを含むフレームデータ(データ100)を通信バス10に送出する。時刻T1において、受信制御回路21はスタートビットを検出し、受信スタート信号107を割込み制御回路U1及び待機制御回路40に出力する。この際、ハイレベルの受信スタート信号107が待機制御回路40にセットされる。時刻T2において、待機制御回路40には、受信スタート信号107に応じてハイレベルの待機制御信号103がセットされる。これによりデータ送信の待機期間の開始時刻が設定される。すなわち、時刻T2が待機期間の開始時刻となる。尚、受信制御回路21は受信スタート信号107に替えてフラグによって受信開始を待機制御回路40に通知しても良い。   Here, as in FIG. 6, the node 1 sends frame data (data 100) including a start bit, a data bit (8 bits), and a stop bit to the communication bus 10. At time T1, the reception control circuit 21 detects a start bit and outputs a reception start signal 107 to the interrupt control circuit U1 and the standby control circuit 40. At this time, a high level reception start signal 107 is set in the standby control circuit 40. At time T2, the standby control circuit 40 is set with a high-level standby control signal 103 in accordance with the reception start signal 107. Thus, the start time of the data transmission standby period is set. That is, time T2 is the start time of the standby period. The reception control circuit 21 may notify the standby control circuit 40 of the start of reception by a flag instead of the reception start signal 107.

本実施の形態では、CPU14は、受信完了割込みに関係なく送信データ200を生成及び出力しても構わない。例えば、ノード1から送信データ100が送信されている途中の時刻T3において、CPU14から送信データ200が送信シフトレジスタ(送信バッファ)32に出力されるとともに、アドレス検出回路41を介して送信要求信号104が出力されても良い。この場合、第1の形態と同様に、アドレス検出回路41は、送信シフトレジスタ32への書き込みアドレスが第1アドレスであることを検出し、検出結果を待機制御回路40に通知する。これにより待機制御回路40は、待機期間中に入力される送信要求信号104を待機させる制御を行なう。すなわち、待機期間Ts中にCPU14からデータ200が出力された場合、待機制御回路40は、送信要求信号の立下り時刻T4から待機期間Tsが終了する時刻T7までの間(期間Tw)、送信要求信号104を待機させた後、送信開始信号105として送信制御回路31に出力する。   In the present embodiment, the CPU 14 may generate and output the transmission data 200 regardless of the reception completion interrupt. For example, the transmission data 200 is output from the CPU 14 to the transmission shift register (transmission buffer) 32 at the time T3 in the middle of transmission of the transmission data 100 from the node 1, and the transmission request signal 104 is transmitted via the address detection circuit 41. May be output. In this case, as in the first embodiment, the address detection circuit 41 detects that the write address to the transmission shift register 32 is the first address, and notifies the standby control circuit 40 of the detection result. Thereby, the standby control circuit 40 performs control for waiting for the transmission request signal 104 input during the standby period. That is, when the data 200 is output from the CPU 14 during the standby period Ts, the standby control circuit 40 transmits the transmission request from the falling time T4 of the transmission request signal to the time T7 when the standby period Ts ends (period Tw). After waiting for the signal 104, the signal 104 is output to the transmission control circuit 31 as the transmission start signal 105.

時刻T5において、ノード2はストップビットを検出する。この際、ハイレベルの受信完了通知信号102が待機制御回路40にセットされる。時刻T6において、待機制御回路40には、受信完了通知信号102に応じてハイレベルの待機制御信号103がセットされる。これによりデータ送信の待機期間Tsの終了時刻が設定される。本実施の形態では、待機制御信号103は、受信完了通知信号102の立下り時刻T6から予め設定された期間Te後の時刻T7が待機期間Tsの終了時刻として設定される。   At time T5, the node 2 detects a stop bit. At this time, a high-level reception completion notification signal 102 is set in the standby control circuit 40. At time T6, the standby control circuit 40 is set with a high-level standby control signal 103 in accordance with the reception completion notification signal 102. Thus, the end time of the data transmission standby period Ts is set. In the present embodiment, the standby control signal 103 is set as a time T7 after a preset period Te from the falling time T6 of the reception completion notification signal 102 as an end time of the standby period Ts.

時刻T7において、送信制御回路31は、送信開始信号105に応じて送信シフトレジスタ32に書き込まれた送信データ200を送信端子11から通信バス10上に送出させる。ノード1から送出された通信バス10上のストップビットは、時刻T7においてデータ200のスタートビットに置き換わるが、そのデータ幅は、期間Te以上となる。ここで、期間Teを1ビット長以上に設定することで、データ100のストップビットのビット長Tstを1ビット長以上とすることができる。すなわち、本発明によれば、データ100の受信完了に応じてデータ200を送信しても、データ100のストップビットのデータ幅を短縮させることがない。これにより、ノード2と他のノード3とのサンプリングタイミングに大きな誤差(許容範囲内の誤差)があっても、ストップビットのデータ長が1ビット以上確保され、ノード3は受信エラーを起こすことなくデータ100を受信することができる。   At time T <b> 7, the transmission control circuit 31 sends the transmission data 200 written in the transmission shift register 32 in response to the transmission start signal 105 from the transmission terminal 11 onto the communication bus 10. The stop bit sent from the node 1 on the communication bus 10 is replaced with the start bit of the data 200 at time T7, but the data width is equal to or longer than the period Te. Here, by setting the period Te to be 1 bit or longer, the bit length Tst of the stop bits of the data 100 can be made 1 bit or longer. That is, according to the present invention, even if data 200 is transmitted in response to completion of reception of data 100, the data width of stop bits of data 100 is not shortened. As a result, even if there is a large error (error within an allowable range) in the sampling timing between the node 2 and the other node 3, the data length of the stop bit is secured at least 1 bit, and the node 3 does not cause a reception error. Data 100 can be received.

又、本実施の形態において、待機期間Tsが経過した後にCPU14から送信データが出力された場合でも、図7に示す一例と同様に、CPU14からの出力されたデータ200を遅延させずに通信バス10に送出することができる。又、第1の実施の形態と同様に送信シフトレジスタ32に2つのアドレスを割り当てることで半二重通信と全二重通信を切り換えることができる。   Further, in the present embodiment, even when transmission data is output from the CPU 14 after the standby period Ts has elapsed, similarly to the example shown in FIG. 7, the output data 200 from the CPU 14 is not delayed and the communication bus is output. 10 can be sent out. Similarly to the first embodiment, half-duplex communication and full-duplex communication can be switched by assigning two addresses to the transmission shift register 32.

以上のように、本実施の形態におけるシリアル通信システムは、データの受信が完了する前でもCPU14による送信データ200の準備及び出力を行なうことができる。これにより、更にCPU14の処理効率を向上させることができる。   As described above, the serial communication system according to the present embodiment can prepare and output the transmission data 200 by the CPU 14 even before the data reception is completed. Thereby, the processing efficiency of the CPU 14 can be further improved.

以上、本発明の実施の形態を詳述してきたが、具体的な構成は上記実施の形態に限られるものではなく、本発明の要旨を逸脱しない範囲の変更があっても本発明に含まれる。上述の実施の形態では、半二重通信方式と全二重通信方式とを切り換え可能なシステムについて説明したが、半二重通信方式のみを利用するシリアル通信システムにも適用できる。又、待機制御回路40は、受信完了通知信号102に応じて待機期間の終了時刻を設定しているが、割込み制御回路U1からの受信割込み信号に応じて設定しても良い。   The embodiment of the present invention has been described in detail above, but the specific configuration is not limited to the above-described embodiment, and changes within a scope not departing from the gist of the present invention are included in the present invention. . In the above-described embodiment, the system capable of switching between the half-duplex communication method and the full-duplex communication method has been described. However, the present invention can also be applied to a serial communication system that uses only the half-duplex communication method. Further, the standby control circuit 40 sets the end time of the standby period according to the reception completion notification signal 102, but it may be set according to the reception interrupt signal from the interrupt control circuit U1.

1〜3:ノード
10:通信バス(データバス)
11:受信端子
12:送信端子
13:通信バス
14:CPU
21:受信制御回路
22:受信シフトレジスタ
23:受信バッファ
24:受信サンプリング生成回路
31:送信制御回路
32:送信シフトレジスタ
33:送信タイミング生成回路
34:ボーレートジェネレータ
40:待機制御回路(Wait Tim制御回路)
41:アドレス検出回路(アドレスチェック)
100:データ(受信データ、ノード1の送信データ)
101:受信サンプリング信号
102:受信完了通知信号
103:待機制御信号
104:送信要求信号
105:送信開始信号
107:受信スタート信号
200:データ(送信データ)
U1:割込み制御回路
U2:受信ユニット
U3:送信ユニット
1-3: Node 10: Communication bus (data bus)
11: Reception terminal 12: Transmission terminal 13: Communication bus 14: CPU
21: Reception control circuit 22: Reception shift register 23: Reception buffer 24: Reception sampling generation circuit 31: Transmission control circuit 32: Transmission shift register 33: Transmission timing generation circuit 34: Baud rate generator 40: Wait control circuit (Wait Tim control circuit) )
41: Address detection circuit (address check)
100: Data (received data, transmission data of node 1)
101: Reception sampling signal 102: Reception completion notification signal 103: Standby control signal 104: Transmission request signal 105: Transmission start signal 107: Reception start signal 200: Data (transmission data)
U1: Interrupt control circuit U2: Reception unit U3: Transmission unit

Claims (14)

通信バスを介して他のノードとシリアル通信を行なうノードを具備し、
前記ノードは、
前記他のノードへの送信データを生成する演算処理装置と、
前記送信データを保持する送信バッファと、
半二重通信を行なう際、前記送信バッファが保持する送信データを所定の期間待機させた後、前記他のノードに送信する送信制御回路と、
を備え、
シリアル通信システム。
Comprising a node for serial communication with other nodes via a communication bus;
The node is
An arithmetic processing unit that generates transmission data to the other nodes;
A transmission buffer for holding the transmission data;
When performing half-duplex communication, after waiting for transmission data held in the transmission buffer for a predetermined period, a transmission control circuit for transmitting to the other node;
With
Serial communication system.
請求項1に記載のシリアル通信システムにおいて、
前記ノードは、データの受信完了時を基準として待機期間の終了時刻を設定する待機制御回路を更に備え、
半二重通信を行なう際、前記送信制御回路は、前記待機期間中に前記送信バッファに書き込まれた送信データを、前記終了時刻まで待機させた後、前記他のノードに送信する
シリアル通信システム。
The serial communication system according to claim 1,
The node further includes a standby control circuit that sets an end time of the standby period with reference to the completion of data reception,
When performing half-duplex communication, the transmission control circuit transmits the transmission data written in the transmission buffer during the standby period to the other node after waiting for the end time.
請求項2に記載のシリアル通信システムにおいて、
前記送信バッファには半二重通信用の第1アドレスが割り当てられ、
前記ノードは、前記演算処理装置による前記送信バッファへの書き込みアドレスを検出するアドレス検出回路を更に備え、
前記送信制御回路は、前記待機期間中に前記書き込みアドレスとして前記第1アドレスが検出されると、前記送信バッファに書き込まれた送信データの送信を待機する
シリアル通信システム。
The serial communication system according to claim 2,
The transmission buffer is assigned a first address for half-duplex communication,
The node further includes an address detection circuit that detects a write address to the transmission buffer by the arithmetic processing unit;
The transmission control circuit waits for transmission of transmission data written in the transmission buffer when the first address is detected as the write address during the standby period.
請求項2又は3に記載のシリアル通信システムにおいて、
前記送信バッファには全二重通信用の第2アドレスが更に割り当てられ、
前記送信制御回路は、前記書き込みアドレスとして前記第2アドレスが検出されると前記送信バッファに書き込まれた送信データを待機させずに送信する
シリアル通信システム。
The serial communication system according to claim 2 or 3,
The transmission buffer is further assigned a second address for full duplex communication,
The transmission control circuit transmits the transmission data written in the transmission buffer without waiting when the second address is detected as the write address.
請求項2から4のいずれか1項に記載のシリアル通信システムにおいて、
前記待機期間が経過した後に送信データが前記送信バッファに書き込まれた場合、前記送信制御回路は、前記送信バッファに書き込まれたデータを待機させずに送信する。
シリアル通信システム。
The serial communication system according to any one of claims 2 to 4,
When transmission data is written to the transmission buffer after the waiting period has elapsed, the transmission control circuit transmits the data written to the transmission buffer without waiting.
Serial communication system.
請求項2から5のいずれか1項に記載のシリアル通信システムにおいて、
前記演算処理装置は、前記送信データの生成とともに送信要求信号を発行し、
半二重通信を行なう際、前記待機制御回路は、前記待機期間中に受け取った前記送信要求信号を前記終了時刻まで保持した後、送信開始信号として前記送信制御回路に出力し、
前記送信制御回路は、前記送信開始信号に応じて、前記送信バッファが保持する送信データを前記他のノードに送信する
シリアル通信システム。
The serial communication system according to any one of claims 2 to 5,
The arithmetic processing unit issues a transmission request signal together with the generation of the transmission data,
When performing half-duplex communication, the standby control circuit holds the transmission request signal received during the standby period until the end time, and then outputs to the transmission control circuit as a transmission start signal,
The transmission control circuit transmits transmission data held by the transmission buffer to the other node in response to the transmission start signal.
請求項6に記載のシリアル通信システムにおいて、
前記待機期間が経過した後に受け取った前記送信要求信号を待機させずに前記送信開始信号として送信する。
シリアル通信システム。
The serial communication system according to claim 6, wherein
The transmission request signal received after the standby period has elapsed is transmitted as the transmission start signal without waiting.
Serial communication system.
通信バスを介して他のノードとシリアル通信を行なうノード内で行なわれる通信方法において、
演算処理装置が、前記他のノードへの送信データを生成するステップと、
送信バッファが、前記送信データを保持するステップと、
半二重通信を行なう際、前記保持する送信データを所定の期間待機させた後、前記他のノードに送信するステップと、
を具備する
通信方法。
In a communication method performed in a node that performs serial communication with another node via a communication bus,
An arithmetic processing unit generating transmission data to the other node;
A transmission buffer holding the transmission data;
When performing half-duplex communication, waiting for a predetermined period of the transmission data to be held, and then transmitting to the other node;
A communication method comprising:
請求項8に記載の通信方法において、
データの受信完了時を基準として待機期間の終了時刻を設定するステップを更に具備し、
前記送信データを送信するステップは、前記待機期間中に前記送信バッファに書き込まれた送信データを、前記終了時刻まで待機させた後、前記他のノードに送信するステップを備える
通信方法。
The communication method according to claim 8, wherein
Further comprising the step of setting the end time of the waiting period with reference to the completion of data reception;
The step of transmitting the transmission data includes a step of transmitting the transmission data written in the transmission buffer during the standby period to the other node after waiting for the transmission data to the end time.
請求項9に記載の通信方法において、
前記送信バッファには半二重通信用の第1アドレスが割り当てられ、
前記演算処理装置による前記送信バッファへの書き込みアドレスを検出するステップを更に具備し、
前記送信データを送信するステップは、前記待機期間中に前記書き込みアドレスとして前記第1アドレスが検出されると、前記送信バッファに書き込まれた送信データの送信を待機する
通信方法。
The communication method according to claim 9, wherein
The transmission buffer is assigned a first address for half-duplex communication,
Further comprising detecting a write address to the transmission buffer by the arithmetic processing unit;
The step of transmitting the transmission data waits for transmission of the transmission data written in the transmission buffer when the first address is detected as the write address during the standby period.
請求項9又は10に記載の通信方法において、
前記送信バッファには全二重通信用の第2アドレスが更に割り当てられ、
前記書き込みアドレスとして前記第2アドレスが検出されると前記送信バッファに書き込まれた送信データを待機させずに送信するステップを更に具備する
通信方法。
The communication method according to claim 9 or 10,
The transmission buffer is further assigned a second address for full duplex communication,
A communication method further comprising the step of transmitting without waiting the transmission data written to the transmission buffer when the second address is detected as the write address.
請求項9から11のいずれか1項に記載の通信方法において、
前記待機期間が経過した後に送信データが前記送信バッファに書き込まれた場合、前記送信バッファに書き込まれたデータを待機させずに送信するステップを更に具備する
通信方法。
The communication method according to any one of claims 9 to 11,
A communication method further comprising the step of transmitting without waiting the data written in the transmission buffer when transmission data is written in the transmission buffer after the waiting period has elapsed.
請求項9から12のいずれか1項に記載の通信方法において、
前記演算処理装置が、前記送信データの生成とともに送信要求信号を発行するステップを更に具備し、
前記送信データを送信するステップは、
前記待機期間中に受け取った前記送信要求信号を前記終了時刻まで保持した後、送信開始信号として前記送信制御回路に出力するステップと、
前記送信開始信号に応じて、前記送信バッファが保持する送信データを前記他のノードに送信するステップと
を備える
通信方法。
The communication method according to any one of claims 9 to 12,
The arithmetic processing unit further comprises a step of issuing a transmission request signal together with the generation of the transmission data,
The step of transmitting the transmission data includes:
Holding the transmission request signal received during the waiting period until the end time, and then outputting to the transmission control circuit as a transmission start signal;
Transmitting the transmission data held in the transmission buffer to the other node in response to the transmission start signal.
請求項13に記載の通信方法において、
前記待機期間が経過した後に受け取った前記送信要求信号を待機させずに前記送信開始信号として送信するステップを更に具備する。
通信方法。
The communication method according to claim 13,
The method further includes the step of transmitting the transmission request signal received after the standby period has elapsed as the transmission start signal without waiting.
Communication method.
JP2009020570A 2009-01-30 2009-01-30 Serial communication system and communication method Withdrawn JP2010178199A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009020570A JP2010178199A (en) 2009-01-30 2009-01-30 Serial communication system and communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009020570A JP2010178199A (en) 2009-01-30 2009-01-30 Serial communication system and communication method

Publications (1)

Publication Number Publication Date
JP2010178199A true JP2010178199A (en) 2010-08-12

Family

ID=42708674

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009020570A Withdrawn JP2010178199A (en) 2009-01-30 2009-01-30 Serial communication system and communication method

Country Status (1)

Country Link
JP (1) JP2010178199A (en)

Similar Documents

Publication Publication Date Title
US8494010B2 (en) Data transfer device, data transmitting device, data receiving device, and data transfer method
US11386025B2 (en) Daisy chain complex commands
KR20120106638A (en) Synchronous data processing system and method
US8588234B2 (en) Data processing apparatus, method, and computer-readable storage medium for dynamically controlling a transmission interval
JP5930767B2 (en) Electronic device, communication control method
JP4160068B2 (en) Digital programming interface between baseband processor and radio frequency integrated module
JP6272847B2 (en) Data transfer between clock domains
JP2010178199A (en) Serial communication system and communication method
JP2010218170A (en) Data transfer device, information processor, arbitration method, and image formation system
JP5334173B2 (en) Data transfer system and retry control method
JP5482306B2 (en) Data transfer control device and electronic device
JP3586603B2 (en) Data transfer device and data transfer method
JP2000299716A (en) Data receiver and data receiving method
JP2022134510A (en) Communication device, method for controlling communication device, program, and storage medium
JP6213003B2 (en) Communication control device, image processing device, communication control program
JP2008047033A (en) Controller and control method
JP5315882B2 (en) Semiconductor device and communication method
JP2023030295A (en) Latch circuit device and port sampling system
JP2005182505A (en) Data transfer controller and image forming apparatus
JP2019133567A (en) Data receiver, data sending/receiving system, and method for controlling data sending/receiving system
JP2013243509A (en) Communication apparatus
JP2010198429A (en) Interruption control unit and image forming apparatus
JP2000003285A (en) Method for processing interruption and circuit therefor
JP2008046874A (en) Data transfer apparatus and method
JP2001005742A (en) Data transfer system

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20120403