JPH0467221B2 - - Google Patents

Info

Publication number
JPH0467221B2
JPH0467221B2 JP62310666A JP31066687A JPH0467221B2 JP H0467221 B2 JPH0467221 B2 JP H0467221B2 JP 62310666 A JP62310666 A JP 62310666A JP 31066687 A JP31066687 A JP 31066687A JP H0467221 B2 JPH0467221 B2 JP H0467221B2
Authority
JP
Japan
Prior art keywords
data
timing
serial communication
signal
channel
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.)
Expired
Application number
JP62310666A
Other languages
Japanese (ja)
Other versions
JPH01150957A (en
Inventor
Shinobu Ide
Hirotoshi Tono
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.)
Denso Ten Ltd
Original Assignee
Denso Ten 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 Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP62310666A priority Critical patent/JPH01150957A/en
Publication of JPH01150957A publication Critical patent/JPH01150957A/en
Publication of JPH0467221B2 publication Critical patent/JPH0467221B2/ja
Granted legal-status Critical Current

Links

Landscapes

  • Information Transfer Systems (AREA)
  • Computer And Data Communications (AREA)

Description

【発明の詳細な説明】 〔概要〕 シリアル通信機能を1チヤネル(ch)分しか
有しないマイクロプロセツサユニツトMPUを用
いて、互いに非同期に通信要求を発生する2chの
シリアル通信源と通信する場合、1chは同じデー
タを他チヤンネルと異なる周期で2回送信し、も
う一方のチヤンネルはデータを1回送信する。
MPU側では両データが衝突するときは後者のデ
ータを優先的に受信し、前者のデータは非衝突時
に受信することで効率良い通信を行う。
[Detailed Description of the Invention] [Summary] When communicating with a 2-channel serial communication source that generates communication requests asynchronously to each other using a microprocessor unit MPU that has a serial communication function for only one channel (ch), One channel transmits the same data twice at different intervals from other channels, and the other channel transmits data once.
On the MPU side, when both data collide, the latter data is received preferentially, and the former data is received when there is no collision, thereby achieving efficient communication.

〔産業上の利用分野〕 本発明は、1chのシリアル通信機能で非同期な
2chのデータを効率良く取り込むことができるよ
うにしたマイクロコンピユータのシリアル通信方
式に関する。
[Industrial Application Field] The present invention provides asynchronous communication using a 1ch serial communication function.
This paper relates to a serial communication method for microcomputers that allows efficient acquisition of 2ch data.

〔従来の技術〕[Conventional technology]

第7図aに示すように1ch分のシリアル通信機
能しか有しない装置C(例えばマイクロプロセツ
サMPU)が、装置A(例えばキーボードKB)お
よび装置B(例えばA/DコンバータADC)から
データを取り込む必要のあるシステムでは、次の
様な方法でデータの衝突を回避する。
As shown in Figure 7a, device C (e.g. microprocessor MPU) which has only one channel of serial communication function takes in data from device A (e.g. keyboard KB) and device B (e.g. A/D converter ADC). In systems where this is necessary, data collisions can be avoided using the following methods.

(1) 装置Cからの送信要求により装置A,Bの信
号タイミングをとる。
(1) The signal timing of devices A and B is determined based on the transmission request from device C.

(2) 装置Cは受信確認信号を送出し、装置A,B
は装置Cが信号を受信するまでデータを送信す
る。
(2) Device C sends a reception confirmation signal, and devices A and B
transmits data until device C receives the signal.

(3) 第7図bに示すように装置A,Bが重ならな
いように送信タイミングをずらす。
(3) As shown in FIG. 7b, the transmission timings of devices A and B are shifted so that they do not overlap.

〔発明か解決しようとする問題点〕[The problem that the invention attempts to solve]

(1)の方法は装置Aの送信データの有無が判明し
ないので効率が悪い。
Method (1) is inefficient because it is not clear whether there is data transmitted by device A.

(2)の方法は双方向回線や専用信号線が必要な
上、通信プロトコルが複雑となる。
Method (2) requires bidirectional lines and dedicated signal lines, and the communication protocol is complicated.

(3)の方法はタイミングを制御するための信号が
必要となる。
Method (3) requires a signal to control timing.

本発明は装置A,Bのデータを異なる周期で再
送させる方法を基礎として、非同期データの衝突
を回避しながら受信しようとするものである。
The present invention is based on a method of retransmitting data from devices A and B at different cycles, and attempts to receive data while avoiding collisions of asynchronous data.

〔問題点を解決するための手段〕[Means for solving problems]

