eWON.biz
Knowledge Base

Latest changes
eWON wiki > eWON Support > Knowledge Base > Questions and Answers > How to extract a bit out of a register using Modbus IOServer

How to extract a bit out of a register using Modbus IOServer

From $1

Table of contents

 

Unlike other IOServers on the eWON, the Modbus IOserver does not allow to extract a bit of a word.
You can use the eWON Modbus IOserver to read directly a bit (coil or input) on the Modbus device, but there does not exist a functionality in the eWON Modbus IOserver which allows to extract directly a bit of a 16bit register.

As work around you can use eWON scripting to extract manually the bit of the word.
Here under a script example:

a% = INT(tag_40001@)
tag_40001_0@ = a%#1
tag_40001_1@ = a%#2
tag_40001_2@ = a%#3
tag_40001_3@ = a%#4

Rem:
tag_40001 is the name of the Tag which is linked to a Modbus register
tag_40001_0, tag_40001_1, etc.  are internal memory tags of the eWON (MEM tags)