Package com.serotonin.modbus4j.locator

Examples of com.serotonin.modbus4j.locator.NumericLocator



        ModbusMaster master = ModbusMasterGateway.getInstance(config);
        try {
            master.init();
            NumericLocator bl = new NumericLocator(1, RegisterRange.HOLDING_REGISTER, 266, DataType.TWO_BYTE_INT_UNSIGNED);
            System.out.println("readed value: " + master.getValue(bl));
            master.setValue(bl, 1);

        } catch (ModbusTransportException ex) {
            System.out.println("error1: " + ex.toString());
View Full Code Here


//        config.setProperty("parity", String.valueOf(SerialPort.PARITY_EVEN));
//        config.setProperty("stop-bits", String.valueOf(SerialPort.STOPBITS_1));
        ModbusMaster master = ModbusMasterGateway.getInstance();
        try {
            master.init();
            NumericLocator bl = new NumericLocator(1, RegisterRange.HOLDING_REGISTER, 266, DataType.TWO_BYTE_INT_UNSIGNED);
            System.out.println(master.getValue(bl));

        } catch (ModbusTransportException ex) {
            System.out.println(ex.toString());
        } catch (ErrorResponseException ex) {
View Full Code Here

        int value1 = 235;
        int value = 0;
        try {
            master.init();
            //master.setValue(1,768,2,true);
            NumericLocator bl = new NumericLocator(1, RegisterRange.HOLDING_REGISTER, 771, DataType.TWO_BYTE_INT_UNSIGNED);
            master.setValue(bl, value1);
            value = (Integer) master.getValue(bl);

        } catch (ModbusTransportException ex) {
            System.out.println(ex.toString());
View Full Code Here

            }
        } else {
            if (registerRange == RegisterRange.COIL_STATUS) {
                modbusLocator = new BinaryLocator(slaveId, registerRange, offset);
            } else {
                modbusLocator = new NumericLocator(slaveId, registerRange, offset, dataType);
            }
        }
        //TODO: use the number of registers
        //numberOfRegisters= configuration.getTuples().getIntProperty(i,"NumberOfRegisters",1);
        //At this moment the characterEncoding is not necesary
View Full Code Here

TOP

Related Classes of com.serotonin.modbus4j.locator.NumericLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.