JPH0535914B2 - - Google Patents

Info

Publication number
JPH0535914B2
JPH0535914B2 JP61174485A JP17448586A JPH0535914B2 JP H0535914 B2 JPH0535914 B2 JP H0535914B2 JP 61174485 A JP61174485 A JP 61174485A JP 17448586 A JP17448586 A JP 17448586A JP H0535914 B2 JPH0535914 B2 JP H0535914B2
Authority
JP
Japan
Prior art keywords
port
input
output
data
mode
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 - Lifetime
Application number
JP61174485A
Other languages
Japanese (ja)
Other versions
JPS6329872A (en
Inventor
Hisashi Fujiwara
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.)
NEC Corp
Original Assignee
Nippon Electric 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 Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP61174485A priority Critical patent/JPS6329872A/en
Publication of JPS6329872A publication Critical patent/JPS6329872A/en
Publication of JPH0535914B2 publication Critical patent/JPH0535914B2/ja
Granted legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、周辺機器とのインターフエイスのた
めに入出力ポートを内蔵したマイクロコンピユー
タ(以下、マイコンと称する)に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a microcomputer (hereinafter referred to as a microcomputer) having a built-in input/output port for interfacing with peripheral equipment.

〔従来の技術〕[Conventional technology]

従来、この種のマイコンは、第4図に示すよう
に外部機器とのインターフエイスのためのポート
回路1の入出力を切換えるためのモードレジスタ
2を備えていた。いま、ポート回路1が入力ポー
トとして機能するようにモードレジスタ2が設定
されているとする。ここで、CPU4から内部デ
ータバス3を介して、ポート回路1を出力モード
に設定するようなデータがモードレジスタ2に転
送されると、ポート回路1は出力モードに切換わ
り、出力ポートとして機能するようになる。出力
ポートから入力ポートへの切換えも同様に、
CPU4から内部データバス3を介して、ポート
回路1を入力モードに設定するようなデータをモ
ードレジスタ2に転送することにより実現され
る。
Conventionally, this type of microcomputer has been equipped with a mode register 2 for switching input and output of a port circuit 1 for interfacing with external equipment, as shown in FIG. Assume now that the mode register 2 is set so that the port circuit 1 functions as an input port. Here, when data that sets port circuit 1 to output mode is transferred from CPU 4 to mode register 2 via internal data bus 3, port circuit 1 switches to output mode and functions as an output port. It becomes like this. Similarly, switching from output port to input port is as follows.
This is realized by transferring data for setting the port circuit 1 to the input mode from the CPU 4 to the mode register 2 via the internal data bus 3.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

上述した従来のマイコンでは、CPUが制御す
るモードレジスタの指定により入出力ポートの入
出力モードを切換えるような構成になつているた
め、CPUがモードレジスタをアクセスしている
期間中はポートを有効に利用できず、特に頻繁に
ポートの入出力を切換えるような制御をするマイ
コンの場合、ポートの利用効率が悪くなるという
欠点がある。
The conventional microcontrollers mentioned above are configured to switch the input/output mode of the input/output port by specifying the mode register controlled by the CPU, so the port is not enabled while the CPU is accessing the mode register. Especially in the case of a microcomputer that performs control such as switching port input/output frequently, there is a drawback that port usage efficiency becomes poor.

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

本発明のマイコンは、コンペアレジスタと、前
記入出力ポートに入出力されるデータとコンペア
レジスタに設定されているデータを比較するコン
パレータと、前記入出力ポート内に設けられ、前
記コンパレータから一致信号が出力されると、前
記入出力ポートの入出力モードを切換える手段と
を有する。
The microcomputer of the present invention includes a compare register, a comparator that compares data input/output to the input/output port and data set in the compare register, and is provided in the input/output port, and receives a match signal from the comparator. and means for switching the input/output mode of the input/output port when the input/output port is output.

このように、ポートへの出力データまたはポー
トからの入力データによつてポートの入出力モー
ドを直接切換えることにより、特にポートの入出
力を頻繁に切換える制御を必要とするようなマイ
コンにおいて、ポートの利用効率を高め、ソフト
ウエアの負担を軽減できる。
In this way, by directly switching the input/output mode of a port depending on the output data to the port or the input data from the port, it is possible to control the port input/output, especially in microcontrollers that require control to frequently switch the input/output of the port. It can improve usage efficiency and reduce the burden on software.

