JPH06243052A - Serial communication error processing method - Google Patents

Serial communication error processing method

Info

Publication number
JPH06243052A
JPH06243052A JP5029412A JP2941293A JPH06243052A JP H06243052 A JPH06243052 A JP H06243052A JP 5029412 A JP5029412 A JP 5029412A JP 2941293 A JP2941293 A JP 2941293A JP H06243052 A JPH06243052 A JP H06243052A
Authority
JP
Japan
Prior art keywords
level
signal
data
communication
terminal
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
JP5029412A
Other languages
Japanese (ja)
Inventor
Toshiaki Fujimaki
敏明 藤巻
Atsushi Sato
佐藤  淳
Yoshiki Takeoka
良樹 竹岡
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.)
Fujifilm Holdings Corp
Original Assignee
Fuji Photo Film Co Ltd
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 Fuji Photo Film Co Ltd filed Critical Fuji Photo Film Co Ltd
Priority to JP5029412A priority Critical patent/JPH06243052A/en
Publication of JPH06243052A publication Critical patent/JPH06243052A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To prevent a system from becoming hang-up in serial communication. CONSTITUTION:A micro computer 1 transmits an address and transmits/receives data in serial communication with IC 2. In the micro computer 1, an ACK signal recognizes an H level and sets an STB signal to an L level. When IC 2 sets the ACK signal to the L level immediately after it, the address for eight bits or data is transmitted/received as an input/output signal. At that time, an SCK signal transmits a clock pulse. When transmission/reception normally terminates, the ACK signal becomes the H level and the micro computer 1 sets the STB signal to the H level. When the ACK signal does not become the H level even a prescribed time has passed, the micro computer 1 judges that a communication error occurs, compulsorily sets the STB signal to the H level and abnormally terminates communication. When communication abnormally terminates, IC 2 does not latch the address or data in the middle of input. The micro computer sets the STB signal to the L level after abnormal communication terminates, and resumes communication from the address or data where the communication error occurs.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、シリアル通信エラー処
理方法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a serial communication error processing method.

【0002】[0002]

【従来の技術】マイクロコンピュータとICとの間、マ
イクロコンピュータとマイクロコンピュータとの間でデ
ータを通信する際に、データ量が少ない場合はシリアル
通信が用いられることが多い。このシリアル通信は伝送
するデータのビット数に合わせたデータ伝送線の本数が
必要なく、データ線は2本又は1本でよいから、データ
伝送線の本数や接続ピンの個数に制約があったりする場
合に大変便利である。
2. Description of the Related Art When data is communicated between a microcomputer and an IC or between microcomputers, serial communication is often used when the amount of data is small. This serial communication does not require the number of data transmission lines according to the number of bits of data to be transmitted, and the number of data transmission lines may be two or one. Therefore, there are restrictions on the number of data transmission lines and the number of connection pins. Very convenient in case.

【0003】シリアル通信では、データの他にタイミン
グ信号や送受信の状態をそれぞれ相手側に知らせる制御
信号が用いられ、これらの信号は各信号線を用いて入出
力されている。双方が通信を行う場合は、制御信号の状
態からデータ送受信可能状態、送受信待機状態や要求、
送信開始、受け取り完了などの状態を判断している。
In serial communication, in addition to data, timing signals and control signals for notifying the other party of transmission / reception states are used, and these signals are input / output using respective signal lines. When both sides communicate, data transmission / reception possible state, transmission / reception standby state, request,
The status such as transmission start and reception completion is determined.

【0004】[0004]

【発明が解決しようとする課題】しかしながら上記の方
法では、何らかの理由で通信エラーが発生し、通信相手
の一方がデータの入力されるのを待ち、他方はデータの
受け取りの完了信号を待つといった状態が起こることが
ある。この状態になると双方は相手方からの信号を待ち
続けるため、以降のステップに進まないハングアップに
なってしまう。1度ハングアップしてしまったら、外部
から通信のリセット信号を入力したり、装置の電源を切
ってからもう1度入れてイニシャライズをしなくてはこ
の状態から抜け出せないので大変面倒であるとともに、
このようにして復帰したとしても、正常に通信した有効
なデータが消去されたるため、大変都合が悪い。
However, in the above method, a communication error occurs for some reason, one of the communication partners waits for data input, and the other waits for a data reception completion signal. May occur. In this state, both parties continue to wait for the signal from the other party, and the procedure goes to the next step, resulting in a hangup. If you hang up once, you have to input a communication reset signal from the outside or turn off the power of the device and then turn it on again to initialize it.
Even if it recovers in this way, it is very inconvenient because the valid data that was normally communicated is deleted.

【0005】本発明は上記問題点を解消するためになさ
れたもので、通信エラーを確実に判断し、ハングアップ
することなく通信が再開されるようにしたシリアル通信
のエラー処理方法を提供することを目的とする。
The present invention has been made to solve the above problems, and provides an error processing method for serial communication in which a communication error is reliably determined and communication is restarted without hang-up. With the goal.

【0006】[0006]

