Access PCI-DIO-24D(H) Computer Hardware User Manual


 
1st Read: Status byte
2nd Read: Low byte of latched data
3rd Read: High byte of latched data
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 this card. Source code for the
driver and a sample program showing how to use the functions are located 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
requires the Base Address and an additional parameter that 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 ORing 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);
Manual PCI-DIO-24DH
25