Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read and write registers 4x #54

Open
ilariaAnd opened this issue May 31, 2022 · 1 comment
Open

Read and write registers 4x #54

ilariaAnd opened this issue May 31, 2022 · 1 comment

Comments

@ilariaAnd
Copy link

Hi,
I develop with delphi 10.2.
I have to read (and write) registers 4x. I have no problems for the registers of type unsigned INT(16bit) -readHoldingRegister- , but i don't know how to read and write the registers of type unsigned long/float (32bit)

Any suggestions?
Thanks.
Ilaria

@rcervenan
Copy link

rcervenan commented Jun 6, 2022

Hello, for long type try this (let's say your long variable is starting on address 11)

var
Data: array[1..4097] of Word;
DataC: DWord;
val,pos,cnt: Integer;
begin
pos := 1;
cnt := 51;
if mctPLC.ReadHoldingRegisters(pos, cnt, Data) then
...
pos := 11;
LongRec(DataC).Hi := Data[pos];
LongRec(DataC).Lo := Data[pos+1];
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants