-
Posts
3,903 -
Joined
-
Last visited
-
Days Won
269
Content Type
Profiles
Forums
Downloads
Gallery
Everything posted by Rolf Kalbermatter
-
Occurrences work a bit more complicated. I have to admit that my memory is a little foggy about the exact details of this, as it has been several years that I struggled with this for a rather complicated infrastructure, involving use of occurrences also in external C code. But from what I remember, once an occurrence has triggered it is in the set state (to use a more common concept of ResetableEvent as analogy). When a WoO executes for the first time it looks at the state and when ignore previous is true it will USUALLY wait even when the occurence is currently in the triggered state. When it is false it will just continue when the occurrence is in the triggered state. In any case when WoO returns without timeout it will reset the state of the occurrence for this instance of WoO only. Next time around this WoO will use its local state to detect previous triggers when ignore previous is false. Other WoO instances will not influence the behaviour of this WoO in respect to detecting previous triggers. But a specific WoO can only wait once on a trigger eventhough you may have ignore previous set to false. What I encountered sometimes was that the occurrence could get triggered the first round around even when ignore previous was true AND the trigger event had clearly occurred before the wait executed. My solution was to use the occurence as an indication that something might have happened and when WoO returned without timeout to actually check for the data to have arrived and if it didn't so far treat it as timeout anyhow, usually looping once more for an event. This was back in LabVIEW 6 or 7 days and I have since always used occurrence in a way that was tolerant to this behavior. At first I considered it a bug of the occurrence but some discussions let me believe that it was an artifact of concurrent programming that can't be completely avoided and use of this should always be prepared for this possibility. NI might have changed something in the occurrence handling since and it may not behave exactly that way anymore, but I wouldn't really notice as my implementation is tolerant to the old behavior but of course won't break on an improved behavior of the occurrence. As to a case where occurrences have an advantage over the other asynchronous objects in LabVIEW: If you want to be able to trigger an event from external C code the only native LabVIEW objects that are to my knownledge available for this are Occurrences since LabVIEW 3 or 4 and User Events since LabVIEW 7.1. None of this is well documented but there are for both semi offical NI examples floating around. Wait on Occurrence had that as long as I can remember. (But my long term memory is sometimes a bit fuzzy so it may not have been there in LabVIEW 3. It's definitely there as far back as LabVIEW 5.1, I just checked. ) Using (undocumented) LabVIEW manager calls, one can create dynamic occurrence refnums. I have done so in the past for a data logging application, giving every single channel tag its own occurrence so clients could wait on value changes easily. Worked like a charm even for several 100 channels. All the LabVIEW refnums created (except those created by the LabVIEW manager calls directly unless you use some other manager calls to register those refnums for automatic cleanup) are suspectible to automatic cleanup on termination of the hierarchy that created them. So they do get cleaned up eventually. Static refnums vs. dynamic refnums has always pros and cons on both sides. Try to execute Create Occurrence in a loop to create several occurrences for a varying number of objects. It won't work as expected. So while dynamic refnums do require extra care from a programmer to properly cleanup after use, they also offer much more flexibility. For the same reasons you could vote that string constants should be static to avoid a LabVIEW user creating memory hogs by wiring it to an autoindexing loop boundary of an infinite loop. But that would possibly render LabVIEW even turing incomplete as you could not deal with a lot of common situations anymore. Yes notifiers and occurrences are similar but a notifier can have a data item attached to it, while an occurrence only carries the notification event itself.
-
Anybody out there know the status of LuaVIEW?
Rolf Kalbermatter replied to Mark Smith's topic in LabVIEW General
On a sidenote on this. I just noticed that the luaview mailinglist at luaforge was shutdown as part of the downsizing of that site to a mostly static project directory. Do any people here have recommendations for a mailinglist provider, that we could use for a replacement? Until we have something else in place as a public mailing list the email addresses luaview-info(at)citengineering.com and luaview-bug(at)citeengineering.com can serve as an intermediate solution, but I would prefer to have a public accessible mailing list for the longer run. Running our own forum solution is unfortunately a to heavy-weight solution for such a project . -
Occurrences are the underlaying functionality of all LabVIEW asynchronous operations. However they have a few limitations in itself. 1) They don't allow for any data to be associated to them 2) They have somewhat confusing semantics 3) You can get a triggered occurrence from set occurrence invocations that happened before the wait occurrence was called even when ignore previous is true. This can be worked around easily by checking for the actual event in some other ways and reentering a wait if the event wasn't really true, but one needs to be aware of it.
-
I don't think a wire stores any data in LabVIEW. However you may want to look into custom probes. They basically do what you want, though you have to place them manually (well maybe scripting supports them too :-) )
-
Convert CIN to Call Library Function LabVIEW 2010
Rolf Kalbermatter replied to MCornwall's topic in LabVIEW General
You didn't happen to go from one platform to another? Remember Windows 32 bit and Windows 64 bit are completely different platforms when compiled code is concerned and CINs are simply compiled object code. Change between Mac, Windows, Linux and VxWorks are anyhow different platforms. As long as you stay in the same platform, CINs should still load fine in LabVIEW. However I don't beleive CIN tools have been ported to Win 64 Bit so don't expect to be able to create CINs for that platform. To port a CIN you would anyhow need the source code as you need to recompile it. Even if they wanted they couldn't. The actual CIN is just as different as a DLL for different platforms. There exists no good translation to convert a 32 bit DLL to a 64 bit DLL, that I would know of. The solution is to take the source code and recompile. Without source code it's a though cookie.- 7 replies
-
- cin
- library function node
-
(and 1 more)
Tagged with:
-
Uniterated For Loops do not pass References
Rolf Kalbermatter replied to AlexA's topic in LabVIEW General
It's a bug in the sense of a user error. It's not really a bug in LabVIEW itself as it does perfectly right what it is supposed to do. -
Anybody out there know the status of LuaVIEW?
Rolf Kalbermatter replied to Mark Smith's topic in LabVIEW General
Yes I do happen to know about LuaVIEW and its future. We haven't yet defined an exact timeframe of when and what things will happen, but expect LuaVIEW to be maintained and even improved in the future. A few things in the pipeline though no promises they will all be released: - Fix some minor errors in newer LabVIEW versions with the unit tests - Make the LuaVIEW core a shared library instead of a CIN - Provide direct VISA and .Net interfaces in LuaVIEW from a script - Make it's distribution VIPM compatible - Get it Lua 5.1 compatible - Add additional targets (x86 Mac, x64 Mac, x64 Windows, possibly cRIO VxWorks) -
And just to add a bit to it. Even if you find that location where the password is checked, things get a lot more complicated if you take password protected libraries (and maybe classes) into the picture. Those do not use the same code paths to check for password protection and the passwords of each are actually used in the hash of the other.
-
Yes you are not supposed to do that and I can't guarantee that it works for 64 Bit OSes. I treated it so far simply as a NumericArray of 32 bit integers for 32 bit OS and 64 bit integer for 64 bit OS, but never really tested any code on a 64 bit system so far. As to handles passed by value: Yes you can assume that they are not null, as you rightly have reasoned that you could not resize them in your code then. It still means that the pointer inside the handle can be null but DSSetHandleSize() should be able to deal with that correctly.
-
TCP_NODELAY.llb library
Rolf Kalbermatter replied to Mark Yedinak's topic in Remote Control, Monitoring and the Internet
The VI in VI lib should work. It may use a different API internally, if NI hasn't updated it, but should in fact do the same. Early on when networking was really sort of an addon API in LabVIEW (~ V 4) there existed a function to retrieve all kinds of internal parameters. One of them was to get the associated network socket of a network refnum. But that function ultimately called the predecessor of NCGetRawNetObject() which wasn't exported back then. Being a standard VI lib function it should solve your source code control issues. -
The rules are simple C programming rules. If you pass an array of handles to C code and resize the array size, you are fully responsible to deallocate any elements that are occupied by the previous array beyond its new size and to allocate any elements thathaven't existed before in the array. Additionally you have to make sure to resize any existing handle to the required size before you modify its contents. And your last remark about that who allocated it also needs to deallocate it, that is ambiguous at least. In C the caller is usually responsible for both since there is no standrad way of passing ownership of memory between caller and callee, but APIs can decide to change that, by allocating and returning memory, but that has to be specifically documented by the API and such an API better provides a function to allow the caller to deallocate that memory later on, since the malloc/free from the API may not be compatible and not even refer to the same heap than the malloc/free of the caller. In LabVIEW the situation is different. LabVIEW uses a standardized memory manager throughout, so this limitation does not exist. Whoever holds onto a handle is responsible to manage and eventually release it and all of its contents. For a C function being called by LabVIEW with native handles, this means you may get in a handle, you may modify it and allocate/deallocate any handles therein, provided you also keep the related information such as the array size consistent. If you then pass the array back (which you basically always do if it is in a value parameter, and usually also if it is a reference parameter, you pass on ownership of that handle back to LabVIEW and it will need to manage it from thereon. An additional tidbit you should know is that LabVIEW uses for performance reasons often a null handle when an empty handle is required, but treats an empty handle also correctly. So your C code needs to be prepared to handle an array of 1000 empty strings to be really an array of 1000 null handles, meaning when you want to write something into these strings you can not just do a DSSetHandleSize() as that will crash on a null handle. Instead use NumericArrayResize() with element type uB, as this function gets the handle passed by reference and will correctly allocate a new handle if it was null.
-
robotic - Labview drivers for FANUC LR mate robot
Rolf Kalbermatter replied to E-man's topic in Hardware
Well there are two open sources projects you can try to find and check out. The first one is libopenSRTP and the second one is Visual HMI, both from the same author. There also used to be a GEFCOMM Visual Basic example around from someone from GE Fanuc support but not sure if this is still available anywhere. I found the VB example here: http://forums.mrplc.com/index.php?app=downloads&showfile=574 -
Passing array of string to C dll
Rolf Kalbermatter replied to Reikira's topic in Calling External Code
It might work! I'm not sure about the array of pointer sized integers though. On the LabVIEW diagram they are always 64 Bits, but possiby LabVIEW does the right thing here and only converts to a 64 Bit value when passing it to an indicator. That should be indicated with a coercion dot IMO, but it isn't. -
Passing array of string to C dll
Rolf Kalbermatter replied to Reikira's topic in Calling External Code
You need to write a C wrapper function for that. LabVIEW strings are not the same as a char*, so creating an array of LabVIEW strings does something quite different than char**. Besides, char ** is rather ambiguous anyways. It could be an array of string pointers as your API expects it or it could be also a reference to a string pointer. Basically you need to write a C function that increases every LabVIEW handle in the array with one character annd fill in the terminating 0 char there, then create an array of pointers where you fill in the string pointer extracted from the LabVIEW handle. Something like this: typedef struct { int32 len; LStrHandle elm[];} **LStrArrHdl;yourtype LVfunctionWrapper(....., LStrArrHdl arr, ....){ int32 i ; char **ptr = malloc((*arr)->len * sizeof(*char)); if (!ptr) bailout; for (i = 0; i < (*arr)->len; i++) { int32 len = LStrLen(*((*arr)->elm[i])); LStrHandle h = (*arr)->elm[i]; err = DSSetHandleSize(h, len + 1); if (err) bailout; ptr[i] = LStrBuf(*h); *(ptr[i] + len) = 0; } retval = yourfunction(......, ptr, ......); free(ptr); return retval;} -
Problem on appending files on a zip file on RT
Rolf Kalbermatter replied to jramon's topic in OpenG General Discussions
I had created a 64 Bit version last year already using the Windows SDK command line compiler but it crashed somewhere. And I still need to get a 64bit development version of Visual Studio installed to do some useful debugging. So that will take some time and probably some fiddling around to get working properly. -
Problem on appending files on a zip file on RT
Rolf Kalbermatter replied to jramon's topic in OpenG General Discussions
I have played a little with the vxWorks toolchain. The reason that the // comments are not accepted is that the example vxWorks makefiles that I used as a template for my lvzip makefile do specify the -ansi switch to the C compiler. This reverts to C90 and disables C99 features such as // comments and inline keyword explicitly. Removing that allows compilation without problems but I'm not sure if the resulting shared library is still fully operational for the LabVIEW realtime target as it also has a few effects in terms of compiler builtin symbols that are enabled and are in C90 replaced with library symbols that the compiler will link the resulting object files to. This library shouldn't use any of those symbols but not sure if there are side effects. -
Have you tried playing with the mode input from TCP Read? Do you use message termination scheme with CR LF or something else? Basically LabVIEW defaults to a semi buffered mode but most simple socket programming without any poll() operation resembles more the immediate mode of LabVIEW. A mismatch in this mode with what a C program expects is usually the most likely reason for the behavior you see. The C Read with LabVIEW Write most likely will simply work if above is the culprit.
-
Find NI Shared folder
Rolf Kalbermatter replied to durnek60's topic in Application Builder, Installers and code distribution
Most likely it's location is stored in a key in the registry in a National Instrument specific subtree. -
Problem on appending files on a zip file on RT
Rolf Kalbermatter replied to jramon's topic in OpenG General Discussions
Well the actual code that adds appending support to an archive was incorporated around 2006 or so, so it should definitely have been in the .out library you had first used. There were other changes to the c source including the change to zlib 1.2.5 but not really between the two dates you show. But it is good to know that it the current source seems to work fine now. I will try to go through all targets and build a new shared library file for them in the next few weeks. This would be by now: Windows x86, Windows x64, Mac OS X x86, Mac OS X PPC, vxWorks 6.1, vxWorks 6.3, Linux 32 bit. A serious series of toolchains that one can't install on one computer or even two or three alone. And Mac OS X x64 is probably coming too, as the newest OS X doesn't seem to allow to startup in 32 bit mode anymore. I'll check about the comments. If they are not in the zlib files I'm going to change them, otherwise I'm not sure what is the right solution at the moment. -
Problem on appending files on a zip file on RT
Rolf Kalbermatter replied to jramon's topic in OpenG General Discussions
Well I had submitted a few zlib related fixes lately that haven''t made it yet into the official upstreams zlib library, so those changes could be the reason that it now works. I didn't expect those changes to have such an influence though, as it was really about troubles when compiling as 64bit code. But I'm baffled about the need to change comments! I have compiled this library with the same toolchain and no modifications to the source code without any compile errors about comments. And I would rather leave the comment style as it is, since most of the files are just taken from the zlib project and changing them each time the zlib project has modified files is simply to painful. Can you give some information as to what errors you got from the // comments One guess I have might be that the updated_gcc toolchain that is now on the NI page incorporates a new gnu version that stumbles over the // comments when compiling .c files, as // comments were originally only a C++ feature. But that would be a rather awkward change, since most C compilers nowadays accept both comment styles anyways and it seems also part of the official C99 standard, which is for standard C compilers. So not sure why GNU would revert a feature that is officially declared in the C99 standard. -
Problem on appending files on a zip file on RT
Rolf Kalbermatter replied to jramon's topic in OpenG General Discussions
I'm afraid so but don't have a quick idea what the problem would be. Debugging on VxWorks is also a pain, since I don't have the integrated VxWorks development environment available (which costs $ and I can't justify this as the whole library and especially the VxWorks port is simply voluntary work). -
Refresh file associations in windows
Rolf Kalbermatter replied to Michael Aivaliotis's topic in Calling External Code
The first parameter needs to be SHCNE_ASSOCCHANGED = 0x08000000 and the second SHCNF_IDLIST = 0x0000. The first parameter is a bitmask where the set bit defines the type of event and with no bit set, you simply invoke this function to post no event at all. -
Of course there is! Use a recent LabVIEW version and of course don't use functions that are synchronized through the UI thread. That includes all VIs itself set to run in the UI thread but also just about every LabVIEW VI server function including Property Nodes and Methods.And everything else that will put up a UI screen such as a dialog or similar.
-
Updating a user built App within itself
Rolf Kalbermatter replied to jdebuhr's topic in LabVIEW General
Is the framework you remember maybe RT System Replication? If so this is not for the application on the RT system to replace itself, but to push down an update from a host application to the (running) RT system. And honestly I don't think you want to have an RT system poll some remote location and attempt to replace itself with a new version. Imagine the system crashing somehow because the new version is not operational. And that system being at the other end of the world. You do want someone to take responsibility when the running app is replaced and be ready to take action if things go wrong. -
But if there is no diagram it wouldn't run in a different version than the one it was created in, would it? I remember some dialogs in the past when trying to open a diagramless VI in a different version.