Agilent Technologies E1465A Automobile Parts User Manual


 
94 Register-Based Programming Appendix B
/*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 MAKE_MEAS*/
int make_meas(reg_ptr)
DEV_REGS *reg_ptr;
{
/*close bit 1 of bank0 */
reg_ptr->bank0_channels=0x0001;
for (j=0; j<=7000; j ++); /*wait for switch to close*/
printf("\n Making Measurement");
.
. /*make measurements*/
.
/*open bit 1 of bank0*/
reg_ptr->bank0_channels=0x0000;
return;
}