# CStoreOnInt()

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

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function CStoreOnInt(ByVal intCount As Integer, cntrControl As MccDaq.CounterControl, ByVal memHandle As IntPtr) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo CStoreOnInt(int intCount, MccDaq.CounterControl cntrControl, IntPtr memHandle)

##### Deprecated methods

The following methods are deprecated, and should only be used for legacy applications. The methods above are preferred, and must be used for 64-bit application development.

VB .NET

Public Function CStoreOnInt(ByVal intCount As Integer, ByRef cntrControl As MccDaq.CounterControl, ByVal memHandle As Integer) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo CStoreOnInt(int intCount, ref MccDaq.CounterControl cntrControl, int memHandle)

## Parameters

intCount

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

cntrControl

The array should have an element for each counter on the board. (5 elements for a 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 MccDaq.CounterControl.Disabled or MccDaq.CounterControl.Enabled

All channels that are set to MccDaq.CounterControl.Enabled 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

- An ErrorInfo object that indicates the status of the operation.

## Notes

If the Library Revision is set to 4.0 or greater, the following code changes are required:

- 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 CTR05 device, you must allocate the size of the buffer to be (100 × 5) = 500. This new functionality keeps the user application from having to move the data out of the buffer for every interrupt, before it is overwritten. Now, for each interrupt, the counter values will be stored in adjacent memory locations in the buffer.
- Important: 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.
- If intCount = 0, the functionality is unchanged.