GPIB programming in C# for 34401A Digital Multi Meter.
The 34401A is a standard digital multimeter from Keysight Technology. In this article, I will explain GPIB programming to control 34401A with C #.
I have compiled a set of C# programs to use for instrument control, so if you haven’t seen it yet, please check.
In this post, I used “*IDN?" for the measurement command. This *IDN? Command is a standard GPIB command and returns instrument information.
This command can be used on most devices. This time I will show you how to use the commands specific to the 34401A.
Command for 34401A
When programming in C#, use the “MEAS" command. This command performs setting, measurement, and return of results.
In addition to the MEAS command, the 34401 has highly versatile commands such as “CONF → READ?" and “CONF → INIT → FETC?" which have the same function, but the MEAS command can do the same thing.
Write the voltage, current, resistance and direct current or alternating current behind the MEAS.
- DC voltage measurement – MEAS: VOLT: DC?
- AC current measurement – MEAS: CURR: AC?
- Resistance measurement – MEAS: RES?
If you want an answer, add “?". And write the command in mbSession.query (" “). For example, to display the result of DC voltage measurement in a rich text box
Sample code
As an example, I made sample code of 34401A GPIB control. It is written on the assumption that the driver of NI is installed.
Example 1 Measure the voltage when the button is pressed
The sample below is a program that measures when buttonStart is pressed. Place buttonStart and richTextBox1 on the designer screen.
Example 2 Measure voltage every fixed time
The following example uses a timer to repeat the measurement every 2000 milliseconds. When the start button is pressed, it stops at the stop button.
Please place timer1 on the designer screen.
I think that the result is displayed in richTextBox1 as follows.

Summary
Once you understand the above code, you can create a large program just by adding some features or changing the layout of the display.
Link to Japanese page
Discussion
New Comments
No comments yet. Be the first one!