【課題を解決するための手段】本発明は上記目的を達成
するために、送信側から受信側へデータをシリアルに送
る通信において、送信側から受信側に送信要求信号を送
るための第1の通信線と、受信側から送信側に受信要求
信号を送るための第2の通信線とを設け、データ通信時
に送信側は送信要求信号を発生を開始し、受信要求信号
の発生停止を確認してから送信要求信号の発生を停止
し、受信側は送信要求信号の受取直後からデータの受信
が終了するまで受信要求信号を発生しており、送信要求
信号の発生開始時点から一定時間が経過したときに、受
信要求信号が発生したままであるときには、送信側は通
信エラーが発生したものと判断して送信要求信号の発生
を停止し、その後通信エラーが発生したデータを再送信
するために送信要求信号を発生し、他方受信側は受信要
求信号の発生中に送信要求信号の発生が停止したときに
通信エラーが発生したものと判断して受信中のデータを
廃棄する。
In order to achieve the above object, the present invention provides a first method for transmitting a transmission request signal from a transmission side to a reception side in communication for serially transmitting data from the transmission side to the reception side. A communication line and a second communication line for transmitting a reception request signal from the reception side to the transmission side are provided, and the transmission side starts the generation of the transmission request signal during data communication and confirms that the generation of the reception request signal has stopped. After that, the generation of the transmission request signal is stopped, and the receiving side generates the reception request signal from immediately after receiving the transmission request signal until the end of data reception, and a fixed time has elapsed from the generation start point of the transmission request signal. When the reception request signal is still generated, the transmission side judges that a communication error has occurred, stops the generation of the transmission request signal, and then transmits it to retransmit the data in which the communication error occurred. request The generated items, the other receiving side discards the data being received it is determined that a communication error when the occurrence of the transmission request signal during generation of the received request signal is stopped occurs.

【0007】[0007]

【実施例】図2は本発明を用いて通信を行うマイクロコ
ンピュータとICのブロック図である。同一セット内に
あるマイクロコンピュータ1とIC2は、複数の信号線
で接続されており、この信号線にはSTB信号、ACK
信号、入出力信号、SCK信号、ALD信号、WLR信
号用とがある。IC2はマイクロコンピュータ1から指
定されたアドレスを保持し、そのアドレスにマイクロコ
ンピュータ1が送出したデータを書き込む機能とそのア
ドレスのデータを読み出しマイクロコンピュータ1に送
出できる機能を持っている。
DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 2 is a block diagram of a microcomputer and an IC for communicating using the present invention. The microcomputer 1 and the IC 2 in the same set are connected by a plurality of signal lines, and STB signal and ACK are connected to these signal lines.
There are signals, input / output signals, SCK signals, ALD signals, and WLR signals. The IC 2 holds an address designated by the microcomputer 1 and has a function of writing data sent by the microcomputer 1 to the address and a function of reading data at the address and sending the data to the microcomputer 1.

【0008】STB信号はマイクロコンピュータ1から
の送信要求信号である。ACK信号はIC2からの受信
要求信号である。入出力信号にはアドレスとデータとが
あり、これらは8ビットで構成され、1ビットずつマイ
クロコンピュータ1とIC2との間でやりとりされる。
この8ビットの入出力信号の区切りを示すために、SK
C信号がクロックパルスとしてマイクロコンピュータ1
からIC2に送られる。ALD信号はアドレスとデータ
の選択をする信号であり、マイクロコンピュータ1はア
ドレスを送出するときはALD信号をLレベルにし、デ
ータを入出力するときはHレベルにする。STB信号お
よびALD信号、SCK信号はマイクロコンピュータ1
からIC2に入力される。ACK信号はIC2からマイ
クロコンピュータ1に入力される。マイクロコンピュー
タ1はこのACK信号がクロックパルスの1周期よりも
長い時間経過した後にもHレベルになっていると、AC
K信号がHレベルになったことを検知する。さらに、マ
イクロコンピュータ1はACK信号が一定時間以上Lレ
ベルにあると、通信エラーが発生したと判断しSTB信
号を強制的にHレベルにする。
The STB signal is a transmission request signal from the microcomputer 1. The ACK signal is a reception request signal from IC2. The input / output signal includes an address and data, which are composed of 8 bits and are exchanged bit by bit between the microcomputer 1 and the IC 2.
In order to indicate the division of this 8-bit input / output signal, SK
Microcomputer 1 with C signal as clock pulse
Sent to IC2. The ALD signal is a signal for selecting an address and data, and the microcomputer 1 sets the ALD signal to L level when sending an address and sets it to H level when inputting / outputting data. The STB signal, the ALD signal, and the SCK signal are the microcomputer 1
Is input to IC2. The ACK signal is input from the IC 2 to the microcomputer 1. When the ACK signal is at the H level even after the ACK signal has been longer than one cycle of the clock pulse,
It is detected that the K signal has become H level. Further, when the ACK signal is at the L level for a certain time or longer, the microcomputer 1 determines that a communication error has occurred and forcibly sets the STB signal to the H level.

【0009】WLR信号は、マイクロコンピュータから
指定されたアドレスに、マイクロコンピュータ1からI
C2にデータを書き込むのか、IC2のデータをマイク
ロコンピュータ1に読み出すのかを選択する。マイクロ
コンピュータ1がデータの読み込みを選択してるとき
は、IC2は指定されたアドレスのデータをSCK信号
に同期させて入出力信号として送り出す。また、書き込
みに設定されているときはマイクロコンピュータ1から
のデータを受け取ることができる。
The WLR signal is sent to the address specified by the microcomputer from the microcomputer 1 to I.
It is selected whether to write data to C2 or read the data of IC2 to the microcomputer 1. When the microcomputer 1 selects the reading of data, the IC 2 sends the data at the designated address as an input / output signal in synchronization with the SCK signal. Further, when the writing is set, the data from the microcomputer 1 can be received.

