Konica Minolta PCI-1712 Computer Hardware User Manual


 
– 50 –
Chapter 5
PCI-1712/1712L User’s Manual
Advantech Co., Ltd.
www.advantech.com
//Set the value of CRT2 as 65,535 for down counting
outport(addr2_1712+0x24,0x80); //Set CNT2’s gate input as high
outport(addr2_1712+0x24,0x88);
outport(addr2_1712+0x24,0x00); /*Generate one clock to CNT2,
and set CNT2’s gate input as
low*/
outport(addr2_1712+0x24,0x52); /*Set CNT2’s clock source as
external from CNT1’s OUT, and
negative polarity*/
outport(addr2_1712+0x22,0x80); //Set CNT1’s gate input as high
outport(addr2_1712+0x22,0x88);
outport(addr2_1712+0x22,0x80); //Generate one clock to CNT1
outport(addr2_1712+0x22,0x81); //Set CNT1’s clk source as
//internal
//Check if CNT2’s gate and clock are in logic-high status
//It means that if frequency measurement is in progress
while(i != 0x500)
{
i = inport(addr2_1712+0x24) & 0x0500 ;
}
//The CNT2 has started to do frequency measurement
//Check if CNT2’s gate is in logic-low status
//It checks if frequency measurementis over?
while(1)
{
i = inport(addr2_1712+0x24) & 0x0100 ;
if(i!=0x0100) break;
}
/*The CNT2 has finished the job, and then show the measured
frequency on display*/
dl= inport(addr2_1712+0x1c); //Read low byte
dh= inport(addr2_1712+0x1c)<<8; //Read high byte
dh= dh + (dl & 0x00ff);
old_count = 0xffff - dh ;