Jump to content

Mark Zvilius

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Mark Zvilius

  1. Thanks all, especially for the sample code. Mark Z.
  2. I am developing a LabView interface to a legacy device driver which is in the form of a native Windows DLL. The heart of the device driver is a callback function that periodically delivers data (video frames) from the device (a camera). I have a written a wrapper DLL which implements the callback function, puts the frames on a queue, and exports a function that can be called from LV to pop a frame from the queue. On the LV side I have a thread that polls for frames by calling the "pop frame" function in the wrapper DLL and then puts the frames in a LabView Queue, which is the interface to the rest of the LabView application. My question is: what event-driven alternatives to my polling solution are available? I've searched through various fora and seen many discussions on this subject, but the answers haven't been very coherent (at least to me), and many of the discussions are quite old. Ideally I'd like to be able to push frames onto a LabView Queue from the wrapper DLL, thus entirely eliminating the thread I have running on the LV side. Are LabView Queues exposed to a Windows DLL in any way? Failing that, what techniques are available for an event-driven .. as opposed to polled .. solution? Notifiers? Thanks, Mark Z.
  3. Thanks for the discussion. I agree that (the other) Mark's approach is cleaner than the dual control-indicator approach, which I had seen before but didn't want to mention in my original post .. because it seems such an awful kludge. Mark Z.
  4. I am working on an XControl whose Facade (front panel) is composed of standard LV numeric controls. I want to handle the "Direction Change" event simply by changing the numeric controls to indicators (or vice versa). Is it possible to get references to controls that are "hosted" by the XControl Facade VI? If so, I could simply set the Indicator property on each of them and be done. I tried creating references to the controls on the Facade front panel, but that didn't work. Makes sense because each instance of the XControl has its own instances of the numeric controls. I can use the Container State:Refnum item to get a reference to the XControl instance, but I don't know how to get references to the numeric controls from that. If that approach is a dead end, what other technique is available to accomplish the same thing? Thanks, Mark Zvilius
  5. Thanks for the discussion. My takeaway is that exactly how queues function wrt element copy is still rather opaque, and I would have to run some performance tests to determine when copies are being made. If I wanted to be absolutely sure, I'd have to wrap my elements (the 2D arrays) in a DVR and pass the DVRs on the queue. Going back to my original diagram I would argue that the queue could be thought of as logically connecting the wire in the Producer loop to the wire in the Consumer loop. Each time through the Producer loop the Initialize Array creates a new buffer to hold the array, and the Consumer could use the same buffer without copying because there are no branches in either the Producer or the Consumer. That's my naive, relatively-new-to-Labview idea of what could be, and I understand that there are probably very good reasons for what is. Thanks again, Mark Z.
  6. I have a producer-consumer app that uses a queue. The data items are rather large matrixes .. on the order of 300kB. Because of the size of the matrixes, I've become interested in optimizing the number of data copies that are performed. I wrote some test code and simplified it down to the following, which uses a 10x10 matrix as the data item. I then used the "Show Buffer Allocations" tool to look at data copies (note the black dots on Initialize Array and Dequeue Element). Questions: 1. Is it really true that a copy is made on the Dequeue operation? That surprises me since there can be only one destination for the queue element. 2. Would I be able to eliminate the copy by wrapping the matrix in a DVR and passing the DVR on the queue? Would the performance hit of using the reference negate the savings? (I'm not sure if I would actually do this; it's more of an learning exercise at the moment.) I appreciate your input, Mark Zvilius
  7. "start a new thread..." What's the best practice (assuming I have a follow-up question in a week or two)? Reply to this thread or start a new thread? I would've thought the former.
  8. Thanks again for the reply. Yesterday I found a reference to "ReferenceObject.lvproj" in a FAQ on the NI site, so it's good to know I'm proceeding down the correct path. Your explanation of the meanings of "by-reference," "by-value," and "global" in the context of LabView is useful. While I understand the concepts from other programming environments, I am still working to grok the implications in the context of LabView. So thanks for that. Yes, I am using LV 2009. The LaunchProcess example is very useful. Thanks. Now I have to go off and "do" for a while. If I run into any further roadblocks I'll return to this string. Thanks for the assistance and advice!
  9. First of all, thanks for the extensive reply. There is a lot there for me to chew on. My abstraction layer is defined by a class, let's call it "Device". There are two classes that inherit from Device: ActualDevice and MockDevice. ActualDevice performs communication with the actual device. MockDevice is the simulator. I think this is basically in line with your suggestion, if I understand you correctly. What I'm looking to do is have some of the methods in MockDevice reference some data that is shared with the parallel, "simulator-vi", so that a tester can manually control some device characteristics. No. I just haven't seen the need for it to read the shared data yet. Very good point. The application I'm developing at present only talks to one device. But doubtless the next step will be talk to multiple devices, and having multiple MockDevice instances running (with a separate simulator-vi front panel for each) will be useful in the long term. That brings up the question of how to launch multiple instances of a VI, so that I have multiple copies of the same front panel on the screen accessible to the user? The terms "by-ref class" (aot "global class") and "data value reference" are new to me. I'll have to do some studying... Thanks for your help, Mark Z.
  10. I am developing an application ("main-app") that communicates with an external device. I have defined an abstraction layer in the application for the device (using LV classes). Now I am using that abstraction layer to develop a simple simulator for the device. When running against the simulator, I want to launch a separate VI .. call it "simulator-vi" .. to run in parallel with main-app, so that a tester can control the simulator. For example, the tester can press a button on simulator-vi to force an error condition to occur in the "device" in order to test the error-handling functionality of main-app. What options are available to represent the simulator state so that it can be shared between main-app and simulator-vi? For my immediate purposes, I think the simulator state would be write-only for simulator-vi and read-only for main-app, but in the future it would make sense for main-app to be able to modify the simulator state too. The simulator-vi will run in memory alongside the main-app, there is no need for it to run remotely. I think I can use global variables to represent the simulator state, especially as long as it is read-only for main-app. But I'm interested in what other options I might consider, and pros and cons of the various possibilities. Thanks, Mark Zvilius
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.