Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP7604071B2 - Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device - Google Patents
[go: Go Back, main page]

JP7604071B2 - Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device - Google Patents

Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device Download PDF

Info

Publication number
JP7604071B2
JP7604071B2 JP2020134525A JP2020134525A JP7604071B2 JP 7604071 B2 JP7604071 B2 JP 7604071B2 JP 2020134525 A JP2020134525 A JP 2020134525A JP 2020134525 A JP2020134525 A JP 2020134525A JP 7604071 B2 JP7604071 B2 JP 7604071B2
Authority
JP
Japan
Prior art keywords
identification number
slave device
slave
automatic identification
number setting
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.)
Active
Application number
JP2020134525A
Other languages
Japanese (ja)
Other versions
JP2022030462A (en
Inventor
華奈 小林
芙美 大場
健悟 福田
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.)
Nissha Co Ltd
Original Assignee
Nissha 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 Nissha Co Ltd filed Critical Nissha Co Ltd
Priority to JP2020134525A priority Critical patent/JP7604071B2/en
Publication of JP2022030462A publication Critical patent/JP2022030462A/en
Application granted granted Critical
Publication of JP7604071B2 publication Critical patent/JP7604071B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Description

本発明は、識別番号自動設定方法、識別番号自動設定プログラムおよび識別番号自動設定装置に関する。 The present invention relates to an automatic identification number setting method, an automatic identification number setting program, and an automatic identification number setting device.

1つのマスタ機器と、マスタ機器に直列に通信可能に接続された複数のスレーブ機器とで構成される通信システムが知られている。このような通信システムの各スレーブ機器に対して、識別番号(ID)を自動的に設定する方法がある(たとえば、特許文献1参照)。これは、図8のように構成された識別番号自動設定装置70を用いる方法である。 A communication system is known that is composed of one master device and multiple slave devices that are serially connected to the master device so that they can communicate with each other. There is a method for automatically setting an identification number (ID) for each slave device in such a communication system (see, for example, Patent Document 1). This method uses an automatic identification number setting device 70 configured as shown in Figure 8.

まず、最上位のスレーブ機器(マスタ機器20に最も近いスレーブ機器30)は、自己よりも1つ下位のスレーブ機器40との接続を切断し、管理用データ線60を通してマスタ機器20から送信されたID=1を受信し、自己のIDとして設定する。次に、最上位のスレーブ機器30は、管理用データ線60を通して、ID=1を設定したことを示す確認信号をマスタ機器20に送信する。次に、最上位のスレーブ機器30は、自己よりも1つ下位のスレーブ機器40との接続をする。 First, the highest-level slave device (slave device 30 closest to master device 20) disconnects from the slave device 40 that is one level lower than itself, receives ID=1 sent from master device 20 through management data line 60, and sets it as its own ID. Next, the highest-level slave device 30 sends a confirmation signal to master device 20 through management data line 60 indicating that ID=1 has been set. Next, the highest-level slave device 30 connects to the slave device 40 that is one level lower than itself.

最上位のスレーブ機器30から確認信号を受信したマスタ機器20は、管理用データ線60を通してID=2を送信する。最上位のスレーブ機器30はID=2を受信するが、自身にすでにIDが設定されているためこれを無視する。スレーブ機器40がID=2を受信し、自己のIDとして設定する。このとき、スレーブ機器40とスレーブ機器50とは切断されている。ID設定後、スレーブ機器40は、管理用データ線60を通して、ID=2を設定したことを示す確認信号をマスタ機器20に送信する。次にスレーブ機器40は、スレーブ機器50との接続をする。 The master device 20 receives a confirmation signal from the top-level slave device 30 and transmits ID=2 through the management data line 60. The top-level slave device 30 receives ID=2 but ignores it because an ID has already been set for itself. Slave device 40 receives ID=2 and sets it as its own ID. At this time, slave device 40 and slave device 50 are disconnected. After setting the ID, slave device 40 transmits a confirmation signal to master device 20 through management data line 60 indicating that ID=2 has been set. Slave device 40 then connects to slave device 50.

スレーブ機器40から確認信号を受信したマスタ機器20は、管理用データ線60を通してID=3を送信する。スレーブ機器30,40はこれを無視し、スレーブ機器50がID=3を受信し、自己のIDとして設定する。 The master device 20, which receives the confirmation signal from the slave device 40, transmits ID=3 through the management data line 60. Slave devices 30 and 40 ignore this, and slave device 50 receives ID=3 and sets it as its own ID.

このように、従来の識別番号自動設定方法によれば、マスタ機器に近い順に、各スレーブ機器にIDを設定することができる。 In this way, with the conventional method of automatically setting identification numbers, an ID can be set for each slave device in order of proximity to the master device.

特開平8-37538号公報Japanese Patent Application Publication No. 8-37538

しかし、従来の識別番号自動設定方法では、マスタ機器がIDを送信し、それを受信したスレーブ機器がマスタ機器に確認信号を送信していた。つまり、IDを設定するたびに、マスタ機器とスレーブ機器との間で逐一通信が必要であって、複数のスレーブ機器にIDを設定するのに時間がかかるといった問題があった。 However, in conventional methods for automatically setting identification numbers, the master device transmits an ID, and the slave device that receives it transmits a confirmation signal to the master device. In other words, each time an ID is set, communication is required between the master device and the slave device, and there is an issue that it takes a long time to set IDs to multiple slave devices.

本発明は上記のような課題を解決するためになされたものであり、容易にID設定の時間を短縮することができる、識別番号自動設定方法、識別番号自動設定プログラムおよび識別番号自動設定装置を提供することを目的とする。 The present invention has been made to solve the above problems, and aims to provide an automatic identification number setting method, an automatic identification number setting program, and an automatic identification number setting device that can easily shorten the time required to set an ID.

本発明の識別番号自動設定方法は、
マスタ機器と複数のスレーブ機器とを備え、
複数のスレーブ機器はマスタ機器に直列に通信可能に接続され、
接続箇所での通信は、マスタ機器からの命令情報とスレーブ機器からの応答情報とをやり取りするための半二重通信、および識別番号を設定するためのシリアル通信であり、
複数のスレーブ機器が、自己に終端抵抗が装着されているか検出するステップと、
終端抵抗を検出したスレーブ機器が自己の識別番号を設定するステップと、
終端抵抗を検出したスレーブ機器が、シリアル通信によって、自己の識別番号を自己よりも1つ上位のスレーブ機器に送信するステップとを含み、
マスタ機器に至るまで、終端抵抗を検出したスレーブ機器を除く各スレーブ機器が、自己よりも1つ下位のスレーブ機器から受信した識別番号をインクリメントした値を自己の識別番号として設定し、自己よりも1つ上位の機器にシリアル通信によって送信する動作を繰り返すことによって、すべてのスレーブ機器に識別番号を自動的に設定するものである。
The method for automatically setting an identification number of the present invention comprises the steps of:
A master device and a plurality of slave devices are provided,
A plurality of slave devices are serially connected to the master device so as to be capable of communicating with each other;
The communication at the connection point is half-duplex communication for exchanging command information from the master device and response information from the slave device, and serial communication for setting the identification number.
A step in which a plurality of slave devices detect whether a termination resistor is attached to the slave device;
a slave device that detects the termination resistor setting its own identification number;
a step in which the slave device that has detected the termination resistor transmits its own identification number to a slave device that is one rank higher than itself by serial communication;
Each slave device up to the master device, except for the slave device that detected the termination resistance, sets its own identification number to an incremented value of the identification number received from the slave device one level lower than itself, and repeats the operation of transmitting the incremented value via serial communication to the device one level higher than itself, thereby automatically setting identification numbers to all slave devices.

上記態様において、半二重通信およびシリアル通信は有線通信であってもよい。 In the above embodiment, the half-duplex communication and the serial communication may be wired communication.

上記2つの態様のいずれかにおいて、シリアル通信はUART通信であってもよい。 In either of the above two aspects, the serial communication may be UART communication.

本発明の識別番号自動設定プログラムは、
マスタ機器に直列に通信可能に接続された複数のスレーブ機器に、識別番号を自動的に設定するためのプログラムであって、
複数のスレーブ機器を、自己に終端抵抗が装着されているか検出する手段として機能させ、
終端抵抗を検出したスレーブ機器を、自己の識別番号を設定する手段と、自己の識別番号を自己よりも1つ上位のスレーブ機器に送信する手段として機能させ、
終端抵抗を検出したスレーブ機器を除く各スレーブ機器を、自己よりも1つ下位のスレーブ機器から受信した識別番号をインクリメントした値を自己の識別番号として設定し、自己よりも1つ上位の機器に送信する手段として機能させるものである。
The automatic identification number setting program of the present invention comprises:
A program for automatically setting identification numbers to a plurality of slave devices serially connected to a master device so as to be able to communicate with the master device, comprising:
A plurality of slave devices are made to function as a means for detecting whether a termination resistor is installed in the slave device itself,
a slave device that detects the termination resistance is made to function as a means for setting its own identification number and as a means for transmitting its own identification number to a slave device one rank higher than itself;
Each slave device, except for the slave device that detected the termination resistance, is made to function as a means for setting its own identification number to an incremented value of the identification number received from the slave device one level lower than itself, and transmitting the value to the device one level higher than itself.