第1図は本発明の基本構成図である。装置Cは
1つのシリアル入力端子Siしか有しないので、装
置A,Bからのシリアルデータ,は切替スイ
ツチSWで選択する。このスイツチSWの切替制
御は装置CのポートP1の出力により、装置Bか
らのデータ収集タイミング(例えばADスター
ト)に同期して行われる。装置Aは同じデータを
2回、Bとは異なる周期で再送するように設定さ
れている。
FIG. 1 is a basic configuration diagram of the present invention. Since device C has only one serial input terminal Si, serial data from devices A and B are selected by a changeover switch SW. This switching control of the switch SW is performed by the output of the port P1 of the device C in synchronization with the data collection timing from the device B (for example, AD start). Device A is set to retransmit the same data twice at a different cycle than device B.

〔作用〕[Effect]

装置Aは装置Cの予想できないタイミングでデ
ータを送信する。これに対し装置Bは装置Cの
予測できるタイミングでデータを返送する。従
つて、装置Aがデータを送信しない限りデータ
が問題なく収集できる。
Device A transmits data at a timing that device C cannot predict. In response, device B returns data at a timing that device C can predict. Therefore, as long as device A does not transmit data, data can be collected without any problem.

これに対し、装置Aが非同期にデータを送信
すると、データと衝突することがある。しか
し、第2図のようにデータの再送周期TAとデ
ータの送信周期TBを異ならせておくと、2回
のデータ送信のうち1回は衝突しても残り1回は
衝突しない。
On the other hand, if device A sends data asynchronously, data may collide. However, if the data retransmission period T A and the data transmission period T B are made different as shown in FIG. 2, even if one of the two data transmissions collides, the remaining one will not.

具体的には、データの送信周期TBをデータ
の再送周期TAより長く設定し、特にデータ
の送信間隔TABをデータの1回の送信時間TBW
より長くすることで、データ,が2回続けて
衝突することを回避できる。
Specifically, the data transmission period T B is set to be longer than the data retransmission period T A , and in particular, the data transmission interval T AB is set to be longer than the data retransmission period T BW.
By making it longer, data can be prevented from colliding twice in a row.

装置Cはデータの送信開始信号を受けるとフ
ラグFをセツトする(F=1)。途中データの
要求が生じたとき、または受信データが異常なと
きは該フラグをリセツトする(F=0)。そして、
F=0となつたら、再び送信開始信号を受信する
まではデータ側のシリアル信号が入力されても
無視する。これに対し、F=1のまま正常にデー
タの送信終了信号を受信したらデータを受信
できたのでF=0にし、次回の受信に備える。
When device C receives the data transmission start signal, it sets flag F (F=1). When a request for intermediate data occurs or when the received data is abnormal, the flag is reset (F=0). and,
When F=0, even if a serial signal on the data side is input, it is ignored until the transmission start signal is received again. On the other hand, if the data transmission end signal is normally received with F=1, the data has been successfully received, so F=0 is set and preparations are made for the next reception.

〔実施例〕〔Example〕

第3図は本発明の一実施例を示す構成図で、C
は自動車用エンジンの性能評価装置である。この
装置CはキーボードAからの演算指示を受けてア
ナログ入力のデータ変換を行い、D/Aコンバー
タから出力する機能を有する。例えばキーボード
Aからセンサ出力(アナログ入力)のダイナミツ
クレンジを変えたりオフセツトを加えることで、
センサ劣化時の特性等を模擬的に出力できる。
FIG. 3 is a configuration diagram showing an embodiment of the present invention, and C
is a performance evaluation device for automobile engines. This device C has a function of receiving calculation instructions from the keyboard A, converting analog input data, and outputting the converted data from the D/A converter. For example, by changing the dynamic range of the sensor output (analog input) from keyboard A or adding an offset,
It is possible to output simulated characteristics of the sensor when it deteriorates.

データは9600BPSの非同期シリアル通信方
式を例としており、1データは第4図aのように
10ビツト構成である。このうちスタートビツトと
ストツプビツトを除く8ビツトが1バイトで、全
体としては同図bのような20バイトのデータとな
る。一例として 演算指示コード〔4〕……線形演算(ax+b) パラメータ1 〔100〕=a パラメータ2 〔50〕=b パラメータ3 〔 〕=空データ とする。
The data uses 9600BPS asynchronous serial communication method as an example, and one data is as shown in Figure 4 a.
It has a 10-bit configuration. Of these, 8 bits excluding the start bit and stop bit constitute 1 byte, resulting in a total of 20 bytes of data as shown in Figure b. As an example, it is assumed that calculation instruction code [4]...Linear calculation (ax+b) Parameter 1 [100] = a Parameter 2 [50] = b Parameter 3 [ ] = Empty data.

