08-04-2016 03:34 PM
On my main GUI, I can't seem to view values I'm obtaining from my class structure. I've included my LabVIEW project, the project is called "Mass Spectrometer", GSE_mod is the main LabVIEW program. Under "Instrument Data", there is a field called "Last CMD". Somehow when I'm trying to trying to capture data, it's not updating. Not sure if it's an issue I have with my class formatting?
08-05-2016 07:18 AM
08-05-2016 08:25 AM - edited 08-05-2016 08:34 AM
Your 'Last CMD' in 'Instrument Data' doesn't use objects - it's just using a VISA reference to the VISA instrument you are controlling so classes here have nothing to do with it (you're essentially using a class like an lvlib - without any class private data).
It probably has something to do with the weird array operations you're performing in InstrData Status.vi - picking out random subsets from arrays and then doing a subset/indexing on that. Are you sure you're receiving the data you're expecting from the instrument? I don't actually understand what you're trying to do in that VI - find a termination character? If so, why not use the termination character option in VISA? Also, if you have a 1651 byte string in, search for something that's not at the start of the string, trying to get 1651 characters after that (your subset 'length') will return a shorter string than you're expecting. The 'last CMD' will also only ever return a single character (i.e. the 'A' of hex 'AA', since you convert the string into hex), is that what you were expecting?
Edit: In fact, I looked at your other classes for other instruments and it is completely pointless to use classes and have the class wires being passed around your VIs in this project. The idea of the 'class' is to have data (e.g. class private data such as device references, configuration settings) + methods (e.g. 'configure', 'start', 'stop', 'close'). Inside your class VIs, you never bundle/unbundle anything from the class wire so it might as well not be there. I suggest you take a look at some of the LabVIEW OOP tutorials or try to find some class-based examples of instrument drivers.
08-05-2016 10:03 AM
Yea my implementation of class structure sucks ... I'll have to look more into it. Any examples you think my code can benefit from?
In the meanwhile in the current code, this is what I'm getting within my block of code (InstrData Status.vi). "Last CMD" is displaying here, however it's not appearing on the page, GSE_mod. This is running data, and I'm supposed to extrace info. The size of the data coming in is 1651 characters, and I start extracting the data after finding A5, index it thereafter.