Jump to content

meocop

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Posts posted by meocop

  1. Absolutely! The question is clear, the asker has already tried some stuff, and provided an example - and look at the results! People have really tried to help out :) Maybe we should link to this thread from a FAQ - how to ask a question...

    Crelf, I don't know if you're being serious or not, but since I got chewed out by Mike for showing a messy VI, I've tried to ask simple questions and given clear examples. These simple things play big role in an application I am trying to develop. See, I write C++ and Java, so my boss thinks that I can write Labview and that's why I am assigned with some labview projects and not sent to any training course. So I appreciate any help I can get.

    Dan, sorry for falsely accusing your VI not working. But I still think the Enabling Index will work better for me if I can make it work.

    MC

  2. Try something like this

    Dan

    Thank you Dan, but I don't think your program works the way I want it. The max and min results did not look right because they were greater than 1. The RNG should give numbers between 0-1.

    Also I've written my program in such a way that using Enabling Index is the most simplest way and I like to make it work that way.

    Thank you.

    MC

  3. Admin Note: This is a great example of how to participate on the LAVA Forums! :thumbup:

    Crelf and Mike,

    What I want to do is to to take a bunch of data points on my N part and then a bunch of points on my S part, then calculate some statistical vaules such as max and min. So I used the Enabling Index concept and it seemed to work. However I kept getting 0 for the min and I am not sure why. Please help.

    Meo Cop

    Download File:post-4960-1161363802.vi

  4. I see Christopher has given you some help.

    I did have one idea you might like to know about. You can tag your North and South data when you collect it by clustering it with a boolean where N = 0 and S = 1. Then when you need it you unbundle the boolean to pick the case you want. You are not limited to booleans and only two potentials, you can bundle an enum with unlimited choices instead, and therefore unlimited case selections. Clustering is useful whenever you want two unlike but related pieces of information to travel together.

    Mike

    I think the concepts you need are Shift Registers and Enabling Indexing of loops. Take a look at the example attached. The Shift Registers allow you to watch the data build. Enabling indexing puts the same collection of data on the output border of the loop for display when the vi is stopped.

    Both functions are accessed by right clicking the loop border.

    I threw in an initalization sequence frame that runs as soon as the vi is started to clear the graphs and to reseet the stop button.

    Mike

    Thank you all for helping me. You guys are great!!!

    MeoCop

  5. Your graph will display data if you turn on autoscaling for the y axis.

    You haven't really stated the problem so I can understand it, the example code is a big mess with no effort made to document it, or make it neat for reading. Also, it sounds a like like school work. For those reasons I am not going to be very specific with my help. If you make it hard for us to even read the code or understand its goals then it is much less likely you will get useful advise.

    Please understand that good advise actually takes work to think up and present. You should be willing to work fairly hard in order to get hard work from us. If you have worked hard I can not tell. It just looks like a big sloppy mess. Sending us code is a good first step, but it needs to be quality work to the best of your ability. An extreme minimum of effort on your part is that we should not have to move icons around just to see where your wires go. Your code is unreadable.

    Consider this methodology:

    Take the problem one step at a time.

    First generate good data. And check the data before moving on to the next step. There is no point in trying to graph nonsense. You give no clues as to what the data should look like so I can't guess if it is the generation of it that is a problem or the display.

    I suggest you place probes or indicators much earlier in the dataflow so you can see if you are doing anything like what is needed. Or scrap the whole vi and start over with simples steps.

    Mike

    Mike,

    - You're absolutely right that my code is a mess and unreadable

    - You're wrong that this is school/course work

    Attached is a simplified version. Basically depending on the user input (N or S), I want to plot on the Norht or South graph. I have two analog signals, one used for x and one for y. I use 2 RG in their places in the code. Where I am stuck is in the False case, I don't know how to wire. Your help is appreciated.

    Meocop

    Download File:post-4960-1159988801.vi

  6. Hello,

    In my application, I have two xy graphs, one for the North and the other for the South. So depending on what the user input is (N or S), I want to plot the information on the correspondent graph. I used Match True/False string to capture the user input, then use a Case structure to pass my information to the correspondent graph. I does not work. Please see my attached VI and help!!!

    Download File:post-4960-1159977483.vi

  7. Just for completeness' sake, I'll add a slight variation on Mike's reply - perform the test for > 19, then feed that to the boolean terminal of a 'Select' primitive. This is the triangular-shaped node on the 'Comparison' palette which is the LV equivalent of the C syntax:

    s ? t : f

    Wire the shift register leftside to the 'f' input, your constant zero to the 't' input, and the output to the shift register rightside.

    Same result as the case structure, but a little more readable - you don't have to flip the case structure to see its alternate-case code.

    Hope this helps!

    Dave

    Mike and Dave, thank you. Both ways worked. It's great.

    MC

  8. I might not completely understand what exactly you're trying to do, but this is one way to check to see if a number has crossed a threshold. You can make it more complex by adding more shift registers and more logic.

    Gary

    Gary,

    Yeah I know that I did not explain clearly what I am trying to do here. But believe, your program helped me get my project done, at leat I am 90% sure at this point. I need to test it over and over to make sure there are no glitches. People on this website are awsome.

    Thanks Gary.

    MC

  9. MC,

    Your AT-MIO-16E-10 card is the MIO (Multiple Input/Output) card that is the heart of your data acqusition system. It has analog inputs, analog outputs, digital inputs/outputs, and counter timers. The AMUX 64T card is a multiplexer card that allows the AT-MIO-16E-10 card to read up to 64 separate analog channels, although at a slower maximum sampling rate. It has a temperature sensor on it in case some of those inputs are thermocouples and need temperature compensation. This is a link to the NI manual that covers this card.

    At this stage, it is somewhat difficult to help without more description of the measurement being made. I might suggest you try using the following example VI assuming you are running Labview 7.1 on the computer you are trying this on.

    post-2931-1150822605.jpg?width=400

    This will allow you to get a better handle on exactly what your voltage vs. time signal looks like, and may allow for some real engineering decisions based on the waveforms. If you get signals from this, you could do "Alt-PrtScn" and paste into Paint or some other program for posting here in the Forum. Without better insight as to the exact parameters of your signal (signal to noise ratios, charateristic time constants, average/min/max event frequency, etc.) it is extremely hard to predict what might do the job for you.

    -Pete Liiva

    Thanks again Pete. I know some more about my hardware. Well I thought of something and now turn my problem in to this: let say I want to compare two successive signals, and if the first signal is zero and the second signal is not zero, I'll increase my count by 1. Would you help modify my program? I am sweating over here as dealine is around the corner. I use a random number generator in place of my signal. Thanks in advance.

    Download File:post-4960-1150825099.vi

  10. MC,

    Most importantly, what do you expect the max count rate should be?

    Hardware wise, do you mean the AMUX 64T?. If I remember right, the AMUX 64T needs to be connected to a MIO card of some sort to operate. Which MIO card are you using? It ought to have counter/timers, which would be the ideal way to go. If there is alot of noise on the signal, you may need some signal conditioning.

    Are you in a position to be able to buy or assemble a breakout box to get at the various other outputs from your MIO card, or do you have a connecting block to hook directly to the MIO card?

    -Pete Liiva

    Pete,

    I think this is what I have: AMUX 64T hooked up to a SC2050 cable adapter board (these two boards sit in an electrical box), sort of acting like a enclosed connector block. I also have a ATMIO 16E10 board sitting in my computer.

    Regardless of the hardware though, I don't feel comfortable with using a timer because something can happen to my process that will throw the timer off. I am thinking about something like a gate switch or event trigger or something of that nature, but I don't have a good knowlege on any of those things. Thanks for trying to help Pete.

    MC

  11. MC,

    What is the hardware you are using for the Analog Input? And also, what is the maximum expected frequency of pulsing?

    One issue I see here is that assuming that if all goes according to schedule, instead of counting transitions, you are counting the number of samples you "catch" over the 4.03 Voltage level. If you have more than one sample above 4.03 Volts before the voltage drops, each of those will samples will cause a new "count" to accumulate.

    You may need to set up some way of telling your program to only count once when going above 4.03 Volts, and not to count again until falling below some value close to your low state (say 0.5 Volts or so).

    And your sample rate is "nominally" 20 Hz, but it depends on a software loop to remain as such. This can be dangerous depending what else might be going on in the background of a standard PC. Depending on what hardware you are using, there should be more robust sample timing options available.

    -Pete Liiva

    I have an old NI Amux 64I card. Yeah I am aware of all the problems you mentioned, but I don't know how to "tell my program to count once", to use your phrase. Using a timer does not work for me because my process is not stable ( I mentioned above that the cycle duration is not constant). Using a comparator (greater or less than a certain value) does not work either because my signal fluctuates a bit. Can you tell me how to count just once per cycle?

    Thank you.

    MC

  12. Hello,

    This is sort of a follow up question to my previous post "Keeping Count". Thanks for your help, I now know how to use shift registers to keep count. I am running into a bit of a problem with a real application here at work. I have a pulsing voltage signal that goes from 0 to roughly 4.5 volt and goes back to zero, counting as a cycle. For each cycle the peak is not constant, nor is the duration of the cycle. What else do I need to do to count the cycles when timer and comparators don't do the job??

    Thx,

    MC

  13. In the "false" case, simply wire the input to the output as a pass-through. Then it won't reset anymore and you'll have the monotonically increasing value you expect. You shouldn't have selected "use default if unwired" option of the output tunnel from your case structure -- in fact, I would personally recommend against using it in general, as it tends to hide the data flow (as well as errors.)

    Cheers,

    Guillaume Lessard

    Great, great tip Guillaume. I appreciate it.

    MC

    Are you using the continuous run button? If so, the counter is reset to zero each time you press the stop button.

    I've attached a modified version of your vi (LabVIEW 8.0).

    I made the following changes;

    Used a Select operator from the comparison palette instead of a true/false case statement. This makes the code generally easier to read.

    Changed the while loop's conditional terminal to stop on true. (stop sign in lower right corner; right click to change)

    Changed the mechanical action for the Stop button on your front panel to latch on release.

    Changed the value for the Less? comparison operator to 0.5, as you indicated in your original post.

    post-949-1150195711.gif?width=400

    Download File:post-949-1150195544.vi

    :thumbup: Great job! You might want to explore the comparison palette a bit more. Press <CTRL-H> to turn on the context help and you will see some basic info on the different operators.

    Thank you for your help as well Phillip. I got most of what you said except the "reset to zero each time pressing the stop button". With your program, the counter is still reset to zero each time I stop and start, is it not?

    MC

  14. You got the first part and most of the second part.

    It seems like the shift register is precisely what you need. Use it to keep track of a value from one iteration to the next. Currently you always add one to zero; with a shift register you would increment a value that has potentially been incremented at previous iterations. Sounds more useful to me...

    Guillaume Lessard

    Thanks Guillaume. The problem is I'm not quite sure how to use the shift register with my Case Loop.

    MC

    Thanks Guillaume. The problem is I'm not quite sure how to use the shift register with my Case Loop.

    MC

    Well, I changed my code a bit but it's working better, but not totally right. It's resetting my Count to 0 when the comparitor is false. I don't want it to that. What changes do I need to make here?

    MC

    Download File:post-4960-1150153978.vi

  15. MC,

    You are not far from the basic premise of what you are trying to do...

    1. To get your loop to run for more than 1 iteration right-click on the boolean (wired to the stop indicator) and select "change to control". Now when you run the program the loop will iterate until the control is pressed to True.

    2. Instead of casing out the data value itself, I would recommned incorporating the file write operation into the case structure. This way the file will only be written when the boolean is ON (True). This should get you started.

    3. Might I also suggest adding a small loop delay to control how fast your loop iterates (slow it down to allow your PC to handle other processes).

    Hope this helps...

    ES

    That's awsome. It worked now. Thanks for your help ES.

    MC

  16. Hello,

    I am trying to write selective data to a file. By "selective", I mean I want the users to turn a on/off switch to only save the data that they like. So I figured if I put my data through a Case loop and wire an On/Off button to it, that will do the trick. Attached is my vi. I have two problems with it.

    1. Some how, even I put everything in a while loop, the execution stops after 1 iteration. Can anyone help explain?

    2. For my Case loop, I hope that the False case would not give any data, but that's not the case. False case gives "0". Is there a better way to do this?

    Your respons is much appreciated.

    MC

    Download File:post-4960-1148504903.vi

  17. Thanks. Can you be more specific by giving detail instructions or examples? I appreciate your help.

    MC

    I found a solution. I used Express XY graph instead of XY graph. Express XY graph gives me an option of "Not clearing previous data" whereas XY graph does not.

    Thanks for looking into this guys. I am sure I'll have more questions in the future.

    MC

  18. I think you are looking for a "chart" instead of a "graph". The chart holds a history of the data. So just feed in the new datapoint and it will be inserted on the right by shifting the rest to left. Set chart history length (rmb) and x-axis scale to your needs. Unfortunately it doesn't exist as xy-graph (x-axis is always time or a monoton growing number).

    oh, almost forgot: you'll have to insert the limits as point each time you insert a data point, or they are also shifted left outside view.

    Thanks. Can you be more specific by giving detail instructions or examples? I appreciate your help.

    MC

  19. Try this.

    Thanks. But that's not exactly what I try to do. On my front panel I have a number controller and my application requires the user to click on the number controller to provide the location (1, 2, 3) and each location will have a voltage reading. Thus, I cannot use a For Loop.

    MC

  20. Hi all,

    Thanks in advance for any of your advice.

    I am trying to do a very simple task. I want to display a voltage signal (corresponds to some quality parameter I need to monitor) on a XY graph. I need to display a static upper control limit and lower control limit and a moving, real-time value with the user supply the location (x axis). In my attached program I used a random number generator in place of the voltage signal. The problem I have is I can only display one point at a time. What do I need to do to display the last twelve data points? I have tried many different ways (using loops, array etc.) but to no avail. Please help.

    MC

    Download File:post-4960-1148421910.vi

×
×
  • Create New...

Important Information

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