![Ceyear 1465 Series Скачать руководство пользователя страница 122](http://html1.mh-extra.com/html/ceyear/1465-series/1465-series_programming-manual_2584913122.webp)
4 Programming example
4.1 Basic operation example
115
If using the NI-488.2 library, you must do the following operations:
Add GPIB-32.OBJ file to the source file;
Add windows.h file to the header file;
Add Deci-32.h file to the header file.
More detailed information on the NI-488.2 library and the VISA library is available on National
Instruments and Agilent websites respectively.
4.1.3 Initialization and default status setting
When the program starts, firstly initialize VISA resource manager, and then enable and establish the
communication connection between VISA library and the instrument. The specific steps are as follows:
4.1.3.1 Generation of global variable
First generate global variables to be recalled by other program modules, for example: Instrument handle
variable. The following example program shall contain the following global variables:
ViSession source;
ViSession defaultRM;
Const char sourceString [VI_FIND_BUFLEN] = "GPIB0::20::INSTR";
Const sourceTimeout = 10000;
The constant sourceString represents the instrument descriptor, ―GPIB0‖ represents the controller and
―20‖ represents the instrument connected to the controller. If supposing that the instrument is connected
with LAN and IP address is ―192.168.1.1‖, the variable will be:
Const char sourceString [VI_FIND_BUFLEN] = " TCPIP::192.168.1.1::INSTR ";
4.1.3.2 Controller initialization
/*************************************************************************/
The following example shows how to open and establish a communication connection between
VISA library and the instrument (specified by instrument descriptor).
//Initialize controller: Open the default resource manager and return to the device handle source
/*************************************************************************/
void InitController()
{
ViStatus status;
status = viOpenDefaultRM(&defaultRM);
status = viOpen(defaultRM, sourceString, VI_NULL, VI_NULL, &source);
}
4.1.3.3 Instrument initialization
/*************************************************************************/
The following example shows how to initialize the instrument default status and clear status
registers.
/*************************************************************************/
void InitDevice()
{
Содержание 1465 Series
Страница 1: ...1465 series Signal Generator Programming Manual...
Страница 2: ......
Страница 5: ......
Страница 39: ......
Страница 127: ......