【0010】図1はIC2の主要部の論理回路図であ
る。マイクロコンピュータ1からのSTB信号はORゲ
ート25a、インバータ29a、立ち下がり検出回路2
1及び立ち上がり検出回路22に入力される。立ち下が
り検出回路21はSTB信号の立ち下がり(Hレベルか
らLレベルに変化)で短いパルス(Hレベル)を1個発
生し、そのパルスをJK−FF23のK端子、ANDゲ
ート24a及びORゲート25bに出力する。立ち上が
り検出回路22はSTB信号の立ち上がり(Lレベルか
らHレベルに変化)で短いパルス(Hレベル)を1個発
生し、その出力をANDゲート23b、23c、26、
27に出力する。
FIG. 1 is a logic circuit diagram of the main part of IC2. The STB signal from the microcomputer 1 is an OR gate 25a, an inverter 29a, a fall detection circuit 2
1 and the rising edge detection circuit 22. The fall detection circuit 21 generates one short pulse (H level) at the fall of the STB signal (changes from H level to L level), and outputs the pulse to the K terminal of the JK-FF 23, the AND gate 24a, and the OR gate 25b. Output to. The rising edge detection circuit 22 generates one short pulse (H level) at the rising edge of the STB signal (changes from L level to H level), and outputs its output from the AND gates 23b, 23c, 26,
To 27.

【0011】JK−FF23および後述のJK−FF2
5は共にJK型フリップフロップ回路であり、J端子が
Lレベル、K端子がLレベルでQ端子の出力は変化せ
ず、J端子がHレベル、K端子がLレベルで出力QはH
レベルになり、J端子がLレベル、K端子がHレベルで
出力QはLレベルになり、J端子がHレベル、K端子が
HレベルでQ端子の出力が反転する。Q端子の出力はJ
端子及びK端子の変化が生じてからクロック半周期以内
の遅れで変化する。
JK-FF23 and JK-FF2 described later
Reference numeral 5 is a JK type flip-flop circuit, in which the J terminal is at L level, the K terminal is at L level, the output of the Q terminal does not change, the J terminal is at H level, the K terminal is at L level, and the output Q is at H level.
When the J terminal is at the L level, the K terminal is at the H level, the output Q is at the L level, the J terminal is at the H level, the K terminal is at the H level, and the output of the Q terminal is inverted. The output of the Q terminal is J
It changes with a delay within half a clock cycle after the change of the terminal and the K terminal occurs.

【0012】マイクロコンピュータ1から送出されたS
CK信号は、ANDゲート29に入力される。インバー
タ29aの出力は、ANDゲート29に入力されてお
り、STB信号がLレベルの時のみにSCK信号のクロ
ックパルスはカウンタ24及びANDゲート25cに入
力される。カウンタ24はSCK信号のクロックパルス
の立ち下がりで計数し、そのカウント数は2進数で低い
桁からQA端子、QB端子、QC端子、QD端子、CO
端子の順に出力する。カウンタ24は24aからパルス
(Hレベル)が送られるとその値を「0」にする(QA
端子〜QD端子,CO端子の出力が全てLレベルにな
る)。QA端子,QB端子,QC端子の出力はNORゲ
ート25dに、QD端子の出力はインバータ25eを介
してNORゲート25dに入力されている。
S sent from the microcomputer 1
The CK signal is input to the AND gate 29. The output of the inverter 29a is input to the AND gate 29, and the clock pulse of the SCK signal is input to the counter 24 and the AND gate 25c only when the STB signal is at the L level. The counter 24 counts at the falling edge of the clock pulse of the SCK signal, and the count number is a binary number from the lowest digit to the QA terminal, QB terminal, QC terminal, QD terminal, CO
Output in the order of terminals. When the pulse (H level) is sent from the counter 24a, the counter 24 sets its value to "0" (QA
The outputs from the terminals to the QD terminal and the CO terminal are all at the L level). The outputs of the QA terminal, QB terminal and QC terminal are input to the NOR gate 25d, and the output of the QD terminal is input to the NOR gate 25d via the inverter 25e.

【0013】ORゲート27aにはNORゲート25d
の出力及びカウンタ24のCO端子の出力が入力され
る。カウンタはSCK信号のクロックパルスを1から順
に計数していき8個目にQD端子〜QA端子の出力が
「H,L,L,L」になるので、出力がHレベルにな
る。カウンタ24がクロックパルスを16個目を計数し
たときには、CO端子の出力が「H」になっている。
The OR gate 27a has a NOR gate 25d.
And the output of the CO terminal of the counter 24 are input. The counter sequentially counts the clock pulses of the SCK signal from 1 and the outputs from the QD terminal to the QA terminal become "H, L, L, L" at the eighth position, so that the output becomes the H level. When the counter 24 counts the 16th clock pulse, the output of the CO terminal is "H".

【0014】ORゲート27aの出力はワンショット回
路27に入力される。カウンタ24のCO端子の出力は
ワンショット回路28にも入力されている。ワンショッ
ト回路27及び28は入力される信号の立ち上がりで短
いパルスを1個出力する。ワンショット回路27からの
パルスはORゲート25aに入力される。ワンショット
回路28のパルスはORゲート23aに入力される。A
LD信号はANDゲート27に入力され、またALD信
号はインバータ26aを介してANDゲート23b、2
6に入力されている。
The output of the OR gate 27a is input to the one-shot circuit 27. The output of the CO terminal of the counter 24 is also input to the one-shot circuit 28. The one-shot circuits 27 and 28 output one short pulse at the rising edge of the input signal. The pulse from the one-shot circuit 27 is input to the OR gate 25a. The pulse of the one-shot circuit 28 is input to the OR gate 23a. A
The LD signal is input to the AND gate 27, and the ALD signal is passed through the inverter 26a to the AND gates 23b and 2b.
It has been entered in 6.

