Cicode Programming Reference > Cicode Function Categories > Tag Functions Introduction > TagRamp

TagRamp

This function will increment a Tag by the amount defined by iPercentInc. It is often used for incrementing a tag while a button is held down.

Syntax

TagRamp(sTag, iPercentInc)

sTag:

The variable tag name (or alarm property name), as a string. The name of the tag can be prefixed by the name of the cluster that is "ClusterName.Tag".

To read a particular element in an array, you can enter the array name here, followed by an index to the element as follows:

"PLC_Array[9] "

The above example tells the function to read the 10th element in the array variable PLC_Array (remember, the address of the first element in an array is 0 (zero)).

If you enter an array offset using the nOffset argument, it will be added to the index value specified here. For example, TagRead("PLC_Array[9]", 4) will read the 14th element in PLC_Array (because [9] means the 10th element, and an offset of 4 means 4 elements after the 10th = element 14).

iPercentInc:

The percentage by which you want to increase the value of the variable. A negative number will decrease the variable. The increment is calculated as a percentage of the full range.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

TagInfo, TagRead, TagWrite

Example

Buttons

Text

Ramp Up

Repeat Command

TagRamp("PLC_VAR_1",2);

Comment

Continual increment by 2%

See Also

Tag Functions