〔実施例〕 次に、本発明の実施例について図面を参照して
説明する。
[Example] Next, an example of the present invention will be described with reference to the drawings.

第1図は本発明のマイコンの一実施例を示すブ
ロツク図である。アンドゲート11、3ステート
バツフア12,13、バツフア14、ポートレジ
スタ15、トランスフアゲート16,17により
ポート回路1が構成され、コンペアレジスタ6、
コンパレータ7、トリガフリツプフロツプ21、
インバータ22によいポート回路1の入出力モー
ドを切換えるための制御回路が構成されている。
ポート回路1には外部端子群5(8ビツト)が設
けられている。本実施例は、ポート回路1の入出
力の切換えをポート回路1の外部端子群5のレベ
ルで行なうものである。すなわち、ポート回路1
が出力モードに設定されているときに、コンペア
レジスタ6に設定した8ビツトデータと同じデー
タが出力されると、ポート回路1は自動的に入力
モードに切換わり、ポート回路1が入力ポートに
設定されているときには、外部端子群5に入力し
たデータがコンペアレジスタ6に設定した8ビツ
トデータと同じデータであつたとき、ポート回路
1が自動的に出力モードに切換わるというもので
ある。
FIG. 1 is a block diagram showing one embodiment of a microcomputer according to the present invention. A port circuit 1 is configured by an AND gate 11, 3-state buffers 12, 13, a buffer 14, a port register 15, and transfer gates 16, 17.
Comparator 7, trigger flip-flop 21,
A control circuit for switching the input/output mode of the port circuit 1 is configured in the inverter 22.
The port circuit 1 is provided with an external terminal group 5 (8 bits). In this embodiment, input/output switching of the port circuit 1 is performed at the level of the external terminal group 5 of the port circuit 1. That is, port circuit 1
If the same data as the 8-bit data set in compare register 6 is output while the port circuit is set to output mode, port circuit 1 automatically switches to input mode and port circuit 1 is set as an input port. When the data input to the external terminal group 5 is the same as the 8-bit data set in the compare register 6, the port circuit 1 automatically switches to the output mode.

以下、本実施例の動作を第2図のタイミングチ
ヤートを参照しながら説明する。
The operation of this embodiment will be described below with reference to the timing chart of FIG.