【0015】ORゲート25aからの出力はJK−FF
25のJ端子に入力されている。JK−FF25のK端
子にはORゲート25bの出力が入力されている。OR
ゲート25bの入力にはANDゲート25cの出力が入
力されている。JK−FF25のQの出力はACK信号
として出力され、さらにANDゲート25c、26、2
7に入力されている。INV−Q端子からはQ端子の出
力を反転した出力がされる。INV−Q端子の出力はA
NDゲート23cに入力されている。
The output from the OR gate 25a is JK-FF.
It is input to the J terminal of 25. The output of the OR gate 25b is input to the K terminal of the JK-FF25. OR
The output of the AND gate 25c is input to the input of the gate 25b. The Q output of the JK-FF 25 is output as an ACK signal, and the AND gates 25c, 26, 2
It is entered in 7. The INV-Q terminal outputs an inverted version of the output from the Q terminal. INV-Q terminal output is A
It is input to the ND gate 23c.

【0016】ANDゲート23bの出力はORゲート2
3aに入力されている。ANDゲート23cの出力はO
Rゲート23aに入力されている。23aの出力はJK
−FF23のJ端子に入力されている。JK−FF23
のQ端子の出力はANDゲート24a及び27に入力さ
れている。
The output of the AND gate 23b is the OR gate 2
It is input to 3a. The output of the AND gate 23c is O
It is input to the R gate 23a. The output of 23a is JK
-It is input to the J terminal of FF23. JK-FF23
The output of the Q terminal of is input to the AND gates 24a and 27.

【0017】ANDゲート26はADWTE信号を出力
する。ANDゲート26が出力するパルスによってIC
2はマイクロコンピュータ1が送出したアドレスをラッ
チする。また、ANDゲート27はDWTE信号を出力
する。ANDゲート27が出力するパルスによってマイ
クロコンピュータ1から送出されたデータをラッチす
る。
AND gate 26 outputs the ADWTE signal. The IC output by the pulse output from the AND gate 26
2 latches the address sent by the microcomputer 1. Also, the AND gate 27 outputs the DWTE signal. The data output from the microcomputer 1 is latched by the pulse output from the AND gate 27.

【0018】次に図2に示す回路の作用について、図3
から図6を参照して説明する。電源投入時の初期状態と
して、STB信号、JK−FF23のQ端子、ALD信
号はHレベルに設定される。正常な通信のときは次のよ
うに作動する。まずマイクロコンピュータ1はACK信
号のHレベルを検知するとALD信号、WLR信号及び
STB信号をLレベルにする。このときのLレベルにす
るタイミングはALD信号、WLR信号、STB信号を
同時にLレベルにしてもよいし、STB信号を少し遅ら
せてもよい。
Next, the operation of the circuit shown in FIG. 2 will be described with reference to FIG.
From now on, referring to FIG. As the initial state when the power is turned on, the STB signal, the Q terminal of the JK-FF 23, and the ALD signal are set to the H level. In normal communication, it operates as follows. First, when the microcomputer 1 detects the H level of the ACK signal, it sets the ALD signal, the WLR signal and the STB signal to the L level. At this time, the ALD signal, the WLR signal, and the STB signal may be set to the L level at the same time, or the STB signal may be slightly delayed.

【0019】STB信号の立ち下がりによって立ち下が
り検出回路21からのパルスが出力されると、JK−F
F23のQ端子がHレベルになっているので、ANDゲ
ート24aからパルスが出力され、カウンタ24をクリ
アする。またJK−FF23のK端子もHレベルが入力
されるので少し遅れてQはLレベルになる。さらに、J
K−FF25のJ端子はLレベルになり、K端子はHレ
ベルが入力されるのでJK−FF25のQ端子から出力
されるACK信号は少し遅れてLレベルになる。
When a pulse is output from the fall detection circuit 21 due to the fall of the STB signal, JK-F
Since the Q terminal of F23 is at H level, a pulse is output from the AND gate 24a and the counter 24 is cleared. Further, since the H level is also input to the K terminal of the JK-FF 23, Q becomes the L level with a slight delay. Furthermore, J
Since the J terminal of the K-FF 25 becomes L level and the H terminal is inputted at H level, the ACK signal output from the Q terminal of the JK-FF 25 becomes L level with a little delay.

【0020】マイクロコンピュータ1はACK信号がL
レベルになるのを確認すると、SCK信号で8個のクロ
ックパルスの送出とともに、入出力信号として8ビット
のアドレスデータのを送出する。クロックパルス8個目
をカウンタ24が計数するとJK−FF25のJ端子に
はHレベルが入力され、ACK信号はHレベルになる。
マイクロコンピュータ1は、ACK信号がHレベルにな
ったのを検知すると、STB信号をHレベルにする。
In the microcomputer 1, the ACK signal is L
When it is confirmed that the level is reached, eight clock pulses are sent by the SCK signal and 8-bit address data is sent as an input / output signal. When the counter 24 counts the eighth clock pulse, the H level is input to the J terminal of the JK-FF 25, and the ACK signal goes to the H level.
When the microcomputer 1 detects that the ACK signal has become H level, it sets the STB signal to H level.

