Communication Design of LabVIEW and Multiple AI-501 Instruments

<

Communication Design of LabVIEW and Multiple AI-501 Instruments

Liu Haiyun, Institute of Physics, Chinese Academy of Sciences

Abstract: This project uses an RS232-RS485 converter to connect a PC to multiple AI-501 meters, and monitors the temperature of these meters in time through LabVIEW programming. Using this method, you can also program LabVIEW communication for other AI series instruments.

Keywords: RS232-RS485 converter LabVIEW serial port initialization function (VISA Configure Serial Port) serial port write function (VISA Write) serial port read function (VISA Read) character processing

introduction:
Yudian AI series instruments are well-known in the domestic market, and the quality of service is second to none in China. But on Yudian's website, there are only communication codes written in VB, and some netizens hope to get the communication source code written in LabVIEW. Recently, I purchased 10 AI-501 temperature displays for equipment baking in my laboratory, so I took this opportunity to write the communication codes of 10 instruments with LabVIEW, and got the temperature (PV value) of each instrument and displayed it in On the computer. I hope this program can give you a little help, and the errors are welcome to criticize and correct.
This thesis is divided into two parts: first, the hardware connection between the computer and multiple AI-501; second, the programming of LabVIEW.

1. Hardware connection between computer and 10 AI-501 meters

Using RS232-RS485 converter can connect computer and 10 AI-501 conveniently. The specific scheme is shown in Figure 1. The RS232 terminal of the RS232-RS485 converter is connected to the computer, and all instruments are connected in parallel to the A and B terminals of RS485, and different addresses are set. The 10 AI-501 addresses I set are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

figure 1:

AI series instrument data format is 1 start bit, 8 data, no parity bit, 1 or 2 stop bit, baud rate 4800 ~ 19200 bit / S. Taking into account the number of 10 instruments, in order to communicate quickly, I used 19200bit / S for this project. After testing, the effect is very good.

Second, LabVIEW programming

LabVIEW is a very good graphical programming language developed by National Instruments Corporation. Unlike text-based programming languages, LabVIEW programs are written in graphical language (G language), icons, and wiring instead of text. It uses data flow programming to describe the execution of the program, which is more intuitive and easier to operate.
The LabVIEW user interface mainly includes a front panel and a graphical code window. The front panel is similar to an actual instrument panel, and can include control and display elements such as knobs, buttons, and text boxes. The graphical code window includes constants, functions, and VI programs represented by icons, and guides the data flow through wires. It is intuitive and convenient to write and debug programs.
The front panel of this program is shown in Figure 2.

Figure 2: (1380.8 means the instrument is not connected to a thermocouple)
Figure 3: Program code flow

The graphical code windows of this program are shown in Figures 4.1 and 4.2. In the graphical code window, in order to complete the initialization, writing and reading of the serial port, the serial port initialization function (VISA Configure Serial Port), the serial port write function (VISA Write) and the serial port read function (VISA Read) are used respectively. In addition, because the data obtained is in hexadecimal, some byte processing functions are also used to convert it to decimal and display it on the front panel of the program.
In the introduction of the following code, take the AI-501 with address 1 as an example, other instruments can be copied directly, and the address can be changed.

Figure 4.1
Figure 4.2

1. Serial port initialization: Set the serial port initialization function (VISA Configure Serial Port) as shown in Figure 4.1A. Among them, ASRL6 :: INSTR indicates the COM6 port that my computer expanded; Enable Termination is set to False, otherwise it will interrupt reading serial data when the carriage return byte is read.
2. Write a command to read serial port features to the serial port: call serial port write function (VISA Write function) a total of 10 AI501, addresses 1-10, the read commands to be sent are as follows. It should be noted that, as shown in Figure 4.1B, the written string is Hex Display. Right-click the String Constant connected to the VISA Write function, select Hex Display, and directly enter 8181521500005315, that is, read the model feature of the address 1. Other addresses can be deduced by analogy.
AI-501 instrument address command (hexadecimal)
1 8181521500005315
2 8282521500005415
3 8383521500005515
4 8484521500005615
5 8585521500005715
6 8686521500005815
7 8787521500005915
8 8888521500005A15
9 8989521500005B15
10 8A8A521500005C15
3. Read serial port data: After the command is sent successfully, call the serial port read function (VISA Read function) to read 10 bytes to the serial port, as shown in Figure 4.2C. Because whether it is reading or writing, the meter returns the following 10 bytes of data (see "AIBUS communication protocol description (V7.0)")
4. Convert hexadecimal data to decimal data: as shown in Figure 4.2D, because the first 2 bytes of the 10-byte data obtained by reading the serial port represent the PV value information, call the String Subset function to take out the first and second words Section. Then call the String To Byte Array function to convert the 1st and 2nd bytes to the 0th and 1st elements of the Byte Array. Finally, call the Index Array function to extract the two elements into a single decimal number. I set the temperature to 1 decimal place, so the correct temperature is decimal
PV = (first byte + second byte * 256) / 10
After the data is converted, it is output to the corresponding display on the front panel, which is in the style of Figure 1. The above is the code of an instrument. Except for the different read commands, the codes of the other instruments are the same and can be copied directly.

Conclusion: This project performed simple LabVIEW communication programming on the AI-501 instrument, and there is still a lot of room for expansion, such as data storage, temperature curve drawing, remote monitoring, etc. references:
1. "AIBUS Communication Protocol Description (V7.0)"
2. "LabVIEW6.1 Programming Technology Practical Course" by Shi Boqiang, Zhao Yongde and others

    Stainless Steel Kettle! high quality 18/10 stainless steel for kettle body,robust ,veratile and durable in use.polished inside and outside with elegant look.capacity:1.6/1.8/2.0/3.0/4.0/5.0L etc. special designed handle and knob make your cooking comfortable.impact bonding base for quick and even heat distribution.the value and high quality kettle will bring a ray of sunshine and brightness into your kitchen.

Stainless Steel Kettle

Stainless Steel Kettle,Black Stainless Steel Kettle,Stainless Steel Jug Kettle,Stainless Steel Electric Water Kettle

JAPOP COMPANY LIMITED , https://www.japopkitchenware.com