本発明の識別番号自動設定装置は、
マスタ機器と複数のスレーブ機器とを備え、
複数のスレーブ機器はマスタ機器に直列に通信可能に接続され、
接続箇所での通信は、マスタ機器からの命令情報とスレーブ機器からの応答情報とをやり取りするための半二重通信、および識別番号を設定するためのシリアル通信であり、
複数のスレーブ機器が、自己に終端抵抗が装着されているか検出する手段と、
終端抵抗を検出したスレーブ機器が自己の識別番号を設定する手段と、
終端抵抗を検出したスレーブ機器が、シリアル通信によって、自己の識別番号を自己よりも1つ上位のスレーブ機器に送信する手段とを含み、
マスタ機器に至るまで、終端抵抗を検出したスレーブ機器を除く各スレーブ機器が、自己よりも1つ下位のスレーブ機器から受信した識別番号をインクリメントした値を自己の識別番号として設定し、自己よりも1つ上位の機器にシリアル通信によって送信する動作を繰り返すことによって、すべてのスレーブ機器に識別番号を自動的に設定するものである。
The automatic identification number setting device of the present invention comprises:
A master device and a plurality of slave devices are provided,
A plurality of slave devices are serially connected to the master device so as to be capable of communicating with each other;
The communication at the connection point is half-duplex communication for exchanging command information from the master device and response information from the slave device, and serial communication for setting the identification number.
A means for detecting whether a termination resistor is installed in each of the slave devices;
A means for a slave device that detects a termination resistor to set its own identification number;
a means for transmitting its own identification number to a slave device one rank higher than itself by serial communication,
Each slave device up to the master device, except for the slave device that detected the termination resistance, sets its own identification number to an incremented value of the identification number received from the slave device one level lower than itself, and repeats the operation of transmitting the incremented value via serial communication to the device one level higher than itself, thereby automatically setting identification numbers to all slave devices.

本発明の識別番号自動設定方法によれば、容易にID設定の時間を短縮することができる。また、本発明の識別番号自動設定プログラムおよび識別番号自動設定装置を用いると、容易にID設定の時間を短縮することができる。 The automatic identification number setting method of the present invention can easily reduce the time required to set an ID. In addition, the automatic identification number setting program and automatic identification number setting device of the present invention can easily reduce the time required to set an ID.

本発明の識別番号自動設定装置の一実施形態を示す構成図である。1 is a configuration diagram showing an embodiment of an automatic identification number setting device of the present invention; 図1の配線図の一例を示す図である。FIG. 2 is a diagram showing an example of the wiring diagram of FIG. 1 . USB-TypeCのピン配置を示す図である。FIG. 1 is a diagram showing the pin arrangement of USB Type C. 本発明の識別番号自動設定方法の一実施形態を示すフローチャートである。2 is a flowchart showing an embodiment of an automatic identification number setting method of the present invention. スレーブ機器の一実施形態を示すブロック図である。FIG. 2 is a block diagram showing an embodiment of a slave device. スレーブ機器の一実施形態を示すブロック図である。FIG. 2 is a block diagram showing an embodiment of a slave device. スレーブ機器の主要な内部構成を示すブロック図である。FIG. 2 is a block diagram showing the main internal configuration of a slave device. 従来の識別番号自動設定装置を示す構成図である。FIG. 1 is a configuration diagram showing a conventional automatic identification number setting device.

以下、図面を参照しながら、本発明の識別番号自動設定方法、識別番号自動設定プログラムおよび識別番号自動設定装置の実施形態の一例を説明する。 Below, an example of an embodiment of the automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device of the present invention will be described with reference to the drawings.

識別番号自動設定装置1は、マスタ機器2と複数のスレーブ機器3,4,5とを備えている(図1参照)。複数のスレーブ機器3,4,5は、少なくともCPU8やメモリ9といった部品が設置された制御基板と、送信用外部接続インターフェイス11と、受信用外部接続インターフェイス12とを少なくとも備えている(図7参照)。メモリ9は、少なくとも識別番号自動設定プログラム10を記憶している。2つの外部接続インターフェイス11,12には、マスタ機器2と複数のスレーブ機器3,4,5とを直列に通信可能に接続するためのUSB-TypeCのコネクタ6(後述)を接続する。つまり、マスタ機器2の受信用外部接続インターフェイス12と、スレーブ機器3の送信用外部接続インターフェイス11とが接続される。同様に、スレーブ機器3の受信用外部接続インターフェイス12と、スレーブ機器4の送信用外部接続インターフェイス11とが接続される。最下位のスレーブ機器5には、自己よりも下位のスレーブ機器との接続はなく、受信用外部接続インターフェイス12に終端抵抗7が装着されている。つまり、終端抵抗7は外付けされている。 The automatic identification number setting device 1 includes a master device 2 and multiple slave devices 3, 4, and 5 (see FIG. 1). Each of the multiple slave devices 3, 4, and 5 includes at least a control board on which components such as a CPU 8 and a memory 9 are installed, a transmission external connection interface 11, and a reception external connection interface 12 (see FIG. 7). The memory 9 stores at least an automatic identification number setting program 10. A USB-Type C connector 6 (described later) is connected to the two external connection interfaces 11 and 12 to connect the master device 2 and the multiple slave devices 3, 4, and 5 in series so that they can communicate with each other. That is, the reception external connection interface 12 of the master device 2 is connected to the transmission external connection interface 11 of the slave device 3. Similarly, the reception external connection interface 12 of the slave device 3 is connected to the transmission external connection interface 11 of the slave device 4. The lowest-level slave device 5 is not connected to any slave device lower than itself, and a termination resistor 7 is attached to the reception external connection interface 12. In other words, the termination resistor 7 is external.

