Jump to content

EJW

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

Posts posted by EJW

  1. So I hooked 'er back up to the scope, and it seems almost perfect! I can now get timing very accurate to the ms, however, the off time always seems to be twice as long as what is entered on the front panel. This can be seen by entering 1000 for both values. When doing this, the light is on for 1 second, but off for 2.

    I will investigate this further, and hopefully find the problem.

    P.S. Dividing the Off time by 2 before putting it into the start frame does not solve the problem.

    So it turns out that the Off Time has to be wired directly into the Start of the next frame, and not added to the Actual Start of the sequence. Strange, as I thought since the first frame started at say 1000, that you would want the start of the next frame to be at 2000. But I guess the Start option for the right data node is relative to the previous frame.

    This maybe due to the timer resetting itself. try changing the off value to 0 and see if this works. if it does, you can either leave it like that, or we can go the messier route of using shift registers to carry around the current timer value.

  2. There must be someone out there who has used precise LabView timing (w/o using RealTime). I have access to timing signals from DAQmx cards if that helps.

    Thanks

    Unfortunately the computer clock can't always be counted on, but i modified your vi so that it should work for you now.

    If it looks like it slows down or speeds up, that is just your system's ability to keep up, it may actually be running properly, but

    the screen updates happen too slow.

    but i modified your vi so that it should work for you now.

    By the way, i forgot to mention that i changed the clock from 1KHz to 1KHz®, which resets for every iteration. you could use a shift register and the output node to get the second frame's ending time and add that to the off time and keep looping that into the 't0", but that gets messy and it is possible for the timed loop to get farther ahead while your doing the math and then it misses.

    I also removed your extra local variable and have your high (T) wired directly to the terminal for the indicator. Minimize the use of variables to keep memory/processor overhead down.

    Hope all this helps. Good Luck!!! :D

    Download File:post-3482-1166042884.vi

  3. Hi!

    I've studied the simple serial communication examples in LabVIEW and knows how to set up and close a connection.

    But how do I take the next step? What is good programming practice when developing a routine for serial communication?

    My application is about streaming data via RS232, and I would appreciate references for further development

    /Bjarke

    It will mainly depend on what type of data you are streaming and what you are streaming from. Many serial devices have their own way of sending data and you need to know how to decode the data as it is received. After you have determined what type of data it is sending you and how to properly decode it, you can then build an appropriate program around it. :book:

  4. Or, you can not use a Global Variable and thereby not pick up an extremely nasty habit. Global Variables are easy to write and painful to debug, especially if anything starts happening in parallel. Stretching just a bit for a slightly harder solution (functional globals, events, queues) will help you a lot when it is time to debug the problem.

    Nothing wrong with a global variable if you are using it as a read only variable AFTER initialization where you write to it once!

    Even a global used for data read from a daq device is no problem. You write to the global as the output from the daq read and read from

    it during processing.

    Properly used, globals can be very useful. :2cents:

  5. ... but I'd prefer to have them on a single user interface.

    If you want to use a control that has a front panel multiple times within one vi, the only way i know of is to use the subpanel control. This is accessed from the front panel controls- modern - containers - subpanel. This allows you to show multiple vi front panels. You need one subpanel for each instance.

    Otherwise, the ideal thing to do, would be to create your front panel controls on one vi and use a subvi of your timed loop multiple times on your block diagram.

  6. Keep in mind that you must have all your typedef instances in memory for this technique to work.

    The short answer to why this is not a bug is:

    • Typedefs only update on type changes.
    • Strict typedefs update on all changes (including cosmetic modifications)
    • Ring text is not part of the data type. Enum text is.
    • There no such thing a strict typedef on the diagram.*

    Now, being a usability advocate, I'm going to argue that "working as designed" doesn't mean it's right. The LabVIEW team has been struggling with how to fix this problem.

    Would anyone be opposed if we changed it so that constants that are linked to strict typedefs update on all changes, the way front panel instances do?

    The downside is that you have no control over what a constant from a typedef looks like. So, for example, if you create a constant from a strict typedef cluster and then resize the constant, whenever the constant updates you lose your resizing.

    - Christina, LabVIEW R&D

    * - The reason constants of strict typedefs are demoted to non-strict typedefs is because "strictness" generally applies only to cosmetic attributes which are meaningless on the diagram. I think the use case for rings was not fully considered, and that's part of why we're considering changing it.

    Christina, if you check support reference #7122877, i had a similar issue, which was resolved with the release of 8.2

    ---- they had considered it a severe bug at the time and corrected it in time for 8.2 shipment.

  7. Attached is a simple project where i try to create a DLL with a 2D array as an input.

    When I try to build the DLL and define the prototype, the builder does not seem to recognize a 2D array as an array.

    Consequently, if you try to build a test vi and define the prototype manually (using Call Library Function Node), it

    really does not like it, (crashes)

    The problem appears to be in the builder itself, as it is not recognizing a 2D array.

    Anyone with any thoughts to this please respond.

    Download File:post-3482-1164909520.zip

  8. Your consumer loop (bottom) waits on a notifier; default is -1 (wait forever).

    Your top loop has a timeout of 100 ms, and sends a Timeout notifier every 100 ms. :blink: You don't need to send a timeout unless the bottom loop needs to perform some periodic action; it will just "wait forever". That's the nice thing about user events, no polling or no-op type loops!

    You should consider using typdefs for your enums; if you add or rename a case later on, you would have to edit all the enum constants in all the different cases on your block diagram(yuck!). I usually name the typdef control to match the vi name..

    Looks good! :thumbup:

    Actually, in the real program, there is a multiple channel/single point data acquisition ocurring, and monitoring of a DIO card during the timeout state.

    The various steps (1-4) would coincide with my finite data acquisition (approx 5000 samples per each of 8 channels - 40K total), followed by a process , status, update, and output state, then back to the timeout state providing there wasnt an error generated which is then handled by the error state first. I was using the timeout on the event structure to trigger the timeout state and still allow full UI functionality.

  9. Download File:post-3482-1157995331.vi

    Hi,

    take a look at

    http://www.vi-lib.com/user.lib/OpenFileDialogBox.html

    this worked for me

    Good luck,

    TNT

    EDIT: the only problem I have is that I want to pass the owner to the dialogbox,

    because otherwise the vi could appear on top of the dialogbox and not always on top...

    This means a labview windowhandle is needed of the type Iwin32window (.NET)

    and I haven't figured out yet how to accomplish this

    I used the code at the above URL to make a VI using .NET that allows for inputs of

    Initial Directory, Filters, FilterIndex and Multiselect options (of course Error In)

    The outputs consist of an array of filenames and the dialog status (OK or Cancel) and Error Out.

    Hopefully this will be useful to you. You can change the default All Files to Text Files easily enough.

    The VI is attached.

    Eric

  10. Yes it's about 8.2. When I put *.txt in the Pattern terminal the *.txt is added but *.* is still there as other pattern.

    Dany

    Unfortunately this is typical behavior of a file dialog box in Windows.

    Labview appears to only access the standard file dialog. When using things

    such as the Visual Studio environments, the "All Files" can be removed as you

    have access to more lower level functions.

  11. Look in the Advanced File Functions pallete, you should see "Seek". Pass in your file refnum along with your position before performing a write, using the same refnum. To avoid race conditions, be sure to wire the Seek refnum out and error out cluster from Seek to the Write...

    (I'm at home today, and I'm not sure if the primatives for the file I/O palletes have changed with 8.0 / 8.20.)

    post-949-1157035922.gif?width=400

    Look in the Advanced File Functions pallete, you should see "Seek". Pass in your file refnum along with your position before performing a write, using the same refnum. To avoid race conditions, be sure to wire the Seek refnum out and error out cluster from Seek to the Write...

    (I'm at home today, and I'm not sure if the primatives for the file I/O palletes have changed with 8.0 / 8.20.)

    post-949-1157035922.gif?width=400

    I tried that in Labview 7.1 and it does not seem to work with records. (Its says it does.) I am trying to do this in 8.0.1

    which says the offset is in bytes only ( i guess i could try records, but i doubt it works).

    BTW, in Labview 8, SEEK has been changed to SET FILE POSITION.

  12. I have been looking for a way to use random access files in labview. The closest thing i have seen is the datalog files, which are not completely what i am looking for. The datalog files can randomly read, but they only append to the end of the file. What i need is a way to read/write randomly to a specific location/record in a file. If i want to update record 15 with new information, i don't want to have to rewrite the whole file!!

    Any help is greatly appreciated.

    Eric

  13. Does anyone have a clue how to set up a syntax checker.

    Here is the issue: I have an input form for a user that includes a string control where they can type in a formula.

    There are 6 variables allowed, the parentheses (), and the boolean operators "AND" and "OR".

    I want to somehow be able to check to make sure there are no errors in the formula, for example, a missing parenthesis,

    or a misspelled variable.

    A formula like this : (VARIABLEA AND VARIABLEC OR VARIABLE B would be incorrect because the ")" is missing after

    "VARIABLEC"

    Please HELP!

×
×
  • Create New...

Important Information

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