Ir al contenido principal

Entradas

Required Outputs Wizard

It's an old LabVIEW programmer's dream to be able to make VI outputs required, just as can be done with inputs. Some years ago I discovered a way of achieving it, through a deprecated scripting method. I checked with NI staff and they said it was clever but could cause unexpected problems, so I set it aside.But the time goes by and the functionality is still not available, so here we go, the Required Outputs Wizard is yours. I've been using it on and off for a long time and no errors have arisen, even when applying it to connectors with modern data types, such as classes (OOP). But I guess the risk is still there, so be cautious and test it first with unimportant VIs.Download (LLB for LabVIEW 2016)The bowels of the codeSo, how it works? Launch the top VI in the LLB, you can leave it there running. When a connected front panel indicator is selected, the "REQUIRED" button will be available. Just press it. Yeah, that's all, now your indicator connection is requi…
Entradas recientes

Coerce to Type

I'm surprised the Coerce to Type primitive hasn't found yet its way to the public front. It was revealed some years ago and since then has proved being a reliable way of converting data types, much better than the classic Type Cast, but it's still not visible in the LabVIEW functions API.Consider the following code example. You're casting an U32 value (2) to U8 (you shouldn't, but shit happens). Type cast just casts it, so the resulting value is 0 (wrong!), but Coerce to Type understands what you are doing and returns 2 (correctly).To use Coerce to Type in your VIs, the easiest way is downloading the VI below into your drive.Download (VI for LabVIEW 2016)Next we're going to place it in the functions palette. So, open any block diagram and click Tools → Advanced → Edit Palette Set. Then select the palette you want to add the VI into (in this case I recommend Programming → Numeric → Data Manipulation) and click Insert → VI(s) and select the path to the VI.Now, im…

Antenna pointer

Now let's get graphic!For satellite applications is always useful to know where to point your antennas. This LLB top VI draws the positions and the azimuth angle over an equirectangular projection, chosen because of its easiness (no coordinates conversion needed), though far north and south latitudes are deformed. Also provided is phi, the angle of incidence, important for asymmetric antennas.For your own calculations you'll find useful calculate azimuth.vi and calculate elevation.vi (also calculate phi.vi for angle of incidence). All of them are included in this LLB.Download (LLB for LabVIEW 2016)

Simple FTP client for LabVIEW

LabVIEW comes with its own nice pack of FTP functions, but some time ago I needed a very low level control over the communication with a particularly stubborn equipment that returned strange codes and list formats. You know, that's the problem with the FTP protocol: it was designed for human interaction and sometimes the automatization can be really hard if the server is not respecting supposed standards.So I developed some very simple VIs to see what were going down there, and now they're in this blog in case anybody needs a simple and direct way of FTP communication. The top-level functions offered are LIST, GET, PUT, DELE and RMD, the basics to manipulate files, and both active and passive modes are allowed. I think their main utility is to see how things go in the TCP chatting between client and server.Download (LLB for LabVIEW 2016)To demonstrate how they work, I have developed a simple FTP client that connects to a FTP server of your choosing and allows to navigate folde…

Implode / Explode

LabVIEW lacks native implode/explode functions for strings, to split a string into an array and vice versa. This is easily feasible thanks to the Spreadsheet String To Array function and its opposite Array to Spreadsheet String, but it's useful having a couple of VIs ready to do the work.Download explode.vi (VI for LabVIEW 2016)The explode function is pretty straightforward, but imploding is a little harder since the parallel function puts a carriage return / line feed at the end of the resulting string, and we need to remove it applying a trim. Trim is not the best function in performance and could add more problems (for example if the last chunk has a white space at the end), so I have implemented an alternative simple for-loop mechanism.Download implode.vi (VI for LabVIEW 2016)Check the code and select the mode you are mor confortable with.

SNMP library for LabVIEW

SNMP (Simple Network Management Protocol) is a fairly common protocol for communicating with network equipment. It's fast, lightweight and standardized. Unfortunately it's not quite as simple as its name implies and LabVIEW doesn't support it natively.Some years ago I was in the necessity of using SNMP from a LabVIEW system to control some hardware. I started looking for already implemented solutions and found a library developed by Mark Yedinak (great work!). It was useful since it demonstrated it could be done and how, but I needed more control over the operations, so I had to read the protocol down to the low level bytes and implement what I need by myself. Yeah, pretty hard and with time constraints no less. Anyway, here it is.Download (Library in LLB file for LabVIEW 2016)See the examples folder to grasp the basic use. Probably you'll need no more than these sets of VIs to send and retrieve data and to get traps sent by your equipment. To integrate in a program, u…

Release current directory

This is not mine, it's a tip I found years ago in a LabVIEW forum and still works like a charm (thanks to the genious that got it!).When the user selects a file to work with (signal data you want to analyze, for example) your LabVIEW application "grabs" its path, so you can't delete it or its directory, or unmount the unit if you're using an external drive, even if you are not reading that file anymore and you clear any path controls. But we can use Kernel32.dll method SetCurrentDirectoryA to release it (obviously, this only works in Windows systems).No downloadable code today, it's better if you link the call library function node by yourself, so you're sure it finds the dll. You can find more info about this method here: SetCurrentDirectory function at MSDN.