Executing each step of a for loop only on a VISA read output

Hi,
I would like to give multiple steps to a motor/controller to exectue, but I keep getting a "command overflow" error.  Therefore, I am trying to tell the for loop only to execute when the VISA Read receives an output. I have included the .vi I have written so far. For example, the code /1P1000p66R tells the controller to move motor "1" forward 1000 steps and then to output the number "66" when the motor has moved 1000 steps. My input to the "table control" is, e.g., 3 commands:
/1P1000p66R
/1D1000p66R
/1D5000p66R
How do I get the code to send each of those commands only when the number "66" is sent back to the program so that I don't get the command overflow error? Also, if anyone has a better way to control the motor to do multiple steps, let me know. I'm pretty new to all of this. 
Thanks.
Attachments:
Motor Controller (Sub VI 2).vi ‏26 KB

Rather than using a table control, I would just use a string array.
Set your serial port parameters before the loop.  Close the serial port after the loop.
Your controls don't have any real data in them saved as default, so I'm confused a bit as to what your are trying to do.  Why do you have a numeric control with the number 0 establishing the loop iterations?
Instead of a For Loop, use a while loop.  Set the 1-D array of strings to be autoindexing at the input tunnel.  Write the command (why you have everything wrapped in a case statement with a true constant makes no sense.  Do a VISA read.  If the response has the 66 (you'll have to figure out how to parse it out), all is good.  If it does not have the 66, or the number of loop iterations equals the number of commands in the array -1 , then end the loop.
Message Edited by Ravens Fan on 05-20-2009 09:31 PM
Attachments:
MotorController(SubVI).vi ‏18 KB
Motor%20Controller%20(Sub%20VI%202)[1]_BD.png ‏8 KB

Similar Messages

  • Error occurred in deployment step 'Uninstall app for SharePoint': Only users who can View Pages can list Apps

    While deploying the SharePoint Hosted App I am facing the issue  'Uninstall app for SharePoint': Only users who can View Pages can list Apps"
    - Provided the permissions for App Management and Subscription Services as well as DB.
    - Added into Host web as SC Administrator
    Thanks in Advance.

    Hi,
    The user you are running with Visual Studio should have read permission on the pages of SharePoint web you are trying to deploying your app.
    I suggest you add the login user to the SharePoint web in the “Site Settings”->”People and Group”.
    Here is a similar thread for your reference:
    http://sharepoint.stackexchange.com/questions/68590/error-occurred-in-deployment-step-uninstall-app-for-sharepoint-only-users-who
    More reference:
    Step by step How to configure environment for app development:
    http://gianespo.wordpress.com/2014/01/30/step-by-step-how-to-configure-environment-for-sharepoint-app-development/
    Best regards
    Zhengyu Guo
    TechNet Community Support

  • How to insert elements into an array after each iteration of a for loop

    I am new to labview and working on an application where I am supposed to store an element into an array (without overwriting) after each iteration in a for loop. I have tried using Build Array Function keeping the indicator outside the for loop and played with indexing but didn't work. Please suggest me an idea how to do it.
    Thanks
    Solved!
    Go to Solution.

    Thank you for your suggestion.Here is my actual application attached . In the first image, a difference in time is evaluated and an enum const of insert into array is passed to the shift register where it takes to Insert element into array phase (Second image). I need to enter the time difference into an array after every loop iteration. Please have a look and could you let me know where I am mislead.
    Attachments:
    Image 1.JPG ‏88 KB
    Image 2.JPG ‏71 KB

  • How to save a chart after each iteration in a for loop?

    Hello,
    I have written code which initializes a spectrometer. Once initialized, if the "Capture" button is pushed, the spectrometer takes a new spectrum three times (see for loop) every second. This spectrum is displayed as a chart in my front panel. My code runs fine...it will update the spectrum every second.
    However, I want to be able to save each of these three iterations as separate graphs. Basically, I want to click "Capture" and have my code save three charts to a specified folder. How do I go about doing this?
    I've attached my VI.
    Thanks.
    Solved!
    Go to Solution.
    Attachments:
    Spectrometer Iteration.vi ‏444 KB

    Use Build Array to make a 2D Array of your X and Y data and use Write To Spreadsheet File to save the data.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I have each pass through a for loop communicate with a new indicator?

    Hello,
    I am using 16 color boxes to indicate how 16 channels are behaving.  If a color box is blue, its respective channel is running correctly, red means it has failed etc.  I am continuously checking each channel using a loop, and I wanted to update the channel colors every loop.  I have made an array of 16 numbers corresponding to the color I wish to have (which are blue = running, red = failed, green = completed, black = not in use).  However, I cannot find a way to pull these 16 numbers out of the array and to the color boxes short of 16 index arrays connected to the color boxes. 
    I understand how to convert each individual number to a color, I just don't know how to use a 16 times for loop to communicate with a different color box each pass through.  Is there any way to do this or should I just go for brute force?
    Thank you.
    Solved!
    Go to Solution.

    Sorry I keep making new posts.  Attached is an example i wrote up.  There are three cases in the disabled structure, each has a different implementation of what i belive your specs are.
    Tim Elsey
    LabVIEW 2010, 2012
    Certified LabVIEW Architect
    Attachments:
    update color box.vi ‏24 KB

  • I have used a 'for loop' to create an array of output data, however I want the each of the data sets from the array to be placed into a 1-D array. How do I concatenate the output of the for loop into a 1-D array?

    I am using this to create a data set that will be passed as an anolog output therefore it needs to have the correct array dimensions to go into the analog write vi.

    I'm updating my request... I've figured out how to do this by copying an example that uses a simple FOR loop (as seen in the attached current version of my VI). My question now becomes this: Is there a way to save the Y values corresponding to those X values into two more arrays? That is, just for argument's sake, let's say I took the first 100 elements from the X array, and found them to be positive. Then I would like to take the first 100 elements of the Y array and put them into a 'Y Values for X > 0' array. ...And likewise with the negative X values, they should have a separate array of corresponding 'Y values for X < 0' array.
    I can see that I should somehow save the indices of the positive X values from the large arrray wh
    en I sort them out, and use those indices to pick out the elements from the main Y array with the same indices.
    I just can't seem to set up the code necessary to do this. ...Can anyone help, please?
    Attachments:
    Poling_Data_Reader_5i.vi ‏79 KB
    30BLEND.txt ‏3 KB

  • After I put an inner for loop,i don't get any output!

    Hello,
    I have an RTF which does not show the output properly. I had a for-each@section, then i put another for-each to repeat the block of data twice
    The code is as follows:
    *<?for-each@section: Books_S1/Category_S2_Group/On_Rental_S3?>*
    <?Fax_Number_ID10?>
    <?for-each:xdoxslt:foreach_number($_XDOCTX,1,2,1)?>
    Value does not display here!!!!!
    <?Order_Number_DOCO_ID20?>
    <?end for?>
    *<?end for-each?>*
    Please help me on this issue, i must display the value in the inner loop. I think it has lost the data (+for-each@section: Books_S1/Category_S2_Group/On_Rental_S3+) when it steps into the inner loop
    Edited by: Lovvyrules on Dec 2, 2010 10:08 AM

    It should be the other way.
    Can you try this out.
    <?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,2,1)?>
    <?for-each: Books_S1/Category_S2_Group/On_Rental_S3?>
    <?Order_Number_DOCO_ID20?>
    <?end for-each?>
    <?end for-each?>
    Also check the link for an example http://winrichman.blogspot.com/2008/09/multiple-copies-in-bi-publisher.html

  • How to execute an SP within a for loop?

    hi,
    i have the following sp.
    PROCEDURE insert_and_update (
              book_name IN table01.book_name%TYPE,
    description1 IN table01.description1%TYPE
    status IN OUT number
    i need to call this sp in the following loop.
    for i in (select book_name, book_descfrom new_books) loop ..... end loop;
    i did the following but it didnt work. what am i missing ?
    declare
    nn number(10):=0;
    begin
    for i in (select book_name, description from new_books) loop
    exec insert_and_update (i.book_name,i.book_desc, :nn);
    end loop;
    end;
    please advise.
    thanks in advanced
    novideDBA

    EXEC is a SQL*Plus command, not PL/SQL. You don't need EXEC in PL/SQL, just call the procedure
    for i in (select book_name, description from new_books) loop
      insert_and_update (i.book_name,i.book_desc, :nn);
    end loop;Justin

  • How to show a database to a user for which only he has the read access?

    Hi All,
    We have a SQL Server and it has say 10 datatabases, we have created a login and also a user which has read access to just one of the 10 databases.
    I used 
    use [master]
    DENY VIEW ANY  DATABASE to msam_test
    To hide all the databases from explorer for that user if he logsin with msam_test.Now, i want this user to see a database named suresh3_test for which he has a read access.
    Can someone please help me if this is achievable?
    Thanks

    hi,
    It is not possible to look at one database if the user only have read access in your scenario.
    either you revoke the DENY VIEW ANY  DATABASE permission, which will list all the databases  for the user
    or  You need to make the user database owner by doing so:
    First delete the user from the database
    Right click on the database and select properties and change the owner to msam_test as shown in the pic below
    But the user will have owner rights on the database.
    Hope this clarifies your doubt. The same was explained in your earlier post as well
    Thanks
    Bhanu

  • How do i configure a FOR loop to have the behavior of the step Loop Type: Pass/Fail count?

    Hello,
    I'm using the Pass/Fail count set to one Pass to capture an event generated by my DUT.  I originally used a numerical compare step with the Looping type of Pass/Fail count to accomplish this.  Unfortunately the implementation changed and now I need to execute a few steps that can not be combined within one code module as before. Nor can these steps be put into a subroutine.  One of the steps executes a .NET asembly and I haven't figured out how to pass the reference to the subroutine.  When the subroutine is intered the reference is lost and the methode does not execute correctly.
    I have an evaluation function the exits the loop when the expected conditions are met. Everything works except for the Overall Pass/Fail result of the For loop.  If the loop exits due to the first numerical compare test passing, I want the loop overall execution to report as "Passed".  If the loop reaches it's predetermined number of iterations, the overall result needs to report as "Failed".  It would also be nice to have the radio button functionality of "Record Result of Each iteration".  Some conditions require a wait over a minute for the event to occur and I don't want to generate needless data for the report.
    Currently I get the pass/fail status for each For loop iteration, but only "Done" for each loop iteration.  I don't want the initial few failures to cause the test to fail.
    Does anyone know how to do this? Suggestions?
    Thanks,

    I have 2 steps in the loop that can not be combined into one step. This forces me to implement the behavior in some form of loop.  A While Loop could be an option.  I would need to pass the Step.Result.Status from the Multiple Numerical compaire step to the condition of the While Loop.  I tried to use the Step.TS.ID without success.  Some form of reference to the numerical compare step would be needed. I'm using a For Loop as I do want to limit the number of iterations of the loop.  In the case where the loop iterations are reached, the event I am trying to detect did not occur at the correct time and a failure needs to be reported.
    I came up with something based on my comments in the second post:
    1) To start with I configured a Locals.ForLoop_5 variable.  This is used to set the limit on the loop iterations and for comparison after the loop has finished executing. More on that later.
    2) The first step inside the loop invokes a method within a .NET assembly that has been packed in a DLL This method gets the required data from the DUT and stores it to a text file.
    3) The next step is the Multiple Numeric Limit step.  This step invokes a VI that extracts the data from the text file.  This step has been customized in several ways.
      i)  In Run Options, the Results Recording Option was disabled.  This prevents recording of "Failed" while the loop executes when waiting for the event to happen.
      ii) In Run Options, the Step Failure Causes Sequence Failure is unchecked.  Same reasoning as i)  These steps are not true failures.
      iii) A Post Action is configured to go to the nexxt step after the For Loop End step On Condition True with the logic of Step.Result.Status == "Passed".  This causes the loop to exit when the first "Passed" is encountered which corrolates with the event I'm trying to detect. On Conditon Fail remains set to default.
    4)  The step after the For Loop End is an expression step with everythin set to default except for the Status Expression logic set to: Locals.Loopindex < Locals.ForLoop_5 ? (Step.Result.Status = "Passed") : (Step.Result.Status = "Failed"). This step performs the overall Pass/Fail reporting for the For Loop.  If the number of loop iterations is less than the maximum it could have only gotten there by the previous logic triggered by the numerical compare passing, therefore "Passed".  If the loop index has reached the limit, then the event was not detected, therefore Failed.
    I have tested this work around with success, it just a pain to now have to implement this on my 40 some odd For Loops.
    If there is a better way, I'd still like to hear it.

  • How to make for loop pass only once in a next() method

    Good Day!
    Can anyone help me or suggest any idea to resolve my problem with the below code, wherein it will only pass the for loop only once. I already tried inserting the for loop in side the if (sqlset4.isFirst()) condition but the problem is it only retrieved the first row of the resultset.
    Cheers!
                   Statement sOutput = consrc.createStatement();
                            ResultSet sqlset4 = sOutput.executeQuery(xquery);
                            ResultSetMetaData rsMetaData = sqlset4.getMetaData();
                            int numberOfColumns = rsMetaData.getColumnCount();
                            String writefld = "";
                            while (sqlset4.next()) {
                                 writefld = "";
                                 for (int i = 1; i <= numberOfColumns; i++) {
                                     if (xxformatid.equals("1") || xxformatid.equals("3")) {
                                         writefld = writefld + "sqlset4.getString(" + i + ").trim()" + "|";
                                writefld = writefld.substring(0, writefld.length() - 1) + ")";
                                output.write("\r\n");
                                output.write(writefld);
                            output.close();I am using Netbean IDE 6.8
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi

    Hi everyone!
    What I actually trying to do is that I have a multiple tables and from these tables I'm going to write each of it into a flatfile that is a pipe delimeted that is why I have to make a loop to know how many fields I am going to write. The code that was attached are actually working, my only concern is that it will take a longer time of processing cause every record of a table it will pass to the for loop(checking how many column) wherein number of column/ were already known on the first loop.
    Hi kajbj,
    I think what your trying to explain is almost the same with below code which i had already tried. The problem with this is that the every loop of the outer loop data retrieve is only the data of the first record.
                   Statement sOutput = consrc.createStatement();
                            ResultSet sqlset4 = sOutput.executeQuery(xquery);
                            ResultSetMetaData rsMetaData = sqlset4.getMetaData();
                            int numberOfColumns = rsMetaData.getColumnCount();
                            String writefld = "";
                            while (sqlset4.next()) {
                                 writefld = "";
                                 if (sqlset4.isFirst()) {
                                    for (int i = 1; i <= numberOfColumns; i++) {
                                        if (xxformatid.equals("1") || xxformatid.equals("3")) {
                                            writefld = writefld + "sqlset4.getString(" + i + ").trim()" + "|";
                                writefld = writefld.substring(0, writefld.length() - 1) ;
                                output.write("\r\n");
                                output.write(writefld);
                            output.close();

  • Fill a multi record block with a for-loop

    Hi
    I've got a simple question but I couldn't find a solution yet.
    I have a multi record block and behind this i wrote a post-query-trigger with a cursor and a for-loop. Now I try to show each record of the for-loop in the multi record block. The loop works correctly, but the problem is that I only see the last found record of the loop in the first multi record and I'm not able to go to the next multi record when the loop finds more then one record.
    I tried to use NEXT_RECORD but then I got the error message "100500: non-ORACLE exception".
    May someone help me? Thanks a lot!

    What exactly are you trying to do? If you are simply trying to display the result of a query in a Multi-Record Block (MRB), I would recommend basing your block on the query (From Clause Query) or if you are simply displaying the contents of a table or a view in the block, base your MRB on the table or view and let Forms handle displaying the records.
    The Post-Query (PQ) trigger will execute for each record displayed in the MRB, which I'm sure is not what you intended. Since the trigger fires for each record, your loop is essentially assigning the value of each row in the cursor to the same row in the MRB.
    Hope this helps.
    Craig...

  • Display value in MATLAB For loop on LabView

    Hi guys,
    I have a MATLAB script in my VI. The MATLAB script runs a For Loop. For each iteration of the For Loop, a variable say, count is incremented by 1.
    From what I am experiencing, the MATLAB script only outputs the final value of count when the script is done running.
    Is it possible to capture the value of count as each iteration is performed?
    PS : Using a LabView For loop is not possible for my case. Running the MATLAB code is mandatory.
    Thank you in advance!

    When the Matlab script gets called, it's actually passing control over to the Matlab ActiveX server. Thus, LabVIEW has to wait until that's done before it can proceed. What you're asking for is interprocess communication. That doesn't come provided "out of the box". You have to create it yourself. Some ideas were suggested here: http://forums.ni.com/t5/LabVIEW/Labview-Matlab-Exchange-Data/td-p/1408054

  • Unable to put a timed structure in a parallel for loop, error -808

    If I try to place a Timed Structure in a Parallel For Loop, the TS needs a different structure name per instance to prevent collisions. However, setting the Structure Name node  to something unique per instance doesn't work, I get error -808. Have I missed something?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

    That got me thinking - something to do with the number of compiled parallel instances.
    Indeed, the compiler creates a number of parallel instances of the for loop in the compiled code (in my case 8), and uses the number requested at the Parallel Instances terminal (just under the Iterations terminal), which is set to 2. Therefore the compiler has created 8 instances of the Timed Structure, each in its own for loop instance, but they all have the same defined Structure Name. When launched, there is an immediate conflict because they can't share the same name, and error -808 is launched before the set Structure Name function can change it. Hence the error still shows when requesting only one instance, because the other seven still exist.
    I guess this means you can't have Timed Structures (or Timed Loops for that matter too) in a Parallelised For Loop?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • Java - sleep in a for loop doesn't work (as desired)

    Hey all,
    I'm trying to get a draw animation when the mouse is released (after dragging an object to a set area on the screen) - hence I'm trying to do this via a for loop with a small sleep() delay. However it isn't working. The delay is there, but nothing changes until the end of the for loop and then you only see the final repaint() [i.e. instead of each iteration in the for loop]:
    // This program is concerned with this and the mouseDragged methods
         public void mouseReleased(MouseEvent e)
              for( int c = 0; c < xButton.length; c++)
                   if( xButton[c] >= xRandWeight && xButton[c] <= (xRandWeight+50) && yButton[c] >= yRandWeight && yButton[c] <= (yRandWeight+50) )
                        // Have an animation for the scales re-adjusting
                        if( c == 0 )
                             currWeight = (int)(scales.getWeight2());
                             desiredWeight = Integer.parseInt(b1.getLabel());
                             if( desiredWeight >= currWeight )
                                  // More efficient than putting this subtraction straight into for loop
                                  difference = desiredWeight - currWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight+count);
                                       repaint();
                                       try
                                            Thread.currentThread().sleep(100);
                                       catch (InterruptedException in)
                                            in.printStackTrace();
                             else
                                  difference = currWeight - desiredWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight-count);
                                       repaint();
         }Any ideas on how to fix this/meet the goal would be greatly appreciated :)
    Thanks,
    Tristan Perry
    Edited by: TristanPerry on Nov 16, 2008 12:36 PM

    My program isn't being written in SWINGFirst, it's Swing, not SWING. It's not an acronym.
    Perhaps you would like to tell us which windowing toolkit you are using, so that you can get better responses. Or is that a closely guarded secret? <sarcasm/>
    I'm very new to JavaSo ditch the GUI stuff and get a foundation first.
    db

Maybe you are looking for

  • I'm using windows 7 with PSE9.  Where is the menu bar??

    This is a brand new computer HP-400 , 23" screen.  Also brand new individual license of PSE9,  My PSE 7 worked great on my XP. How do I get the menu bar to show? Alsom the 'Export' option in the editor is grayed out.  How do I export as new file????

  • Product wise pending sales order

    Hello, From which transaction code we can find out the Product wise pending sales order list. thanks harish

  • Encrypting data in columns

    Is there a way to encrypt certain column in a table in 8i?

  • WLC service-group settings

    After checking the WLCs at several sites using the WLC Config Analyzer, one of the errors that came up was that the service-port interface was invalid because it was set to 0.0.0.0. We're not using the service-port interface, so how should this be se

  • Vista x64 bit GUI "Quirks"

    Has anyone else running a 64 bit version of Vista experience weird GUI issues in iTunes 8? Mine range from disappearing minimize,maximize and close buttons to when iTunes loads up it's all black (issue was also in iTunes 7 as well). Message was edite