bit0: DI 0番ピンの入力値 0:High(default), 1:Low
bit1: DI 1番ピンの入力値 0:High(default), 1:Low
[DX-U1000 / DX-U2000 シリーズの場合]
bit0: DIO 0番ピンの入力値 0:High(default), 1:Low
bit1: DIO 1番ピンの入力値 0:High(default), 1:Low
bit2: DI 0番ピンの入力値 0:High(default), 1:Low
bit3: DI 1番ピンの入力値 0:High(default), 1:Low
bit0: DO 0:High(default), 1:Low
bit1: 未使用
bit2: 8 - 28V外部電源 0:Low(default), 1:High
bit3: 5V外部電源 0:Low(default), 1:High
[DX-U1000 / DX-U2000 シリーズの場合]
bit0: DIO 0番ピンの出力 0:High(default), 1:Low
bit1: DIO 1番ピンの出力 0:High(default), 1:Low
int fd;
int ret = 0;
unsigned char diport=0, doport=0;
if ( (fd = MT_Open(NULL) ) < 0) {
printf("Faild to open i2c port\n");
return 1;
}
ret = MT_GetDio(fd, &diport, &doport);
if (ret == 0) {
printf("Get DIO DI:%02X DO:%02X\n", diport, doport);
}
else {
printf("MT_GetDio Failled %d\n", ret);
}
MT_Close(fd);
import ctypes
import sys
import mtdll_arm
fd = mtdll_arm.MT_Open(None);
if fd < 0:
print("Faild to open i2c port");
sys.exit()
diport = ctypes.c_ubyte();
doport = ctypes.c_ubyte();
ret = mtdll_arm.MT_GetDio(fd, diport, doport);
if ret == 0:
print("Get DIO DI:", '{:02x}'.format(diport.value), " DO:", '{:02x}'.format(doport.value));
else:
print("MT_GetDio Failled", '{:d}'.formart(ret));
mtdll_arm.MT_Close(fd);