Register-Based Programming 51
Appendix B
/* wait 1 second (must wait at least 100 usec before writing a "0") */
wait(1);
err = viOut16(rf_mux,VI_A16_SPACE,0x04,0);
if(err < VI_SUCCESS)err_handler(rf_mux,err);
printf("\n\nE1470A is reset");
/* Close Session */
viClose (rf_mux);
viClose (defaultRM);
}
void err_handler()
/* Error Handling Routine */
{
ViStatus err;
char err_msg[1024] = {0};
viStatusDesc(rf_mux,err,err_msg);
if(strcmp ("VI_SUCCESS: No error",err_msg) != 0)
printf("ERROR = %s\n",err_msg);
return;
}
void wait (int wait_seconds)
/* Wait for specified period in seconds */
{
time_t current_time;
time_t entry_time;
fflush(stdout);
if(-1 == time(&entry_time))
{
printf ("Call failed, exiting ...\n");
exit(1);
}
do
{
if (-1 == time)¤t_time))
{
printf("Call failed, exiting ...\n");
exit(1);
}
}
while ((current_time - entry_time) ((time-t)wait_seconds));
fflush(stdout);
}