Jump to content

Mark Yedinak

Members
  • Posts

    429
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Mark Yedinak

  1. QUOTE (nicolasB @ Feb 19 2009, 04:02 PM)

    Hey Jim,

    sorry, I think it could be very easy to help you if you'd explain what you're trying to do.

    Please discribe your problem more precisely.

    regards,

    nicolas

    I agree. I am completely in the dark about what you are trying to do therefore I can't even begin to suggest a solution for you. With that said if you are trying to process your data in parallel you could use a queue or a notifier to pass the data from one task (the For loop) to another task (draw your graph). That essentially is the basic method for passing data out of a loop to be processed by another task.

  2. You will have to decode the body of the message. Most email application use MIME encoding. You will need to decode the MIME encoded data and extract the content of the attachment from that. Here are two examples (the separators "----- Label ----" are not part of the POP3 data.) of a message both with the same content however one was sent as plain text and the other as an attachment.

    --------Plain Text Message ----------

    Received: from 10.3.4.98 ([10.3.4.98]) by 03ctctestexch.ctc-zebra.test with Microsoft SMTPSVC(6.0.3790.1830);

    Thu, 19 Feb 2009 14:21:16 -0600

    To: lab_tester@ctc-zebra.test

    From: fubar@blegga.com

    Subject: Test (Send as plain text)

    Return-Path: fubar@blegga.com

    Message-ID: <03CTCTESTEXCH8wSA1X00000004@03ctctestexch.ctc-zebra.test>

    X-OriginalArrivalTime: 19 Feb 2009 20:21:16.0898 (UTC) FILETIME=[9E544C20:01C992CF]

    Date: 19 Feb 2009 14:21:16 -0600

    ^xa

    ^fo0, 0^a0,,20^fdUnderachievement -- The tallest blade of grass is

    the first to be cut by the lawnmower.^fs

    ^HCN

    ^xz

    .

    ------- End of message ---------

    ------- Attached data ----------

    Received: from 10.3.4.98 ([10.3.4.98]) by 03ctctestexch.ctc-zebra.test with Microsoft SMTPSVC(6.0.3790.1830);

    Thu, 19 Feb 2009 14:21:16 -0600

    MIME-Version: 1.0

    Content-Type: multipart/mixed; boundary="LabVIEW_SMTP_MIME_Boundary"

    Content-Transfer-Encoding: 7bit

    To: lab_tester@ctc-zebra.test

    From: fubar@blegga.com

    Subject: Test (Send as file attachment)

    Date: Thu, 19 Feb 2009 14:21:22 -0600

    Return-Path: fubar@blegga.com

    Message-ID: <03CTCTESTEXCHFRaqbC00000003@03ctctestexch.ctc-zebra.test>

    X-OriginalArrivalTime: 19 Feb 2009 20:21:16.0528 (UTC) FILETIME=[9E1BD700:01C992CF]

    --LabVIEW_SMTP_MIME_Boundary

    Content-Type: text/plain; charset="us-ascii"

    Content-Transfer-Encoding: quoted-printable

    --LabVIEW_SMTP_MIME_Boundary

    Content-Type: text/plain; name="supersmall.zpl"; charset="us-ascii"

    Content-Transfer-Encoding: quoted-printable

    Content-Disposition: attachment; filename="supersmall.zpl"

    ^xa

    ^fo0, 0^a0,,20^fdUnderachievement -- The tallest blade of grass is the f=

    irst to be cut by the lawnmower.^fs

    ^HCN

    ^xz

    --LabVIEW_SMTP_MIME_Boundary--

    .

    ------- End of message ---------

    I have also include the libraries that I use for POP3 messaging. I found these on the internet several years ago.

  3. QUOTE (jdunham @ Feb 19 2009, 11:17 AM)

    If it were me, I would implement a listbox with 1 element selected, and then you could edit the IP address of the selected listbox item in a separate control, and you could have a delete button, and you can show the checkmark symbols to show which ones are enabled. You have to code up all the handling yourself, but it should only take a half day or so.

    This was my thought as well. By doing this method you could read the list of fixtures from a file or a database and populate the list box with the appropriate data. You could also have different connection types for your fixtures if needed. Internally you have an array of clusters with all the necessary data. You could then pass the individual cluster of the desired fixture to whatever needs it.

  4. QUOTE (Ton @ Feb 17 2009, 03:39 PM)

    Here are the steps (LabVIEW isn't currently running).

    Use a string to numeric conversion VI:

    dectonum.gif

    With a I64 (or U64) as datatype.

    Now you have two options

    1.Use a Number to Hexadecimal string:

    numtohex.gif

    2.Display the 'number' and change it's representation to HEX.

    Ton

    This will work nicely provided he has 64 bit integers. Based on an earlier post of his he needed to do this on without 64 bit integers for numbers larger than 32 bit integers. That was the reason I was suggesting converting the string to a byte array and processing that. That solution will work for abitrarily large numbers.

  5. Use the same general approach that I used in the example I posted in your other thread but modify the algorithm. In this case you would only be working with a single array and you would need to work with two elements of the array at one time. You would also need to work with nibbles of data. Cycle through the array picking 16 bits of data at a time from the digits and then accumulate the new hex string. In this conversion you would not need to generate the intermediate byte array as you could go directly to the hexadecimal string.

  6. You should be careful changing the IP address of your PC programmatically. Is you are not careful this can cause you lots of networking headaches. If you are on an isolated, controlled and self contained network you could do this. If you are running on a large network, such as your company's network, I recommend you contact your IT staff regarding your IP addressing needs. Network addresses are managed for a reason. The last thing you want to do is create duplicate addresses on a network.

  7. Without using a different data type such as a double then your only real option is to handle 64 bit integers yourself. You would have to do this by using two 32 bit integers and creating your own methods for operating on those values. this would be a non-trivial exercise but if you must have them in integer format this is one of your only real alternatives. Much more memory intensive but possibly easier to work with and more extensible would be to store each digit of the number as an element of a byte array. Again, you have to create your own methods for operating on the numbers but they would be fairly straight forward to implement. Think back to your early days of learning math.

  8. QUOTE (Kubo @ Feb 13 2009, 03:12 PM)

    I am sure this is easy stuff, but its a friday and I am burned out.

    Okay I got down the sequence structures and how to initiate each step one at a time. But how would I be able to preform a step and make it pause there until a certain value is received... I opened up the examples for the event structures and tried reading the how to's... I got burned out. Maybe someone could help me out by pointing me in the right direction.

    This is based off my first question on here.... How to recieve a value when a pre-determined group of text is recieved in serial connection.

    I am going to be using a sequence in my state machine, when it is at that state it will start that sequence. That works fine, but I want it to pause at a frame till I get a true value from that string... when it gets that value, then proceed. Is there an easy way to do this? Will I have to dynamically register that event? (Thats the part I dont understand fully)

    Actually this functionality is part of your state machine. I am not sure how you implemented yours but I prefer to use queues for my state events. The state machine runs parallel to the while loop containing the event structure. The event structure handles my user interface events and can start or stop the state machine. The state machine itself contains the logic regarding the sequence of your processing as well as handling when certain things should occur or waiting for a specific data input. For instance, once started your state machine could initialize your hardware, then send some data followed by a wait for a response from the hardware. Once the response is read it would then go to the next step in the process. I suggest you include an error state and a general delay state in your state machine. That wait you could set a timeout value for your response and process the error in an appropriate manner. At the moment I don't have an example of a simple queued state machine. I am sure others might be able to provide one. If not I could probably put something together if you needed it.

  9. First I would recommend a more robust architecture for your application. It would benefit from a state machine as well as parallel tasks using queues or notifies to pass messages. With that said you need to read the serial port and compare the messages read using the various string functions. You could use regular expressions or more basic comparisons. Without any details on the types and format of the messages your device sends it is difficult to make anything more than very basic suggestions.

    Also, it is not necessary to reconfigure your Visa connection every loop iteration. This should really only be done once outside the loop. The loop should only be reading the serial port and taking the correct action when it sees the desired message.I also have to ask if you really want to read both ports within the same loop. Would your application be more robust and flexible if each port was handled individually or are they truly related to each other?

  10. I think the answer is more fundamental then that. What you need to do is validate your input prior to execution. In your example you would need to capture the start event (using an event structure is one possibility), then validate all of your input. If the input is valid start the execution. If not, display a message using a simple dialog box and return to waiting for the start message again.

  11. On a somewhat related topic do you know if it is possible for a subVI to inherit the background color of the calling VI? In my environment we reuse a large amount of our code and we have many general purpose VIs that are dialog boxes. Because we reuse our code I would like these dialog boxes to inherit the colors from the calling VI. The brute force method would be to get a reference to the calling VI and get it's color information and then set the colors for the subVI. This however may result in a flicker of the display (or we have to delay showing the FP until the colors are set). It would seem that an attribute allowing teh colors to be inherited would be convenient and useful. Is there such a thing?

  12. QUOTE (mesmith @ Feb 5 2009, 03:50 PM)

    I passed my CLD :D

    Lucky for me, Michael didn't get to grade my exam ;) - or maybe his advice kept me from making silly mistakes!

    Thanks to all for the feedback and help - LAVA is a great community.

    Mark

    Congrats! I took my exam at the end of last year and was notified last month that I passed. Now onto the CLA exam.

  13. QUOTE (mesmith @ Feb 5 2009, 01:00 PM)

    Mark,

    I'm gonna guess that you and I are working from the same paradigm where we see TCP/IP and client and we start thinking about servers and distributed apps and networks. But I think that this problem is just one of local instrument control where a Ethernet and a NIC can replace a GPIB cable and card. So this is like having to address four instruments that all have the same GPIB primary address that can't be changed (I know that doesn't make any sense, but then again I can't imagine an Ethernet-enabled instrument where the IP address can't be changed, but that's apparently the case) by addressing four separate GPIB controllers so the VISA string might look like

    GPIB0::2

    GPIB1::2

    and so on.

    But I'm extrapolating here, since we haven't heard back from jbhee on this!

    Mark

    Edit: also what Phillip said (he got that in before I posted)

    You might be write but I can't imagine anyone creating a networked device that isn't intended to sit on a real network. My entire professional career has been in the network world and the thought of duplicate IP addresses makes me cringe. You may be right and this is intended to be the equivalent of a hard wire replacement but I don't see the logic in anyone doing this. The beauty of a network is that you can place equipment anywhere and be able to communicate with it. Once you are on the network you should play by the rules. Anyway, that is the network guy in me talking.

  14. QUOTE (Phillip Brooks @ Feb 5 2009, 12:49 PM)

    This is a GUI application which needs to be able to be run from the command line. Essentially this is a tool that can be used by a person sitting down and interacting with it or it can be invoked automatically and run in a non-interactive mode. Since we need command lines arguments to support this functionality I would line to be able to print an error message back out to the command prompt if the command line arguments are incorrect. I suppose I could display a dialog box with the error message but it seems to be much more straightforward to simply print the message out to the command line.

  15. QUOTE (OlivierL @ Feb 5 2009, 11:45 AM)

    There is an easy way to open a TCP connection using the TCP interface of your choice. I can't find the code I wrote in the past using this technique but I'm 98% certain that this is right though:

    Use "VISA Open" and specify the Ressource Name to be: TCPIP SOCKET TCPIP[board]::host address::port::SOCKET TCP/IP Socket

    [board] allows you to select which interface you wish to use. You can then talk to the device using regular VISA VIs. For more information, look up "VISA Resource Name Control" in LabVIEW help files.

    Hope this helps.

    Olivier

    This is useful information but it is still a very bad idea to give the same IP address to all of the clients. This can cause some major problems on your network. Duplicate IP address can lead to routers and switches on the network having bad routes and can create data loops and circular routes within the network. Worst case this can bring a network down. If the IP addresses of these clients can be seen by network I would strongly recommend against using duplicate IP addresses. From a network perspective you are asking for trouble.

  16. How can I write data back out to standard out from a built application? I have a stand-alone executable that takes command line arguments and I want to be able to write an error message back out to standard out if the command line arguments are invalid. How can this be done?

  17. QUOTE (GraemeJ @ Feb 4 2009, 06:21 PM)

    Any suggestions on how this would used with a user interface which has

    multiple tab pages, and different controls and indicators on each page?

    Regards,

    GraemeJ.

    Within the single event structure you simply create event cases for each control or evnet you are interested in processing. This can be extended by using user events in addition to the standard events (value change, mouse up, mouse down, etc.).

  18. I generally use a single event structure for all of my user interface control. I use queues to communicate with the individual while loops which actually do the work. Remember, once you begin processing inside a case of an event structure no other event can be serviced until that one completes. Using multiple event structures complicates the control of your user interface and creates situations that you are seeing. A good practice is to have very minimal processing inside an event structure. Capture the event and trigger some other process (another while loop waiting on a queue or notifier) and then return to waiting for events. Off load your processing to separate parallel tasks rather than perform the processing inside of the event structure itself.

  19. QUOTE (bsvingen @ Feb 3 2009, 01:38 PM)

    With a bit of theoretical work, you can show that any programming paradigm is "perfect" for just about anything. This doesn't mean that a specialized programming language like LV is a general purpose language just because it uses dataflow. On the other hand, Java is indeed a general purpose object oriented language like C++, but Java is abselutely useless for making low level stuff like drivers for instance. I mean, programming paradigm is only one of several pieces that makes a language "tick" in the real world.

    I use LV for lots of things as well, but I have grown more and more sceptical using it for general purposes. The cost is one major issue. If you use it in the lab with equipment costing several millions, this cost is easely justfied. As a general purpose language, the cost is way too high, when looking at the alternatives which cost nothing (Java, C/C++ etc.)

    I think most people using LV as a general purpose language, started using it in the lab. Then they got more and more professional with it, and also started using it for other tasks as well (why use a month learning Qt and some more C++/Java when I can do this in one evening using LV? right?) This is all very fine, but sooner or later, if your code base develops, you will get into practical problems with license cost, portability, maintainability, not necessary for yourself but for others and for future development and certainly for future distribution. These are problems that naturally surfaces due to the fact that you are using a highly specialized proprietary programming language. You cannot even legally read the source without a valid license. For a general purpose language this is a big NO NO. These are real world problems that you simply cannot get around untill NI start licensing LV the same way Sun is licensing Java (which doesn't seem to happen any time soon).

    Anyway, I'm not saying "don't use LV". I think LV is excellent. But it is not a general purpose language, not in any stretch of the word. If you use it as a general purpose language, you should be aware that you could face unsolvable problems in the future.

    In general I agree with what you say however you are referring mainly to the licensing issues of the language, not the language itself. While the licensing issues are a major concern there is nothing in the G language itself that precludes it from being a general purpose language. As with any tool it can be said that it may not be the best language for a particular situation but this can be said about any programming language. Your example of Java is a prime example.

    If you look at my earlier posts I have been saying that I believe NI needs to address the issues that you raise so that LabVIEW can be positioned better to become a general purpose programming language. Currently we are basing our all of our automation efforts on LabVIEW. Many of the issues you raise are not as much of a concern because our automation efforts are all internal to the company. Licensing and distribution is more controlled in my environment.

    I choose LabVIEW for a number of reasons. I am a CS major and spent the first half of my career working with C, C++ and assembly working in realtime embedded systems. For me I find that I am much more productive in LabVIEW than any other language. This negates much of the cost issue. The additional cost for the license is easily recouped by the time it has saved me implementing something. LabVIEW is one environment that easliy migrates to the multicore environment and can take advantage of it with very little effort on my part. A standard C++ application will not be able to make that same transition without some significant development efforts. Many of the things built into LabVIEW don't come for free in other languages. But until NI does a better job at promoting and supporting LabVIEW as a general purpose programming language it will not be seen as one. I think this is the cruxt of this entire debate.

×
×
  • Create New...

Important Information

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