Agilent Technologies E1465A Automobile Parts User Manual


 
Register-Based Programming 97Appendix B
/*sub to verify the time to close the switch*/
ver_time( );
/*sub to close a set of switches and make measurements*/
scan_meas(dev);
} /*END of main program*/
/*SUB VER_TIME*/
ver_time( )
{
struct timeval first,
second,
lapsed;
struct timezone tzp;
gettimeofday(&first,&tzp);
for (j=0; j<=7000; j ++);
gettimeofday ($second,&tzp);
if (first.tv_usec > second.tv_usec)
{
second.tv_usec +=1000000;
second.tv_sec--;
}
lapsed.tv_usec = second.tv_usec - first.tv_usec;
lapsed.tv_sec = second.tv_sec - first.tv_sec;
printf("Elapsed time for closing a channel is: %ld sec %ld usec \n",
lapsed.tv_sec, lapsed.tv_usec);
}
/*SUB SCAN_MEAS*/
int scan_meas(reg_ptr)
DEV_REGS *reg_ptr;
{
/*set bank0 to 000 */
reg_ptr->bank0_channels=0x000;
i=0;
for (i=0;i=lastch;i ++)
{
y=i;
reg=pow(2.0,y);
reg_ptr-bank0_channels=reg;
for (j=0; j<=7000; j ++); /*wait for switch to be closed*/
printf("\n Making Measurement");
.
. /*make measurements*/
.
}
return;
}