User manual
Page 6-5
Manual MPCI-DA12-16.Dh
After any latching operation on a counter, the contents of its hold register must be read before any
subsequent latches of that counter will have any effect. If a status latch command is issued before the
hold register is read, then the first read will read the status, not the latched value.
8254 Driver
A simple driver is provided to perform basic counter/timer operations on the cards. Source code for
the driver and a sample program showing how to use the functions is in the DOS\CSAMPLES
directory. The following functions are provided:
Frequency Measure
The Frequency Measure function of the 8254 Counter Driver has the ability to measure an unknown
frequency from 1KHz to 2MHz. This function requires as input the Base Address of the card. The
unknown frequency is applied to the CLOCK IN pin of the card. The function will return the frequency
as a long integer in Hz.
long frequency_measure(unsigned BaseAddress);
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);