MA-X3xx シリーズは、
を使用することができます。
※ /AD(extended)には24ピン着脱式スクリューレス端子台が同梱されています。 (Phoenix contact製 DMC 0,5/12-G1-2,54 P20 THR R72 接続ケーブルAWG26~AWG20対応)
DI 部はフォトカプラ及び電流制限抵抗により構成されています。また、外部電源の接続方法によりマイナスコモン、及びプラスコモンの機器と接続が可能です。
グループ毎に共通コモンとなっています。
(The DI section consists of a photocoupler and a current limiting resistor. Depending on the external power supply connection method, it can be connected to devices with negative common or positive common. The common is common for each group.)
従来使用していた sysfs GPIO が deprecated で廃止予定のため、libgpiod を利用してアクセスします。
(Since sysfs GPIO used in the past is deprecated and scheduled to be discontinued, libgpiod is used for access.)
No. | Name | Note |
---|---|---|
1 | DIN_S0 | |
2 | DIN_S1 |
No. | Name(フィルタ無) | Name(フィルタ有) | Note |
---|---|---|---|
1 | EXT_DI0 | Filtered_DI0 | A0 |
2 | EXT_DI1 | Filtered_DI1 | A1 |
… | … | … | … |
11 | EXT_DI10 | Filtered_DI10 | C2 |
12 | EXT_DI11 | Filtered_DI11 | C3 |
13 | EXT_DI12 | Filtered_DI12 | D0 |
14 | EXT_DI13 | Filtered_DI13 | D1 |
… | … | … | … |
23 | EXT_DI22 | Filtered_DI22 | F2 |
24 | EXT_DI23 | Filtered_DI23 | F3 |
※ フィルタについて: 64Hz 2bit シフトレジスタ を利用したステートマシンによるチャタリング除去フィルタが入っています。
(About the filter: A state machine chatter removal filter using 64Hz 2bit shift registers is included.)
root@metis:~# gpioinfo |egrep "DIN_S|DI[0-9]+" line 60: "DIN_S0" unused input active-high line 61: "DIN_S1" unused input active-high line 0: "EXT_DI12" unused input active-high line 1: "EXT_DI13" unused input active-high line 2: "EXT_DI14" unused input active-high line 3: "EXT_DI15" unused input active-high line 4: "EXT_DI16" unused input active-high line 5: "EXT_DI17" unused input active-high line 6: "EXT_DI18" unused input active-high line 7: "EXT_DI19" unused input active-high line 8: "EXT_DI20" unused input active-high line 9: "EXT_DI21" unused input active-high line 10: "EXT_DI22" unused input active-high line 11: "EXT_DI23" unused input active-high line 16: "Filtered_DI12" unused input active-high line 17: "Filtered_DI13" unused input active-high line 18: "Filtered_DI14" unused input active-high line 19: "Filtered_DI15" unused input active-high line 20: "Filtered_DI16" unused input active-high line 21: "Filtered_DI17" unused input active-high line 22: "Filtered_DI18" unused input active-high line 23: "Filtered_DI19" unused input active-high line 24: "Filtered_DI20" unused input active-high line 25: "Filtered_DI21" unused input active-high line 26: "Filtered_DI22" unused input active-high line 27: "Filtered_DI23" unused input active-high line 0: "EXT_DI0" unused input active-high line 1: "EXT_DI1" unused input active-high line 2: "EXT_DI2" unused input active-high line 3: "EXT_DI3" unused input active-high line 4: "EXT_DI4" unused input active-high line 5: "EXT_DI5" unused input active-high line 6: "EXT_DI6" unused input active-high line 7: "EXT_DI7" unused input active-high line 8: "EXT_DI8" unused input active-high line 9: "EXT_DI9" unused input active-high line 10: "EXT_DI10" unused input active-high line 11: "EXT_DI11" unused input active-high line 16: "Filtered_DI0" unused input active-high line 17: "Filtered_DI1" unused input active-high line 18: "Filtered_DI2" unused input active-high line 19: "Filtered_DI3" unused input active-high line 20: "Filtered_DI4" unused input active-high line 21: "Filtered_DI5" unused input active-high line 22: "Filtered_DI6" unused input active-high line 23: "Filtered_DI7" unused input active-high line 24: "Filtered_DI8" unused input active-high line 25: "Filtered_DI9" unused input active-high line 26: "Filtered_DI10" unused input active-high line 27: "Filtered_DI11" unused input active-high root@metis:~#
gpiod パッケージのアプリケーションでアクセスします。
libgpiod を使用してプログラムを作成します。
Nim 用の binding を作成したので、C 言語より簡単にプログラムをすることもできます。
import std/asyncdispatch
import std/times
import nim_gpiod
proc asyncMain() {.async.} =
let di0 = newGpio("DIN_S0", "NimGPIO")
if di0.isNil:
echo "newGpio failed."
quit(1)
while true:
echo "wait event..."
let event = await di0.wait_event(Edge.Both, 10)
let now = now().format("yyyy-MM-dd HH:mm:ss")
echo &"*** {now}: Event! (edge: {event.edge}, value: {event.value})"
waitFor asyncMain()
DO 部はフォトカプラ及び過電流保護素子により構成されています。グループ毎に共通コモンとなっています。
(The DO section consists of a photocoupler and an overcurrent protection element. Each group has a common common.)
LED class driver にバインドしています。(Bound to LED class driver.)
No. | Name | Note |
---|---|---|
1 | DO_S0 |
No. | Name | Note |
---|---|---|
1 | EXT_DO0 | |
… | … | |
8 | EXT_DO7 |