GW Instek scope control software

Well, it appears there's no really good way to do this here. This will contain various bits of code used to support the fusor, which presently includes everything from embedded 8 bit uP code to stuff to run under Linux in some HLL (often perl) to interface-specific stuff for commercial hardware, sysadmin tips and setups, and running on whatever machines I have in the tree here. So any one piece might fit some other category too, but...there's no pigeon-holing even computer science without losing the app-specific stuff and inter-relations of it all in a specific usage.
Forum rules
Code sharing for fusor data aq and control software

GW Instek scope control software

Postby Doug Coulter » Sun Mar 05, 2017 12:59 pm

Don't forget to read the post I made as fusordoug - this is pretty specific to the scope we have here, a GDS-2204. Having said that, I had to use the manual for a much older scope and the things I did worked fine, it's just that every scope is a little different (ranges, number of channels, how it connects) - and this one is ethernet at a fixed IP inside my LAN. Most of my other GW scopes are USB<>serial, and this code might even work if that type of communication is substituted; there will be examples in other things of using perl's Device::SerialPort with path names that look like "/dev/serial/by-id/somedevice". This is a super handy trick and no fooling with guessing which com port (windows#$%@#$%) has assigned to which device this time...which of course changes if things go on and off... Hint to the arduino IDE guys - you could do this to, but I suppose it wouldn't work on the inferior platforms then.

I wrote this particular code to let me change a tiny fraction of the adjustments on this fancy scope while running the fusor (and video recording the screen in time-sync during runs!). There's more, some of what's in the manual doesn't work even for the scope model it was written for, and some is just useless, like dumping the scope's ram - you get maybe 9600 baud worth of speed doing that, which is why we gave up and just pointed a camera at the screen here. I don't need to know what happened yesterday...but for 1/10th the price of a "real tektronix that might not even be better" - I will live with this.

I used Glade to do the GUI layout. Not quite like MS Devstudio in the old days, but not so bad if you don't have to read the resulting XML, and you don't. This version is for GTK3 which in theory can run on windows, but the effort to put a GTK desktop library set on windows just isn't worth it. It may work on macs, dunno - I know they support perl well there. At any rate, Glade produces a long winded file to describe each GUI element and all its properties, what event to fire if various things happen and so on. Perl has a library that will "eat" this info and make a GUI on the screen, and even connect events to subroutines automatically if the names match (look out for that one). You have a choice here - perl will let you embed this nasty XML file right in the perl code after the __END__ or __DATA__ tags and do the GUI from that as if it were a file named....data. Or it can be a separate file, as I did here, which makes it tons easier to edit. When I have something really really done, I embed the XML in the perl which means only one thing to copy around later on, but then to edit it you have to copy it back out into a file and run Glade on it to change anything. Them's the breaks.

You will of course need cpanminus or cpan to get some of the dependencies. The trick is to run from the terminal and it'll barf with reasonably helpful error messages till you get them all. I've found it's better to get the actual missing stuff via the slightly different names it will often have in synaptic (say, adding lib to the beginning of the name) as for whatever reason, when the dependencies get deep, it simply does a better job. I will maybe put some more tips on that issue up here next time I run into it and have to solve it Yet. Again.

These files go in the /home/you/bin directory every linux geek makes for his own programs - it's added to your path by default if it exists at boot time, saves typing and even makes creating desktop shortcuts a little easier. I do NOT do that till things are pretty solid, as the "run in terminal" option you get there make the terminal go away if the program has some issue, and you then lose the error message or any debug printing it did. So I run these from a terminal till they are solid on whatever machine. There is a .dft file that allows you to create, store, and recover default setups (name them something worthwhile), at least to the level of the controls this interface lets you fiddle. That would be only the ones I felt the need for realtime remote control of. There are tons more but I have other things to do...and it would quickly get out of control, be frustrating, and run out of screen space without a ton of other paging/tabbing code.

scopecontrol.zip
Scope control code
(4.99 KiB) Downloaded 261 times
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA

Re: GW Instek scope control software

Postby Doug Coulter » Wed Mar 08, 2017 4:22 pm

Oops, forgot to show a screenshot. Modified to fit your scope (eg channel count etc) this should work fine with most GW instek scopes which I think more or less emulate Tek scopes.
The fusor master control program has some nice perl code to talk to USB serial in it you could use for those scopes that don't have ethernet (most of them) and finds things by name, not some arbitrary TTY or com port - on linux you get the right device 100% of the time regardless of what's plugged in and out as long as it's there when you set up the port.
scope.png
What I see. You can get or set the scope to the GUI, and get and set a preset file (any number of them) to the GUI (and hence <> scope).
Posting as just me, not as the forum owner. Everything I say is "in my opinion" and YMMV -- which should go for everyone without saying.
User avatar
Doug Coulter
 
Posts: 3515
Joined: Wed Jul 14, 2010 7:05 pm
Location: Floyd county, VA, USA


Return to Fusor support

Who is online

Users browsing this forum: No registered users and 1 guest

cron