機器同士の接続は、たとえば、両端がUSB-TypeCのコネクタ6を用いて実現することができる。接続箇所での通信は、半二重通信およびシリアル通信である。本実施形態では、半二重通信はRS485による通信であり、シリアル通信はUART通信(非同期シリアル通信)である。RS485による半二重通信とUART通信とは、それぞれ役割が異なる。RS485による半二重通信は、マスタ機器2からの命令情報とスレーブ機器3,4,5からの応答情報をやり取りするために用いる。UART通信は、複数のスレーブ機器3,4,5に識別番号(ID)を設定するために用いる。複数のスレーブ機器3,4,5にID設定が終わった後に、RS485による半二重通信が行われる。図1の配線図を図2に示す。H,LはRS485によるRS485による半二重通信の線を示し、T,RはUART通信の線を示し、Pは電源(5V)およびGNDを示している。 The devices can be connected to each other using, for example, a connector 6 with USB-Type C on both ends. The communication at the connection point is half-duplex communication and serial communication. In this embodiment, the half-duplex communication is communication by RS485, and the serial communication is UART communication (asynchronous serial communication). The half-duplex communication by RS485 and the UART communication have different roles. The half-duplex communication by RS485 is used to exchange command information from the master device 2 and response information from the slave devices 3, 4, and 5. The UART communication is used to set identification numbers (IDs) to the multiple slave devices 3, 4, and 5. After the IDs are set to the multiple slave devices 3, 4, and 5, the half-duplex communication by RS485 is performed. The wiring diagram of FIG. 1 is shown in FIG. 2. H and L indicate the lines of the half-duplex communication by RS485, T x and R x indicate the lines of the UART communication, and P indicates the power supply (5V) and GND.

マスタ機器2とスレーブ機器3,4,5とが有する、USB-TypeCのピン配置(メス)を図3に示す。RS485による半二重通信には、A6・A7・B6・B7(図の中央)のD+/D-のペア線を用いる。D+がHIGH、D-がLOWである(図2のH,Lに相当)。UART通信には、A5のCC1ピンまたはB5のCC2ピンを用いる(図2のT,Rに相当)。電源用にはA4・A9・B4・B9のVbusピンを用い、グランドにはA1・A12・B1・B12(図の両端)のGNDピンを用いる(図2のPに相当)。最下位のスレーブ機器5には終端抵抗7を装着し、A8のSBU1ピンとB8のSBU2ピンとを用いて、終端抵抗7の装着有無を検出する。
このように、USB-TypeCのコネクタ6を1本用いるだけで、図2に示すような配線が容易に可能となる。
The pin arrangement (female) of USB-Type C that the master device 2 and the slave devices 3, 4, and 5 have is shown in Figure 3. For half-duplex communication by RS485, the D+/D- pair wires A6, A7, B6, and B7 (center of the figure) are used. D+ is HIGH, and D- is LOW (corresponding to H and L in Figure 2). For UART communication, the CC1 pin of A5 or the CC2 pin of B5 is used (corresponding to T x and R x in Figure 2). For power, the Vbus pins A4, A9, B4, and B9 are used, and for ground, the GND pins A1, A12, B1, and B12 (both ends of the figure) are used (corresponding to P in Figure 2). The lowest-level slave device 5 is equipped with a termination resistor 7, and the presence or absence of the termination resistor 7 is detected using the SBU1 pin of A8 and the SBU2 pin of B8.
In this way, by using only one USB-Type C connector 6, wiring as shown in FIG. 2 can be easily achieved.

なお、シリアル通信としては同期シリアル通信(SPI通信、I2C通信)も用いることはできるが、同期シリアル通信は、同期をとるためのクロック信号線が必要になり、配線数が増える。一方、UART通信は調歩同期式であり、必要な配線数を最小限に抑えることができるため、UART通信を用いるのが好ましい。 Note that synchronous serial communication (SPI communication, I2C communication) can also be used as serial communication, but synchronous serial communication requires a clock signal line for synchronization, which increases the number of wires. On the other hand, UART communication is asynchronous and can minimize the number of wires required, so it is preferable to use UART communication.

識別番号自動設定方法について説明する。図4は、複数のスレーブ機器3,4,5のそれぞれが行うステップを示すフローチャートである。 The method for automatically setting an identification number is explained. Figure 4 is a flowchart showing the steps performed by each of the multiple slave devices 3, 4, and 5.

