Exemple #1
0
    def test3_write_error(self):
        apf = modbus(baudrate)

        start = time.time()
        apf.write_buf_i16(range(100), 4)
        end = time.time()
        print("full request time : %f" % (end - start))
Exemple #2
0
    def test4_autobaud(self):
        apf = modbus()
        baudrate = apf.autobaud()
        if not baudrate:
            print("##########################Autobaud failed, try again")
            baudrate = apf.autobaud()

        print("########### detected baurate = %d\n" % baudrate)
Exemple #3
0
    def test1_readseg(self):
        apf = modbus(baudrate)  # , "/dev/tty.usbserial-FTWVIUZU"

        print("\nTest read basic segment")
        start = time.time()
        resp = apf.read_seg_16(0, 4)
        end = time.time()
        print("full request time : %f" % (end - start))

        hex_print(resp)
Exemple #4
0
    def test2_writeseg(self):
        apf = modbus(baudrate)

        start = time.time()
        apf.write_buf_i16(range(5), 4)
        end = time.time()
        print("full request time : %f" % (end - start))

        resp = apf.read_seg_16(4, 5)
        end = time.time()
        print("full request time : %f" % (end - start))

        hex_print(resp)
Exemple #5
0
    def test2_readi16(self):
        apf = modbus(baudrate)

        print("\nread 1 value at 0 : ")
        version = apf.read_i16(0)
        print(type(version))

        print(version)

        print("*************************")

        print("read 1 value at 0xFFFE : ")
        print(apf.read_i16(0xFFFE))
Exemple #6
0
    def test3_readbuf(self):
        apf = modbus(baudrate)

        start = time.time()
        apf.write_buf_i16(range(70), 4)
        end = time.time()
        print("full request time : %f" % (end - start))

        start = time.time()
        resp = apf.read_buf_i16(0, 300)
        end = time.time()
        print("full request time : %f" % (end - start))

        hex_print(resp)