【0021】STB信号が立ち上がると、立ち上がり検
出回路22がパルスを送出する。これにより、ALD信
号をインバータ26aで反転さセた信号及びJK−FF
25のQ端子がHレベルになっているから、ANDゲー
ト26がADWTE信号のパルスを出力する。このAD
WTE信号によってIC2にマイクロコンピュータ1か
ら送出されたアドレスデータがラッチされる。また、J
K−FF23のJ端子にはHレベルが入力されるので、
Q端子はHレベルになる。その後JK−FF25のQ端
子にはSTB信号のHレベルが入力されるが、QはHレ
ベルの状態から変化はしない。
When the STB signal rises, the rising edge detection circuit 22 sends out a pulse. As a result, the signal obtained by inverting the ALD signal by the inverter 26a and the JK-FF
Since the Q terminal of 25 is at H level, the AND gate 26 outputs a pulse of the ADWTE signal. This AD
The address data sent from the microcomputer 1 is latched in the IC 2 by the WTE signal. Also, J
Since the H level is input to the J terminal of K-FF23,
The Q terminal becomes H level. After that, the H level of the STB signal is input to the Q terminal of the JK-FF 25, but Q does not change from the H level state.

【0022】マイクロコンピュータ1はACK信号がH
レベルであることを確認した後に、ALD信号をHレベ
ルにし、WLR信号をデータ書き込みまたは読み出しに
設定し、STB信号をLレベルにする。STB信号が立
ち下がると、立ち下がり検出回路21からパルスが出力
され、カウンタ24はクリアされる。さらにJK−FF
23ではK端子にHレベルが入力され、遅れてQ端子が
Lレベルになる。また、JK−FF25では、J端子は
Lレベルになり、K端子にはHレベルが入力されるか
ら、遅れてQ端子すなわちACK信号がLレベルにな
る。
In the microcomputer 1, the ACK signal is H
After confirming the level, the ALD signal is set to the H level, the WLR signal is set to write or read data, and the STB signal is set to the L level. When the STB signal falls, a pulse is output from the fall detection circuit 21 and the counter 24 is cleared. Furthermore JK-FF
At 23, the H level is input to the K terminal, and the Q terminal becomes the L level after a delay. Further, in the JK-FF 25, the J terminal is at the L level and the K terminal is at the H level, so that the Q terminal, that is, the ACK signal is at the L level with a delay.

【0023】ACK信号のLレベルをマイクロコンピュ
ータ1が確認すると、クロックパルスの送出とともに入
出力信号でデータの上位8ビットを送受信する。カウン
タ24が8個のパルスを計数すると、JK−FF25で
はJ端子にHレベルが入力されてACK信号がHレベル
になる。マイクロコンピュータ1は、ACK信号のHレ
ベルを検知してから、STB信号をHレベルにする。こ
のときJK−FF23のJ端子はHレベルにならないの
でQ端子はLレベルのままである。この時点でDWTE
信号のパルスは出ていないから、データをラッチしな
い。
When the microcomputer 1 confirms the L level of the ACK signal, the upper 8 bits of data are transmitted / received by the input / output signal together with the transmission of the clock pulse. When the counter 24 counts eight pulses, the H level is input to the J terminal of the JK-FF 25 and the ACK signal goes to the H level. After detecting the H level of the ACK signal, the microcomputer 1 sets the STB signal to the H level. At this time, the J terminal of the JK-FF 23 does not go to the H level, so the Q terminal remains at the L level. At this point DWTE
Since the signal is not pulsed, it does not latch the data.

【0024】マイクロコンピュータ1は、一定時間後に
STB信号をLレベルにする。このとき立ち下がり検出
回路21からパルスが出力されても、JK−FF23の
Q端子はLレベルであるから、カウンタはクリアされな
い。JK−FF25ではK端子にHレベルが入力される
ので、少し遅れてACK信号はLレベルになる。マイク
ロコンピュータ1は、ACK信号のLレベルを確認した
後に、8個のクロックを送出し、データの下位8ビット
の送受信を行う。この送受信が終了すると、カウンタ2
4のカウント数は16になるから、JK−FF23のJ
端子及びJK−FF25のJ端子にはHレベルが入力さ
れ、これによりJK−FF23のQ端子及びACK信号
はHレベルになる。
The microcomputer 1 sets the STB signal to L level after a fixed time. At this time, even if a pulse is output from the fall detection circuit 21, the counter is not cleared because the Q terminal of the JK-FF 23 is at L level. Since the H level is input to the K terminal in the JK-FF25, the ACK signal goes to the L level with a slight delay. After confirming the L level of the ACK signal, the microcomputer 1 sends out eight clocks and transmits / receives the lower 8 bits of data. When this transmission / reception ends, the counter 2
The count number of 4 becomes 16, so J of JK-FF23
The H level is input to the terminal and the J terminal of the JK-FF 25, whereby the Q terminal of the JK-FF 23 and the ACK signal become the H level.