一方、データは第4図cのように10ビツト構
成で、MSBから先に送信される。
On the other hand, the data has a 10-bit structure as shown in FIG. 4c, and is transmitted from the MSB first.

第5図は装置CのCPUで実行される制御ソフ
トのフローチヤートである。CPUはAD変換時に
ポートP1を1にしてスイツチSWをデータ側に
切替える。そしてAD変換が完了したらP1=0に
してスイツチSWをデータ側に切替える。ステ
ツプS1はこのポートP1のレベルを判定するもの
である。P1=0であればステツプS2でデータ
の受信エラー(例えばフレームエラー)を検出す
る。エラーがなければステツプS3でフラグFを
調べ、F=0であればステツプS4で送信開始信
号かを調べる。イエス(Y)であればステツプ
S5でF=1にする。これは第2図のタイミング
である。ステツプS6はデータ配列nの初期化
である。
FIG. 5 is a flowchart of the control software executed by the CPU of device C. During AD conversion, the CPU sets port P1 to 1 and switches the switch SW to the data side. When the AD conversion is completed, P 1 is set to 0 and the switch SW is switched to the data side. Step S1 is to determine the level of this port P1 . If P 1 =0, a data reception error (for example, a frame error) is detected in step S2. If there is no error, flag F is checked in step S3, and if F=0, it is checked in step S4 whether it is a transmission start signal. If yes (Y) then step
Set F=1 in S5. This is the timing shown in FIG. Step S6 is the initialization of data array n.

ステツプS3でYになつたらステツプS7で終了
かを判断し、ノー(N)であればステツプS8で
データをメモリPnに取込み、ステツプS9でn
値をインクリメントする。
If the result is Y in step S3, it is determined whether the process is finished in step S7, and if the result is no (N), the data is taken into the memory Pn in step S8, and the data is read in the memory Pn in step S9.
Increment the value.

ステツプS7でYになつたらステツプS11でデー
タ数mを初期化し、ステツプS12でメモリPnのデ
ータをメモリQmに移す。これをm=17になるま
で繰り返し(ステツプS13,S14)、最後にステツ
プS15でF=0にする。これはデータの取込み
を正常終了した場合で、第2図のタイミングに
相当する。
When the result is Y in step S7, the number m of data is initialized in step S11, and the data in memory Pn is transferred to memory Qm in step S12. This is repeated until m=17 (steps S13, S14), and finally F=0 in step S15. This corresponds to the timing shown in FIG. 2 when the data acquisition is normally completed.

一方、ステツプS1でP1=1と判断されたらス
テツプS21でデータの受信エラーを判別する。
NであればステツプS22でデータ変換をし(デー
タの取り込み)、ステツプS23で次のADchをセ
ツトして、ステツプS24でP1=0に切替える。
On the other hand, if it is determined in step S1 that P 1 =1, a data reception error is determined in step S21.
If N, data is converted (data is taken in) in step S22, the next ADch is set in step S23, and P 1 is changed to 0 in step S24.

P1=1にするのは第6図のメインルーチンで
ある。ステツプS31は、例えば200msに1回の
ADタイミングを判別し、Yであればステツプ
S32でF=0にする。このタイミングは第2図の
である。次のステツプS33でP1=1にし、ステ
ツプS34でADchを出力する。
The main routine shown in FIG. 6 sets P 1 =1. Step S31 is executed once every 200ms, for example.
Determine AD timing, if Y, step
Set F=0 in S32. This timing is shown in FIG. In the next step S33, P 1 is set to 1, and in step S34, ADch is output.

フラグFが第2図の以外のタイミングで0に
なるのは、上述したタイミングだけではない。
第5図のステツプS2でデータに受信エラーが
検出されたときは、ステツプS10でF=0にな
る。これは第2図の例では図示されない。いずれ
のケースでもF=0になるとステツプS3のNか
らステツプS4のNを通りリターンするので、そ
の後のデータは再度送信開始信号が検出される
まで取り込まれない。
The above-mentioned timing is not the only time when the flag F becomes 0 at a timing other than that shown in FIG.
If a reception error is detected in the data in step S2 of FIG. 5, F=0 in step S10. This is not illustrated in the example of FIG. In either case, when F=0, the process returns from step S3 N to step S4 N, so subsequent data will not be captured until the transmission start signal is detected again.

