top of page
Abstract Digital Mesh

DIO 7x7

SERIAL COMMANDS

    Communication

        - UART Baud Rate: 115200

           Stop Bit 1

 

     Relay Control:

          R1 ON / R1 OFF ("R1 ON","R1 OFF")

           ....

       R7 ON / R7 OFF

     Relay Query:

       R1?

        ...

       R7?

     Digital Input Query:

        DI1?

         ...

        DI7?

     Reset:

         RESET -> Turns all relays off

     Identification:

        *IDN?

Abstract Light Waves

Example code 

C# Console app

using System;
using System.IO.Ports;

class Program
{
    static void Main()
    {
        // Change COM3 to your actual port
        using (SerialPort port = new SerialPort("COM3", 115200))
        {
            port.Parity = Parity.None;
            port.DataBits = 8;
            port.StopBits = StopBits.One;
            port.Handshake = Handshake.None;

            // Very important: device uses \n line endings
            port.NewLine = "\n";
            port.ReadTimeout = 1000;   // 1 second
            port.WriteTimeout = 1000;

            port.Open();
            Console.WriteLine("Port opened at 115200");

            // Example 1: Get ID
            port.WriteLine("*IDN?");
            string line;
            try
            {
                // DIO 7x7 prints 3 lines for *IDN?
                line = port.ReadLine();
                Console.WriteLine("Rx: " + line);
                line = port.ReadLine();
                Console.WriteLine("Rx: " + line);
                line = port.ReadLine();
                Console.WriteLine("Rx: " + line);
            }
            catch (TimeoutException)
            {
                Console.WriteLine("No response for *IDN?");
            }

            // Example 2: Turn R1 ON and check state
            port.WriteLine("R1 ON");
            // (No explicit reply, but IDEAL timer resets)

            port.WriteLine("R1?");
            try
            {
                line = port.ReadLine();  // should be "1" or "0"
                Console.WriteLine("R1 state = " + line);
            }
            catch (TimeoutException)
            {
                Console.WriteLine("No response for R1?");
            }

            // Example 3: Query DI1
            port.WriteLine("DI1?");
            try
            {
                line = port.ReadLine();
                Console.WriteLine("DI1 = " + line);
            }
            catch (TimeoutException)
            {
                Console.WriteLine("No response for DI1?");
            }

            port.Close();
        }
    }
}
 

Python

#> pip install pyserial

import serial
import time

# Change 'COM3' to '/dev/ttyUSB0' or similar on Linux
ser = serial.Serial(
    port='COM3',
    baudrate=115200,
    bytesize=serial.EIGHTBITS,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    timeout=1  # seconds
)

print("Opened:", ser.portstr)

def send_cmd(cmd: str):
    """Send a command with newline and read one response line (if any)."""
    print(f">> {cmd}")
    ser.write((cmd + "\n").encode('ascii'))

    try:
        line = ser.readline().decode('ascii', errors='ignore').strip()
        if line:
            print(f"<< {line}")
            return line
        else:
            print("<< [no data]")
            return ""
    except Exception as e:
        print("Read error:", e)
        return ""

# Example 1: *IDN?
send_cmd("*IDN?")
# DIO 7x7 sends 3 lines, so read additional:
for _ in range(2):
    line = ser.readline().decode('ascii', errors='ignore').strip()
    if line:
        print("<<", line)

# Example 2: Relay ON / Query
send_cmd("R1 ON")
time.sleep(0.1)
send_cmd("R1?")

# Example 3: DI read
send_cmd("DI1?")

ser.close()
 

LAB VIEW 

LabVIEW (VISA Serial) – Block Diagram Steps

In LabVIEW you’ll use VISA to open the serial port and read/write text.

A. Configure Serial Port

  1. Place VISA Configure Serial Port block.

  2. Set:

    • VISA resource: COM3 (or your port)

    • Baud rate: 115200

    • Data bits: 8

    • Parity: None

    • Stop bits: 1

    • Flow control: None

  3. Enable termination character:

    • Termination char: 0x0A (newline \n)

    • Termination enabled: TRUE

B. Write Command (*IDN?)

  1. Place VISA Write block.

  2. Wire the VISA reference from Configure block.

  3. Command string constant: "*IDN?\n"

  4. Bytes to write is handled automatically from string length.

C. Read Response

  1. Place VISA Read block.

  2. Wire same VISA reference.

  3. Set byte count (e.g., 256).

  4. Because termination is enabled, VISA Read will stop when it sees \n.

  5. Output string → indicator on the front panel to show response.

D. Example Flow

You can build a simple VI with:

  • Front Panel:

    • String control: Command (e.g., R1 ON, R1?, DI1?, RESET, *IDN?)

    • String indicator: Response

    • Button: Send

  • Block Diagram:

    1. On “Send”:

      • Take Command, concatenate \n.

      • VISA Open (if not already open).

      • VISA Write.

      • VISA Read (optional, depending on command).

      • Display response in indicator.

S I L I C O  V O L T

ADDRESS

A BLOCK, A-4B, Bajghera Rd, Block A, New Palam Vihar Phase 2, Sector 110, Gurugram, Haryana 122017

bottom of page