Hi, i am connecting my M580 to my Citect scada 2018 and i wanna pass along a word type and don't seem to find it in citect scada so i am wondering if i chose Real type will it pass the exact value or change it somehow.. i can't check with the simulations that is why i need to know since i am still early on in the project.
WORD type doesn't exist as Type of Tags in Citect SCada. Depending what you want to do with the variable read from the M580, you can choose any 16 bits type ( 2 bytes long). see the table here after:
If you are certain that your WORD value will not exceed 32,767 then in your M580 code use the WORD_TO_INT function then send the resulting INT to Citect. You can also use WORD_TO_REAL or WORD_TO_UINT, all depends on the limits of the value you are reading and you can select the appropriate data type in Citect that caters for it.
There is no need to change the type in Control Expert, you can let the WORD type. In Citect define a type with UINT and the address on the Control Expert variable type WORD and that's it.
Normally when you use a WORD format in Control Expert, it is to use Bits inside.
They can be extracted in Citect with the BITAND function. If you need to read the bit 4 of a tag named MyTag (type UINT, mapped on a Control Expert variable type WORD), the function will be MyTag BITAND 0x0010. It can be used for animation, alarms or to set a DIGITAL Tag variable (Address will be MyTag BITAND 0x0010)
Basically you need to to BITAND/BITOR instructions to set/reset the bit of a word
I usually use a Cicode function that I pass the Tag value, the bit number and the state I want to change the bit to
INT FUNCTION LEB_writebit(INT iOldVal, INT iBit, INT bVal)
IF bVal = 1 THEN
iNewVal = iOldVal BITOR Pow(2,iBit);
iNewVal = iOldVal BITAND ( 0xFFFF BITXOR Pow(2,iBit));
Then, on a button or whatever, if I want to set bit 4 of Tag "Tag1" I would use
Tag1 = LEB_writebit(Tag1, 4, 1)
Discuss challenges in energy and automation with 30,000+ experts and peers.
Find answers in 10,000+ support articles to help solve your product and business challenges.
Find peer based solutions to your questions. Provide answers for fellow community members!