まず、識別番号自動設定装置1の電源を入れると、複数のスレーブ機器3,4,5は、自己に終端抵抗7が装着されているか検出する(S1)。次に、複数のスレーブ機器3,4,5のうち、自己に終端抵抗7が装着されていることを検出した(S1:YES)スレーブ機器5は、自己のID=1を設定する(S2)。次に、スレーブ機器5は、UART通信によって、自己のID=1を自己よりも1つ上位のスレーブ機器4に送信する(S3)。S1における検出手段には、スレーブ機器3,4,5が備えているCPU8(図7参照)およびSBU1ピン・SBU2ピン(図3参照)を用いることができる。S2における設定手段には、スレーブ機器5のCPU8とメモリ9とを用いることができる。S3における送信手段には、スレーブ機器5が備えているCPU8、およびコネクタ6(CC1ピンまたはCC2ピン)を用いることができる(図1、図3参照)。 First, when the automatic identification number setting device 1 is turned on, the slave devices 3, 4, and 5 detect whether or not they have a termination resistor 7 attached (S1). Next, the slave device 5 that detects that it has a termination resistor 7 attached (S1: YES) among the slave devices 3, 4, and 5 sets its own ID to 1 (S2). Next, the slave device 5 transmits its own ID to the slave device 4 that is one level higher than itself by UART communication (S3). The detection means in S1 can be the CPU 8 (see FIG. 7) and the SBU1 and SBU2 pins (see FIG. 3) provided in the slave devices 3, 4, and 5. The setting means in S2 can be the CPU 8 and memory 9 of the slave device 5. The transmission means in S3 can be the CPU 8 and the connector 6 (CC1 or CC2 pin) provided in the slave device 5 (see FIG. 1 and FIG. 3).

終端抵抗7が装着されていることを検出しなかった(S1:NO)スレーブ機器4は、最下位のスレーブ機器5からID値のデータを受信したかを検出する(S4)。検出手段には、スレーブ機器4が備えているCPU8を用いることができる。 If the slave device 4 does not detect that the termination resistor 7 is attached (S1: NO), it detects whether it has received ID value data from the lowest-order slave device 5 (S4). The detection means can be the CPU 8 provided in the slave device 4.

一定時間以内に、最下位のスレーブ機器5からID値のデータを受信していない場合(S4:NO)は、スレーブ機器4はIDエラーとなる(S8)。つまり、スレーブ機器4でのエラー検出をすることができる。最下位のスレーブ機器5からID値のデータを受信した場合(S4:YES)は、スレーブ機器4は受信したID値をインクリメントする(S5)。スレーブ機器5から受信したID値は1であるため、インクリメントした値は2となる。次に、スレーブ機器4はインクリメントした値=2を自己のIDとして設定する(S6)。次に、スレーブ機器4は、自己のID=2を自己よりも1つ上位のスレーブ機器3に、UART通信によって送信する(S7)。 If ID value data is not received from the lowest-ranked slave device 5 within a certain time period (S4: NO), the slave device 4 will have an ID error (S8). In other words, the slave device 4 can detect an error. If ID value data is received from the lowest-ranked slave device 5 (S4: YES), the slave device 4 increments the received ID value (S5). Since the ID value received from the slave device 5 was 1, the incremented value becomes 2. Next, the slave device 4 sets the incremented value = 2 as its own ID (S6). Next, the slave device 4 transmits its own ID = 2 to the slave device 3 that is one level higher than itself via UART communication (S7).

スレーブ機器3は、マスタ機器2に最も近い、最上位のスレーブ機器である。スレーブ機器3は、一定時間以内にID値のデータを受信していない場合(S4:NO)は、IDエラーとなる(S8)。つまり、スレーブ機器3でのエラー検出をすることができる。スレーブ機器4からID値のデータを受信した場合(S4:YES)は、スレーブ機器3は受信したID値をインクリメントする(S5)。スレーブ機器4から受信したID値は2であるため、インクリメントした値は3となる。次に、スレーブ機器3はインクリメントした値=3を自己のIDとして設定する(S6)。つまり、この時点で、最下位のスレーブ機器5はID=1、その1つ上位のスレーブ機器4はID=2、最上位のスレーブ機器3はID=3である。次に、スレーブ機器3は、自己のID=3を自己よりも1つ上位の機器であるマスタ機器2に、UART通信によって送信する(S7)。ID値=3を受信したマスタ機器2は、自己に接続されたスレーブ機器が3台であることを認識する。 The slave device 3 is the highest-ranked slave device closest to the master device 2. If the slave device 3 does not receive ID value data within a certain time (S4: NO), an ID error occurs (S8). In other words, the slave device 3 can detect an error. If the slave device 3 receives ID value data from the slave device 4 (S4: YES), the slave device 3 increments the received ID value (S5). Since the ID value received from the slave device 4 is 2, the incremented value becomes 3. Next, the slave device 3 sets the incremented value = 3 as its own ID (S6). In other words, at this point, the lowest-ranked slave device 5 has ID = 1, the next higher slave device 4 has ID = 2, and the highest-ranked slave device 3 has ID = 3. Next, the slave device 3 transmits its own ID = 3 to the master device 2, which is the device one level higher than itself, by UART communication (S7). The master device 2, which receives the ID value = 3, recognizes that there are three slave devices connected to it.

