using System; using System.Text; using Ivi.Visa.Interop; namespace Multimeasure3458CSharpVISACOM { class Program { static void Main(string[] args) { ResourceManager rm = new ResourceManager(); FormattedIO488 fmio = new FormattedIO488(); string address = "GPIB0::25::INSTR"; int numReadings = 10; // Open path to DMM fmio.IO = (IMessage)rm.Open(address, AccessMode.NO_LOCK, 0, ""); //max speed readings fmio.IO.Clear(); fmio.WriteString("reset", true); fmio.WriteString("end on", true); fmio.WriteString("preset norm", true); fmio.WriteString("nplc 1", true); fmio.WriteString("oformat dreal", true); fmio.WriteString("nrdgs " + numReadings.ToString(), true); //each reading is 8 bytes byte[] rawData = fmio.IO.Read(8 * numReadings); Console.WriteLine("10 readings:\r\n"); for (int i = 0; i < numReadings; i++) { Console.WriteLine("\t{0}\r\n", System.BitConverter.ToDouble(swapDouble(rawData, i * 8, 8), 0)); } //close connection to the 3458A fmio.IO.Close(); Console.WriteLine("Press any key to exit..."); Console.Read(); } /// /// The 3458A uses a processor that results in big endian data, your PC is little endian, we need to swap the bytes /// static byte[] swapDouble(byte[] rawData, int index, int numberBytes) { byte[] newData = new byte[numberBytes]; for (int i = 0; i < numberBytes; i++) { newData[i] = rawData[index + numberBytes - i - 1]; } return newData; } } }