This FAQ has been written for NEAL (North East Africa and Levant) region. If you are looking for information for another region, please select the correct country from the top-left dropdown in the page and 'Navigate to Browse FAQs' in the Support menu.
OPC protocol is a tag based addressing, so you cannot use modbus address like %M101.1 when using OPC.
If the requirement is to extract bit from word, so here it is the below solutions.
- If you are using unity software, create variables with address inside unity like %MW101.0 and link the file to OFS. so you will have bit information to OPC client automatically.
- Else you read word directly from device with tag based addressing and later use script in scada to extract bit from word. Am not sure what scada and PLC programming software you are using. But my below answer is based on OFS, Vijeo citect and unity software.
// Read an indivual bit number (0-31) from an integer and return
// the state (0 or 1)
INT
FUNCTION
BitRead(INT iValue, INT iBitNo)
RETURN (iValue BITAND Pow(2, iBitNo)) <> 0;
END
- Last solution is to change protocol type ot modbus TCPIP so that its easir for you read directly without using OFS.
If the requirement is to extract bit from word, so here it is the below solutions.
- If you are using unity software, create variables with address inside unity like %MW101.0 and link the file to OFS. so you will have bit information to OPC client automatically.
- Else you read word directly from device with tag based addressing and later use script in scada to extract bit from word. Am not sure what scada and PLC programming software you are using. But my below answer is based on OFS, Vijeo citect and unity software.
// Read an indivual bit number (0-31) from an integer and return
// the state (0 or 1)
INT
FUNCTION
BitRead(INT iValue, INT iBitNo)
RETURN (iValue BITAND Pow(2, iBitNo)) <> 0;
END
- Last solution is to change protocol type ot modbus TCPIP so that its easir for you read directly without using OFS.
Released for:Schneider Electric Egypt and North East Africa

