
Programming Examples
Perform Simple Power Measurement
6
6-7
* power measurement. It dwells in viRead function while waiting
* for measurement.
*
* The time it will take to measure the power depends on the voltage and
* current signals attached to the instrument. Default averaging interval
* (equals to measurement time) is 300 ms. In the case viRead times out
before
* the measured power is returned, VISA timeout must be increased. Use
* function viSetAttribute to change the timeout value (default is 10 sec).
*/
#include <visa.h>
#include <stdio.h>
#define INTFC_RS232 1 /* RS-232 interface */
#define INTFC_GPIB 2 /* GPIB / IEEE 488.2 interface */
#define INTFC_LAN 3 /* ethernet / IEEE 802.3 interface */
#define INTFC_USB 4 /* USB interface (Virtual COM Port) */
#if 1
#define INTFC INTFC_RS232
#elif 1
#define INTFC INTFC_GPIB
#elif 1
#define INTFC INTFC_LAN
#else
#define INTFC INTFC_USB
#endif
#if INTFC == INTFC_RS232
# define RSRC_NAME "ASRL1" /* COM1 */
# define RSRC_ATTR_BAUD 115200 /* baud rate */
# define RSRC_ATTR_FLOW_CNTRL VI_ASRL_FLOW_RTS_CTS /* flow control */
#elif INTFC == INTFC_GPIB
# define RSRC_NAME "GPIB::5"
#elif INTFC == INTFC_LAN
# define RSRC_NAME "TCPIP::192.168.2.251::23::SOCKET"
#elif INTFC == INTFC_USB
# define RSRC_NAME "ASRL2" /* COM2 */
#else
#error 'INTFC': unsupported value
#endif
ViSession rm, // Default resource manager session
vi; // VISA session
ViChar buffer[512]; // buffer to hold instrument response
ViUInt32 retCnt; // number of bytes read from the instrument
#if WIN32
#include <windows.h>
static void Delay(double seconds)
{
Sleep((DWORD)(seconds * 1000));
}
#endif
Summary of Contents for NORMA 4000 Operators
Page 6: ...Remote Control Users Guide iv ...
Page 8: ...Remote Control Users Guide vi ...
Page 10: ...Remote Control Users Guide viii ...
Page 26: ...Remote Control Users Guide 2 2 ...
Page 38: ...Remote Control Users Guide 3 2 ...
Page 50: ...Remote Control Users Guide 4 2 ...
Page 150: ...Remote Control Users Guide 4 102 ...
Page 152: ...Remote Control Users Guide 5 2 ...
Page 160: ...Remote Control Users Guide 6 2 ...
Page 184: ...Remote Control Users Guide 6 26 ...