nodes7 icon indicating copy to clipboard operation
nodes7 copied to clipboard

Can`t write to booleans

Open AMooshofer opened this issue 3 years ago • 5 comments

I got another issue: i can not write to a boolean on my S7-300 or S7-400 plc. I tried every other datatype (INT, REAL, DT, strings), but on boolean i get an error:

(node:10696) UnhandledPromiseRejectionWarning: Error: PLC error [0x8104]: This service is not implemented on the module or a frame error was reported at S7Connection._onIncomingData (D:\Freigabe\curly-octo-spork\node_modules\@st-one-io\nodes7\src\s7connection.js:170:23) at S7Parser.<anonymous> (D:\Freigabe\curly-octo-spork\node_modules\@st-one-io\nodes7\src\s7connection.js:84:43) at S7Parser.emit (events.js:315:20) at addChunk (_stream_readable.js:302:12) at readableAddChunk (_stream_readable.js:278:9) at S7Parser.Readable.push (_stream_readable.js:217:10) at S7Parser.Transform.push (_stream_transform.js:152:32) at S7Parser._transform (D:\Freigabe\curly-octo-spork\node_modules\@st-one-io\nodes7\src\s7protocol\s7parser.js:480:22) at S7Parser.Transform._read (_stream_transform.js:191:10) at S7Parser.Transform._write (_stream_transform.js:179:12) at emitUnhandledRejectionWarning (internal/process/promises.js:149:15) at processPromiseRejections (internal/process/promises.js:211:11) at processTicksAndRejections (internal/process/task_queues.js:98:32) (node:10696) Error: PLC error [0x8104]: This service is not implemented on the module or a frame error was reported at S7Connection._onIncomingData (D:\Freigabe\curly-octo-spork\node_modules\@st-one-io\nodes7\src\s7connection.js:170:23) at S7Parser.<anonymous> (D:\Freigabe\curly-octo-spork\node_modules\@st-one-io\nodes7\src\s7connection.js:84:43) at S7Parser.emit (events.js:315:20) at addChunk (_stream_readable.js:302:12) at readableAddChunk (_stream_readable.js:278:9) at S7Parser.Readable.push (_stream_readable.js:217:10) at S7Parser.Transform.push (_stream_transform.js:152:32) at S7Parser._transform (D:\Freigabe\curly-octo-spork\node_modules\@st-one-io\nodes7\src\s7protocol\s7parser.js:480:22) at S7Parser.Transform._read (_stream_transform.js:191:10) at S7Parser.Transform._write (_stream_transform.js:179:12) (node:10696) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:161:11) at processPromiseRejections (internal/process/promises.js:213:13) at processTicksAndRejections (internal/process/task_queues.js:98:32)

My test function: async function test() { var endp = new S7Endpoint(param[0]); endp.once("connect", async () => { console.log("Connection established!"); let itemGroup = new S7ItemGroup(endp); await itemGroup.writeItems("DB5,X524.0", true); }); endp.on("error", (err) => { console.log(Error on connection: ${err}); }) }

AMooshofer avatar Jan 16 '21 16:01 AMooshofer

For me your code works. Did you test the other datatypes in the same db? Make sure to disable optimized block access and protection settings in the plc for the datablock.

BTNDev avatar Jan 16 '21 16:01 BTNDev

yes, i can write to any other variable of another type in this data block. It also won´t work in the M-area in the plc. Optimized block access is no option in an S7-400 or 300 plc, so it is definetly disabled.

AMooshofer avatar Jan 16 '21 17:01 AMooshofer

I tested this more detailed now, on my IM151-8 CPU it works fine. bot on my old S7-414 with an CP443-1 it just works for all data-types except bolleans. Arrays won't work on both CPUs, but thats fine to me.

Is there any requirements for the CP or CPU used on your API which are different to plcpeople's nodes7? Because it works there.

AMooshofer avatar Jan 18 '21 15:01 AMooshofer

It seems to be related to the padding byte of the telegrams. Looks like we need to consider padding when receiving read responses, but we should not include them in the write requests. The CPUs I have here handle both cases well (with and without padding), but I don't have a 400 CPU here for testing. I'll investigate this deeper in the next weeks

gfcittolin avatar Jan 22 '21 19:01 gfcittolin

that would be awsome cause your module would be so much easyer to use in my applications than plcpeople's. If you got something to test just post what code to change and i can test it on my S7-400 CPU's.

AMooshofer avatar Jan 25 '21 18:01 AMooshofer