M340 Modbus Comms, None sequential write

hmwright

Member
Join Date
Oct 2018
Location
Australia
Posts
3
I am learning Modbus and having a issue writing some code to write a value to a specified register where I also need to write the 1's complement in the same write. This isto a Deep Sea Electronics Governor module. I have to set the module to AUTO by writing 1 to register 35701 and in teh same write also write 1 to the 1's complement at 29834. The writevar command works only with sequential addresses so that leaves me stuck.

Hoping somebody can let me know how its done in Unity Pro.
 
Modbus can't write or read multiple non consecutive addresses in a single request.

Also if the address 35701 refers to an Analog Input then you can't write it due Analog Inputs are read only.
 
Extract from DSE Manual

From DSE Litriture.

Control is performed by sending System Control Keys to the module, and also sending the bitwise opposite
(or one’s compliment) of the control key to another register ‘in the same write operation’ for security.


Hence I assume it must be posible or why do it ?
 
Perhaps that phrase also refers to other protocols that are supported by the device, in other protocols such as Ethernet/P it is possible to write non-contiguous positions in a single request, but Modbus does not allow it.
 
is that Modbus TCP or serial?

If serial, you can't write to different addresses same time which isn't consecutive

if TCP, then you can send two different requests on same time.
 
The 35701 and 29834 values are 1’s complement of each other. I think you’ll find that values like that are the data to be written to consecutive registers, not the actual register addresses. You’ll probably do a modbus function 16 - ‘write multiple registers’ to a series of registers starting at a five or maybe six digit address that begins with 4. I am not familiar with the M340. Depending on your system, your instruction might omit that leading 4 and the starting register might be one less than documented in the governor literature.
 
Last edited:
Solved - Sort Of Limits of write_var

I read again the book and yes they are consecutive registers which lets me use the write_var or so I thought. Registers are 4104 and 4105

Now a new issue is that the DSE controller is expecting a key to be written in one register and its ones complement in the other. For some reason the keys start at 35700.

The issue is write_var has an INT array which is signed hence I can only write values up to 32,768.

Is their another way to wright unsigned integers with write_var
 
I read again the book and yes they are consecutive registers which lets me use the write_var or so I thought. Registers are 4104 and 4105

Now a new issue is that the DSE controller is expecting a key to be written in one register and its ones complement in the other. For some reason the keys start at 35700.

The issue is write_var has an INT array which is signed hence I can only write values up to 32,768.

Is their another way to wright unsigned integers with write_var


unsigned integer and signed integers differs only how 16 bits are converted to numerical view, 16th bit is number or +/- sign.

you have 0..65535 or -32767..+32768 numbers dependig of integer type



Use uint to int conversion block before write block, on bit level both numbers have same bit patterns.

uint 35700 = int -29836 = bin 1000101101110100)


http://www.free-test-online.com/binary/signed_converter.html
 

Similar Topics

Hello all. I am trying to read out the values from a Carlo Gavazzi EM340 energy analyzer via Modbus communication. The S7-1200 PLC has the CB1241...
Replies
29
Views
3,639
Hi has any one linked a Schneider Electric Smart UPS to a PLC through Modbus TCP? Supposedly it can do it, I'm told. but I'm not entirely sure...
Replies
3
Views
2,399
Setup: - Schneider Electric M340 PLC w/ NOE 100 Module installed - Allen Bradley PowerFlex 753 VFD w/ 20-COMM-M Modbus Adapter installed -...
Replies
2
Views
4,525
Hi, I am trying to communicate modicon M340 PLC with an Schneider T200 Remote main unit controller over modbus TCP. the PLC has got in built...
Replies
1
Views
4,534
Hello everyone, I've been working on a Modicon M340 project using a CPU BMX P34 2020 processor, making use of its serial port to do Modbus master...
Replies
2
Views
5,822
Back
Top Bottom