S5におけるインクリメント、S6におけるID設定は、スレーブ機器3,4のそれぞれが備えているCPU8とメモリ9とによって行われる(図7参照)。S7における送信は、スレーブ機器3,4が備えているCPU8、およびコネクタ6(CC1ピンまたはCC2ピン)によって行われる。 The increment in S5 and the ID setting in S6 are performed by the CPU 8 and memory 9 of each of the slave devices 3 and 4 (see FIG. 7). The transmission in S7 is performed by the CPU 8 and connector 6 (CC1 pin or CC2 pin) of each of the slave devices 3 and 4.

上記のようにして、マスタ機器2に直列に通信可能に接続された複数のスレーブ機器3,4,5のすべてに識別番号を自動的に設定することができる。上記の識別番号自動設定方法によれば、マスタ機器2から最も遠いスレーブ機器5から順に、ID=1,2,3が自動設定される。従来の方法ではIDを設定するたびに、マスタ機器20とスレーブ機器30,40,50との間で逐一通信が発生し、ID設定に時間がかかっていた。しかし、上記のような識別番号自動設定方法によれば、電源を入れれば最下位のスレーブ機器5から順にIDが設定されていくため、マスタ機器2からスレーブ機器3,4,5へのID設定のための通信が逐一発生しない。つまり、容易にID設定の時間を短縮することができる。 In this manner, identification numbers can be automatically set for all of the slave devices 3, 4, and 5 connected in series to the master device 2 so that they can communicate with each other. According to the above-described automatic identification number setting method, IDs 1, 2, and 3 are automatically set in order from the slave device 5 that is the furthest from the master device 2. In conventional methods, communication occurs between the master device 20 and the slave devices 30, 40, and 50 each time an ID is set, and it takes time to set the ID. However, according to the above-described automatic identification number setting method, when the power is turned on, IDs are set in order from the lowest-ranked slave device 5, so communication from the master device 2 to the slave devices 3, 4, and 5 to set the IDs does not occur each time. In other words, the time required for ID setting can be easily shortened.

なお、終端抵抗7は外付けであるため、最下位のスレーブ機器に装着するのを忘れた場合、ID設定が始まらず、所定時間内に最上位のスレーブ機器からマスタ機器2へのID値のデータが送信されない。これを検出し、マスタ機器2はエラー表示をすることができる。 Since the termination resistor 7 is external, if you forget to attach it to the lowest-level slave device, the ID setting will not start and the ID value data will not be sent from the highest-level slave device to the master device 2 within the specified time. The master device 2 can detect this and display an error message.

なお、スレーブ機器は4台以上接続されてもよい。その場合でも、最下位のスレーブ機器は図4に示すS1~S3のステップを実行し、他のスレーブ機器は図4に示すS1およびS4~S7のステップを、マスタ機器2に至るまで繰り返し実行する。このようにして、すべてのスレーブ機器に識別番号を自動的に設定することができる。 Four or more slave devices may be connected. Even in this case, the lowest-level slave device executes steps S1 to S3 shown in FIG. 4, and the other slave devices repeatedly execute steps S1 and S4 to S7 shown in FIG. 4 until they reach master device 2. In this way, identification numbers can be automatically set for all slave devices.

次に、識別番号自動設定プログラムについて説明する(図5~図7参照)。
識別番号自動設定プログラム10は、複数のスレーブ機器3,4,5を、自己に終端抵抗7が装着されているか検出する手段F1として機能させる(図5参照)。識別番号自動設定プログラム10は、次に、終端抵抗7を検出したスレーブ機器5を、自己の識別番号を設定する手段F2と、自己の識別番号を自己よりも1つ上位のスレーブ機器4に送信する手段F3として機能させる。
Next, the automatic identification number setting program will be described (see FIGS. 5 to 7).
The automatic identification number setting program 10 causes a plurality of slave devices 3, 4, 5 to function as means F1 for detecting whether a termination resistor 7 is attached thereto (see FIG. 5). The automatic identification number setting program 10 then causes the slave device 5 that detects the termination resistor 7 to function as means F2 for setting its own identification number and means F3 for transmitting its own identification number to the slave device 4 that is one rank higher than itself.

次に、識別番号自動設定プログラム10は、スレーブ機器4を、スレーブ機器5が送信した識別番号を受信する手段F4として機能させる(図6参照)。次に、識別番号自動設定プログラム10は、スレーブ機器4を、スレーブ機器5から受信した識別番号をインクリメントする手段F5と、インクリメントした値を自己の識別番号として設定する手段F6と、自己の識別番号を自己よりも1つ上位のスレーブ機器3に送信する手段F7として機能させる。 Next, the automatic identification number setting program 10 causes the slave device 4 to function as a means F4 for receiving the identification number transmitted by the slave device 5 (see FIG. 6). Next, the automatic identification number setting program 10 causes the slave device 4 to function as a means F5 for incrementing the identification number received from the slave device 5, a means F6 for setting the incremented value as its own identification number, and a means F7 for transmitting its own identification number to the slave device 3 that is one level higher than itself.

