12-27-2017
11:27 AM
- last edited on
06-17-2025
12:31 PM
by
Content Cleaner
I apologize for a newbie question stemming from my first, simple LabView project. I'm an experienced s/w programmer in general, just new to LabView.
Objective:
Background & approach:
Hooray so far!
Problem:
What's been tried:
I'm a bit embarrassed but feel like I'm just missing one or two key pieces of information that I haven't been able to find — either an analogous example, or a snippet of tutorial information on hardware configuration.vi.
Any suggestions or pointers to further information would be very much appreciated!
12-27-2017 02:14 PM
Okay, so I've never used this example project but it writes quite a bit of boiler plate for you. How nice is that! So I've found where you're referring to the refnum. I don't know what hardware you are using (I thought I'd be able to figure out from "usbmodem1471" but google doesn't return anything obvious) but the easiest way to find out how to reference your device is plop a visa open vi (ctrl+space, type visa open) onto your block diagram. VISA open probably belongs in Initialize Hardware References.vi. Next, create a control for VISA resource name input. Next, drop down that control and it should be populated with all the devices you see in NI max that are compatible with visa which I think this seems to be. I bet you will see one that is the same as that port binding you listed. Anyways, this resource control could be used inside of the Hardware Resources cluster replacing the string that is currently there. But a fun fact, a string control coerces to a resource sink, so you can actually wire a string right to visa open also. Then you don't need to change anything about the control. However, visa resource controls are a bit easier to use when trying to enumerate visa resources, so there is that.
For now, you need to make sure that you put the port you choose in the cluster in Acquisition Message Loop. However, long term, you normally load this from a file. So instead you will replace it with something that reads from an ini file or similar. Modifying the control has two parts. One part has to do with it's structure. To modify the structure of the control, you can find the control on the block diagram or front panel, right click, and then open Type Def. You can then add or subtract controls from the cluster. Save and apply your changes, and those changes will show up everywhere in the project. You can also change the value of each instance of the type defined cluster, such as the one on the block diagram of Acquisition Message Loop. If you double click the icon for the control, it will change to mode where you can edit the values that the constant currently has. This can also be done by right clicking the icon and selecting the "View Cluster as Icon" item in the drop down.
Note that if you search #CodeNeeded inside a vi across the whole project, you'll note you need to put code in a lot of places to get this to do something useful. Lemme know if you have any more issues. Definitely continue reading all the labview introductory documentation to learn more about labview basics (such as clusters, type definitions and visa vis).
Also, what languages do you have experient with?
12-27-2017 06:20 PM
Thank you for taking the time to look into this. I'll work on your suggestions & keep this thread posted.
My s/w language experience includes Javascript, Python, Ruby, C++, C, a bit of Java, Basic, Fortran, a variety of assembler-level languages (microprocessors through mainframes), and probably some other things I've forgotten to list.
The specific hardware is described here. No one has written a vi specifically for it.
I have a Github repo (presently private) for this project. Once I get it working (or to a point where it's worth looking at code), I'll make the repo public and post a link to this thread as well. Perhaps at some future date someone else will find the thread and repo useful.
— Eric
12-28-2017 09:54 AM
Awesome. I recommend you start out with an example. There is an example that ships with Labview called Continuous Serial Write and Read. This is a good starting place to make sure that everything is working.
12-28-2017 03:33 PM
Great minds think in similar ruts. I just built a working skeleton around that same example this morning. It was great to see the expected data populating the screen!
Thanks again for the help!