Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
Hello
in the logic machine I would like to read digital from a PLC, I saw that by addressing the register I read the word, to read only the bit of the word in the profile file:
should i use in bit mask?
how does it work?
in the json file the septum anyway as a register?
Where can I find an example
thank you very much
Posts: 4640
Threads: 24
Joined: Aug 2017
Reputation:
207
If it is done correctly on PLC then digital should be a coil not register. If it is register then yes bitmask is needed in profile.
------------------------------
Ctrl+F5
Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
(27.04.2021, 12:17)Daniel. Wrote: If it is done correctly on PLC then digital should be a coil not register. If it is register then yes bitmask is needed in profile. how bitmask works, where can i find example.
thank you
Posts: 4640
Threads: 24
Joined: Aug 2017
Reputation:
207
------------------------------
Ctrl+F5
Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
(27.04.2021, 12:29)Daniel. Wrote: https://forum.logicmachine.net/showthrea...29#pid6729
I can't write the profile line
I have to read bit 2 of register 8 as I have to set the bitmask, the register is uint16.
thank you
Posts: 4640
Threads: 24
Joined: Aug 2017
Reputation:
207
{"name":"Your name" ,"bus_datatype":"1","type":"register","datatype":"uint16", "address":8, "value_bitmask":0x4 },
------------------------------
Ctrl+F5
Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
(27.04.2021, 13:13)Daniel. Wrote: {"name":"Your name" ,"bus_datatype":"1","type":"register","datatype":"uint16", "address":8, "value_bitmask":0x4 },
perfect last question if you wanted to invert both byte and word of the register the following instruction is correct
"Read_swap": "Byte and word"
thank you
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Use "read_swap":"bw"
Make sure that all properties are in lower case, otherwise they'll be ignored. Word swap only affects reading data that spans more than one register - int32, int64 etc. For a single register only byte swap can be applied.
Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
(27.04.2021, 14:11)admin Wrote: Use "read_swap":"bw"
Make sure that all properties are in lower case, otherwise they'll be ignored. Word swap only affects reading data that spans more than one register - int32, int64 etc. For a single register only byte swap can be applied.
maybe I'm missing something
as for the real analog -> floating 32 everything is ok
as for digital both in reading and writing, I have big problems, even using swap and bitmask
I have a doubt in the SIEMENS S7 1200 PLC I have a single db with real numbers and bits.
Using the PLC as TCP mb_server, are the PLC bits always registers of one word? to read the single bit it is right to use the nit mask, counting that verifying with the reading of the LM I have to swap "bw".
Does this also work in writing the bit?
Thank you
Posts: 4640
Threads: 24
Joined: Aug 2017
Reputation:
207
Writing for bitmask works but only on latest fw.
------------------------------
Ctrl+F5
Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
(27.04.2021, 19:49)Daniel. Wrote: Writing for bitmask works but only on latest fw. I have this versione of firmware 20201102 with Zerotier support, is the last version ?
Posts: 4640
Threads: 24
Joined: Aug 2017
Reputation:
207
write_bitmask Boolean FW 2020.10 and newer
Set to true to enable writing shifted value to the register using value_bitmask. Only uint16 datatype is supported
------------------------------
Ctrl+F5
Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
(28.04.2021, 07:51)Daniel. Wrote: write_bitmask Boolean FW 2020.10 and newer
Set to true to enable writing shifted value to the register using value_bitmask. Only uint16 datatype is supported
Hello
the json file below makes me a strange thing, any bit I write in the LM always writes me only the first bit in the PLC.
the strange thing is that as far as the analog values are concerned, everything works perfectly.
Where am I wrong?
Code: {
"manufacturer": "SIEMENS",
"description": "S7 1200",
"mapping": [
{"name": "SERRA 7 SP TEMP","address": 0,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 7 TEMP","address": 2,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 7 V_MAN_REG","address": 4,"bus_datatype": "float32","datatype": "float32","type": "register","units": " Hz","writable": "true"},
{"name": "SERRA 7 ISTERESI","address": 6,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 7 ASS 1","address": 8,"bus_datatype": "float32","datatype": "float32","type": "register","units": " A","writable": "false"},
{"name": "SERRA 7 ASS 2","address": 10,"bus_datatype": "float32","datatype": "float32","type": "register","units": " A","writable": "false"},
{"name": "SERRA 7 A/M REG","address": 12,"read_swap":"bw","value_bitmask":"0x1","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 CMD INV 1","address": 12,"read_swap":"bw","value_bitmask":"0x2","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 RUN INV 1","address": 12,"read_swap":"bw","value_bitmask":"0x4","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 ALM INV 1","address": 12,"read_swap":"bw","value_bitmask":"0x8","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 ACK INV 1","address": 12,"read_swap":"bw","value_bitmask":"0x10","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 CMD INV 2","address": 12,"read_swap":"bw","value_bitmask":"0x20","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 RUN INV 2","address": 12,"read_swap":"bw","value_bitmask":"0x40","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 ALM INV 2","address": 12,"read_swap":"bw","value_bitmask":"0x80","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 7 ACK INV 2","address": 12,"read_swap":"bw","value_bitmask":"0x100","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 SP TEMP","address": 14,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 8 TEMP","address": 16,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 8 V_MAN_REG","address": 18,"bus_datatype": "float32","datatype": "float32","type": "register","units": " Hz","writable": "true"},
{"name": "SERRA 8 ISTERESI","address": 20,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 8 ASS 1","address": 22,"bus_datatype": "float32","datatype": "float32","type": "register","units": " A","writable": "false"},
{"name": "SERRA 8 ASS 2","address": 24,"bus_datatype": "float32","datatype": "float32","type": "register","units": " A","writable": "false"},
{"name": "SERRA 8 A/M REG","address": 26,"read_swap":"bw","value_bitmask":"0x1","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 CMD INV 1","address": 26,"read_swap":"bw","value_bitmask":"0x2","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 RUN INV 1","address": 26,"read_swap":"bw","value_bitmask":"0x4","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 ALM INV 1","address": 26,"read_swap":"bw","value_bitmask":"0x8","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 ACK INV 1","address": 26,"read_swap":"bw","value_bitmask":"0x10","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 CMD INV 2","address": 26,"read_swap":"bw","value_bitmask":"0x20","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 RUN INV 2","address": 26,"read_swap":"bw","value_bitmask":"0x40","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 ALM INV 2","address": 26,"read_swap":"bw","value_bitmask":"0x80","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 8 ACK INV 2","address": 26,"read_swap":"bw","value_bitmask":"0x100","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 SP TEMP","address": 28,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 9 TEMP","address": 30,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 9 V_MAN_REG","address": 32,"bus_datatype": "float32","datatype": "float32","type": "register","units": " Hz","writable": "true"},
{"name": "SERRA 9 ISTERESI","address": 34,"bus_datatype": "float32","datatype": "float32","type": "register","units": " C°","writable": "true"},
{"name": "SERRA 9 ASS 1","address": 36,"bus_datatype": "float32","datatype": "float32","type": "register","units": " A","writable": "false"},
{"name": "SERRA 9 ASS 2","address": 38,"bus_datatype": "float32","datatype": "float32","type": "register","units": " A","writable": "false"},
{"name": "SERRA 9 A/M REG","address": 40,"read_swap":"bw","value_bitmask":"0x1","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 CMD INV 1","address": 40,"read_swap":"bw","value_bitmask":"0x2","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 RUN INV 1","address": 40,"read_swap":"bw","value_bitmask":"0x4","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 ALM INV 1","address": 40,"read_swap":"bw","value_bitmask":"0x8","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 ACK INV 1","address": 40,"read_swap":"bw","value_bitmask":"0x10","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 CMD INV 2","address": 40,"read_swap":"bw","value_bitmask":"0x20","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 RUN INV 2","address": 40,"read_swap":"bw","value_bitmask":"0x40","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 ALM INV 2","address": 40,"read_swap":"bw","value_bitmask":"0x80","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"},
{"name": "SERRA 9 ACK INV 2","address": 40,"read_swap":"bw","value_bitmask":"0x100","bus_datatype": "bool","datatype": "uint16","type": "register","writable": "true"}
]
}
Thanks so much
Posts: 4640
Threads: 24
Joined: Aug 2017
Reputation:
207
"write_bitmask": true
------------------------------
Ctrl+F5
Posts: 327
Threads: 126
Joined: May 2020
Reputation:
0
(28.04.2021, 09:29)Daniel. Wrote: "write_bitmask": true
Perfect tanks so much, all works.
|