Cicode Programming Reference > Cicode Function Categories > Trend Functions Introduction > TrnGetBufValue

TrnGetBufValue

Gets the value of a trend at an offset for a specified pen. The offset should be a value between -1 and the number of samples displayed on the trend.

Syntax

TrnGetBufValue(AN, Pen, Offset)

AN:

The AN where the trend is located.

Pen:

The trend pen number:

0 - The pen currently in focus

1...8 - Pen1. . .Pen8

Offset:

The trend buffer offset, in samples. The number of samples can range from -1 to the maximum number of samples that can display on the trend minus 1.

-1 means get the last valid value in the display (provided it is less than 1.5 sample periods old).

If there is no invalid or gated sample within the last 1.5 sample periods, it is assumed that a sample has been missed and an invalid trend value is returned. See the TrnIsValidValue function.

Return Value

The trend value. If the actual value is gated or invalid, the standard invalid or gated values are returned (no error is set). You can check this return value using TrnIsValidValue().

Related Functions

TrnGetCursorValue, TrnIsValidValue

Example

! For the trend at AN20
DspText(31,0,TrnGetBufValue(20,0,10):###.#);
/* Displays the trend value at offset 10 for the pen currently in focus. */

See Also

Trend Functions