〔発明の効果〕〔Effect of the invention〕

以上述べたように本発明によれば、1chのシリ
アル通信機能しか有さないマイクロコンピユータ
で非同期なシリアル通信源と効率良く通信するこ
とができる。しかも、双方向回線や専用信号線、
或いはタイミング制御の信号は不要であり、また
通信プロトコルも複雑化することがない。
As described above, according to the present invention, a microcomputer having only one channel serial communication function can efficiently communicate with an asynchronous serial communication source. In addition, bidirectional lines and dedicated signal lines,
Alternatively, a timing control signal is not required, and the communication protocol does not become complicated.

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

第1図は本発明の基本構成図、第2図はその動
作説明図、第3図は本発明の実施例の構成図、第
4図はデータ形式の説明図、第5図は本発明の制
御ソフトのフローチヤート、第6図はメインルー
チンのフローチヤート、第7図は従来のシリアル
通信方式の説明図である。
Fig. 1 is a basic configuration diagram of the present invention, Fig. 2 is an explanatory diagram of its operation, Fig. 3 is a configuration diagram of an embodiment of the invention, Fig. 4 is an explanatory diagram of the data format, and Fig. 5 is an explanatory diagram of the present invention. FIG. 6 is a flowchart of the control software, FIG. 6 is a flowchart of the main routine, and FIG. 7 is an explanatory diagram of a conventional serial communication system.

Claims (1)

【特許請求の範囲】 1 1チヤネル分のシリアル通信機能しか有さな
いマイクロコンピユータCに対し、任意のタイミ
ングでデータを送信できる装置Aと該コンピユ
ータで指定されるタイミングでデータを送信す
る装置Bとが非同期にシリアル通信でデータを送
信するシステムにおいて、 装置Aは装置Bと異なる送信周期で同じデータ
を2回送信し、装置Cはデータを優先的に受
信し、データはデータと衝突しないタイミン
グのものを受信するように入力切替えを行うこと
を特徴とするマイクロコンピユータのシリアル通
信方式。
[Claims] 1. A device A that can transmit data at any timing to a microcomputer C that only has a serial communication function for one channel, and a device B that can transmit data at a timing specified by the computer. In a system in which data is transmitted asynchronously via serial communication, device A transmits the same data twice with different transmission cycles from device B, device C receives the data with priority, and the data is sent at a timing that does not collide with the data. A serial communication method for microcomputers that is characterized by switching inputs to receive signals.
JP62310666A 1987-12-08 1987-12-08 Serial communicating system for microcomputer Granted JPH01150957A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP62310666A JPH01150957A (en) 1987-12-08 1987-12-08 Serial communicating system for microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP62310666A JPH01150957A (en) 1987-12-08 1987-12-08 Serial communicating system for microcomputer

Publications (2)

Publication Number Publication Date
JPH01150957A JPH01150957A (en) 1989-06-13
JPH0467221B2 true JPH0467221B2 (en) 1992-10-27

Family

ID=18007995

Family Applications (1)

Application Number Title Priority Date Filing Date
JP62310666A Granted JPH01150957A (en) 1987-12-08 1987-12-08 Serial communicating system for microcomputer

Country Status (1)

Country Link
JP (1) JPH01150957A (en)

Also Published As

Publication number Publication date
JPH01150957A (en) 1989-06-13

Similar Documents

Publication Publication Date Title
EP0372567B1 (en) Polling communication system with priority control
US7962100B2 (en) Data transmission system for wireless communication
US5021777A (en) Mode-selectable communications system
JPH0824298B2 (en) CSMA communication system
JPH0467221B2 (en)
US5623515A (en) Data communication system for reducing a risk of transmission errors
JPS5962246A (en) Multiplex transmission system
JPS59134943A (en) Data communication system
JPH0644763B2 (en) Data transfer method
JPH0343657B2 (en)
JPH0630506B2 (en) Serial communication device
JP2669844B2 (en) Multiple access control method
JP3063319B2 (en) Data collection method
JP2949118B1 (en) Encoder data output method for bus communication type encoder device
JPH0439938B2 (en)
SU1166123A1 (en) Interface for linking digital computer with communication lines
JP2541492B2 (en) Microprocessor remote reset method
JPH0336460B2 (en)
KR100427764B1 (en) Apparatus for Interface between Devices of different Data Bus
JPH0439939B2 (en)
JPH03254544A (en) Multi-point communication system
JPH0566613B2 (en)
JPH0431158B2 (en)
JPH04326639A (en) Signal converter
JPS58198941A (en) Simple data transmitter