1. Overview
Production test, the test instrument is indispensable, if it is a small-scale production, manual test can deal with; But to think about the purpose of mass production, in order to simplify the test, to save time, it needs to be automated testing, for this demand, the automation program on had demand, Namisoft explains instrument for everyone to do a programmable,
Below is a relatively common test framework
The most critical part of the whole control process is the communication between PC with the test instrument, test environment set up first, able to communication is a critical first step, the second step is to use "the language of the instrument" tell instruments we need them to do, in short, this is the two step,
Common control interface
2.Namisoft in test automation development process, the common control interface mainly include: GPIB, serial port (RS - 232), USB, LAN or Ethernet,
Serial interface communication speed is slow, the modern testing system has been rarely used,
Although modern instrument control interface is rich, but for instrument manufacturers and users, the most widely used are GPIB interface,
Commonly used version of USB interface for USB 2.0, its support for three transmission rate, low speed of 1.5 Mbps, full 12 Mbps and 480 Mbps, high-speed transmission speed automatically adjust according to the external equipment, do not need to set up, even the largest cable length is 5 m, connected devices at most 127,
Ethernet is now the existing LAN using one of the most common communication protocol standards, can be achieved between the interconnection equipment 10 MBPS - 10 GBPS data communication,
Namisoft is mainly used in the actual way of LAN and USB, so frequently discussed mainly by the two kinds, GPIB cost is higher,
More detailed introduction about the control interface, please visit the related website to consult,
3. SCPI (programmable instruments standard language)
The main characteristic is:
(1), program-controlled command for test process, rather than describe the instrument operation; Compatible programming environment using the same commands and parameters to control with the same function of the instrument,
(2), in has nothing to do with the hardware communication physical connection layer on the high level of SPC messages defined,
Based on SCPI IEEE488.2 formation, but is not limited to GPIB interface, it can also be used for RS232C, LAN, USB bus,
(3), has nothing to do with programming method and program language, SCPI user testing program module is easy to transplant,
SCPI with public order, that is, to all of the instruments are feasible; Also has a specific command, that is, different instruments command is different, but all commands are accord with standard of SCPI,
For SCPI more detail, please refer to the related information, go here,
4. VISA (virtual instrument software architecture)
VISA is a driver software architecture, the development of the purpose of this architecture is unity and GPIB, serial port, Ethernet/LAN, IEEE 1394 communication and USB devices, and simplify the instrument control applications, through the VISA API, developers can use GPIB, serial port, Ethernet/LAN, IEEE 1394 and USB devices,
Namisoft on VISA sums up:
(1) interface independence - VISA provides a single API and instruments to communicate in the same way, without considering the interface type, for example, VISA command, send an ASCII string to an instrument based on message, for GPIB, serial port, Ethernet/LAN, IEEE 1394 and USB interface are the same,
(2) an object-oriented architecture, you can easily adapt to the future development of instrument interface,
Instruments (3) fully functional programming features, through a very compact command set,
More detailed introduction to VISA, please refer to the related information,
5.
Namisoft instrument control processInstrumentation: by the commonly used control interface connect PC and control instruments,
Determine the names of the instruments resource: also called instrument descriptors, describes the exact name of the VISA, resources and location, confirm the instruments resource name, you can download the hardware drivers, after open the software can be identified,
In equipment and interface options can be found below instruments resource name, if you can't find (in most cases is to use a LAN interface), can be manually added, the instrument's IP address (may need port number) input, the software can identify instruments,
Write control program:
Two points to note here, different instruments using method is not the same, write instrument control program there are several ways,
1. Use instrument driver, some instrument manufacturers may themselves based on VISA or SCPI development of instrument driver, which is further encapsulation, toward the top of the also is to the VISA and SCPI further encapsulation, thus further simplify the development process, we can according to the driving equipment of programming instructions or use instrument driver software architecture, what you need to implement functions, calling the corresponding driver API, and could provide the reference sample,
2. Use VISA, VISA with instrument for communication bridge, then "instrument language" by VISA interface to instrument, instrument will related operations, according to our logic instruments here descriptions corresponding programming language requires the reference instruments (can be downloaded to the corresponding website of instrument), is mainly refers to the SCPI communication instruction set, the following will be slightly this method a detailed introduction of the
3. Implement your own communication, it is mainly aimed at LAN PORT communication way, because I only come across this kind of circumstance, some instruments is not so advanced, to support the VXI - 11 agreement, although also be TCPIP class resource name, but in this case we need to yourself to achieve TCP communication process, is not difficult, as long as we achieve a TCP client can, through instruments provide IP address and PORT of the PORT, with our client instrument for TCP connections, connection send instrument "instrument language", after the completion of it will also accept to the response of the instrument,
Next, detailed said with instruments to communicate, how to use the VISA
Methods a
Platform: vs2013,
Establish good engineering, after introducing two now..net managed DLL, the Common and VisaNS reference added to the project, the two DLL Files in C: \ Program Files \ (x86) National Instruments \ MeasurementStudioVS20XX \ DotNET \ Assemblies \ directory can be found below,
Open a VISA session,
Querying data, in creating a communication session with our instrument, we can start to send data to the instrument, and read back the response,
We also can use the Write function send not only read the data,
Finally the session closed
Namisoft tip:
When using a serial port and USB port control, the use of this method is easy to a problem, so the explanation the second approach, now I haven't tested whether this method for all of the serial port and U all can't use, if you tested, you can communicate with each other, also, this approach does not apply to the use of the Socket instruments,
Method 2
The second method USES visa interface,
Control process with the first method about, first of all, will Visa32. DLL files in engineering debug directory below, if you don't do this, the program will search the debug directory first, then search system32 directory, looking for Visa32. DLL files, here, don't like the above, will introduce a DLL project, because the DLL file is. NET unmanaged assemblies, you need to explicitly introduced, responsible for introducing the class file reference Visa32. Cs, (note: through the dumpbin - depents * * *. Exe or DLL can check to see if this file belongs to the custody, if have mscoree DLL is managed, or unmanaged)
In the project to build Visa32. Can refer to the function inside a DLL, the use of specific methods refer to: NI - Visa help,
Below is a part of the code
This kind of method for does not support VXI instrument - 11 agreement shall not apply, also need to realize TCP communications,
For instrument control many places I have made clear, a tentative records the harvest of this period of time, if you have any idea on this aspect also, can communicate at any time,