• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

How to read/write Dword value to PLC?

Started by sxbug, October 17, 2020, 12:11:47 pm

Previous topic - Next topic

sxbug

Hi
I am using nrmodbus component to read/write PLC. How to write a 32-bit DWord value to PLC?   How to read a 32-bit DWord value?
for example: eValue.text='12345678', how to write this value to plc's D10 D11?
How to write the  code --->nrModbus1.WriteRegisters(StrToInt(eRegWrite.Text), [StrToInt(eValue.Text)], StrToInt(eAddress.Text));

Thanks

Roman Novgorodov

Hello

Modbus protocol operates 16bit values.
You need to read two 16bit registers and get a 32bit value:

val32bit :=  reg_01 + (reg02 shl 16);
Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.