【0025】マイクロコンピュータ1は、ACK信号が
Hレベルになったことを検知すると、STB信号をHレ
ベルにする。ALD信号、JK−FF23、25のQ端
子がHレベルになっているから、立ち上がり検出回路2
2からのパルスでANDゲート27はDWTE信号のパ
ルスを送出する。データ書き込みに設定されているとき
は、IC2に16ビットのデータがラッチされる。な
お、マイクロコンピュータ1にデータが送出されたとき
は、例えばレジスタに保持するようにすればよい。ST
B信号はHレベルになっているので、JK−FF25の
J端子はHレベルになって初期状態にもどる。必要なデ
ータの送受信が終了するまでこの動作を繰り返す。
When the microcomputer 1 detects that the ACK signal has become H level, it sets the STB signal to H level. Since the ALD signal and the Q terminals of the JK-FFs 23 and 25 are at the H level, the rise detection circuit 2
With the pulse from 2, the AND gate 27 sends out a pulse of the DWTE signal. When data writing is set, 16-bit data is latched in IC2. When the data is sent to the microcomputer 1, it may be held in a register, for example. ST
Since the B signal is at the H level, the J terminal of the JK-FF 25 goes to the H level and returns to the initial state. This operation is repeated until transmission / reception of necessary data is completed.

【0026】次に通信エラーが発生したときの動作につ
いて説明する。上記で図3のタイミングを示したよう
に、マイクロコンピュータ1がSTB信号をLレベルに
したのち、通信が正常終了した場合はACK信号よりも
先にSTB信号がHレベルになっている。しかし、何ら
かの理由で通信が正常終了しないときは、図4のように
マイクロコンピュータ1は、ACK信号が一定時間以上
経過してもHレベルを検知できないので、通信がエラー
が発生したと判断し強制的にSTB信号をHレベルにす
る。ここでACK信号は遅れてHレベルになるから、S
TB信号はACK信号よりも先にHレベルになり異常終
了する。STB信号がHレベルになってイル間はSCK
信号はANDゲート29から先には送出されない。
Next, the operation when a communication error occurs will be described. As described above with reference to the timing of FIG. 3, after the microcomputer 1 sets the STB signal to the L level and the communication is normally completed, the STB signal is set to the H level before the ACK signal. However, if the communication does not end normally for some reason, the microcomputer 1 cannot detect the H level even after the ACK signal has passed for a certain period of time as shown in FIG. Then, the STB signal is set to H level. Here, since the ACK signal is delayed and becomes H level, S
The TB signal goes to H level before the ACK signal and ends abnormally. STB signal goes to H level and SCK between
No signal is sent out from AND gate 29 first.

【0027】異常終了したときに立ち上がり検出回路2
2からパルスが送出されてもJK−FF25のQ端子は
まだLレベルである。これによってIC2は通信エラー
を知り、入力中のアドレス又はデータをラッチせずにこ
れらを廃棄する。JK−FF25のINV−Q端子はH
レベルになっているので、立ち上がり検出回路22から
パルスが送出されると、ANDゲート23cからJK−
FF23のJ端子にHレベルが入力されJK−FF23
のQ端子をHレベルにする。その後マイクロコンピュー
タ1は、エラーが発生した時のアドレスまたはデータを
再送するために、STB信号をLレベルにする。
Rising detection circuit 2 upon abnormal termination
Even if the pulse is transmitted from 2, the Q terminal of the JK-FF 25 is still at the L level. As a result, the IC 2 recognizes a communication error and discards the input address or data without latching them. INV-Q terminal of JK-FF25 is H
Since it is at the level, when a pulse is sent from the rising edge detection circuit 22, the AND gate 23c outputs JK-
H level is input to the J terminal of FF23 and JK-FF23
Q terminal of H level. After that, the microcomputer 1 sets the STB signal to the L level in order to retransmit the address or the data when the error occurs.

【0028】例えばクロックの少ない場合や、カウンタ
24のクロックのカウントミスなどなど、何らかの理由
でカウンタ24のカウント数が8または16にならない
状態が一定時間以上続くと、通信エラーが生じたものと
判断してマイクロコンピュータ1はSTB信号を強制的
にHレベルにする。そして前述したように、通信エラー
が発生した入出力信号から再送信する。
For example, if the count of the counter 24 does not reach 8 or 16 for a certain period of time for some reason, such as when the number of clocks is small or the clock count of the counter 24 is missed, it is determined that a communication error has occurred. Then, the microcomputer 1 forcibly sets the STB signal to the H level. Then, as described above, retransmission is performed from the input / output signal in which the communication error has occurred.

【0029】図5はクロックの多い場合のタイミングを
示したものである。例えばSCK信号にノイズが乗って
しまうなどして、本来の8個目または16個目のパルス
の前にカウンタが8または16個を数えると(ここで図
5では16個目のみの変化は破線で示してある)、JK
−FF25のQ端子すなわちACK信号がHレベルにな
る。しかし、8個または16個目をカウンタが計数した
後にもSCK信号のクロックがIC2に入力されてく
る。ANDゲート25cは、JK−FF25からの入力
がすでにHレベルになっている。見掛け上9個または1
7個目のクロックのHレベルが入力されてくると、OR
ゲート25bを介してJK−FF25のK端子にHレベ
ルを入力する。この時すでにワンショット回路27から
の出力はLレベルになっており、またカウンタ24のC
O端子にも変化がないので、再びワンショット回路27
からパルスが出力されることもなく、したがってJK−
FF25のJ端子はLレベルになっている。
FIG. 5 shows the timing when there are many clocks. For example, if the counter counts 8 or 16 before the original 8th or 16th pulse due to noise on the SCK signal (in FIG. 5, the change of only the 16th pulse is a broken line). ,), JK
-The Q terminal of the FF 25, that is, the ACK signal becomes H level. However, the clock of the SCK signal is input to the IC2 even after the counter has counted the 8th or 16th counter. In the AND gate 25c, the input from the JK-FF 25 is already at H level. Apparently 9 or 1
When the H level of the 7th clock is input, OR
The H level is input to the K terminal of the JK-FF 25 via the gate 25b. At this time, the output from the one-shot circuit 27 is already at L level, and the counter 24 C
Since there is no change in the O terminal, the one-shot circuit 27 is again used.
No pulse is output from JK-
The J terminal of the FF 25 is at the L level.

