Jump to content

ShaunR

Members
  • Posts

    4,940
  • Joined

  • Days Won

    307

Posts posted by ShaunR

  1. Ok, I see that I will have to elaborate. I mistakenly thought my question was clear enough.

    I have actually a TCP connection open in LabView, but I would not like to read from it, I would like to call some VI that would block (with the timeout set by me) until data is available. Then I will call another VI that will actually read from the connection and do something with the data.

    Or to be specific - I am using STM, but STM only has one parameter. The timeout can be set when reading a message, but unfortunately this timeout isn't used only when waiting for the data. It also seems to be used internally. The effect is, that if I set the STM timeout too short (lets say 100ms), then STM stops working because the timeout is too short to compose the entire message. So the timeout needs to be larger, about 1000ms. But I don't want to wait for 1 second for a new message. I want to wait for it just for 100ms. If it arrives, I will read it, if not, I will do other things.

    And since I don't want to modify the STM library and break compatibility with NI, I decided to look for some other function that would wait for new data without removing it from the connection. If the data comes, then STM will be used with its default settings to read the message.

    I hope my intention is clearer now.

    Thank you for any pointers, Mike

    If you set your TCPIP read function to "IMMEDIATE". IT will wait for the time-out period if nothing is received and return immediately if some bytes arrive.

    Alternatively. If you open your TCPIP connection using the VISA functions instead of the TCPIP functions; you can you can then use a property node to read the number of bytes at the port before reading. It will also enable you (if I remember correctly) to set different time-outs for the read and write functions.

    If you are using a native labview STM driver, you can always go in and hard-wire the time-outs manually.

  2. The workflow I had envisioned, would go like this: someone checks out the Main project from source control. He then creates a separate project for his plugin (based on a template). He can then go and write his plugin, save the plugin code into his own version control, etc. However, the Main project doesn't change (the plugin files are not added to the Main project file), so I avoid having to deal with lots of commits from other people in the group.

    This is why we need a project manager (read project/class/lvlib manager) that can nest projects like any other language can. At present, we can only include sub-components at one level down the dependent tree. This means that in your (and my) cases if your component also shares reusable code, that code cannot be used higher up the hierarchy (or so it seems).

    We have lost one of the big benefits of LV in that if a VI is in memory, it is automatically used (without winge-ing that x owns y or breaking VIs). If you want easily distributable (slim) components. Don't use the project manager or lvlib -. Use a VI tree.vi.

  3. Sweet. that's my (sad) weekend filled.

    A little food for thought to maybe kick off a discussion.....With a small spattering of ajax to show/refresh an image and detect where in the image the user has clicked, and you wouldn't need all the extra libraries and widgets and you can standardise the deployment (even via CDN)

    I think the real boon in websockets is purely for web browsers (not much difference for LV-LV client/servers). With a websocket, polling is no longer required and the server can stream data to the client. something that without websockets has always been a bit cumbersome and very limiting (requiring the user to refresh the page and use a intermediary webserver).

    My thoughts here are along the lines of Google Maps (but for VIs) where we can have an ajax browser API that "seamlessly" interacts with a LV front end - A remote-panel that is more effective and configurable (not to mention open source) than NI remote panels whilst being able to leverage already established technologies (KML, SVG and the like). No dedicated, pre configured servers. Just VIs and browsers. Wouldn't it be nice to just put a link in to your webpage to download the script from the NI CDN and, hey presto, your front panel appears in the <div class="NI"> tag with a websocket stream straight to/from your VI? thumbup1.gif

  4. Sorry, here's the manual.

    I tried using the string "$MODE ?\n" which "\ display" format changes to "$MODE\s?\n" and selected the "query" button, but it just reads the same string back to me: "$MODE ?" I tried without the space and got (without the space) the samething "$MODE?"

    $SCALE ?\r

  5. Looking to control mass flow from feedback via coriolis meter. Proportional and Integral by themselves would do (no Differential). Looking to build it without the PIDs found only in Real-Time module. Found an ancient example in NI called Simple PID. Here it is...

    The ancient example in LV 5.

    But it is so very ancient that LV 2010 refuses to load it. I presume that's what I might have needed. Where can I find something like that, only newer?

    Simple PID controller just set the derivative to 0.

  6. Doesn't anyone know a solution to my problem? Or will this better get answered in some other forum like "application Design & Architecture" which has more visits?

    Br, Miha

    OK. I'll get serious (just for a moment biggrin.gif). It depends on what you are trying to do.

    As far as I'm aware (under windows at least) there is no native labview way to "hook" a TCPIP connection. In fact, without a kernel level driver not many other apps can either (they use WinPCap). I know RolfK did a load with TCPIP which got into the nuts and bolts of TCPIP and UDP (they're on LAVA somewhere). But I only looked at them briefly - maybe something in there for you.

    If you just want to detect if something is active, you can ,however, just open the port. If it fails; "something" has it. Quick and dirty if that's all you need to know.

    The other way is as a proxy handler. Where, each end-point connects to ports in your software so you become the "man-in-the-middle". you can then pretty much do what you like with the streams form that point but you stipulate "without reading" so I guess that's out.

    Labview tries to alleviate the programmer from really low level stuff, so it's not surprising there is nothing "off-the-shelf". You are probably better off using wire-shark, logging to a file, then reading it in LV (I don't know if Wire-shark has an API or not).

  7. For me; 8.x was the worst (pick any version). I almost cried with joy when 2009 came out. biggrin.gif I've skipped 2010 altogether - far to slow loading dynamic VIs (which many of my designs use) and no real new features or improvements that I either want or use (maybe the cluster hiding, but that's about it). It''s only used for playing and downloading stuff from LAVA - nothing serious. If 2011 is a bug-fixed version of 2010, then unless it fixes the bugs relevant to me, then that probably will get skipped as well.

    I'm pleased that NI now have yearly releases with defined periodic bug fixes, because now I know not to even think about upgrading until SP1 is released laugh.gif

    Oh. And don't get me started on beta testing biggrin.gif

  8. And Shaun why are you activating modules manually? Does the activation wizard not work for you in Windows 7?

    Activation wizard works fine. Development machines don't have internet access, nor do they need it.thumbup1.gif We have separate (IT owned) machines for office work like internet browsing wink.gif

  9. You do realise that, in it's current format, this can never be certified ph34r.gif

    Incomplete or secure code will not be accepted: including code with locked diagrams, missing diagrams or password protection.

    I would suggest at least putting a warning in the description that the package does not contain any accessible source code as this is unusual for LAVA.

  10. I had been thinking this way for over 12 years ... since V5.. It has only been in the last 6 months or so LV has really rattled my perception of the universe. 2009 and 2010 have been the occasional poke-in-the-eye after another of quirks and workarounds and glitches and potential show-stopping nightmares. I've spent more time on the phone with NI tech support in the last 2 months than I have in the previous 12 years combined.

    Those were the days rolleyes.gif. When men were men, and sheep were worried. (and the known issues would fit on a cigarette packet beer_mug.gif) < wispy reminiscing emoticon>

  11. My libraries have something similar for trimming, but use the lexical class as an input.

    post-949-0-04034000-1296658805_thumb.png

    That's sweet. I like the idea of using the lexical class. How do you trim both ends? Use twice? You could use an enum to choose head/tail or both.

    The speed of my implementation derives from the fact you do both ends at the same time and you don't have to increment along the entire string. So the speed doesn't deteriorate with increasing string size (assuming the reverse string and array aren't a factor....which they don't seem to be).

    But it's a bit moot since we both have difficulty testing our implementations without resorting to ridiculous string sizes and/or improbable numbers of iterations. biggrin.gif But I love these sorts of little nuggets of re-inventing the wheel - only a little rounder and a little more grease.beer_mug.gif

  12. I am still working on this one Shaun. I am using XP. Address bar shows C:\Documents and Settings\C.Richter\My Pictures before I right click on it. When I right click the address bar, I do not see an option to " edit address" but I only see 'Cut, Copy,Paste, Delete, Show unicode control, Insert unicode control. I guess I am one step closer, as I tried using "C:\Documents and Settings\C.Richter\My Pictures\MARS1 and this time got Error 7.

    MARS1.jpg?

    You can right click and use "Copy" then click inside the path constant and press "CTRL V". It will paste the path into the constant.

  13. [Queue ShaunR]

    Thanks Priscilla biggrin.gif

    I'm a LabVIEW beginner and would like to know what you think about using LabVIEW to make real-time and parallel updates to a SQL Server database. I presently use a serial overnight process to update my SQL Server backend database using stored procedures, MS Access, and VBA. There are a few hundred steps and currently the only way to update the database is to run the update process sequentially from beginning to end for the entire database. Since this takes about 8 hours a day, I can only run it once a day. My initial impression is that LabVIEW might be a nice way to represent the dependencies in the data, but the number of processes might be overwhelming to look at graphically in LabVIEW. Thank you.

    I'm not really sure what you have in mind here. Maybe your current VBA application is sequential because the operations are indeed sequential (no point re-indexing a table before you delete a load of rows for example).

    I think generally speaking though, that any move away from VBA (and definitely away from Access wink.gif ) will have performance benefits with the caveat that there are not many interfaces to Access that would be more efficient than the interface between VBA and the DB (I assume your using VBA within Access). With databases, just running more threads of the same process doesn't equal better performance (a thread will stall if a table is locked by another thread), but moving away would enable you to optimise your queries and give you greater control over those functions that can be executed simultaneously.

    Perhaps a better short-term route might be to look at Visual Basic since you will be able to more easily port existing code (CopyPasta with Hacksauce) whilst being able to assess what functions can be realised asynchronously. In addition, you will be running compiled code rather than interpreted (I think VBA is interpreted at least) and you will be able to see more easily how and where the software is idling; waiting for the database to complete.

    Many people just go for a text file with the SQL and squirt the SQL direct using PassThrough to bypass JET. The VBA becomes little more than a file reading function with a for loop and to change the queries you don't have to write any VBA. I have heard of significant performance improvements just by doing that alone. Indeed, you could very easily write something similar in LV (very quickly) and see if you can achieve better performance by doing a side-by-side comparison with a section of the existing VBA code. After all. You don't want to commit to a technology change only to find 2 months later after re-implementing that it's just as bad wink.gif

    • Like 1
  14. Then how can i make the byte interface to the coming data. i want to get the data from USB which transfers some 8 bytes of data..

    The internal representation of a char (1 character of a string) is a byte. If you write the character "A" it s a byte of value 101 (decimal) or 41 (hex). So when you write A to the port you are in fact writing a byte of value $41.

    A string is an array of characters and therefore an array of bytes. So writing "ABC" you are actually write an array of bytes $41,$42,$43. You can easily convert to and from the representations by using using the "String To Byte Array" and "Byte Array To String" primitives in the string/array/path palette (under the strings palette). But you can only ever write read and write strings using the VISA functions;.

    Now.

    When you read (or write) "bytes" that are in the printable character range everything is fine. You will be able to type in values to string controls when writing and when you read it back you will see characters if you usea string indicator

    However.

    What if you want to write a hex byte of value 0?.

    Labview has a very easy way of doing this. If you right click on a string control (or indicator) you will see a menu option for "\" Codes Display and "Hex display. Setting the control/indicator to these will display the "string" in either the escaped format (e.g \00 \00) or in hex byte format (e.g 00 00). so unless you are going to do some function on the values of the bytes (like a CRC) then there is no need to convert and has the added bonus that you can use the string splitting functions to break up the data..

  15. I am seeking to open a jpeg file into labview 7.0. If I do not wire a file path, a dialog box appears for me to specify a file to read from. This works just as the user manual says it should. However if I wire my path to the VI

    Desktop/My Documents/My Pictures/Mars1 ,this message pops up; "error 1 occurred at File/Directory Info in Check Path.vi>Read JPEG File.vi>Open a jpeg file.vi" I do have a picture of mars stored at Desktop/My Documents/My Pictures. Open a jpeg file.vi Please show me where I went wrong.

    " Desktop/My Documents/My Pictures" isn't a real path. It's similar to a short-cut to a folder that changes with each user.

    To find what the real path is you can open "My Pictures" in explorer and right click on the address bar. Then choose. "Edit address". The address bar will then show you the absolute path which will be something like C:\Documents and Settings\user name\My Pictures (XP) or C:\users\user name\My Pictures (Win7/Vista).

    • Like 1
×
×
  • Create New...

Important Information

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