次に、識別番号自動設定プログラム10は、スレーブ機器3を、スレーブ機器4が送信した識別番号を受信する手段F4として機能させる(図6参照)。次に、識別番号自動設定プログラム10は、スレーブ機器3を、スレーブ機器4から受信した識別番号をインクリメントする手段F5と、インクリメントした値を自己の識別番号として設定する手段F6と、自己の識別番号を自己よりも1つ上位のマスタ機器2に送信する手段F7として機能させる。 Next, the automatic identification number setting program 10 causes the slave device 3 to function as a means F4 for receiving the identification number transmitted by the slave device 4 (see FIG. 6). Next, the automatic identification number setting program 10 causes the slave device 3 to function as a means F5 for incrementing the identification number received from the slave device 4, a means F6 for setting the incremented value as its own identification number, and a means F7 for transmitting its own identification number to the master device 2 that is one level higher than itself.

識別番号自動設定プログラム10は、CPU8が次の処理を制御するよう規定している。まず、CPU8は、自己(スレーブ機器3,4,5)の受信用外部接続インターフェイス12に終端抵抗7が装着されているかを検出する。次に、終端抵抗7を検出したスレーブ機器5のCPU8は、自己の識別番号を設定する(ID=1)。このとき、ID=1はメモリ9に記憶する。次に、スレーブ機器5のCPU8は、自己のID=1を自己よりも1つ上位のスレーブ機器4に送信する。送信の際は、送信用外部接続インターフェイス11に接続された、USB-TypeCのコネクタ6を用いる。 The automatic identification number setting program 10 prescribes that the CPU 8 controls the following process. First, the CPU 8 detects whether a termination resistor 7 is attached to its own (slave device 3, 4, 5) external connection interface for receiving. Next, the CPU 8 of the slave device 5, which has detected the termination resistor 7, sets its own identification number (ID=1). At this time, ID=1 is stored in the memory 9. Next, the CPU 8 of the slave device 5 transmits its own ID=1 to the slave device 4, which is one level higher than itself. When transmitting, the USB-Type C connector 6 connected to the external connection interface for transmitting 11 is used.

終端抵抗7を検出しなかったスレーブ機器3,4のうち、自己よりも1つ下位のスレーブ機器からID値のデータを受信したスレーブ機器4のCPU8は、受信したID=1をインクリメントする(ID=2)。次に、CPU8は、インクリメントしたID=2を自己の識別番号として設定する。ID=2はメモリ9に記憶される。次に、スレーブ機器4のCPU8は、自己のID=2を自己よりも1つ上位のスレーブ機器3に送信する。 Of the slave devices 3 and 4 that did not detect the termination resistor 7, the CPU 8 of the slave device 4 that received the ID value data from the slave device that is one level lower than itself increments the received ID=1 (ID=2). Next, the CPU 8 sets the incremented ID=2 as its own identification number. ID=2 is stored in the memory 9. Next, the CPU 8 of the slave device 4 transmits its own ID=2 to the slave device 3 that is one level higher than itself.

スレーブ機器4からID値のデータを受信したスレーブ機器3のCPU8は、受信したID=2をインクリメントする(ID=3)。次に、CPU8は、インクリメントしたID=3を自己の識別番号として設定する。ID=3はメモリ9に記憶される。次に、スレーブ機器3のCPU8は、自己のID=3を自己よりも1つ上位のマスタ機器2に送信する。 The CPU 8 of the slave device 3, which has received the ID value data from the slave device 4, increments the received ID=2 (ID=3). Next, the CPU 8 sets the incremented ID=3 as its own identification number. The ID=3 is stored in the memory 9. Next, the CPU 8 of the slave device 3 transmits its own ID=3 to the master device 2, which is one level higher than itself.

識別番号自動設定プログラムを上記のように規定し、それによって複数のスレーブ機器3,4,5を機能させることにより、容易にID設定の時間を短縮することができる。 By defining the automatic identification number setting program as described above and using it to function multiple slave devices 3, 4, and 5, the time required for ID setting can be easily reduced.

1 :識別番号自動設定装置
2 :マスタ機器
3,4,5 :スレーブ機器
6 :コネクタ
7 :終端抵抗
8 :CPU
9 :メモリ
10 :識別番号自動設定プログラム
11 :送信用外部接続インターフェイス
12 :受信用外部接続インターフェイス
20 :マスタ機器
30,40,50:スレーブ機器
60 :管理用データ線
70 :識別番号自動設定装置
1: Automatic identification number setting device 2: Master device 3, 4, 5: Slave device 6: Connector 7: Termination resistor 8: CPU
9: Memory 10: Automatic identification number setting program 11: External connection interface for transmission 12: External connection interface for reception 20: Master device 30, 40, 50: Slave device 60: Data line for management 70: Automatic identification number setting device

Claims (2)