まず、コンペアレジスタ6にはデータ“FF”
が設定され、ポート回路1は出力モードにあり、
このときトリガフリツプフロツプ21の出力
IOCNTは“0”であるとする。また、ポートレ
ジスタ15の読出し信号PRDは常に“0”であ
るとする。ポート回路1は出力モードであるか
ら、CPU4からの書込み信号WRに同期してデー
タDO1に、DO2,DO3(以上のデータは
“FF”以外とする)をポートレジスタ15とアク
テイブ状態にある3ステートバツフア13を経由
して外部端子群5に出力する。ここで、次の出力
データDO4が“FF”であつたとすると、コンパ
レータ7は一致信号としてINTを出力し、トリ
ガフリツプフロツプ21の出力IOCNTが反転し
て“1”になる。すると、ポート回路1の3ステ
ートバツフア12がアクテイブになり、3ステー
トバツフア13はインアクテイブになつてポート
回路1は入力モードに切換わる。コンパレータ7
の出力信号INTはまたCPU4への割込信号とし
ても機能し、ポート回路1が入力モードになつた
ことをCPU4に認識させる役目も果たす。さて、
このようにして入力モードになつたポート回路1
は、外部から送られてくるデータDI1,DI2,
DI3(以上のデータは“FF”以外とする)に対
し、CPU4からの読出し信号RDに同期して、ア
クテイブ状態にある3ステートバツフア12から
内部バス3にデータを出力するように動く。ここ
で、次の入力データDI4が“FF”であつたとす
ると、コンパレータ7は再び割込信号INTを出
力し、読出し信号RDを止めるよう制御し、トリ
ガフリツプフロツプ21の出力IOCNTは“0”
に反転してポート回路1は出力モードになる。読
出し信号RDが止まるため、DI4(データ
“FF”)は内部バス3には取り込まれない。また、
割込信号INTは、ポート回路1が出力モードに
なつたことをCPU4に認識させる役目も果す。
このように、コンペアレジスタ6に設定したデー
タと同じデータが入力あるいは出力するたびにポ
ート回路1の入出力モードが切換わることにな
る。本実施例ではコンペアレジスタ6に比較用デ
ータとして“FF”を設定したため、入出力デー
タとして有効なデータは“FF”以外のものとな
る。言いかえれば、本実施例のような8ビツトポ
ートの場合、256種類のデータのうちの1つは入
出力制御用のデータとして確保しておく必要があ
る。しかし、以下に述べるように、本実施例と同
様のポート構成をもつマイコンどうしでインター
フエイスをとることにより本発明の効果が十分に
行なわれる。
First, data “FF” is stored in compare register 6.
is set, port circuit 1 is in output mode,
At this time, the output of the trigger flip-flop 21
It is assumed that IOCNT is "0". Further, it is assumed that the read signal PRD of the port register 15 is always "0". Since the port circuit 1 is in the output mode, in synchronization with the write signal WR from the CPU 4, the data DO1, DO2, DO3 (the above data are other than "FF") are sent to the port register 15 and the three active states. It is output to the external terminal group 5 via the buffer 13. Here, if the next output data DO4 is "FF", the comparator 7 outputs INT as a coincidence signal, and the output IOCNT of the trigger flip-flop 21 is inverted and becomes "1". Then, the 3-state buffer 12 of the port circuit 1 becomes active, the 3-state buffer 13 becomes inactive, and the port circuit 1 is switched to the input mode. Comparator 7
The output signal INT also functions as an interrupt signal to the CPU 4, and serves to make the CPU 4 recognize that the port circuit 1 has entered the input mode. Now,
Port circuit 1 that became input mode in this way
is the data DI1, DI2, sent from the outside.
For DI3 (the above data are other than "FF"), the 3-state buffer 12 in the active state outputs data to the internal bus 3 in synchronization with the read signal RD from the CPU 4. Here, if the next input data DI4 is "FF", the comparator 7 outputs the interrupt signal INT again, controls to stop the read signal RD, and the output IOCNT of the trigger flip-flop 21 becomes "0". ”
The port circuit 1 enters the output mode. Since the read signal RD stops, DI4 (data "FF") is not taken into the internal bus 3. Also,
The interrupt signal INT also serves to make the CPU 4 recognize that the port circuit 1 has entered the output mode.
In this way, the input/output mode of the port circuit 1 is switched every time the same data as the data set in the compare register 6 is input or output. In this embodiment, since "FF" is set as comparison data in the compare register 6, valid data as input/output data is other than "FF". In other words, in the case of an 8-bit port like this embodiment, one of the 256 types of data must be reserved as data for input/output control. However, as described below, the effects of the present invention can be fully achieved by interfacing microcomputers having the same port configuration as that of this embodiment.

