Konica Minolta PCI-1712 Computer Hardware User Manual


 
– 54 –
Chapter 5
PCI-1712/1712L User’s Manual
Advantech Co., Ltd.
www.advantech.com
//CNT1’s gate input received the measured signal, check if finished?
while(1)
{
i = inport(addr2_1712+0x22) & 0x0800;
if(i == 0x0000) break; //CNT1’s gate input is low
}
/*The CNT1 & 2 has finished the job, and then show the measured
period on display*/
dl= inport(addr2_1712+0x1a); //Read low byte
dh= inport(addr2_1712+0x1a)<<8; //Read high byte
dh= dh + (dl & 0x00ff);
neg_count = 0xffff - dh ;
dl= inport(addr2_1712+0x1c);
dh= inport(addr2_1712+0x1c)<<8;
dh= dh + (dl & 0x00ff);
pos_count = 0xffff - dh ;
duty = pos_count;
duty = duty + neg_count;
duty = (pos_count/duty)*100; //Show the duty ratio of positive
cycle
printf(“P+ = %u P- = %u Duty %5.3f \n”,pos_count,neg_count,
duty);
neg_count = 0;
pos_count = 0;
}