plcpeople / nodepccc

Library for node.js to communicate with some Allen-Bradley programmable controllers (PLCs)
MIT License
81 stars 24 forks source link

[Question]Write variable, not array #9

Closed meron1122 closed 7 years ago

meron1122 commented 8 years ago

I have on 5000 bool variable mapped at 7. I already tried address like this "B7:0","B7:0/0" and nothing write single bool. If i changed bool to bool array "B7:0", "B7:1" works fine.

How to write single bool?

plcpeople commented 8 years ago

What command are you using to write it? What logs are written when this doesn't work? I have a project that writes a single bool (as either true or false), but in the 5000 the file is mapped as "N" instead of "B" type and it works fine. It writes false to "N42:0/0" with no issues.

My 5000 test setup is on loan to someone else right now otherwise I would test B7:0/0 myself.

meron1122 commented 8 years ago

Yup, but You write single bool in integer, this works fine for me too. I tried to use data type "bool" and write it, in logs only "quality bad". By the way, how to property write a long number? (Example 65000). Integer is too small.

Offtopic:Great works! This libary is very good option to build simple and pretty HMI! :)

plcpeople commented 8 years ago

I will try writing a bool when I get my 5000 back.

To write a long, try defining it in nodePCCC as "L10:0" for example and defining it as an L file when defining your mapping in RSLogix5000 and writing it that way. MicroLogix supports this as well. BUT the protocol does not seem to support WRITING of the higher bits 16-31 individually, it will only support low bits or the whole number. (I was not able to get it working and third party OPC servers also seem to only support this when using native CIP messaging instead of PCCC.) But writing the whole number seems to work fine.

Good to hear the project works for you, thanks.

plcpeople commented 7 years ago

OK I am going to close this after finally doing some testing with an L32E - I set up a variable mapped to file 3 called BTEST and when declared as an INT array, N3:0/0 worked in nodePCCC but B3:0/0 did not. I then changed the type to a BOOL array and B3:0/0 then worked in nodePCCC. So I would say if you want to use B notation with nodePCCC, declare it as a BOOL array in the PLC, if you want to use N notation, declare it as an INT. This seems to be just how the Logix-5000 based PLCs work with their support of the PCCC protocol.