# cbCStoreOnInt()

Installs an interrupt handler that will store the current count whenever an interrupt occurs. This function can only be used with 9513 counters. This function will continue to operate in the background until either IntCount is satisfied or cbStopBackground() with CTRFUNCTION is called.

## Function Prototype

C/C++

int cbCStoreOnInt(int BoardNum, int IntCount, short CntrControl[], int MemHandle)

Visual Basic

Function cbCStoreOnInt(ByVal BoardNum&, ByVal IntCount&, CntrControl%, ByVal MemHandle&) As Long

## Arguments

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99. The specified board must have a 9513 counter.

IntCount

The counters will be read every time an interrupt occurs until IntCount number of interrupts have occurred. If IntCount is = 0, the function will run until cbStopBackground() is called. (Refer below to the MemHandle argument).

CntrControl

The array should have an element for each counter on the board. (5 elements for CTR05 device, 10 elements for a CTR10 device, and so on). Each element corresponds to a counter channel. Each element should be set to either CBDISABLED or CBENABLED. All channels that are set to CBENABLED will be read when an interrupt occurs.

MemHandle

Handle for Windows buffer. If IntCount is non-zero, the buffer referenced by MemHandle must be of sufficient size to hold (IntCount × Number of Counters) points.

## Returns

- Error code or 0 if no errors

## Notes

- If IntCount is non-zero, the buffer referenced by MemHandle must be able to hold (IntCount × Number of Counters) points.
- For example, if you set IntCount to 100 for a device, allocate the size of the buffer to be (100 × 5) = 500. This keeps the user application from having to move the data out of the buffer for every interrupt before it is overwritten. For each interrupt, the counter values will be stored in adjacent memory locations in the buffer.
- Allocate the proper buffer size for non-zero IntCount settings: Specifying IntCount as a non-zero value and failing to allocate the proper sized buffer results in a runtime error. There is no way for the Universal Library to determine if the buffer has been allocated with the proper size.