node-ads icon indicating copy to clipboard operation
node-ads copied to clipboard

multiWrite: Error: parameter size not correct

Open w570955342 opened this issue 6 years ago • 4 comments

Hi @PLCHome ,

I was trying to use multiWrite to pass the array to the beckhoff machine. But when I pass the array I got an exception of 'parameter size not correct' Here is the handle that I pass through:

var myHandle = [{ symname: 'Main.b', bytelength: ads.INT, value: 200 }, { symname: 'Main.c', bytelength: ads.BOOL, value: true }]

Did I do something wrong?

w570955342 avatar May 30 '19 06:05 w570955342

Did you try using 0 and 1 instead of false and true?JanOp 30 mei 2019 08:58 schreef w570955342 [email protected]:Hi @PLCHome , I was trying to use multiWrite to pass the array to the beckhoff machine. But when I pass the array I got an exception of 'parameter size not correct' Here is the handle that I pass through: var myHandle = [{ symname: 'Main.b', bytelength: ads.INT, value: 200 }, { symname: 'Main.c', bytelength: ads.BOOL, value: true }] Did I do something wrong?

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

herrJones avatar May 30 '19 10:05 herrJones

Thanks for your answer. I did not use 0 and 1 instead of false and true. var myHandle = [ { symname: 'Main.c', bytelength: ads.BOOL, value: true }] or var myHandle = [{ symname: 'Main.b', bytelength: ads.INT, value: 200 }] is OK with multiWrite , but var myHandle = [{ symname: 'Main.b', bytelength: ads.INT, value: 200 }, { symname: 'Main.c', bytelength: ads.BOOL, value: true }] is not ok. Throw the error : parameter size not correct.

Did you try using 0 and 1 instead of false and true?JanOp 30 mei 2019 08:58 schreef w570955342 [email protected]:Hi @PLCHome , I was trying to use multiWrite to pass the array to the beckhoff machine. But when I pass the array I got an exception of 'parameter size not correct' Here is the handle that I pass through: var myHandle = [{ symname: 'Main.b', bytelength: ads.INT, value: 200 }, { symname: 'Main.c', bytelength: ads.BOOL, value: true }] Did I do something wrong?

w570955342 avatar May 30 '19 11:05 w570955342

I also run into the same issue. And exactly as you write, with only single handle in the array it works, with more it always fails...

michal-kindl avatar Apr 08 '20 21:04 michal-kindl

Hello @all

there is a bug in the function multiWrite on line 384 to 386. Change to the following code: buf.writeUInt32LE(handle.indexGroup || ADSIGRP.RW_SYMVAL_BYHANDLE, index + 0) buf.writeUInt32LE(handle.indexOffset || handle.symhandle,index + 4) buf.writeUInt32LE(handle.totalByteLength,index + 8)

I hope this helps!

regards

CHoltschlag avatar Jul 10 '20 05:07 CHoltschlag