Konica Minolta PCI-1712 Computer Hardware User Manual


 
– 49 –
Chapter 5
PCI-1712/1712L User’s Manual
Advantech Co., Ltd.
www.advantech.com
Figure 5-6: Frequency measurement
The following C program serves as an example to explain how to
implement the frequency measurement by software.
outport(addr2_1712+0x26,0x03); // Set internal clock as 10 KHz
while(!kbhit())
{
//Initialize CNT1 and CNT2
outport(addr2_1712+0x24,0x00);
outport(addr2_1712+0x22,0x00);
//Setup CNT1 to output 1 sec. pulse in One-Shot mode
outport(addr2_1712+0x1e,0x72); //CNT1 82C54 mode 1
outport(addr2_1712+0x1a,0x10); //Set CNT1 low byte
outport(addr2_1712+0x1a,0x27); //Set CNT1 high byte
/*CNT1 generate the pulse with 1 sec. period (10KHz/ 10,000 pulse =1
Hz) */
/*Setup CNT2 to count the event of external measured clock signal
during one-shot //pulse from CNT1*/
outport(addr2_1712+0x1e,0xb0); //CNT2 82C54 mode 0
outport(addr2_1712+0x1c,0xff); //Set CNT2 low byte
outport(addr2_1712+0x1c,0xff); //Set CNT2 high byte