• L
    libu7alex

    While using ReadSerialTest inside the package com.serotonin.modbus4j.test, I am getting the error mentioned below for Modbus RTU over RS232.
    at com.serotonin.modbus4j.sero.messaging.InputStreamListener.run

    Actually the software doesn't transmit any data over RS232. Hence its receiving a null pointer exception on the receive side.
    Output stream this.out is null, not assigned.
    public StreamTransport(InputStream in, OutputStream out) {
    this.out = out;
    this.in = in;
    }

    What could be the reason. Please help me to resolve the problem.

    posted in Modbus4J general discussion read more
  • L
    libu7alex

        BatchRead<Integer> batch = new BatchRead<Integer>();
        int add;
        int reg;
        int typ;
        add = FEOHdb.intDB[1][3];
       for (int m = 1 ; m < FEOHdb.tDev; m++){
    	   add = FEOHdb.intDB[m][3];
       
        for (int n = 1; n < FEOHdb.mapQty; n++ ){
        reg =FEOHdb.mapInt[n][1];
        typ =FEOHdb.mapInt[n][2];
       	batch.addLocator(n-1, BaseLocator.holdingRegister(add, reg, typ));
        }
    }
        
    
        try {
            master.init();
    
            while (pool) {
                batch.setContiguousRequests(false);
                BatchResults<Integer> results = master.send(batch);
                            
                for (int n = 0; n < FEOHdb.mapQty; n++){ 
                	System.out.println("Value =  " + (int) results.getValue(n));
                }
                Thread.sleep(500);
           
            }

    posted in Modbus4J general discussion read more