マスタ機器と、前記マスタ機器に直列に接続される複数のスレーブ機器とを備え、
前記複数のスレーブ機器が、自己に終端抵抗が装着されているか検出するステップと、
前記終端抵抗を検出したスレーブ機器が自己の識別番号を設定するステップと、
前記終端抵抗を検出した前記スレーブ機器が、識別番号を設定するためのシリアル通信であるUART通信によって、自己の前記識別番号を自己よりも1つ上位のスレーブ機器に送信するステップと、
前記終端抵抗を検出した前記スレーブ機器を除く各スレーブ機器が、自己よりも1つ下位のスレーブ機器から受信した識別番号をインクリメントした値を自己の識別番号として設定し、前記UART通信によって自己よりも1つ上位のスレーブ機器に自己の識別番号を送信するステップと、
前記自己の識別番号を送信するステップは、すべてのスレーブ機器に識別番号を設定するまで繰り返すステップと、
前記すべてのスレーブ機器に識別番号を設定するまで繰り返すステップが終了した後に、前記マスタ機器と直接接続するスレーブ機器は、前記マスタ機器へ向けて前記UART通信により自己の識別番号を発信するステップとを備える、識別番号自動設定方法。
A master device and a plurality of slave devices connected in series to the master device,
a step of each of the slave devices detecting whether a termination resistor is attached thereto;
a step of the slave device detecting the termination resistor setting its own identification number;
the slave device that has detected the termination resistor transmits its own identification number to a slave device one rank higher than itself by UART communication, which is serial communication for setting an identification number;
each slave device other than the slave device which detected the termination resistance sets its own identification number to a value obtained by incrementing the identification number received from the slave device which is one level lower than itself, and transmits its own identification number to the slave device which is one level higher than itself by the UART communication;
the step of transmitting the own identification number is repeated until identification numbers are set in all slave devices;
a step of transmitting its own identification number to the master device via the UART communication by a slave device directly connected to the master device after completing the step of repeating the step until an identification number is set to all of the slave devices.
記シリアル通信は有線通信である、請求項1に記載の識別番号自動設定方法。 2. The method according to claim 1, wherein the serial communication is a wired communication.
JP2020134525A 2020-08-07 2020-08-07 Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device Active JP7604071B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020134525A JP7604071B2 (en) 2020-08-07 2020-08-07 Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2020134525A JP7604071B2 (en) 2020-08-07 2020-08-07 Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device

Publications (2)

Publication Number Publication Date
JP2022030462A JP2022030462A (en) 2022-02-18
JP7604071B2 true JP7604071B2 (en) 2024-12-23

Family

ID=80324724

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020134525A Active JP7604071B2 (en) 2020-08-07 2020-08-07 Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device

Country Status (1)

Country Link
JP (1) JP7604071B2 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012120745A1 (en) 2011-03-10 2012-09-13 三洋電機株式会社 Power supply system and identification information setting method for power supply system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012120745A1 (en) 2011-03-10 2012-09-13 三洋電機株式会社 Power supply system and identification information setting method for power supply system

Also Published As

Publication number Publication date
JP2022030462A (en) 2022-02-18

Similar Documents

Publication Publication Date Title
US10552366B2 (en) Method of communication for master device and slave device on synchronous data bus wherein master and slave devices are coupled in parallel
US9952986B2 (en) Power delivery and data transmission using PCIe protocol via USB type-C port
CN110687993B (en) Controlling power delivery by tunneling messages over USB
US10936524B2 (en) Bus system with slave devices
CN112673363B (en) Detection of DisplayPort Alternate Mode Communication
EP1877911B1 (en) I2c slave/master interface enhancement using state machines
CN106385304B (en) Data transmission method, device and system
US10484100B2 (en) Optical module, optical module system and monitor method using the same
CN106528484A (en) Serial communication method
CN103077139B (en) Integrated circuit using inter-integrated circuit bus and control method thereof
JP7604071B2 (en) Automatic identification number setting method, automatic identification number setting program, and automatic identification number setting device
US20080244129A1 (en) Master device of two-wire bus providing release function for clock line and method thereof
CN102662902B (en) Method, device and system for preventing I2C (inter-integrated circuit) bus locking
CN112445744B (en) I2C communication
CN118819647B (en) Universal serial bus interface driving method, device, electronic device, storage medium and computer program product
TWI741417B (en) Method and device of real time monitoring the connection status of i2c devices
EP1607864A2 (en) Error recovery method for an I2C bus slave
CN107465487B (en) Bus data sending method, system and sub-equipment
JP2001306413A (en) USB communication device
CN101281510A (en) A kind of dual I2C bus setting method and dual I2C bus system
JP2015099528A (en) Method of rewriting program of sub-microcomputer
WO2014083707A1 (en) I2c communication method and i2c communication device
TWI725621B (en) Method for a sensor transmitting datas and electronic apparatus
KR20130138472A (en) Apparatus of universal inter-integrated circuit interface for controlling devices using fpga and communication method for using the same
CN115269481A (en) Control method and electronic equipment

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230510

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20240304

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20240326

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20240515

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20240827

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20240902

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20241210

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20241210

R150 Certificate of patent or registration of utility model

Ref document number: 7604071

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150