Author Topic: WinGPIB - Windows GPIB App (multi-purpose)  (Read 240519 times)

0 Members and 2 Guests are viewing this topic.

Offline IanJTopic starter

  • Supporter
  • ****
  • Posts: 1754
  • Country: scotland
  • Full time EE & Youtuber/Creator
    • IanJohnston.com
WinGPIB - Windows GPIB App (multi-purpose)
« on: November 18, 2018, 09:02:50 pm »
WinGPIB
App rebranded 2nd Jan. 2022 - UK/USA Trademark.
wingpib.co.uk & wingpib.com

This app provides reliable Windows GPIB functionality to many brands and types of test instruments, aka HPIB, GPIB, or IEEE-488 Instrument Control.

WinGPIB is for non-commercial use only, contact me if you wish to use it commercially.

Written in Visual Studio 2019 VB 2022 VB and using Pawel Wzietek's awesome GPIB library code (.DLL Multi-threaded GPIB communication), I wrote a custom front end to what you see below.
The app can interface using VISA, GBIP:ADlink, GPIB-488 and COM port......and can run two devices at the same time.
Pawel's original project: https://www.codeproject.com/Articles/1166996/Multithreaded-communication-for-GPIB-Visa-Serial-i

I/O DEVICE COMPATIBILITY:
99% of instruments with a GPIB inteface will work with this app because it is extremely flexible.
- VISA
- GBIP:ADlink
- GPIB-488
- COM port (serial)
- Prologix (Ethernet TCP & USB Serial)

The app primarily works with Keysight IO Libraries and using the Agilent E5810A or the Agilent 82357B etc. Not to say it won't work with other interfaces, your mileage may vary.

TEMPERATURE/HUMIDITY DEVICE COMPATIBILITY:
- USB-TnH SHT10 V2.00 & USB-TnH SHT30 (Usb serial comms).
- User based protocol (partial).
- Adafruit MCCP2221A/SHT40 as follows:
  Adafruit MCP2221A Breakout - General Purpose USB to GPIO ADC I2C - Stemma QT / Qwiic - http://adafru.it/4471
  Adafruit Sensirion SHT40 Temperature & Humidity Sensor - STEMMA QT / Qwiic - http://adafru.it/4885
  STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long - http://adafru.it/4210

OS TESTED:
Win10
Win11 - reports in so far that it is ok with Win11.

DOWNLOADS:
Release V3.250 (8th Nov. 2024), see ZIP file attached below.
Note: Version 3.143 and over requires MCP2221DLL-M-dotNet4.zip which is available in the downloads if you are updating.
Extra: If you want access to the latest (possibly not released yet) .msi file and previous released .zip files then pick them up here:
https://github.com/Ian-Johnston/WinGPIBadditionalinfo/tree/main/WinGPIBadditionalinfo/WinGPIB-AnyCPU_All-SetupFiles
[all files scanned with BitDefender Antivirus prior to upload]

SOURCE CODE:
This app may be used and distributed freely for strictly non-commercial purposes only. If you wish to use it commercially then contact/PM me.
The source code is available for download from my GIT (you need all 3 repositories):
WinGPIBproj - Visual Studio project (the main GUI).
IODevices - Visual Studio project (the DLL required by the main app).
WinGPIBadditionalinfo - A compilation of files, datasheets, sample data, utilities, 3rd party DLL's & drivers etc.
https://github.com/Ian-Johnston?tab=repositories

INSTALLATION INSTRUCTIONS:
Fresh Installation of WinGPIB:
First, make sure you have the Keysight IO Libraries loaded, running and configured. Then,
1. Unzip and run the .msi installer - WinGPIB_V#####.zip
2. The program is installed at: C:\Program Files (x86)\IanJ\WinGPIB\WinGPIB.exe
3. All user data resides in C:\Users\[username]\Documents\WinGPIBdata
4. A desktop shortcut is created to run the app.

Updating WinGPIB app:
1. Install the same .msi installer as above. It will not overwrite the files in your data folder, C:\Users\[username]\Documents\WinGPIBdata
Note: See post #766 before upgrading if you are on V3.177 or earlier.

