beautypg.com

Interrupt input pin (int) – Measurement Computing USB-4301 User Manual

Page 20

background image

USB-4301 User's Guide

Functional Details

20

Configure Counter 2:

1.

Set the count source for Counter 2 to be the (TC n-1). This causes Counter 2 to increment when Counter 1

reaches TC.

2.

Load the Counter 2 Load Register 2 with a value of zero, since you want Counter 2 to start at 0 and count

up. Counter 2 requires no gating, no special gate, no reloading, and no recycling.

3.

Enable binary mode.

When the button is depressed, Counter 1 will start counting from 0 to 65,535 over and over again. Every time

Counter 1 reaches 65,535, Counter 2 increments by 1 (starting from 0). When the button is released, Counter 1

stops counting. At that point, the count values can both be read.

The total time the button is pressed in µs is (Counter 2 counts * 65,536) + Counter 1 counts µs. If Counter 2 is

at 9 and Counter 1 is at 34,671, the total time is (9 * 65,536) + 34,671 = 624,495 µs = 0.624495 s.

Interrupt input pin (INT)

You can configure the interrupt input pin to perform the following tasks:

Generate an event notification that will be sent to the computer

Latch in the eight digital inputs.
When this option is active, the digital inputs always return the same value until a new active edge is

received on the interrupt pin. When the active edge is received, the current value is latched at the input

pins, and held until the next active edge.

Interrupt latency when latching inputs
There is a latency period between when an active interrupt edge occurs on the INT pin and when the action

triggered by that interrupt occurs. This latency can be as long as 100 µs, but typically varies from about 9 µs to

about 40 µs between interrupts.

Latch out a digital output value.
When this option is active, the digital outputs do not change state until a new active edge is received on the

interrupt pin. New values sent to the digital outputs are stored. The most recently received value is latched

out and held at the next active edge.

Save the current value of all five counters to their respective Hold registers. You can read the value of the

counter when the interrupt was received from the Hold registers.

For more information on the configuration options for your USB-4301, refer to the "USB-4300 Series" section

of the "Counter Boards" chapter in the Universal Library User's Guide. This document is available on our web

site at

www.mccdaq.com/PDFmanuals/sm-ul-user-guide.pdf

.

This manual is related to the following products: