Variable = MPIn (ID, PinNumber)
ID | The ID of the module |
PinNumber | Index of the individual pin (0 ~ 7) |
Reads the state of a pin on the MD-DIDC8 module. The value read is stored in Variable.
A = MPIn(2, 3) ' Read pin 3 of module 2 and store the results in A
The Modport is a modular, RS-485, Modbus field I/O controller from Comfile Technology featuring digital input and output, analog input, temperature sensing, and a variety of other features.
The CT1820 can be connected to the Modport to expand its I/O capabilities. The CT1820 features a library of built-in commands to make it simple and easy to communicate with the Modport.
Please refer to the illustration below to connect the CT1820 to the Modport.
The following program reads the status of 8 inputs on the MD-DIDC8 digital module, and simultaneously outputs each status to the MD-DOSO8 digital output module
#include "CT18XX" Dim TX1 As Integer Dim TY1 As Integer On Pad Gosub TouchOccur ' '********************* Main Do Loop ************************ ' Locate 1,1 Print "MD-DIDC8 Input Status" Locate 3,3 Print "7 6 5 4 3 2 1 0" Locate 3,4 Print "===============" Do Locate 2,5 Print hex2 MPin(1,7),hex2 MPin(1,6),hex2 MPin(1,5), _ hex2 MPin(1,4),hex2 MPin(1,3),hex2 MPin(1,2),hex2 MPin(1,1),hex2 MPin(1,0) MPsource 2,0,MPin(1,0) MPsource 2,1,MPin(1,1) MPsource 2,2,MPin(1,2) MPsource 2,3,MPin(1,3) MPsource 2,4,MPin(1,4) MPsource 2,5,MPin(1,5) MPsource 2,6,MPin(1,6) MPsource 2,7,MPin(1,7) Wait 500 Loop TouchOccur: TX1 = Sys(10) TY1 = Sys(11) Pset TX1,TY1 Ct18beep 10 Return