Moving your WinGPIB profiles to a new PC:
V3.178 onwards:
1. Use the EXPORT PROFILES button to save all your profiles/settings data to \WinGPIBdataProfilesData.dat.
2. Copy the .dat file to your new PC \WinGPIBdata folder.
3. Once you have installed WinGPIB, use the IMPORT PROFILES button to import all your profiles/settings data.
4. Restart WinGPIB.
Prior to V3.178:
1. On your old PC (I'm using Win10) go to: C:\Users\YOURUSERNAME\AppData\Local\Microsoft\WinGPIB.exe_Url_somegreatlonglistoflettersnumbers\1.0.0.0\
and in there is a file called user.config
2. Copy that file out and put it in the similarly named folder in your new PC. The large folder name will be different.

Installation Notes:
1. If you accidentally delete your GPIBchannels.txt or base Log.csv file there are original copies in the program folder you can copy over to C:\Users\[username]\Documents\WinGPIBdata.
2. When upgrading you may lose the contents of your profiles so Export them first.
3. WinGPIB does not use OneDrive for it's data storage.
4. If you get an error on running the program that a Log.csv file or its path doesn't exist, then manually create the exact path and drop a copy of Log.csv in that folder. Restart WinGPIB.
5. Version 3.143 and over requires MCP2221DLL-M-dotNet4.zip available in the downloads. Note that depending on your Windows install you may need to install Microsoft Visual C++ 2010 Service Pack 1 Redistributable Package in order for the MCP2221DLL to work properly. Available here:-
https://www.microsoft.com/en-gb/download/details.aspx?id=26999 or https://www.techpowerup.com/download/visual-c-redistributable-runtime-package-all-in-one/

Possible VISA32.DLL Issues:
If you have Keysight IO Libraries loaded and you can communicate with your device using it's GPIB address via the Connection Expert but get an error (Visa error BFFF009E) using WinGPIB and you've tried everything, then:
Go to C:\Windows\SysWOW64
Rename Visa32.dll to Visa32_old.dll
Rename visa32.Agilent Technologies - Keysight Technologies.dll to Visa32.dll
Reason: Windows updates and updates to other programs on your PC can often replace this .DLL with their own and breaks WinGPIB Visa functionality!

INSTRUCTIONS / NOTES FOR USE (may not be complete):
Assumes that you have loaded the current version of Keysight IO Libraries Suite and have it configured.

DEVICES:
Set up your NAME and ADDRESS of the device(s) you want to connect to, and pick the INTERFACE type (I have tested Visa only).
The defaults shown when you install are my own as an example.
Hit the CREATE DEVICE button (you choose). An pop-up box will appear that lists the connected device. This box will remain visible at all times and will let you see the commands being sent and any queued commands.

You can effectively batch commands using the PRE RUN, AT RUN and AT STOP boxes and using the RUN/STOP button at the bottom.
PRE RUN commandsare used to set up your device.
AT RUN command is the command that is repeated at the SAMPLE RATE.

Command types are as follows:

SINGLE COMMANDS:
Enter single commands in the COMMAND boxes and hit QUERY and you'll get a RESPONSE back.
Types of commands as follows:-
Query Blocking commands are immediately executed/sent. They are immediately executed on the calling thread (usually GUI thread), this method waits until it gets response from the interface.
Query Async commands are queued. Queries are queued and the queue is processed on a different thread (producer-consumer model). The call appends the query to the queue and returns immediately.
Send Async  commands queued. These types of commands do NOT expect a reply.

BATCH/LOOPING COMMANDS:
PRE RUN - Initialize your device with a list of SEND ASYNC type commands.
AT RUN - A single QUERY ASYNC type command.
AT STOP - A list of SEND ASYNC type commands you may wish to send when you hit STOP.

INTERRUPT COMMANDS:
You can specify an Async (no reply) command to be send periodically, such as ACAL DCV when you are logging etc.
Duration in secs = How long you need that command to be active for, i.e. ACAL DCV on a 3458 may take 60secs.
Period in mins = How often do you want that command sent, i.e. every 120mins.

IO DEVICES POP-UP:
When the CREATE DEVICE buttons are pressed a pop-up box will appear that lists the connected device(s).
This box will remain visible at all times and will let you see the commands being sent and any queued commands.
Note that you can close this window without any effect on the app. You can use the button "Show Device List" to show it again if needed.

COMMAND LINE INTERFACE:
After connecting to your device(s) use the comand line interface to send and receive data from your device(s).

TEMPERATURE/HUMIDITY:
There is only a couple of Temperature/Humidity sensor I have tested and that are available from DOGRATIAN seller here - https://www.dogratian.com/index.php
They are serial USB type sensor and does not require any drivers except what Win7/Win10 loads automatically as you insert it. You should see a COM port which you can pick from the list on the app.
The SHT30 gives 2dp's whereas the SHT10 1dp.

DATA LOG / CSV:
For CSV generation, per the defaults, set up your filename and path to where you want the CSV to be saved. At the moment there is not file generated if it doesn't exist so make sure you have an empty .CSV text file at the path specified.
The check box ENABLE CSV will start saving data to the .CSV file.
The EXPORT CSV file will copy the active .CSV file to the same folder and append the current date & time as the filename.
EXPLORER will launch Windows Explorer and pointing to the path folder.
You can clear the current CSV file with the RESET CSV button, there's a check box next to it which must be set before the reset will work.
ENABLE LOG check box will activate the log file display window.
E NOTATION TO DECIMAL check box will convert ########E-02 to the decimal equivalent. This is for the CSV and well as the log window.

CHART:
Enable either or both device charts via the check boxes.
With the boxes un-checked you can hit the CLEAR CHART to reset the chart windows and remove the data.
You can change the resolution of the chart with the X-AXIS SCALE POINTS entry. Once the chart display reaches the set number of data points on it the chart will start to scroll off to the left as new data appears at the right.
The range of the Y-axis is adjustable via the SCALE MIN AND SCALE MAX enries. You can manually set them or hit AUTO SCALE and the chart will look at the existing trace and from it's highest and lowest position will centre and scale the chart.
The UP and DN buttons allow the current set scale to be adjusted in 10% steps.

PLAYBACK CHART:
For offline display of the generated .CSV files. The user can select the Device to be displayed on the graph (since there are 2 devices available), and also zoom in/out and scroll back/forward through the graph.
TIP: The Playback Chart relies on the consistency of the CSV being correct, i.e. no empty lines, the first 3 lines start with // for the metadata, the first and last data timestamp is used to calculate the period of the entire data.

HP3458A & HP3457A DMM RAM EXTRACT:
Utility to extract the battery backed up (DS1220Y IC) cal ram on the 3458A down to a .bin file.
Utility to extract the battery backed up (DS1235Y ICs) settings ram (both) on the 3458A down to a .bin file.
Utility to extract the battery backed up cal ram (2 versions) on the 3457A down to a .bin file.

ADVANTEST R6581 CALIBRATION CONSTANTS EXTRACT:
Utility to extract all the regular calibration constants from the meter to a .txt file.

3245A UNIVERSAL SOURCE CALIBRATION:
Utility to automate the full calibration (DCV & DCI) of an HP 3245A by using a 3458A.

SAVE SETTINGS:
Most of the entries are saved off so when you restart the app they will be there.

E5810A AGILENT LAN/GPIB GATEWAY CONFIG:
1. Power up E5810A and make sure it gets an IP assigned (DHCP), i.e. 192.168.1.175
2. Go to http://192.168.1.175 and "Find & Query Instruments". Make sure you can communicate with your device.
3. Go to Keysight Connection Expert and ADD Remote GPIB Interface.
    Change SICL Interface ID to the one that finds the IP of the E5810A. Hit OK.
4. Now a device will be listed on the "My Instruments" panel. The GPIB address will be displaye i.e. GPIB1::22:INSTR

TERMINATOR INFO:
CR carriage return……..moves to column zero without advancing paper
LF line feed…… advances paper without returning to column zero
CRLF……. does both the above
\r = CR = 0x0D = 13
\n = LF = 0x0A = 10 = newline

COMMON PROBLEMS:
ISSUE 1: MAV not set errors:
Example: "Poll timeout: MAV not set, status byte=4"
Check your device manual to see where the MAV is coded in the status byte and set the MAV mask accordingly.
The standard value is 16 and is set by default in WinGPIB.
If it still doesn't work the only option is to disable polling altogether although you then might experience
delays if you have more than one device connected via GPIB.
Also, if this is happening with large NPLC settings or other such time hungry commands then try increasing the Timeout (ms) to 10000 or 15000.

ISSUE 2: Can connect to my device but get syntax errors, no command is actioned:
I have found a dodgy GPIB cable/connector can cause this.

ISSUE3: The main WinGPIB.exe is sometimes flagged up & quarantined by Windows anti-virus scans. Three Four times now it's been flagged as containing a virus and three four times now I have sent it in and it's been confirmed as a false positive. Twice by BitDefender, and once twice by Microsoft Defender. If it happens to you then please let me know and I will contact the anti-virus company involved.

Have fun.

Ian.

Screenshots below (reduced in size for webpage), click on them to see full size version.
NOTE: These are not the latest screenshots, I don't keep them up-to-date with each GUI mod:



























Offline Andreas

  • Super Contributor
  • ***
  • Posts: 3308
  • Country: de
Re: 3458a logging via Windows app.....revisited
« Reply #1 on: November 18, 2018, 10:11:21 pm »
but I do find it a little unreliable. It'll just stop logging minutes or hours in......
Hello,

your plans are really high sophisticated. (with the graphical display).
But how do you get W10 working reliable?
Every time I want to log one of my ADCs via RS232 in a W10 machine it tries to install some software and reboot over night.
I have found no way to stop this behaviour. So I usually use old XP or W7 machines for measurements.

Just one hint:
instead of trying to put all software into one application I use several  small programs.
E.g. one program for temperature sensing and one for sensing the reference voltage.
The easiest way is to log 1 minute averages and combine the results via spread sheet calculations.

Another interesting way is to use a virtual file for data exchange.
So the values of e.g. a NTC-sensor ADC can be used from other software applicatons
and logged together with the readings or could even be used for T.C. corrections.

with best regards

Andreas
 
The following users thanked this post: blackdog, chilternview, Ade911

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: us
    • The Messy Basement
Re: 3458a logging via Windows app.....revisited
« Reply #2 on: November 19, 2018, 12:38:40 am »
I do this with a small PowerBASIC program and an old Prologix adapter that uses an FTDI chip. I can easily call their drivers and have few reliability problems... but I haven't tried it on my Win10 machine. I don't expect any serious problems. The same program, with some minor changes reads my HP3478A, HP3455A and frequency counter (can't remember the model). I suspect similar code could be done with Visual Basic or most any language. I just happen to like Basic and FTDI chips.
 

Offline alanambrose

  • Frequent Contributor
  • **
  • Posts: 377
  • Country: gb
Re: 3458a logging via Windows app.....revisited
« Reply #3 on: November 19, 2018, 03:26:35 pm »
Another data point - I have quite a lot of C# GPIB code which runs fine. I have used both and USB<->GPIB adaptors and LAN<->GPIB and both work good. There's a bit of nonsense with the different manufacturers (NI, Keithley, Agilent etc) all trying to be the visa interface on your machine - I'm using the Agilent version right now but I think I've used others in the past. I've found that the different manufacturer's test equipment has its own GPIB idiosyncrasies, timing behaviour etc. A bit of care with good exception handling and dealing with corner cases will pay dividends. The good thing about the Microsoft environment (I'm sure others will list the negatives) is that visual studio is 'grown-up' and has a good built-in debugger. You can even make some code changes within the debugger and it'll do an incremental compile on-the-fly and continue running from where you hit the break point - i.e. without a full re-build, app re-start etc.

Alan
“A foolish consistency is the hobgoblin of little minds"
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: 3458a logging via Windows app.....revisited
« Reply #4 on: November 19, 2018, 03:53:29 pm »
C# and before that C has been used for decades for instrument control. According to Wikipedia, LabWindows (the LabVIEW framework with G code replaced by C) started in 1987 (for DOS). So of course there is no reason you couldn't develop something that is at least as good as the Python + PyVISA solution you might use on a Raspberry PI (which should also work on Windows). The only disadvantage compared to the Raspberry PI solution I can see is price and power usage if you want to run it 24/7.

Like Andreas, I would reconsider the monolithic approach, and consider separating data acquisition and analysis / plotting. You can later create something that manages both (e.g. connect to acquisition using a socket and embed the plotting), but this makes it much easier to do unattended logging (e.g. start as service), offline analysis, combining data from multiple instruments, etc. I would also separate logging from the DMM (including its internal temperature if you care) and logging from the environment sensor(s), since the latter data may be used for multiple instruments that are in the same room.

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: us
    • The Messy Basement
Re: 3458a logging via Windows app.....revisited
« Reply #5 on: November 19, 2018, 04:09:04 pm »
As Alan says, different instruments have their own quirks. It took me forever to figure out how to get my HP 8903B back to local from program control. Long ago I interfaced to an HP network analyzer that had a very early version of HPIB. I did it with a big old Data Translation card that had a bunch of I/O lines. Quirky doesn't begin to describe it. Huge PITA, but the interface cards were quite expensive back then. I'd never think about using anything other than a National or Prologix interface now.
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: 3458a logging via Windows app.....revisited
« Reply #6 on: November 19, 2018, 04:32:02 pm »
Instruments certainly have their quirks. Some in hardware: I think the designer of the Prologix interface had to spend a lot more time than he expected to get his GPIB interface to work with all kinds of instruments. In my experience, newer (e.g. post-IEE-488.2 / SCPI) instruments are better behaved than older ones: if you go back far enough, then they implemented GPIB entirely in discrete logic gates, and the programming might be "send a byte with the first bit set and the other seven bits the voltage you want to set" without having any feedback. In my experience HP/Agilent instruments are better behaved than Keithley or Philips instruments from the same era. I've had to write more "if garbage data, then ignore" code or "avoid this sequence, since the instrument may lock up" for the latter two than for HP equipment. But I'm sure that's not universal across instruments.

Offline IanJTopic starter

  • Supporter
  • ****
  • Posts: 1754
  • Country: scotland
  • Full time EE & Youtuber/Creator
    • IanJohnston.com
Re: 3458a logging via Windows app.....revisited
« Reply #7 on: November 19, 2018, 07:29:11 pm »
Hi all,

New screenshot posted in message #1 above......

3458A connected via E5810A......and I've done a bit more coding, enough to see if the concept will work reliably.
I have a PDVS2 connected to the 3458A and set to ramp the voltage up & down between 0 - 10Vdc.

The procedure with the app is to manually send a few commands (will vary with instrument I guess), then trigger readings from then on, i.e.:

END ALWAYS - GPIB EOI mode, this is needed so the 3458A can respond correctly
NRDGS 1 - Number of readings
TARM SGL - Trigger readings (1)

PS. I haven't played with NPLC etc yet.....thats next to do.

Then with TARM SGL left in the COMMAND window, set the sample rate, in this case 1 second and hit "Run"
Over on the right on the DATA LOG the sample are being logged to screen along with Date, Time and Temperature. I've not processed the sampled reading so have left it as per sent by the 3458A for now.
The current Sample count is recorded in the Device 1 area.

At the moment "Stop" will cease the sampling, but will leave the 3458A connected. I will add another button to properly "disconnect" later.

No CSV file yet, I want to make sure, as a few have hinted, that Win10 is happy.

Noted alm post regarding Keithley instruments less well behaved.....I have a couple of 2015 THD DMM's so will hook them up at some point and give them a go. I also have some Fluke's, Racal-Dana gear also.

So far seems to be working fine, and much more reliable than my Excel spreadsheet/macros.

Ian.
« Last Edit: November 19, 2018, 07:36:29 pm by IanJ »
Ian Johnston - Original designer of the PDVS2mini || Author of WinGPIB
Website: www.ianjohnston.com
YouTube: www.youtube.com/user/IanScottJohnston, Odysee: https://odysee.com/@IanScottJohnston, Twitter(X): https://twitter.com/IanSJohnston, Github: https://github.com/Ian-Johnston?tab=repositories
 

Offline IanJTopic starter

  • Supporter
  • ****
  • Posts: 1754
  • Country: scotland
  • Full time EE & Youtuber/Creator
    • IanJohnston.com
Re: 3458a logging via Windows app.....revisited
« Reply #8 on: November 19, 2018, 10:44:04 pm »
Like Andreas, I would reconsider the monolithic approach, and consider separating data acquisition and analysis / plotting. You can later create something that manages both (e.g. connect to acquisition using a socket and embed the plotting), but this makes it much easier to do unattended logging (e.g. start as service), offline analysis, combining data from multiple instruments, etc. I would also separate logging from the DMM (including its internal temperature if you care) and logging from the environment sensor(s), since the latter data may be used for multiple instruments that are in the same room.

I hear ya.......however, at the moment I just want something operational that mostly fits my own needs.......and it's just easier for me to integrate everything into the one app. My forte is uC C++, this is my ummm 4th Visual Studio VB app....ever, so there's a lot I don't know.
The source code will be posted at some point (warts and all).....so anyone else can take it on after that if I don't look into it.

Update:
Have added a checkbox to format returned data in numerical data format with correct DP position. Useful for 3458A data. Screenshot above updated.
One issue I do have which I need to look at is manually terminating GPIB and not have the 3458A front panel controls locked out.......a job for tomorrow. Then I'll look at writing to CSV.

Ian.
Ian Johnston - Original designer of the PDVS2mini || Author of WinGPIB
Website: www.ianjohnston.com
YouTube: www.youtube.com/user/IanScottJohnston, Odysee: https://odysee.com/@IanScottJohnston, Twitter(X): https://twitter.com/IanSJohnston, Github: https://github.com/Ian-Johnston?tab=repositories
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: us
    • The Messy Basement
Re: 3458a logging via Windows app.....revisited
« Reply #9 on: November 20, 2018, 03:34:54 am »
My effort was much less ambitious, didn't even put a title on the title bar, but it does the job. It's reading 1.23456 VDC from the calibrator-
 
The following users thanked this post: IanJ

Offline IanJTopic starter

  • Supporter
  • ****
  • Posts: 1754
  • Country: scotland
  • Full time EE & Youtuber/Creator
    • IanJohnston.com
Re: 3458a logging via Windows app.....revisited
« Reply #10 on: November 21, 2018, 11:04:59 am »
Hi all,

Hit upon a wee problem last night......all was working well, I could connect to the 3458A and I recorded some 60k+ samples at 1sec intervals no problem, I can connect to the 3458A via a series of commands every time without problem.

However, disconnection is another matter!.......LOCAL 7 or LOCAL 722, or any other combination of RESET, CLEAR etc etc etc will not release the meter from remote back to local.......and as a result some subsequent commands in an attempt to do so just time-out, almost like it is half way between remote and local.....and the funny thing is that it does accept SOME command but not all, i.e. BEEP and RESET work. I did read the GPIB manual, including Appendix B.....to no avail.

So, I fired up the Agilent E5810A's web inteface and sent some commands from it, the same commands I am sending from my VB app and it reacts in exactly the same way.

The only way I can get back to local mode on the 3458A after I have sent the commands is to press the LOCAL button on the 3458A itself.....or pull the GPIB connector from the back of the 3458A.

Tonight I will try the Agilent USB-GPIB adaptor (clone) I have and see if it does the same.

It's not a huge issue, but I would prefer that it all works as perfect as possible............any Ideas?

Ian.
Ian Johnston - Original designer of the PDVS2mini || Author of WinGPIB
Website: www.ianjohnston.com
YouTube: www.youtube.com/user/IanScottJohnston, Odysee: https://odysee.com/@IanScottJohnston, Twitter(X): https://twitter.com/IanSJohnston, Github: https://github.com/Ian-Johnston?tab=repositories
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: 3458a logging via Windows app.....revisited
« Reply #11 on: November 21, 2018, 02:21:46 pm »
So you are saying it does not just fail to release the keyboard, but also fails to respond to commands it would respond to before you send "LOCAL 722"?

If new commands were sent after "LOCAL 722", then I could understand the instrument going back to remote immediately.  Note that the "22" is the GPIB address, so if the instrument is at GPIB address 16, you should send "LOCAL 716". Did you also try to send the GTL GPIB command (ibloc), instead of sending the string "LOCAL ..." to the instrument?

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: 3458a logging via Windows app.....revisited
« Reply #12 on: November 21, 2018, 02:46:26 pm »
Hi Ian,

As far as I remember the command for Agilent stuff should have been either "LOCAL:RESET" or "LOCAL OFF", did you try those?

Also, did you try to Dispose the class instance? Dispose calls the "viClose" Visa function, this might reset the instrument to local but I'm not sure.

Otherwise, if it doesn't work tell me and I could try to implement the GPIB "GTL" command in the library.  GTL is a GPIB bus message and Visa implements it e.g. with :
 
ViStatus viGpibControlREN(ViSession vi, ViUInt16 mode);

with this option: (from Visa manual):
mode                                                  Action Description
 
VI_GPIB_REN_ADDRESS_GTL                Send the Go To Local command (GTL) to this device.

But then check first in the manual if GTL is supported by your 3458A - not sure this belongs to the list of mandatory 488 functions (there are several levels of compatibility for GPIB but I don't remember them).

The call to this function could be added to Dispose just before the call to viClose.

Pawel
 


 

Offline IanJTopic starter

  • Supporter
  • ****
  • Posts: 1754
  • Country: scotland
  • Full time EE & Youtuber/Creator
    • IanJohnston.com
Re: 3458a logging via Windows app.....revisited
« Reply #13 on: November 21, 2018, 02:47:16 pm »
It fails to respond to LOCAL 7 or LOCAL 722, and yes my GPIB address is 22.

So, I send my preamble commands and ultimately TARM SGL every second and logging begins.....I then eventually stop sending TARM SGL and then send LOCAL 722 or CLEAR or RESET etc and those commands fail. This happens both with my VB and also at the command line on the E5810A web interface. And when those commands fail if I send BEEP or RESET instead then the 3458A responds......so not as if all comms has ceased. If I then try to start logging again (TARM SGL etc) then it fails, it's like the 3458A is half-ib and half-out of remote/local. I have to manually hit LOCAL on the front panel and manually RESET.......or pull the GPIB connector.
I will try your suggestions tonight when I get back to the workshop.

It would be nice to know what series of commands other folks are sending when they are finished with their GPIB session.....not much on the web about that, just plenty about initiating sessions.

Ian.
Ian Johnston - Original designer of the PDVS2mini || Author of WinGPIB
Website: www.ianjohnston.com
YouTube: www.youtube.com/user/IanScottJohnston, Odysee: https://odysee.com/@IanScottJohnston, Twitter(X): https://twitter.com/IanSJohnston, Github: https://github.com/Ian-Johnston?tab=repositories
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: 3458a logging via Windows app.....revisited
« Reply #14 on: November 21, 2018, 02:56:54 pm »
For me, the instruments used for long-term logging are usually in remote mode. If I want to use them for local operation, I use the front panel to go to local, enable display and set triggering to auto. So I never bothered with sending the local command via GPIB. Will try it later today if I have time.
 
The following users thanked this post: TiN, denimdragon

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: us
    • The Messy Basement
Re: 3458a logging via Windows app.....revisited
« Reply #15 on: November 21, 2018, 03:29:51 pm »
Getting my instruments back to front panel operation remotely has always been a problem. I think I've got it licked, though I'm not a programmer and can't even play one on TV. The trick is to tell your controller not to look for data after every send. If it does that, communication can never stop, regardless of what else you send. Don't know if this will help, but here's the code called by my disconnect button (PowerBASIC for Prologix adapter)-

Code: [Select]
SUB GPIB_Close
    DIM lResult AS LONG
    DIM lpBuffer AS ASCIZ * %gpibWriteLen
    DIM B2W AS DWORD
    DIM BW AS DWORD
    ON ERROR GOTO GPIB_Error_Trap

    lpBuffer = "++auto0"+$LF                     'turn off controller automatic read after write so meter will release
    B2W = LEN(lpBuffer)
    lResult = FT_Write(InstHandle, lpBuffer, B2W, BW)
    IF lResult <> %FT_OK THEN ERROR 152

    lpBuffer = "D1F1R-2RAZ1N4T1"+$LF             'turn on internal trigger and reset other settings for manual operation
    B2W = LEN(lpBuffer)
    lResult = FT_Write(InstHandle, lpBuffer, B2W, BW)
    IF lResult <> %FT_OK THEN ERROR 152

    lpBuffer = "++loc"+$LF                       'return control to front panel- this releases instrument
    B2W = LEN(lpBuffer)
    lResult = FT_Write(InstHandle, lpBuffer, B2W, BW)
    IF lResult <> %FT_OK THEN ERROR 152

    lResult = FT_Close(InstHandle)               'close the GPIB connection
    IF lResult <> %FT_OK THEN ERROR 152

    gpibConnected = 0

GPIB_Close_Exit:
    EXIT SUB


« Last Edit: November 21, 2018, 06:33:07 pm by Conrad Hoffman »
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: 3458a logging via Windows app.....revisited
« Reply #16 on: November 21, 2018, 06:01:48 pm »
I guess the VB code posted by Conrad Hoffman is for a Prologix GPIB adapter?

Quote
lpBuffer = "++loc"+$LF                       'return control to front panel- this releases instrument

In Prologix language the "++loc" command sends a GoToLocal message to the device, this should be equivalent to the Visa function I mentioned.

edit:
In fact as there is no device address in this code, I think the "++loc" simply releases the REN line, so that all devices on the bus return to local.  Prologix manual is not clear about this.
« Last Edit: November 21, 2018, 06:13:31 pm by pwlps »
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: us
    • The Messy Basement
Re: 3458a logging via Windows app.....revisited
« Reply #17 on: November 21, 2018, 06:37:40 pm »
For the above to work, that first command in my disconnect code is needed. You have to get the adapter out of auto mode. For the Prologix it's "++auto0". No idea for other adapters, but I tore my hair out until I  figured this out.  :palm:
 

Offline IanJTopic starter

  • Supporter
  • ****
  • Posts: 1754
  • Country: scotland
  • Full time EE & Youtuber/Creator
    • IanJohnston.com
Re: 3458a logging via Windows app.....revisited
« Reply #18 on: November 21, 2018, 08:11:35 pm »
Hi all,

I'll get back to the 3458A disconnect issue later....I was starting to pull my hair out also!

Meantime I have done some more work and have got both devices working at the same time now.....HP3458A and a Keithley 2015THD......see screenshot in post#1 above.
There are now some extra text boxes:
Commands to send at run......and Commands to send at STOP......It's this 'stop' where I was trying to send LOCAL 722 to the 3458A......ahh well!

The way it works is: The preamble commands are sent, but the last command in the list is the one that is repeated over and over......hence my TARM SGL & :READ?

I also have the CSV file generation working and logging to there also.
Snapshot of CSV below.....note I have decoded the readings in it as well as the onscreen Data Log, this is optional via a checkbox.

PS. Keithley DMM has annoying 'beep' when GPIB command is sent....I am sure there's a command to disable this!.....actually I think it's an error being generated....need to fix this....UPDATE: Send ":INIT:CONT OFF" also, per page 2-55 of 2015THD manual.

PS. There's a wee bug in the data formatting below......
Code: [Select]
HP3458A,21/11/2018 8:00:37 PM,4.53913284,25.0 C,33.2 %RH
KEITHLEY,21/11/2018 8:00:37 PM,4.53913284,25.0 C,33.2 %RH
HP3458A,21/11/2018 8:00:40 PM,8.55030307,25.0 C,33.3 %RH
KEITHLEY,21/11/2018 8:00:40 PM,4.53913284,25.0 C,33.3 %RH
HP3458A,21/11/2018 8:00:42 PM,8.55030307,25.0 C,33.3 %RH
KEITHLEY,21/11/2018 8:00:42 PM,8.55030307,25.0 C,33.3 %RH
HP3458A,21/11/2018 8:00:45 PM,5.93175246,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:00:45 PM,8.55030307,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:00:47 PM,5.93175246,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:00:47 PM,5.93175246,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:00:50 PM,1.10277879,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:00:50 PM,5.93175246,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:00:52 PM,1.10277879,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:00:52 PM,1.10277879,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:00:55 PM,4.37050003,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:00:55 PM,1.10277879,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:00:57 PM,4.37050003,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:00:57 PM,4.37050003,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:01:00 PM,3.19072211,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:01:00 PM,4.37050003,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:01:02 PM,3.19072211,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:01:02 PM,3.19072211,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:01:05 PM,7.16935305,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:01:05 PM,3.19072211,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:01:07 PM,7.16935305,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:01:07 PM,7.16935305,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:01:10 PM,8.15781706,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:01:10 PM,7.16935305,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:01:12 PM,8.15781706,25.0 C,33.4 %RH
KEITHLEY,21/11/2018 8:01:12 PM,8.15781706,25.0 C,33.4 %RH
HP3458A,21/11/2018 8:01:15 PM,1.56956653,25.0 C,33.5 %RH
KEITHLEY,21/11/2018 8:01:15 PM,8.15781706,25.0 C,33.5 %RH
HP3458A,21/11/2018 8:01:17 PM,1.56956653,25.0 C,33.5 %RH
KEITHLEY,21/11/2018 8:01:17 PM,1.56956653,25.0 C,33.5 %RH
HP3458A,21/11/2018 8:01:20 PM,4.12928689,25.0 C,33.5 %RH
KEITHLEY,21/11/2018 8:01:20 PM,1.56956653,25.0 C,33.5 %RH
HP3458A,21/11/2018 8:01:22 PM,4.12928689,25.0 C,33.5 %RH
KEITHLEY,21/11/2018 8:01:22 PM,4.12928689,25.0 C,33.5 %RH
HP3458A,21/11/2018 8:01:25 PM,2.5474837,25.0 C,33.5 %RH
KEITHLEY,21/11/2018 8:01:25 PM,4.12928689,25.0 C,33.5 %RH

Ian.
« Last Edit: November 21, 2018, 08:42:34 pm by IanJ »
Ian Johnston - Original designer of the PDVS2mini || Author of WinGPIB
Website: www.ianjohnston.com
YouTube: www.youtube.com/user/IanScottJohnston, Odysee: https://odysee.com/@IanScottJohnston, Twitter(X): https://twitter.com/IanSJohnston, Github: https://github.com/Ian-Johnston?tab=repositories
 
The following users thanked this post: Conrad Hoffman, denimdragon

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: 3458a logging via Windows app.....revisited
« Reply #19 on: November 21, 2018, 09:03:04 pm »
PS. Keithley DMM has annoying 'beep' when GPIB command is sent....I am sure there's a command to disable this!.....actually I think it's an error being generated....need to fix this....UPDATE: Send ":INIT:CONT OFF" also, per page 2-55 of 2015THD manual.
I remember the error beep and having to send ":INITIATE:CONTINUOUS OFF" as one of the Keithley quirks, indeed. Took quite a while until I figured out the solution.

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: 3458a logging via Windows app.....revisited
« Reply #20 on: November 21, 2018, 10:49:53 pm »
A quick test on a HP 3458A connected to an Agilent E2050A (predecessor of the E5810A without all the new-fangled stuff like web interfaces :P). I used a Python shell with python-vxi11 to send commands through the E2050A. This instrument is on GPIB address 20.
Code: [Select]
# Initialize
>>> import vxi11
>>> instr = vxi11.Instrument("TCPIP::1x.x.x.x::gpib,20::INSTR")
# Send a random command to make it go to remote mode
>>> instr.write('DISP ON')
# At this point the REM annunciator is lit, and front panel keys other than local are disabled.
# Send GTL
>>> instr.local()
# The REM annunciator turns off, and front panel keys work again
I checked the manual again, and the LOCAL 7 commands are for HP 200/300 BASIC, so they're irrelevant for modern computers. Sending those to the 3458A produces an error, as expected. You just have to tell the GPIB controller to send the GTL command and / or release the REM line. In the NI 488 C bindings, this would be ibloc(), and pwlps describes a few posts earlier how to do it with VISA. In the VXI-11 bindings I was using for this test, it's Instrument.local(). Before this, I issue DISP ON and TRIG AUTO to get the DMM into a usable state for interactive use.
 
The following users thanked this post: IanJ

Offline IanJTopic starter

  • Supporter
  • ****
  • Posts: 1754
  • Country: scotland
  • Full time EE & Youtuber/Creator
    • IanJohnston.com
Re: 3458a logging via Windows app.....revisited
« Reply #21 on: November 21, 2018, 11:15:39 pm »
I checked the manual again, and the LOCAL 7 commands are for HP 200/300 BASIC, so they're irrelevant for modern computers. Sending those to the 3458A produces an error, as expected. You just have to tell the GPIB controller to send the GTL command and / or release the REM line. In the NI 488 C bindings, this would be ibloc(), and pwlps describes a few posts earlier how to do it with VISA. In the VXI-11 bindings I was using for this test, it's Instrument.local(). Before this, I issue DISP ON and TRIG AUTO to get the DMM into a usable state for interactive use.

Aha!......this prompted me to do more testing because pwlps had sent me an updated DLL to do just this (there are two applications, I am just modifying one of them right now)......but I think it was written to call GTL on shutdown of the app, which indeed does work and it releases the 3458A back to local mode. A good step forward though.

Ian.
Ian Johnston - Original designer of the PDVS2mini || Author of WinGPIB
Website: www.ianjohnston.com
YouTube: www.youtube.com/user/IanScottJohnston, Odysee: https://odysee.com/@IanScottJohnston, Twitter(X): https://twitter.com/IanSJohnston, Github: https://github.com/Ian-Johnston?tab=repositories
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: us
    • The Messy Basement
Re: 3458a logging via Windows app.....revisited
« Reply #22 on: November 22, 2018, 01:02:28 am »
Wow, that reminds me of the HP 85 I used to use. We've come a ways.
 

Offline acts238willy

  • Regular Contributor
  • *
  • Posts: 95
  • Country: us
Re: 3458a logging via Windows app.....revisited
« Reply #23 on: November 22, 2018, 02:48:30 am »
+Sadly, the old gear is still very good, ppm-wise.
The Datron, HP, etc., GPIB stuff that all calls for
the HP85 needs a modern solution for data collection.
I get some help from Digelent's program called
'Labview Home'... it's a student copy of Labview,
dated 2014, for less than $60. It has good tools
for my 3458s.
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: us
    • The Messy Basement
Re: 3458a logging via Windows app.....revisited
« Reply #24 on: November 22, 2018, 04:03:29 am »
With the right meter setup, say "F1R0Z0N3T3D3" to blank the display and fix the range, I can read at about 60 ms intervals. OK for what I tend to do, but not record breaking speed. How fast is your program?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf