Cstore.vi – Measurement Computing UL for NI LabVIEW User Manual
Page 68

Universal Library Virtual Instruments (VIs)
Counter VIs
CStore.VI
Changed R4.0 RW (MOD)
Installs an interrupt handler that will store the current count whenever an interrupt occurs. This VI can only be
used with 9513 counters. This VI will continue to operate in the background until either
IntCount
is satisfied
or StopBg.VI is called.
Summary:
Inputs:
BoardNum
[U32] - The board number assigned when installed with InstaCal. Can
be 0 to 100.
IntCount
[I16] - Number of interrupts.
CntrControl
[TF] - Array with each element set to either
ENABLED
or
DISABLED.
Outputs:
Context
[cluster] - Output data structure
ErrCode
[I32] - Error code. See ErrMsg.VI
Arguments:
BoardNum
The board number associated with a board when it was installed with InstaCal. The
specified board must have a 9513 counter.
IntCount
The counters will be read every time an interrupt occurs until
IntCount
interrupts
have occurred. If
IntCount
is = 0 then the VI will run until StopBg.VI is called.
CntrControl
The array should have an element for each counter on the board (five elements for
CTR-05 board, 10 elements for a CTR-10, etc.). Each element corresponds to a
possible counter channel. Each element should be set to either
DISABLED
(False) or
ENABLED
(True). All channels that are set to
ENABLED
will be read when an interrupt
occurs.
Context
Data structure containing information from a background operation. Some of the
information included is the board number, the data array, the array size, and the
initial status of the background operation.
Follow the steps below when wiring this VI:
1.
DInScBg.VI starts a background operation.
2.
GetStatus.VI checks for completion (boolean output called "Running").
3.
StopBg.VI terminates the operation, if not already done, and frees memory aliases.
4.
Data output from the background operation is passed to GetStatus.VI and
StopBg.VI via Context, and can be wired from one or both of them for
intermediate or final actions, respectively.
The demo VIs illustrate this process effectively.
ErrCode
Error code returned from the Universal Library. Zero if no error occurred. Use the
ErrMsg VI to convert
ErrCode
into a readable string.
New Functionality:
If the Library Revision is set to 4.0 or greater then the following code changes are required.
If
IntCount
is non-zero then the
Context
object will contain
IntCount
samples for each counter. Counter
elements that are
DISABLED
will return 0.
For example, if
IntCount
is set to 100 for a CTR-05 board, then the new functionality keeps the user
application from having to move the data out of the context buffer for every interrupt, before it is overwritten.
Now, for each interrupt the counter values will be stored in adjacent memory locations within the context.
68