Recent

Author Topic: visasession  (Read 4266 times)

Stefano58

  • New member
  • *
  • Posts: 9
visasession
« on: July 22, 2016, 06:13:13 pm »
please, Can anyone give me a small application for FP-VISA with a USB meter?

thank you

Laksen

  • Hero Member
  • *****
  • Posts: 724
    • J-Software
Re: visasession
« Reply #1 on: July 22, 2016, 06:57:32 pm »
It all depends on what meter you are using. The different vendors use different commands to setup and retrieve data.

Here's a quick and dirty example for a Keysight 34411A where the dmm is a TVisaSession component from here(https://github.com/Laksen/FP-VISA):
The address has to be configured to match the USB visa address provided by whatever VISA stack you have installed.
Code: Pascal  [Select][+][-]
  1. begin
  2.   // Setup for autoranging DC measurements
  3.   dmm.Command('CONFigure:VOLTage:DC');
  4.   dmm.Command('TRIGger:SOURce BUS');
  5.   dmm.Command('INITiate');
  6.  
  7.   // Do a single measurement
  8.   dmm.Command('*TRG');
  9.   dmm.Query('*OPC?'); // Wait for trigger
  10.   memo1.Lines.Add('Read: "'+trim(dmm.Query('FETCh?')));
  11. end;
  12.  

Stefano58

  • New member
  • *
  • Posts: 9
Re: visasession
« Reply #2 on: July 25, 2016, 06:11:01 pm »
I also need to install a VISA stack, can you help me?
Thank you for your patience.

Laksen

  • Hero Member
  • *****
  • Posts: 724
    • J-Software
Re: visasession
« Reply #3 on: July 26, 2016, 12:10:49 am »
At work I use Keysight IO Libraries (http://www.keysight.com/main/software.jspx?cc=DK&lc=dan&ckey=2175637&nid=-33330.977662&id=2175637), but that's Windows only. For Linux/Mac NI VISA might work, but it's apparently not easy to get working; at least not on Linux.

Stefano58

  • New member
  • *
  • Posts: 9
Re: visasession
« Reply #4 on: July 29, 2016, 07:29:41 pm »
I have already installed VISA library.
The Python script, as reported below, runs with no problem.
--------------------------------------------------------------
>>> import visa
>>> rm = visa.ResourceManager() # create a ResourceManager object
>>> print(rm.list_resources())  # list the available resources
('USB0::0x0699::0x0368::C012494::INSTR', 'ASRL10::INSTR', 'ASRL33::INSTR', 'USB::0x0699::0x0368::C012494::INSTR')
>>> my_inst = rm.open_resource('USB0::0x0699::0x0368::C012494::INSTR')
>>> print(my_inst.query("*IDN?"))
TEKTRONIX,TBS 1102B,C012494,CF:91.1CT FV:v4.0
----------------------------------------------------------------
I installed also the FP-VISA package for Lazarus.
Can anyone translate the Python script into Lazarus?

Thank you

Laksen

  • Hero Member
  • *****
  • Posts: 724
    • J-Software
Re: visasession
« Reply #5 on: July 29, 2016, 10:23:46 pm »
Try this:

Code: Pascal  [Select][+][-]
  1. program Project1;
  2.  
  3. uses
  4.   session;
  5.  
  6. var
  7.   my_inst: TVisaSession;
  8. begin
  9.   my_inst:=TVisaSession.Create(nil);
  10.   my_inst.Address:='USB0::0x0699::0x0368::C012494::INSTR';
  11.  
  12.   my_inst.Active:=true;
  13.   writeln(my_inst.Query('*IDN?'#10));
  14.  
  15.   my_inst.Free;
  16. end.
  17.  

 

TinyPortal © 2005-2018