I'm trying to connect to a device (Circutor power analyzer) that uses the Modbus RTU protocol through a serial port (I'm using a RS232 to USB converter). The data I'm reading is of Unsigned Long Reverse Words type - in modbus scanner, where it always works without a problem!!!
First of all I have a sequence that seemed to work before i formatted the PC in question. The sequence is:
Var.test = Device.ModbusRTU.ReadHoldingRegistersUWSLI(1,60,1)
var.test2 = Device.ModbusRTU.ReadHoldingRegistersUWSLI(1,30,1)
V.DnevnaMoc = var.test / 1000
V.trenmoc = var.test2 / 1000
the problem is that it does not work anymore.. It seemed to work fine before.
The only way it starts to work with the sequence above, is when I start another instance of DAQFactory(I still have the trial version installed so I can modify the settings without the hardware key).
I made a new *.ctl file containing only two channels reading from ModbusRTU device. The data type is of course invalid (Read Holding Registers Unsigned 32-bit), but the data is read without a problem. When this file was open and both channels active, I opened the original file with the sequence above (immediatelly an error occured in the newly open file - the port is in use by another app...). So I closed the test *.ctl file, started the sequence and VOILA it magically started to work....
and now every time I want to start the readout from the device I have to do the procedure described above.