Chapter 4
NI-FBUS CM Software
NI-FBUS Hardware and Software User Manual
4-4
ni.com
Example: Using Core Functions
Suppose the object
VIEW_1
for a PID function block consists of
GAIN
,
RATE
,
SP
,
CAS_IN
,
MODE
, and
ALARM_SUM
parameters of the PID function
block. You want to get the values of all these parameters using a single read
of the
VIEW_1
object. If the tag of a PID function block is
TIC101_PID
,
you can read the
VIEW_1
object by executing the following function call:
nifReadObject(sessionDesc, "TIC101_PID.VIEW_1", buffer,
&cnt)
Notice that it is not necessary to have a block descriptor to read the
parameters of an object. If you
do
have the block descriptor, you can read
the object with the following call:
nifReadObject(blockDesc, "VIEW_1", buffer, &cnt)
You can get the block descriptor using
nifOpenBlock
, which returns
blockDesc
.
If you wanted to change the setpoint of the preceding PID block, you can
do so with the following call:
nifWriteObject(sessionDesc, "TIC101_PID.SP", buffer,
cnt)
Alert and Trend Functions
When a properly configured device detects an alarm condition, the device
broadcasts the data. A host device receives the alarm, then sends a
communication acknowledgment and an operator acknowledgment to the
field device. The field device also can collect trends based on a configured
sample type and interval. When the field device collects 16 samples, it
broadcasts the trend data on the Fieldbus. Any number of interested hosts
can collect this data. For more details, refer to the
Foundation
Specification: Function Block Application Process, Part 1
document.
With a program such as the NI-FBUS Configurator, you can configure
the F
OUNDATION
™
Fieldbus field devices to broadcast alert and trend data.
The NI-FBUS Communications Manager has functions to receive
trends and alerts from configured devices and to perform operator
acknowledgment on alerts.
nifWaitAlert
and
nifWaitAlert2
lets you
wait for an alert from any device in a link, any function block in a physical
device, or a specific function block, depending on the type of descriptor
that you pass to it. When the NI-FBUS Communications Manager receives
an alert, it returns a structure containing information about the alert.