-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathut_poll_stb.c
More file actions
43 lines (34 loc) · 858 Bytes
/
ut_poll_stb.c
File metadata and controls
43 lines (34 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//NOT RELIABLE WITH E4440A!
#include <stdio.h>
#include <stdlib.h>
#include "tmc.h"
#include "ut.h"
int main(int argc, char *argv[])
{
// char *bus_name="any", *device_name="any";
unsigned char buf[65536*16+8];
int a,b;
usbtmc_device_data *current_handle;
if (argc<2) {
fprintf(stderr,"Usage: %s <device> <command>\n",argv[0]);
exit(-1);
}
usbtmc_init();
current_handle=usbtmc_open(argv[1],0,0,1000);
if (!current_handle) {
fprintf(stderr,"couldn't open device %s\n",argv[1]);
return -1;
}
// usbtmc_clear(current_handle);
a=usbtmc_printf(current_handle,argv[2]);
usbtmc_readstb(current_handle);
for(a=0;(a&0x8040)!=0x8040;) {
usbtmc_readstb(current_handle);
a=usbtmc_poll_stb(current_handle,1);
printf("a: %04x\n",a);
usleep(10000);
}
printf("final status: %04x\n",a);
usbtmc_close(current_handle);
return 0;
}