18.01.2015 Views

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

Technical Reference Manual - InduSoft

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix: Built-in Scripting Language<br />

Tag Name<br />

Expression<br />

Tag Format( "%h", 30 ) // Returned value = "00:00:30"<br />

Tag Format( "%h", 60 ) // Returned value = "00:01:00"<br />

Tag Format( "%h", 90 ) // Returned value = "00:01:30"<br />

Tag Format( "%h", 3600 ) // Returned value = "01:00:00"<br />

Tag Name<br />

Expression<br />

Tag Format( "##.#", 26.56789 ) // Returned value = "26.6"<br />

Tag Format( "#.##", 26.56789 ) // Returned value = "26.57"<br />

Tag Format( "##.##", 26.56789 ) // Returned value = "26.57"<br />

GetBit<br />

GetBit is a built-in scripting function that gets the value of a single bit in a numeric value.<br />

Function Group Execution Windows Embedded Thin Client<br />

GetBit Arithmetic Synchronous Supported Supported Supported<br />

Syntax<br />

GetBit( tagName, numBitNumber )<br />

tagName<br />

numBitNumber<br />

The name of an Integer tag from which the bit value will be gotten.<br />

Note: To directly specify the name of a tag, rather than take the value of<br />

the tag, you must enclose the tag name in double-quotes. For example,<br />

GetBit( "Second", 1 ).<br />

A numeric tag or value specifying the position (0…31) of the bit to get.<br />

Returned value<br />

Returns the value ( 0 or 1 ) of the specified bit.<br />

Notes<br />

You also can use the Bit field to read/write values from specific bits in an integer tag. For example, enter<br />

Second->b0 to access the LSB (Least Significant Bit of the Second tag), and Second->b31 to access the MSB<br />

(Most Significant Bit of the Second tag).<br />

Examples<br />

Tag Name<br />

Expression<br />

Tag GetBit( "numSource", 4 ) // If the tag numSource holds a value of 15, then this function returns 0.<br />

Tag GetBit( "numSource", 1 ) // If the tag numSource holds a value of 19, then this function returns 1.<br />

Page 538<br />

<strong>InduSoft</strong> Web Studio

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!