st-one-io / node-red-contrib-s7

A Node-RED node to interact with Siemens S7 PLCs
GNU General Public License v3.0
111 stars 58 forks source link

s7-Out, send a Boolean command #20

Closed mrsalhaoui closed 6 years ago

mrsalhaoui commented 6 years ago

Hello, I'm trying to send the value true or false to my variable test in the PLC, using the node S7, but it doesn't work when I put the adress : DB3,X42.0 or even DB3,BOOL42.0.

imagen

gfcittolin commented 6 years ago

Hi, You should try DB3,X42.0 (with a comma instead of the first dot). We use here the naming schema of the library we use under the hood, plcpeople/nodes7.

gfcittolin commented 6 years ago

Oh, now I see you've used the comma on the screenshot, the dot was a typo on your text. Shouldn't your string "MatriculaEntrante" be DB3,S10.30, as it's 30 bytes long?

If you don't succeed, maybe could you activate the debug mode and post the logs from Node-RED, so we can try to understand why it's not working.

mrsalhaoui commented 6 years ago

Yes, but the string works very well, and the number 32 for the string, came from the difference between the offset of the Bool variable and the string's offset, I tried yesterday to put the variable Bool before the variable string in the table, and it works, but when is directly after the string it doesnt !! why ? Can you show me please how to activate the debug mode ?

gfcittolin commented 6 years ago

You can activate the debug mode in the config node of the PLC: image

The bool access should indeed work either before or after the string, so there may be a bug here. But I'd suggest trying to set the string length to 30. The underlying library should account for the 2 extra bytes used to store the string length. The way you have it configured you may be asking to read beyond the memory area of your DB.

mrsalhaoui commented 6 years ago

Yes , you are right, when I changed the string length to 30, it worked, the value 32 was like an excess of memory that is why I didn't receive anything in the next value. Thank you. imagen Would you please send to us all cases of variables that can we send to the PLC, and supported by the node S7. Thank you.

gfcittolin commented 6 years ago

We support reading all basic types from DBs (boolean, int, dint, word, dword, real, char, string), and additionaly timers and counters when reading from other memory areas.

We plan to add support to field validation in the next minor version of the node, but until there, the only way to be sure of the supported types is by looking at the sources on the library here

mrsalhaoui commented 6 years ago

Ok Thank you so much.