第3図は第1図のマイコンの使用例を示す図
で、マイコンM1,M2はそれぞれポートP1,
P2を有し、ポートP1,P2の外部端子群T
1,T2は互いに接続されている。それぞれのコ
ンペアレジスタにはデータ“FF”が設定されて
いるものとする。また、マイコンM1のポートP
1は出力モードに、マイコンM2のポートP2は
入力モードに設定されていたとする。すなわち、
マイコンM1からマイコンM2へとデータが転送
されている場合を考える。ここで、マイコンM1
のポートP1から外部端子群T1へデータ“FF”
が送出されたとする。これはマイコンM1からマ
イコンM2へのデータ出力の終了を意味する。こ
の動作によつてマイコンM1のポートP1は出力
モードから入力モードに、マイコンM2のポート
P2は入力モードから出力モードに速やかに切換
わつて、今度はマイコンM2からマイコンM1へ
のデータ転送が行なえるようになる。以上の動作
を従来例と比較してみると、最初出力モードにあ
るマイコンM1のポートP1が“FF”を出力し
入力モードに切換わつたことは、一見、従来例の
ようにCPUが出力状態にあるポートのモードレ
ジスタをアクセスしてポートを入力状態に切換え
るのと同等であるかのようにも見える。しかし、
ポートから制御用データ“FF”が出力する期間
(第2図のDO4に相当する)は割込信号(第2
図のINTに相当する)が発生しているわずかの
期間だけであり、従来のようにCPUがポートの
モードレジスタを切換えるために必要な時間に比
べて極めて短い。すなわち、入出力モード切換の
ためにポートを有効に利用できない期間が、従来
に比べずつと短縮される。さらに、マイコンM1
のポートP1から出力したデータ“FF”は、相
手方のマイコンM2のポートP2を入力モードに
切換える作用もする。従つて、ポートP2にとつ
ては、端子レベルで直接モードが切換わつたこと
になり、従来のようにポートP2を入力モードに
するためにマイコンM2をCPUを介してモード
レジスタを操作する必要もなく、高速切換が可能
となる。
FIG. 3 is a diagram showing an example of the use of the microcontroller shown in FIG.
P2, and external terminal group T of ports P1 and P2
1 and T2 are connected to each other. It is assumed that data "FF" is set in each compare register. Also, port P of microcomputer M1
1 is set to output mode, and port P2 of microcomputer M2 is set to input mode. That is,
Consider a case where data is transferred from microcomputer M1 to microcomputer M2. Here, microcomputer M1
Data “FF” from port P1 to external terminal group T1
Suppose that is sent. This means the end of data output from the microcomputer M1 to the microcomputer M2. Through this operation, port P1 of microcomputer M1 is quickly switched from output mode to input mode, port P2 of microcomputer M2 is quickly switched from input mode to output mode, and data can now be transferred from microcomputer M2 to microcomputer M1. It becomes like this. Comparing the above operations with the conventional example, we can see that the port P1 of the microcomputer M1, which is initially in output mode, outputs "FF" and switches to input mode. It appears to be equivalent to accessing the mode register of a port in the port and switching the port to the input state. but,
During the period when the control data “FF” is output from the port (corresponding to DO4 in Figure 2), the interrupt signal (second
(corresponding to INT in the figure) is occurring for only a short period of time, which is extremely short compared to the time required for the CPU to switch the mode register of the port as in the past. In other words, the period during which a port cannot be used effectively due to input/output mode switching is gradually shortened compared to the conventional method. Furthermore, microcomputer M1
The data "FF" outputted from the port P1 of the microcomputer M2 also has the effect of switching the port P2 of the other microcomputer M2 to the input mode. Therefore, for port P2, the mode is switched directly at the pin level, and it is no longer necessary to operate the mode register of microcomputer M2 via the CPU in order to set port P2 to input mode as in the past. This enables high-speed switching.

本実施例では8ビツトの入出力ポートについて
説明したが、制御対象となるポートのビツト数に
は特に制限はなく、また、コンパレータで比較さ
れるデータのビツト数もポートのビツト数と同一
である必要はない。例えば8ビツトポートの下位
の4ビツトに入力あるいは出力するデータのみが
入出力を切換えるための対象となつてもよい。
Although this example describes an 8-bit input/output port, there is no particular restriction on the number of bits of the port to be controlled, and the number of bits of the data compared by the comparator is also the same as the number of bits of the port. There's no need. For example, only the data input to or output from the lower 4 bits of an 8-bit port may be subject to input/output switching.

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

以上説明したように本発明は、ポートへの出力
データまたはポートからの入力データによつてポ
ートの入出力モードを直接切換えることにより、
特にポートの入出力モードを直接切換える制御を
必要とするようなマイコンにおいて、ポートの利
用効率を高め、ソフトウエアの負担を軽減できる
効果がある。
As explained above, the present invention directly switches the input/output mode of a port depending on the output data to the port or the input data from the port.
Particularly in microcomputers that require control to directly switch port input/output modes, this has the effect of increasing port usage efficiency and reducing the burden on software.

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

第1図は本発明のマイコンの一実施例の構成
図、第2図は第1図を説明するためのタイミング
チヤート、第3図は第1図の実施例の使用例を示
す図、第4図は従来のマイコンの構成図である。 1……ポート回路、2……モードレジスタ、3
……内部バス、4……CPU、5……外部端子群、
6……コンペアレジスタ、7……コンパレータ、
11……アンドゲート、12,13……3ステー
トバツフア、14……バツフア、15……ポート
レジスタ、16,17……トランスフアゲート、
21……トリガフリツプフロツプ、22……イン
バータ、M1,M2……マイコン、P1,P2…
…マイコンM1,M2のポート、T1,T2……
ポートP1,P2の外部端子群。
FIG. 1 is a block diagram of an embodiment of the microcomputer of the present invention, FIG. 2 is a timing chart for explaining FIG. 1, FIG. 3 is a diagram showing an example of use of the embodiment of FIG. 1, and FIG. The figure is a block diagram of a conventional microcomputer. 1...Port circuit, 2...Mode register, 3
...Internal bus, 4...CPU, 5...External terminal group,
6...Compare register, 7...Comparator,
11...And gate, 12,13...3 state buffer, 14...Buffer, 15...Port register, 16,17...Transfer gate,
21...Trigger flip-flop, 22...Inverter, M1, M2...Microcomputer, P1, P2...
...Ports of microcontrollers M1 and M2, T1, T2...
External terminal group for ports P1 and P2.

Claims (1)

【特許請求の範囲】[Claims] 1 入出力ポートを内蔵したマイクロコンピユー
タにおいて、コンペアレジスタと、前記入出力ポ
ートに入出力されるデータとコンペアレジスタに
設定されているデータを比較するコンパレータ
と、前記入出力ポート内に設けられ、前記コンパ
レータから一致信号が出力されると、前記入出力
ポートの入出力モードを切換える手段とを有する
ことを特徴とするマイクロコンピユータ。
1 In a microcomputer with a built-in input/output port, a compare register, a comparator that compares data input/output to the input/output port and data set in the compare register, and a comparator provided in the input/output port and configured to A microcomputer comprising means for switching the input/output mode of the input/output port when a match signal is output from the comparator.
JP61174485A 1986-07-23 1986-07-23 Microcomputer Granted JPS6329872A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP61174485A JPS6329872A (en) 1986-07-23 1986-07-23 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP61174485A JPS6329872A (en) 1986-07-23 1986-07-23 Microcomputer

Publications (2)

Publication Number Publication Date
JPS6329872A JPS6329872A (en) 1988-02-08
JPH0535914B2 true JPH0535914B2 (en) 1993-05-27

Family

ID=15979306

Family Applications (1)

Application Number Title Priority Date Filing Date
JP61174485A Granted JPS6329872A (en) 1986-07-23 1986-07-23 Microcomputer

Country Status (1)

Country Link
JP (1) JPS6329872A (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0738996Y2 (en) * 1989-07-28 1995-09-06 三洋電機株式会社 Input / output circuit of microcomputer
JP2914317B2 (en) * 1996-09-25 1999-06-28 日本電気株式会社 Microcomputer

Also Published As

Publication number Publication date
JPS6329872A (en) 1988-02-08

Similar Documents

Publication Publication Date Title
US4271466A (en) Direct memory access control system with byte/word control of data bus
US5774702A (en) Integrated circuit having function blocks operating in response to clock signals
US5021950A (en) Multiprocessor system with standby function
US6810460B1 (en) AMBA bus off-chip bridge
JPH0258649B2 (en)
JPH05324348A (en) Single chip microcomputer
JPH0535914B2 (en)
US20050235069A1 (en) Microcontroller
JPH03257652A (en) Multiprocessor system and interruption controller
EP0363905A2 (en) I/O Apparatus for programmable controller
JPH10301657A (en) Peripheral device of computer system
JPH06274462A (en) Asynchronous writing system for shared memory
KR920008007Y1 (en) Floppy disk control circuit
SU1683039A1 (en) Device for data processing for multiprocessor system
JP3310482B2 (en) Microcomputer
KR890008835Y1 (en) Circuits for selecting synchronous communication port of computer system
KR860001785B1 (en) System program protection circuit of z80 cpu
RU1807495C (en) Process-to-process interface
JPS6269348A (en) Data transfer device
JPH03290750A (en) Dma transfer method
JP3161370B2 (en) Port shared circuit
KR930000670B1 (en) Interface circuit of common ram between main cpu and sub-cpu
CA1234220A (en) Bus translator
JPS62150459A (en) Single chip microcomputer
JPH08106338A (en) Microcontroller