User Tools

Site Tools




Variable = MPADIn (ID, Channel)

ID The ID of the module
Channel The number of the channel to read (1~4)

If the module cannot be found, 19999 is returned. In 1~5V mode, -11,111 is returned if voltage is less than 1V and 22,222 is returned if value is greater than 5V. Values falling within the 1~5V rage will return a value between 0 and 10,000 (13.3 bit resolution).

A = MPADIn(2, 3)    ' Read from module 2, channel 3 and store value in A

Using the CT1820 with the Modport

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.

Modport Test Program

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 "==============="
    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
    TX1 = Sys(10)
    TY1 = Sys(11)
    Pset TX1,TY1
    Ct18beep 10

Go CUBLOC home

cubloc/mpadin/index.txt · Last modified: 2016/07/17 21:35 by COMFILE Technology