【0030】JK−FF25のK端子にHレベルが入力
されることで、ACK信号がHレベルになってから、最
長でもクロックパルスの1周期以内の時間にはLレベル
になっている。ここではマイクロコンピュータ1はAC
K信号を検知しない。本来の8個または16個目のクロ
ックパルスが送出され、カウンタ24で計数されている
途中でも終了後でもACK信号のLレベルの状態は変化
しない。一定時間後にマイクロコンピュータ1は、通信
エラーと判断してSTB信号をHレベルにする。前記と
同様に再送が開始される。
Since the H level is input to the K terminal of the JK-FF 25, the ACK signal is at the L level during the maximum time within one cycle of the clock pulse after the ACK signal is at the H level. Here, the microcomputer 1 is AC
K signal is not detected. The original 8th or 16th clock pulse is sent out, and the L-level state of the ACK signal does not change during or after counting by the counter 24. After a certain period of time, the microcomputer 1 determines that there is a communication error and sets the STB signal to H level. Retransmission is started as described above.

【0031】また、通信が中断した後の通信については
アドレスとデータの関係が崩れている可能性があるか
ら、IC2は前述しているように、ALD信号がLレベ
ルの場合は常にアドレスとする。図6の(a)のよう
に、続けてALD信号がLレベルでもIC2はアドレス
を受け取るものとする。また図6の(b)のように上位
8ビットのデータの送受信の後で、ALD信号がHレベ
ルからLレベルになっても、IC2はアドレス2を受け
取る。このときアドレス1に対応する上位8ビットのデ
ータ1はラッチされることはない。
Further, since there is a possibility that the relationship between the address and the data is broken in the communication after the communication is interrupted, the IC2 always uses the address when the ALD signal is at the L level as described above. . As shown in FIG. 6A, it is assumed that the IC 2 receives the address even if the ALD signal is at the L level. Further, as shown in FIG. 6B, the IC2 receives the address 2 even if the ALD signal changes from the H level to the L level after the transmission and reception of the upper 8 bits of data. At this time, the upper 8 bits of data 1 corresponding to address 1 are not latched.

【0032】以上のように、IC2とマイクロコンピュ
ータ1は通信エラーが発生しても双方で通信の終了を待
ち続けることがなくなり、ハングアップすることなく通
信を再開するようになった。
As described above, even if a communication error occurs, the IC 2 and the microcomputer 1 do not continue to wait for the end of communication, and communication is resumed without hangup.

【0033】上記の実施例では、マイクロコンピュータ
とIC間のについて説明したが、マイクロコンピュータ
とマイクロコンピュータ間についても同様なプロトコル
を用いてもよい。また、同一セット内における通信だけ
でなくセット間の通信も可能である。アドレスとデータ
の識別にALD信号線を使用したが、この信号線はなく
てもよい。データの読み出しと書き込み用にWLR信号
線を使用したが、この信号線はなくてもよい。
In the above embodiment, the description has been made between the microcomputer and the IC, but a similar protocol may be used between the microcomputers. Further, not only communication within the same set but also communication between sets is possible. Although the ALD signal line is used for identifying the address and the data, this signal line may be omitted. Although the WLR signal line is used for reading and writing data, this signal line is not necessary.

【0034】[0034]

【発明の効果】以上に述べたように、本発明の通信エラ
ー処理方法によれば送信側と受信側との間に、送信要求
信号を送る通信線と、受信要求信号を送る通信線とを設
け、通信開始から一定時間経過してもデータが送信が終
了しないときは通信エラーが発生したものと判断し、通
信エラーが生じたデータの再送信を行うようにしたか
ら、ハングアップになることを防止することができる。
また、この信号の状態から、通信エラーを制御するか
ら、確実かつ簡単である。
As described above, according to the communication error processing method of the present invention, the communication line for transmitting the transmission request signal and the communication line for transmitting the reception request signal are provided between the transmitting side and the receiving side. If the data transmission does not end within a certain time after the start of communication, it is determined that a communication error has occurred, and the data with the communication error is retransmitted. Can be prevented.
Further, since the communication error is controlled from the state of this signal, it is reliable and simple.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の方法を実施するICの主要部のロジッ
ク図である。
FIG. 1 is a logic diagram of the main parts of an IC implementing the method of the present invention.

【図2】マイクロコンピュータとICとのシリアル通信
を示すブロック図である。
FIG. 2 is a block diagram showing serial communication between a microcomputer and an IC.

【図3】実施例のロジック回路の正常通信時を示すタイ
ミングチャートである。
FIG. 3 is a timing chart showing normal communication of the logic circuit of the embodiment.

【図4】通信エラー時のタイミングチャートである。FIG. 4 is a timing chart when a communication error occurs.

【図5】別の通信エラー時のタイミングチャートであるFIG. 5 is a timing chart when another communication error occurs.

【図6】ALD信号による動作説明図である。FIG. 6 is an operation explanatory diagram according to an ALD signal.

