Manual PCI-DA12-8/16
24
Event Counter
The Event Counter function has the ability to trace the number of events that have occurred. This function
accepts as input the Base Address of the card, as well as an additional parameter. The additional
parameter identifies which features should be implemented on this call to the function. Each feature can
be identified by its unique integer value. Multiple features can be run in a single call to the function by OR
ing the respective integer values together. Features will be executed in increasing integer order. The
CLOCK IN pin of the card is the point of application for the incoming events. (Note: This function is limited
by the input speed of the 8254 counter, and slow signals are preferred. Further only 65,535 events are
possible without a RESET.) The function returns the number of events (based on priority) or 0 for those
features that do not specify a return value.
Features:
Initialize
= 1;
initialize the counter.
Start
= 2;
begin counting.
Sincestart
= 4;
return the number of events since the start.
Sincelast
= 8;
return the number of events since last check.
Stop
= 16;
stop counting events.
Reset
= 32;
reset number of events to 0.
unsigned event_counter(unsigned BaseAddress, int feature);
Generate Frequency
The Generate Frequency function will generate a square wave (0 to +5V) with the desired frequency. The
Base Address of the card as well as the frequency are required as input to the function. The counter can
generate a frequency with a range of 1Hz to 250KHz. The square wave can be read on the CLOCK OUT
pin of the card.
void generatefrequency(unsigned BaseAddress, unsigned long frequency);
Pulse Width
The Pulse Width function will measure the width of an applied event from its rise to its fall (effectively one
half the period). The Base Address of the card is required as input to the function. The signal should be
applied to the CLOCK IN pin of the card. Software latency will be affected by the operating system and
will set a limit on the precision of the measurement.
unsigned pulse_width(unsigned BaseAddress);