Case structure içerisinde While döngüsü kullanma problemi ??

Herkese merhabalar... Sorunum şu şekilde; 
Case structure ın kontrolü bir text kontrol (menu ring) tarafından yapılmakta. Bu kontrol isimleri sırasıyla 1-%25 PWM, 2-%50PWM. 1. durumda text kontrol den case structure'a 0 değeri gönderilmekte, 2. durumda ise 1 değeri gönderilmektedir. 0 gönderildiğinde case structure içinde bir while döngüsü elektronik röleyi %25 PWM ile çalıştırmakta, 1 değerinde ise yine while döngüsü içerisinde bulunan aynı röleyi %50 pwm ile çalıştrmakta. Sorunda bu aşamada başlıyor. Ben text kontrolden tercihi değiştirdiğimde, yani 0 dan 1 e yada 1 den 0 getirdiğimde kontrol bu değişikliği yapmıyor. Fakat while döngüsü kullanmadığımda bu istenen değişiklik doğrultusunda case structure içindeki istenen görevler yapılıyor. Sebebini anlayamadım. Yardımcı olursanız çok sevinirim... Kolay gelsin....
Metin

Merhabalar,
Menu ring değiştiğinde while loop'a giriyor ve tabiki bu while loop sonlanana dek siz menü ring'i değiştirseniz bile çalışmayacaktır. Çünkü hala ilgili while loop çalışmakta ve bu loop'dan çıkmadığı için menü ring'i değiştirseniz bile çalışmayacaktır. Menü ring'i değiştirmeden önce bir şekilde çalışan while-loop'u durdurmanız gerekmektedir.
Saygılarımla...
Himmet GENCER
Software Development Coordinator at Teknik Destek Grubu
[email protected]

Similar Messages

  • How do i output multiple arrays from a case structure to create one larger array

    I currently have a vi that has one hardware input that i needed to take a measurement then be moved and take a similar measurement at a different point.  To accomplish this i used a while loop inside a case structure.  The while loop takes the measurement  and finds the numbers i need while the case structure is changed per the new measurement location.  I want to take the data points i have created in each case and output them into a single table.  I assumed to do this the best way would be to get the data from each case into its own built array and build a larger array but I cant get the information out of the case structure so that it all inputs at different places.
    thanks for your help
    Attachments:
    Array.vi ‏30 KB

    Hi Ross,
    attached you will find a solution for your table building problem.
    I would suggest thinking about program design - having the same case content in several cases doesn't make sense. I also would not want my user to press several stop buttons depending on choosen measurement...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    Array.vi ‏45 KB

  • Case structure back and forth from LED

    Hello, I'm trying to make a case structure switch back and forth everytime a boolean LED indicator goes off. I want case one to start when a button is pushed, switch to case two when an LED indicator goes on, then switch back to case one when that same LED goes on again, then case two the next time the light goes on, and so on. The LED is set to go on every ten seconds. So far i have the case structure in a while loop but im not sure how to get them to switch back and forth using this one LED. Any suggestions?

    Then you have two asynchronous parallel loops, and you want one of them to receive information (Boolean) from the other in order to determine its state.
    If the loop with the elapsed time contains nothing but elapsed time, then consider moving it to the first loop.
    Otherwise, you should use a form of synchronization communication, such as a Notifier or User Event, to send data from your loop with the elapsed time to your loop with the case structure.

  • Tunnel mode: indexing with a case structure

    Hello,
    I have a code like the one  attached to this message.
    I have a case structure in a while loop, and I would like to transfere some data from my case structure to outside the while loop in indexing mode tunnel.
    This is to accumulate results (or to save results) following each iteration.
    My problem:
    I dont want any value in the False case of the case !!
    How can I get rid of that? I do not want to use default value for unwired case and I dont want 0. 
    Many thanks 
    Attachments:
    Untitled 1.vi ‏9 KB

    Your VI is saved in LabVIEW 2014.  So you should have this.  Right-click on the output tunnel of the loop.  There is a tunnel mode->conditional.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Conditional Indexing Tunnel.png ‏7 KB

  • Execute Case Structure with Button Press Slows Down VI

    Hi -
    I'm fairly new to LabView, and I am having some issues with using a button to run a timed while loop.
    I am writing a VI that outputs a timed voltage pulse to an output channel on a DAQ; meanwhile, the VI reads and graphs the voltage on three input channels on the DAQ. When I use a timed loop that automatically executes when the VI runs, the program works. However, I would like to include a button so I can control the timing and number of voltage pulses sent to the output channel, instead of sending only one voltage pulse each time the VI runs. I have tried to do this using a button wired to a case structure. If the button is 'true,' the VI should send the voltage pulse. If the button is 'false,' the VI should keep the voltage at zero.
    When the button is 'false,' the VI runs normally; however, when the button changes to 'true,' the VI slows down and never sends the pulse. Why does this happen? How can I fix it?
    Also, how can I send the voltage pulse only when the value of the button changes?  I only want the timed loop to execute once when the button changes value.
    Thanks for any help or advice!!!
    Attachments:
    Sensor Read6.vi ‏85 KB

    The graph is in the same while loop as the case structure.  The while loop won't iterate until all the code inside of it has completed.  So the graph only gets updated once, and won't update again until the while loop iterates again.  If you need more continual updating you may want to put that in a loop that executes a couple of times, or completely separate your code into 2 while loops.  Is it that long of a wait considering your pulse length is 1 second?
    Your analog output code is just writing a voltage out (7 volts) until it eventually writes out 0 volts.  There is no reason for it to drop down unless you have some sort of electrical problem between your DAQ device and the device on the other end that is reading the 7 volts.  What are you connecting that analog output too?
    What if you don't use LabVIEW and try to test out that analog output using Measurement and Automation Explorer?  Does it do the same thing?

  • Case structure connection

    hi all
    I am trying to connect a wire from the inside of a case structure to another while loop. but it shows as you can see in the attached picture .(unwired)  how can i solve that please /?
    Bill David
    Attachments:
    Capture.PNG ‏3 KB

    Bildavid wrote:
    Thank you
    Also remember that the LabVIEW compiler is very good at explaining code problems. For example if you get a broken run arrow because of this problem and click the run arrow anyway, it will tell you the following:
    Tunnel: Missing assignment to tunnel
    Details: The Case or Event structure does not have anything wired to the output tunnel in one or more cases. Since only one frame of the structure is executed, every frame must assign values to all the outputs.  Right-click the tunnel and select Use Default If Unwired to relax this requirement.
    All clear?
    LabVIEW Champion . Do more with less code and in less time .

  • Execute case structure only once

    Hi everybody.
    I want to execute a case structure inside a while loop only once. The case strucutre is controlled by a counter, so that every time the counter has a value multiple of N, the program records an acoustic signal and calculate the main peaks of the FFT. The problem I have at the moment is that, every time the case is executed, it records and analyze the sound several times until the counter jumps to the next value. I want the case to execute only once every time the counter has a value multiple of N. I atttach the vi.
    Thank you for your attention guys!!!
    Attachments:
    Pulsations2.vi ‏243 KB

    GERD is right.  You should use a feedback node to store the previous count value.  If the current count is Not Equal AND the remainder is Equal To Zero run your case.
    Since your counts are all integers, I would also recommend changing the representation to an integer type.  I32 would likely be the most appropriate.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Combine 4 stops for 4 case structure

    Hello everyone!!
    I meet a problem in my project, I knwo it's not difficult but we are all beginners for labview.
    We need to control 4 batteries, each battery needs a life cycle calculator. I try to connect 4 life cycle calculator(case structure) in my while loop, but there are 4 stops for 4 case structure and 1 stop button for the whole while loop....I don't know how to handle with these four extra case structure stop buttons....
    As the battery charging and discharging, the life cycle part keep working so actually it's no need for stop button for each case structure , can we just get rid off the stop button for each case structure?? Is there any problem with the life cycle calculator if we do not use the stop button???
    Really Thank you for help !!!!
    here I attach our vi, you can configure it directly !!
    Attachments:
    PR2.vi ‏78 KB

    The main problem is code architecture. Once you fix this, your current problem will vanish automatically.
    You seem to be spending way too much time rewriting basically the same code over and over. You need to modularize the code and make it scalable. You have four instances of basically the same code. Are you planning to later scale this up for a few hiundred batteries? Would you then simply make it a diagram that is millions of pixels hight? Once you combine all the functionality for one battery into scalable code, you can scale it up for an arbitrary number of instances.
    Same for the front panel. Make the controls for one battery into a cluster and then make a 2D array of such cluster (2x2 in your case). Suddenly, the entire code will be the size of a postage stamp and easy to maintain. If you currently want to change an error in the algorithm, you need to make identical changes in four different places. If you forget one place, bugs will be very had to find.
    LabVIEW Champion . Do more with less code and in less time .

  • Execute case structure a certain number of times within a while loop

    Hi guys,
    I was wondering if it was possible to execute a case structure a specified number of times within a while loop. Basically I'm running a camera where each iteration of the outer while loop displays a frame of a live video feed and I'd like to capture the next x amount of frames (specified by the user) each time the 'Start Capture' button is clicked. The block diagram within the case structure captures and saves an image frame. As the program is written right now, frames will continue to be captured until the 'Start Capture' button is clicked again. Instead of having to click the button again to stop the case structure from executing for each iteration of the while loop, I'd like it to only execute for the next x iterations of the while loop. Any help would be appreciated. Thanks.

    Hello Uxorious,
    A while loop has a iteration counter that gives an integer value of how many times the loop has iterated. You can utilise this to count the number of frames captured. I assume that the program could be running for any amount of time before clicking start capture, if that is the case then you will need to be able to detect when you have clicked the button and add the desired number of frames you wish to capture to the current loop iteration.
    If you use a shift register on the outer loop with the start capture button connected to it (inside the loop) you will be able to compare its current value to its previous value. If it changes from false to true then you can add the desired number of frames to it to give you the loop iteration value where you need to stop.
    Then you can compare the current loop iteration value to that number and once reached, you can use a property node to change the value of your start capture button back to false.
    One final thing, don't forget to initialise the shift register I suggested to false so that you don't run the risk of missing the first time you press the button.
    I hope that makes sense.
    Alistair
    Best regards,
    Ali Bailey
    National Instruments
    Don't forget to Kudos useful posts!

  • Control does not stay in case structure while using motion VIs

    Hi,
    I have a motion control card PCI 7344 connected to my PC. I am able to control the motor at the required speed till the required position using an encoder. Now I have put my motion control VIs in a case structure in such a way that, if Case1 is selected then the motor should to position P at speed S, if case 2 is selected then the motor should move to position Q at speed S and if case3 is selected then the motor should to position R at speed S. I am selecting cases 1,2,3 etc. by scanning a set of numbers seperated by spaces which look like this,
    1 2 5 7 3
    This number scanning is done using a while loop. Now, when the first number is scanned in the above set of numbers. The number 1 is obtained and the control is switched to case1. But before the motor reaches position P, the control switches to case2 and before completing the execution, the program scans case5 and so on. That means that the control does not stay till the move in the case 1 is completed. I'm sure there must be a way to retain the control to a case and stop the next number to be scanned before the functions in the particular are completely executed. I thought of one method, i.e. by using the move complete VI provided in LabVIEW, but I could not implement it. Please help me out with this.
    Regards,
    Giridhar Rajan
    Automation Engineer,
    Cruiser Controls,
    Mumbai, India

    Hi,
    Our motion controllers allow you to preemptively start a move in the middle of a current move.  For example if you are moving from point A to B and based on some logic, you determine you need to immediately start moving to point C.  A preemptive move allows you to just load the new target position and call start.  You do NOT have to first stop the current move and then start the new move.
    In your case, you want the first move to complete before the second move starts.  There are two ways to handle this.  First, wait for the move to complete via a Wait For Move Complete function/VI call, or use the Check For Move Complete function/VI in a loop.  Second, use Blend Start instead of the regular start.  A Blend Start (if blend factor is set to 0) waits for the first move to complete before the second move starts. 
    Check out the help topics for Start Motion and Blend Motion to learn more.
    Thanks,
    Rodger S.

  • Counting only once when a case structure is true in a while loop

    Hi. First time posting here so do pardon me. I have tried searching for answers in the forums along with attempting the solution myself but to no avail.
    Here is the problem. I am trying to collect voltage signals via the DAQ assistant. When a certain threshold voltage is reached, the "true" case would run. I am currently using the shift register along with the while loop hence the output number "numerical 2" would increase as the while loop runs. However, I only want to register a single case as long the voltage is above is above the threshold.
    Eg. When the voltage is above 3V for some time, it registers only a 1. Then the voltage might dip below 3V. The next time the voltage is above 3V again it would register a 2. So on and so forth. I have attached an image of my block diagram below. Thanks for the help!
    Solved!
    Go to Solution.

    Keep the status of the threshold reached in a shift register.  Perform an AND with the inverse of the value in the shift register and your new threshold detection.  The result of the AND goes into your case structure.
    EDIT:  I just threw together this example.  I used a Feedback Node since it would be cleaner.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Threshold Count.png ‏12 KB

  • Why won't my charts continuall​y update while running a case structure?

    I'm making a VI to drive an actuator and read a force on a load cell.  I have programmed the actuator to run through a flat sequence using millisecond timers to delay its drives outward and inward, which is necessary for its intended use.  However, my goal is to have it display the motor position and the force on the load cell on the charts continuously throughout the test.  However, when activating the case structure containing the test sequence, the graph fails to update live. 
    I'm not sure if I'm on the right track, but I have posed my file for whomever is interested.  I hope you can lead me in the right direction, and thank you very much.
    Keith Blume
    Attachments:
    Final VI.vi ‏303 KB

    johnsold wrote:
    You can find the version of a VI you have downloaded (as long as you have not saved it) by closing the window.
    Well, closing the window is a bit drastic.
    Simply go to VI-properties (e.g. by right-clicking the icon in the upper right) and do: "General...list unsaved changes"
    Message Edited by altenbach on 12-16-2008 08:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Version.png ‏31 KB

  • Calculate maximum value of subarray while creating it using a case structure and shift registers

    I have two 1D arrays that contain cyclical information (kind of like a sine wave).  One that contains information on position in degrees and another that contains torque.  I would like to calculate the maximum torque value each time the position is within a certain range (e.g. from 30-80 degrees).  The ranges are repeated - that's why it is cyclical.   I use the "in range" function, a case structure and shift registers to build a new array with values that fall within the range I specify - this was the easy part (see VI attached).  I'm struggling with a way to calculate a maximum value for each subarray formed when values are "in range".   Your help is much appreciated.
    Solved!
    Go to Solution.
    Attachments:
    Simple Calculate between anatomical position range.vi ‏16 KB

    It's not really noise - it's more inconsistency.  So a position output can run: 20, 30, 40, 50, 60 etc.  OR, it could run: 21, 24, 32, 41, 44, 51, 59 etc. But, it is always cyclical. 
    Attached you will find a .csv file with the data arrays - I'm using POS (ANAT) degrees column (column D if you open in excel).  There you also see torque in ft-lbs along with some other information.
    Attachments:
    025C.csv ‏224 KB

  • How can I pass data generated in a SubVI inside a Case Structure out of the Case Structure?

    Hello,
    I am using a USB 2701 to control a heater.  I have three SubVIs that are all working properly on their own.  I'd like to use an Enum to select which of the SubVIs is running at a given time.  The problem is that no data is passing out of the case structure.  How can I pass the temperatures and heater outputs acquired by the SubVIs to the main VI?  I've attached my some of my code below.  I can't attach more than 3 files, but you can see how the main VI is configured.  Like I said, the SubVIs are working individually, so you shouldn't really need to look at them.
    Thank you,
    CJones581
    Attachments:
    RampHeater6-21-07.vi ‏305 KB
    69_Heater_Case.vi ‏23 KB
    HeaterTCD6-21-07.vi ‏210 KB

    CJones,
    You might check a couple of things.
    Your HeaterTCD... VI has a While loop with a stop button condition.  HeaterTCD pass out values only when it finishes running.  If it doesn't pop open the front panel (which usually doesn't happen when running a SubVI) you could run into a stuck loop because you don't have access to the Stop button.  This could appear in the form of no data being passed out (because the SubVI never stops running).  The primary VI opens the HeaterTCD VI, starts it, and waits for the VI to finish and pass final values .
    Secondary note: Unless you want your SubVI panel (which probably isn't open when running the main VI) to update continuously, consider moving your Temperature Graph and Temperature oC indicators outside the while loop.  Pass final values to them via a tunnel, since the main VI will only read their values after the loop finishes running, anyway.
    It might help to add error management to HeaterTCD like you have for RampHeater.  If you connect error lines with Error Outs to your main VI, that will help tell if there is an error somewhere that is preventing info output.
    RampHeater SubVI has the same issue with the stop button.  It is also probably getting stuck in the While loop waiting for a manual push of that SubVI's Stop button.
    An easy way to test this would be to set up a logic circuit so that when the While loop iteration counter reaches a certain number, it registers True and sends it to the conditional.  I know this isn't what you want to do long-term, but if that lets your SubVI return outputs it means that the SubVI was just never stopping.
    Hope that helps.
    David C, Applications Engineering
    David C
    Applications Engineering

  • Run only once in case structure

    Hello,
    I have a menu set up that is wired to a case structure.  Of course the menu is some boolean buttons that are set to switch when pressed so the case will stay open as long as the button is true.
    inside that case I have another menu and a case structure that operates the same.  In one of these cases I have a piece of code that I only want to run once.  I have tried the while loop that runs once and a for loop that only runs once, but the section of code seems to run continuosly instead of just once.  It works ok if I use any of the latch functions but not the switch when pressed functions.  However, I need the button to stay pressed until the user is finished with that case.
    I really don't want to use an event structure as I was saving that for another piece of code that monitors inputs.
    Anyone have a suggestion?

    Typically, this works easiest with a shift register and and a boolean "implies" function.
    In the code example (see image), the button is set to "switch until released". (Of course you probably don't need the NOT, simply place your one-time code into the FALSE case )
    Message Edited by altenbach on 01-26-2007 01:52 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    implies.png ‏8 KB

Maybe you are looking for