• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. wf321

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    W
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    wf321

    @wf321

    0
    Reputation
    362
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    wf321 Unfollow Follow

    Latest posts made by wf321

    • How to send command to standard serial port

      Dear Sir:

      1. I had a hardware(switch), direct connect to computer com1 using R485 line.
      2. I can turn the switch on/off using standard serial test code.
      3. I can also using following rxtx( same version as scadabr using) java code to turn it on/off.

      now with mango, I created modbus serial data source, and it can scan found 1 node. But when create data point,
      there is no "output" option for "Register range", so I do not know how to continue.

      would you please help me how to create data source ( modbus serial or .. ?) ,
      data point and script to turn the switch on/off ?

      Thanks a lot.
      william
      wf321@163.com

      *********************************** RXTX CODE ****************************
      import gnu.io.CommPort;
      import gnu.io.CommPortIdentifier;
      import gnu.io.SerialPort;

      import java.io.FileDescriptor;
      import java.io.IOException;
      import java.io.InputStream;
      import java.io.OutputStream;

      public static void main ( String[] args )
      {
      connect("COM1");
      }

      void connect ( String portName ) throws Exception
      {
          CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
          CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);
      
                  SerialPort serialPort = (SerialPort) commPort;
      

      serialPort.setSerialPortParams(4800,SerialPort.DATABITS_8,SerialPort.STOPBITS_2,SerialPort.PARITY_NONE);

                  System.out.println(serialPort.getName());
                  InputStream in = serialPort.getInputStream();
                  OutputStream out = serialPort.getOutputStream();
                  
                  // send 8 int to control the switch
                  int len = 8;
                  int[] buffer = new int[len];
      
      
                  buffer[0] = 0x01;  // com1
                  buffer[1] = 0x05;  
                  buffer[2] = 0x00;  // port 0
                  buffer[3] = 0x01;  // channel
                  buffer[4] = 0xff;  // turn the switch on , 0X00 means tuen off
                  buffer[5] = 0x00;
                  buffer[6] = 0xdd;  // check use crc16
                  buffer[7] = 0xfa;  // check use crc16
      
                  
                  for (int i = 0; i < len; i++)
                  {
                      System.out.println(buffer*);
                   out.write(buffer*);
                  }
                  out.flush();
                  
                  commPort.close();
      }
      
      posted in How-To
      W
      wf321
    • RE: How to send command to standard serial port

      Dear Sir:

      1. I had a hardware(switch), direct connect to computer com1 using R485 line.
      2. I can turn the switch on/off using standard serial test code.
      3. I can also using following rxtx( same version as scadabr using) java code to turn it on/off.

      now with mango, I created modbus serial data source, and it can scan found 1 node. But when create data point,
      there is no "output" option for "Register range", so I do not know how to continue.

      would you please help me how to create data source ( modbus serial or .. ?) ,
      data point and script to turn the switch on/off ?

      Thanks a lot.
      william
      wf321@163.com

      *********************************** RXTX CODE ****************************
      import gnu.io.CommPort;
      import gnu.io.CommPortIdentifier;
      import gnu.io.SerialPort;

      import java.io.FileDescriptor;
      import java.io.IOException;
      import java.io.InputStream;
      import java.io.OutputStream;

      public static void main ( String[] args )
      {
      connect("COM1");
      }

      void connect ( String portName ) throws Exception
      {
          CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
          CommPort commPort = portIdentifier.open(this.getClass().getName(),2000);
      
                  SerialPort serialPort = (SerialPort) commPort;
      

      serialPort.setSerialPortParams(4800,SerialPort.DATABITS_8,SerialPort.STOPBITS_2,SerialPort.PARITY_NONE);

                  System.out.println(serialPort.getName());
                  InputStream in = serialPort.getInputStream();
                  OutputStream out = serialPort.getOutputStream();
                  
                  // send 8 int to control the switch
                  int len = 8;
                  int[] buffer = new int[len];
      
      
                  buffer[0] = 0x01;  // com1
                  buffer[1] = 0x05;  
                  buffer[2] = 0x00;  // port 0
                  buffer[3] = 0x01;  // channel
                  buffer[4] = 0xff;  // turn the switch on , 0X00 means tuen off
                  buffer[5] = 0x00;
                  buffer[6] = 0xdd;  // check use crc16
                  buffer[7] = 0xfa;  // check use crc16
      
                  
                  for (int i = 0; i < len; i++)
                  {
                      System.out.println(buffer*);
                   out.write(buffer*);
                  }
                  out.flush();
                  
                  commPort.close();
      }
      
      posted in How-To
      W
      wf321