【符号の説明】[Explanation of symbols]

1 マイクロコンピュータ 2 IC 23,25 JK−FF 24 カウンタ 1 Microcomputer 2 IC 23,25 JK-FF 24 counter

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 送信側から受信側へデータをシリアルに
送るシリアル通信において、前記送信側から受信側に送
信要求信号を送るための第1の通信線と、受信側から送
信側に受信要求信号を送るための第2の通信線とを設
け、データ通信時に送信側は送信要求信号の発生を開始
し、受信要求信号の発生停止を確認してから送信要求信
号の発生を停止し、受信側は送信要求信号の受取直後か
らデータの受信が終了するまで受信要求信号を発生して
おり、送信要求信号の発生開始時点から一定時間が経過
したときに、受信要求信号が発生したままであるときに
は、送信側は通信エラーが発生したものと判断して送信
要求信号の発生を停止し、その後通信エラーが発生した
データを再送信するために送信要求信号を発生し、他方
受信側は受信要求信号の発生中に送信要求信号の発生が
停止したときに通信エラーが発生したものと判断して受
信中のデータを廃棄することを特徴とするシリアル通信
エラー処理方法。
1. In serial communication for transmitting data serially from a transmitting side to a receiving side, a first communication line for transmitting a transmission request signal from the transmitting side to the receiving side, and a receiving request signal from the receiving side to the transmitting side. And a second communication line for transmitting the data, the transmitting side starts generation of the transmission request signal during data communication, confirms that the reception request signal is not generated, and then stops generation of the transmission request signal. Generates a reception request signal immediately after receiving the transmission request signal until the end of data reception, and when the reception request signal continues to be generated when a certain time has elapsed from the time when the generation of the transmission request signal started. , The transmitting side determines that a communication error has occurred, stops the generation of the transmission request signal, and then generates the transmission request signal to retransmit the data with the communication error, while the receiving side receives the reception request signal. A method for processing serial communication error, characterized in that it is judged that a communication error has occurred when the generation of the transmission request signal is stopped while the data is being generated, and the data being received is discarded.
JP5029412A 1993-02-18 1993-02-18 Serial communication error processing method Pending JPH06243052A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5029412A JPH06243052A (en) 1993-02-18 1993-02-18 Serial communication error processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5029412A JPH06243052A (en) 1993-02-18 1993-02-18 Serial communication error processing method

Publications (1)

Publication Number Publication Date
JPH06243052A true JPH06243052A (en) 1994-09-02

Family

ID=12275422

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5029412A Pending JPH06243052A (en) 1993-02-18 1993-02-18 Serial communication error processing method

Country Status (1)

Country Link
JP (1) JPH06243052A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7257742B2 (en) 2001-12-14 2007-08-14 Funai Electric Co., Ltd. Disk reproducing apparatus
US7257656B1 (en) 1999-04-19 2007-08-14 Moeller Gmbh Device for synchronous transmission of data between a master device and a slave device
CN102929830A (en) * 2012-11-08 2013-02-13 浙江绍兴苏泊尔生活电器有限公司 Software simulation rapid communication protocol
US8972638B2 (en) 2007-09-18 2015-03-03 Kowa Company, Ltd. Serial data communication system and serial data communication method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7257656B1 (en) 1999-04-19 2007-08-14 Moeller Gmbh Device for synchronous transmission of data between a master device and a slave device
US7257742B2 (en) 2001-12-14 2007-08-14 Funai Electric Co., Ltd. Disk reproducing apparatus
US8972638B2 (en) 2007-09-18 2015-03-03 Kowa Company, Ltd. Serial data communication system and serial data communication method
CN102929830A (en) * 2012-11-08 2013-02-13 浙江绍兴苏泊尔生活电器有限公司 Software simulation rapid communication protocol

Similar Documents

Publication Publication Date Title
US6275526B1 (en) Serial data communication between integrated circuits
JPH0319740B2 (en)
JPH0612906B2 (en) How to communicate data
KR940002144B1 (en) Data transfer system
JPH0228939B2 (en)
JPH06243052A (en) Serial communication error processing method
JPH07273809A (en) Circuit and method for detecting data collision in communication network
US7408958B2 (en) Device for transmitting asynchronous data having clock deviation control
Cook IEEE 1355 data-strobe links: ATM speed at RS232 cost
EP0405041A1 (en) Terminal adapter having a multiple HDLC communication channels receiver for processing control network management frames
US6920577B2 (en) Clock selection circuit for selecting between an external clock and a clock generated by comparing a count value with a setting value
JPH08279803A (en) Burst signal detection circuit
US5365224A (en) Error recovery arrangement in a time division multiplex data transmission system
JPS63290033A (en) Data transmission reception circuit
JPH07212413A (en) Reception circuit for asynchronous data
KR100267344B1 (en) Apparatus and method for collision protecting of transmitting data in hdlc bus structured switching system
JPH0773286B2 (en) Data transmission method
KR920004806Y1 (en) Noise eliminating circuit in serial data transmission system
JP2573210B2 (en) Communications system
JP2619939B2 (en) Synchronous pattern detection circuit
KR100334190B1 (en) Multistation communication bus system and master station used for it
JP3488378B2 (en) Serial data communication device and error checking method for serial data communication device
KR100207482B1 (en) Parity checking device for smart card
JP2774318B2 (en) Transmission control signal detection device and control method therefor
JP3296905B2 (en) Pattern detection circuit and facsimile machine