Rev 312 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 312 | Rev 314 | ||
---|---|---|---|
Line 59... | Line 59... | ||
59 | char cmd[0xFF]; |
59 | char cmd[0xFF]; |
60 | va_list aptr; |
60 | va_list aptr; |
61 | va_start(aptr, format); |
61 | va_start(aptr, format); |
62 | vsprintf(cmd, format, aptr); |
62 | vsprintf(cmd, format, aptr); |
63 | va_end(aptr); |
63 | va_end(aptr); |
64 |
|
64 | char *p= K2231A_Read(cmd ); |
- | 65 | if (p!= NULL) return atoi(p); |
|
- | 66 | return 0; |
|
65 | } |
67 | } |
66 | 68 | ||
67 | 69 | ||
68 | 70 | ||
69 | double K2231A_QueryDouble(const char *format, ...) { |
71 | double K2231A_QueryDouble(const char *format, ...) { |
70 | char cmd[0xFF]; |
72 | char cmd[0xFF]; |
71 | va_list aptr; |
73 | va_list aptr; |
72 | va_start(aptr, format); |
74 | va_start(aptr, format); |
73 | vsprintf(cmd, format, aptr); |
75 | vsprintf(cmd, format, aptr); |
74 | va_end(aptr); |
76 | va_end(aptr); |
75 |
|
77 | char *p= K2231A_Read(cmd ); |
- | 78 | if (p!= NULL) return atof(p); |
|
- | 79 | return 0; |
|
76 | } |
80 | } |
77 | 81 | ||
78 | static int K2231A_Port=5; |
82 | static int K2231A_Port=5; |
79 | int K2231A_SetPort(int x){K2231A_Port=x; return x;}; |
83 | int K2231A_SetPort(int x){K2231A_Port=x; return x;}; |
80 | 84 | ||
Line 88... | Line 92... | ||
88 | if (DeviceHandle) |
92 | if (DeviceHandle) |
89 | { |
93 | { |
90 | 94 | ||
91 | istat = viSetAttribute (DeviceHandle, VI_ATTR_TERMCHAR, '\n'); |
95 | istat = viSetAttribute (DeviceHandle, VI_ATTR_TERMCHAR, '\n'); |
92 | istat = viSetAttribute (DeviceHandle, VI_ATTR_TERMCHAR_EN, VI_TRUE); |
96 | istat = viSetAttribute (DeviceHandle, VI_ATTR_TERMCHAR_EN, VI_TRUE); |
- | 97 | int baud; |
|
- | 98 | ||
- | 99 | istat = viGetAttribute (DeviceHandle, VI_ATTR_ASRL_BAUD, &baud ); |
|
- | 100 | printf("baudrate1 = %d\n", baud); |
|
- | 101 | ||
93 | istat = viSetAttribute (DeviceHandle, VI_ATTR_TMO_VALUE, |
102 | istat = viSetAttribute (DeviceHandle, VI_ATTR_TMO_VALUE, 1000); |
94 | 103 | ||
95 | 104 | ||
96 | printf("\n"); |
105 | printf("\n"); |
97 | } |
106 | } |
98 | else |
107 | else |