plcpeople / nodeS7

Node.JS library for communication to Siemens S7 PLCs
MIT License
365 stars 122 forks source link

Error on writing Array of Boolean #5

Closed Lichtjaeger closed 8 years ago

Lichtjaeger commented 8 years ago

Hi again,

now I have a problem on writing an Array of Boolean. In reality I need 16bit but for testcase I used 2.

Adress is "DB1,X2.0.2". Write command: plc.writeItems(['boolean'], [[false, true]], ...

Log:

[10622,237878058 192.168.36.94 S1] Preparing to WRITE boolean to value false,true [10622,292730964] Received write error of 7 on DB1,X2.0.2

2bit_in_Array.pcapng.gz

gfcittolin commented 8 years ago

Hi @Lichtjaeger, from the dump you attached, we can see the PLC did not like your data type when writing: image

Is the data type configured in the S7 an array of BOOL? Perhaps, try other data types, and let us know if it works :)

Lichtjaeger commented 8 years ago

It is "Array[0..15] of Bool" with Offset 2.0.

If I adress a single Bool of this array I can write without any problem (thats my actual workaround).

I also tested arrays of other types (for example 'DB1,REAL16.2') and they are working.

plcpeople commented 8 years ago

Will it let you write a length of 8 or 16? On Jun 3, 2016 5:42 AM, "Peter Scheler" notifications@github.com wrote:

It is "Array[0..15] of Bool" with Offset 2.0.

If I adress a single Bool of this array I can write without any problem (thats my actual workaround).

I also tested arrays of other types (for example 'DB1,REAL16.2') and they are working.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/plcpeople/nodeS7/issues/5#issuecomment-223547999, or mute the thread https://github.com/notifications/unsubscribe/AHpeRlFeSRVcghKyuGUFaGgb3UfRT6f4ks5qIAUogaJpZM4ItT5F .

Lichtjaeger commented 8 years ago

Same Error. Tried: "DB1,X2.0.16" with length of 16 "DB1,X2.0.16" with length of 8 "DB1,X2.0.8" with length of 8

plcpeople commented 8 years ago

Will it let you write an integer in DB1.INT2? I think your PLC is just doing data type checking that other PLCs don't do. Is it an S7 1200? Can you write an array of boolean to an address defined as an integer?

Same Error. Tried: "DB1,X2.0.16" with length of 16 "DB1,X2.0.16" with length of 8 "DB1,X2.0.8" with length of 8

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/plcpeople/nodeS7/issues/5#issuecomment-223550582, or mute the thread https://github.com/notifications/unsubscribe/AHpeRt7pDABgGZkUHDD9WKTLqPVZsZ0Uks5qIAjCgaJpZM4ItT5F .

Lichtjaeger commented 8 years ago

It is the same PLC I used in #4 : S7 1214 v2.2

I CAN write a single boolean into an INT. I CAN write an INT over the Array[0..15] of Bool. I CAN NOT write an array of boolean to the PLC. Not on an INT and not on the Array[0..15] of Bool.

The 1200 should be similar to the 1500.

Lichtjaeger commented 8 years ago

Is this working for you? Can you write an array of boolean to your PLC?

plcpeople commented 8 years ago

I am travelling and have not had a chance to test. This weekend I'll be home. On Jun 8, 2016 3:11 AM, "Peter Scheler" notifications@github.com wrote:

Is this working for you? Can you write an array of boolean to your PLC?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/plcpeople/nodeS7/issues/5#issuecomment-224519191, or mute the thread https://github.com/notifications/unsubscribe/AHpeRq6IkwOHkPmKCQjYOqhJrJb9Lte7ks5qJnkZgaJpZM4ItT5F .

plcpeople commented 8 years ago

OK I am committing a fix, please test at your convenience and let me know.

Lichtjaeger commented 8 years ago

Works like expected. I like it.

But your npm-module now contains a test3.js, a test4.js and a test5.js file.

PS: Another question: It's not documented but nodes7.removeItems() (without arguments) removes all items. Or am I wrong?

plcpeople commented 8 years ago

Good to hear it works.

Good catch - I will remove the extra files and update the docs and re-publish later tonight.

On 16 June 2016 at 01:36, Peter Scheler notifications@github.com wrote:

Works like expected. I like it.

But your npm-module now contains a test3.js, a test4.js and a test5.js file.

PS: Another question: It's not documented but nodes7.removeItems() (without arguments) removes all items. Or am I wrong?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/plcpeople/nodeS7/issues/5#issuecomment-226410360, or mute the thread https://github.com/notifications/unsubscribe/AHpeRpxzXnOJ8RG8RdR3pf7kOPDm7Xbgks5qMP0HgaJpZM4ItT5F .