ICP DAS USA PCI-1202L User Manual page 57

Multi-function boards
Table of Contents

Advertisement

PCI-1202/1602/180x Series Card
Multi-Function Boards
 timer2  for Machine Independent Timer
P180x_DelayUs(...) is designed for PCI-1800/1802 series.
P1202_DelayUs(...) is designed for PEX-1202/PCI-1202 series.
P1602_DelayUs(...) is designed for PCI-1602 series.
/* address of timer 2
address of ctrl
input clock
down count 8 time
down count 65536/8 = 8192 μs --> max 8191 μs */
WORD P180X_DelayUs(WORD wDelayUs)
{
WORD wDownCount,wLow,wHigh,wVal;
double fTimeOut;
if (wDelayUs>=8191) return(InvalidateDelay);
wDownCount=wDelayUs*8;
wLow=wDownCount&0xff;
wHigh=(wDownCount>>8)&0xff;
outport((wAddrTimer+3*4), 0xb0);
outport((wAddrTimer+2*4), wLow);
outport((wAddrTimer+2*4), wHigh);
fTimeOut=1.0; // wait 1 to stop
for (;;)
{
wVal=inport(wAddrCtrl)&0x01;
if (wVal!=0) return(NoError);
fTimeOut+=1.0;
if (fTimeOut>6553500.0)
return(DelayTimeOut);
}
}
= wAddrTimer+2*4
= wAddrTimer+3*4
= 8 M
= 1 μs
User Manual/ Ver. 4.8/ Mar. 2015/ PMH-0014-48/ Page: 57
/* timer_2 mode_0 0xb0 */
/* if the timer is up, this bit will be 1 */

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents