How do I correctly time while loops using SCPI and VISA/Ethernet communication to send DC current Values to a Power supply?

I'm rather new to using labview and I having an
issue with a test Data Aquisition lab I'm trying to setup using a
Keithley 6221 AC/DC current source and a basic PCI M-series NI-DAQmx. 
First of all, I'm looking to update the  current value on a power
supply at a rate of atleast 10Hz and I'm using SCPI commands and VISA
communication through ethernet to do so.  Attached below is the VI I
have written. 
The issue I'm having is this:
    My VI will
loop through the values fine in software, or so it seems.  I am unable
to get the Power supply to update sequentially if I don't set my loop
delay to anything greater than 130ms.  If I try to run the loop faster
it starts skipping values instead of counting 1,2,3,4,5,1,2,...etc.  it
goes 1,2,4,5,2,4,1,2 on the display of the power supply and my DAQ unit
also skips these values so I know that the number just isn't getting
read to the Power supply in time.  I was wondering if this was due to
my sloppy programming or if it is a hardware issue, my computer or the
method of communication to the power supply?  Is this due to the fact
that I'm using ethernet and VISA communication?  Is there a faster way
to communicate or is GPIB faster?  Any input at all would be extremely
helpful.
On a side note:  Right now I'm using an pre-determined
array of values that I can update on the fly but in the future this
with be put into a  closed-loop control system.  The value for the
power supply output will be determined by the loop and sent that way.
Attachments:
basic DC loop 6221 Keithley.vi ‏145 KB

Also, one of the string constants is NOT set to '\' Codes Display. Here is an alternative method of calculating the index. I removed the DAQ and VISA stuff since I could not run it.
Lynn
Attachments:
basic DC loop 6221 Keithley.2.vi ‏16 KB

Similar Messages

  • How do i exit a while loop using event handler

    Hello,
    I have an event handler structure within which i run a while loop for a particular event. I would like to interrupt the execution of this while loop as soon as another event occurs, even if the while loop has not finished execution. I have tried so many ways, the best i could get is exiting one itteration after the new event occurs which is no good for me.
    Any suggestions???
    Thanks
    Me

    Instead of having a task while loop in an event case, put your task while loop in parallel with the loop surrounding the event structure. When the event which should start the task occurs, you can signal the start of the task while loop. You could use local variables of references to start/stop the loop when an event occurs. You could also use notifiers instead of variables to pass signals to start/stop the while loop. In general you should have a while loop for the event structure, and a parallel while loop to do the tasks. The parallel loop is controlled by variables or notifiers which are set in the event cases.
    - tbob
    Inventor of the WORM Global

  • How to setup Time Capsule to use wifi and 2 ethernet ports

    Hi, I hope someone can help with this issue as I've been searching for an answer without success. Basically, can a Time Capsule (1st gen) connected to a modem create a wireless network, as well as connect to an ethernet powerline adapter, as well as connect to an iMac by ethernet?
    My original setup was as follows:
    modem > time capsule (which creates a wireless network) > iMac
    I bought an AirPort Express to use in another room. It was extending the TC wifi network, but the speeds weren't great so I've got a pair of powerline ethernet adapters. I wanted to add those into my current setup so that the Express can create a wireless network.
    Anyway, before I can get to that stage, I'm having issues with the TC. I want to achieve the setup as follows:
    modem > time capsule (which creates a wireless network) > powerline adapter 1 * > powerline adapter 2 > airport express
    * But as well as connecting an ethernet cable to powerline adapter 1, also connect one from TC to my iMac.
    When I tried connecting an ethernet cable to the TC in my original setup, the iMac lost connection to the internet. I've managed to get the following setup to work:
    modem > time capsule (which creates a wireless network) > powerline adapter 1 > powerline adapter 2 > imac
    But to achieve the setup I want, would require me to buy another powerline adapter (for the Express), and it seems silly to have to use a powerline adapter for my iMac when it is right next to the TC.
    Any help would be appreciated.

    modem > time capsule (which creates a wireless network) > powerline adapter 1 * > powerline adapter 2 > airport express
    * But as well as connecting an ethernet cable to powerline adapter 1, also connect one from TC to my iMac.
    When I tried connecting an ethernet cable to the TC in my original setup, the iMac lost connection to the internet. I've managed to get the following setup to work:
    What you are attempting should work fine. The TC should be able to manage multiple ethernet connections as well as the wireless.
    Investigate what is happening when you plug ethernet into the TC from the imac.
    Please try it.. turn off wireless in the imac to ensure ethernet is the only connection.
    But I would recommend you shut off the whole network at that point. Restart everything in order.. modem .. TC.. EOPs.. Express.. clients.. with 2min gap between them.
    Now look at the imac and check the network preferences.. did it pick up the correct IP from the TC? It should have router (gateway) and DNS all correct using dhcp.. if not check the connectivity light on the TC.. does it come on when you plug in the ethernet cord?
    Open a terminal on the mac and ping the TC address. does it respond?
    Give a few screen shots of how the TC is setup.. bridge, router and what IP it is running. Even just the summary page.

  • How to out from infinite while loop in sub VI

    Dear Sir,
    how to out from infinite while loop in sub VI from main VI
    attached photo for solution but I can't understand it and i can't find the function in photo 
    please help
    Attachments:
    stop_subVI_frm_main.JPG ‏36 KB

    Asking how to get out of an infinite loop is like asking how to find the end of a circle. I'm not trying to be sarcastic but by definition, if there is a way out of the loop, then it is not infinite. I think what you are asking is how to avoid creating an infinite loop. Is there something about the suggestions you have been given that you do not like? My favorite suggestion is the notifier but maybe you just need an example. Turn on context help and read about the notifier functions in the code below.
    This is your top level VI
    And this is your subVI
    If this seems too complex then a global variable will work too. But what seems simpler can cause much more complex bugs. You can code fast and spend lots of time debugging or you can code slow and spend less time debugging. Personally I perfer writing productive code than looking for bugs any time.
    =====================
    LabVIEW 2012

  • How can I force Time Machine to use existing backup sparsebundle files?

    I backed up both my OSX Mountain Lion MBP and MacOSX Snow Leopard iMac to the same USB Disk. I then plugged this USB Disk into my Time Capsule, and configured Time Machine in both macs to use it through the network. But Time Machine insists on creating new backup sparsebundle files, ignoring the existing ones. How can I force Time Machine to use the existing backups.backupdb sparsebundle files instead of creating new ones?

    How can I force Time Machine to use the existing backups.backupdb sparsebundle files instead of creating new ones?
    You can't. Time Machine works differently over a network than it does with a locally-attached drive. What you could do is delete the folder named "Backups.backupdb" at the top level of the volume, which contains the backups you made via USB. You should then be able to backup to the same sparsebundle locally and over the network. But I wouldn't recommend doing that. Certainly don't do it unless you have at least one other complete backup (which you should have anyway.)

  • How do I correct mistakes while entering #s on keypad during phone call?

    How do I correct mistakes while entering #s on keypad during phone call?

    You mean when actively on the line interacting with an automated system on the other end?  You don't. Or, rather, it's up to the system on the other end. When you tap a number, the tones are sent over the line immediately. You can't "undo" it.

  • How to find max(time) from table using group by

    how to find max(time) from table using group by
    select var max(time)
              from table
              into (var1, time1)
               where .....
                 group by var.
    it is fetching record which is top in table.
    if u can help?
    regards.

    No this will fetch the maximum time from teh table.
    select var max(time)
    from table xxxx
    into (var1, time1)
    where .....
    group by var.
    Refer this code
    TABLES SBOOK.
    DATA:  COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
    DATA:  CONNID LIKE SBOOK-CONNID.
    SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
           INTO (CONNID, COUNT, SUM, AVG)
           FROM SBOOK
           WHERE
             CARRID   = 'LH '      AND
             FLDATE   = '19950228'
           GROUP BY CONNID.
      WRITE: / CONNID, COUNT, SUM, AVG.
    ENDSELECT.

  • I need to know how I will create a dynamic website using php and mysql

    I need to know how will I create a dynamic website using php and mysql that people could have the abilities of registering in the website, and modify their profile where they can add their pictures and everything. apart from that, they should have the ability to search about other member. hope to here more from you.

    If you are a right-brained creative, and have no previous experience or propensity to be able to understand coding and database "stuff", and/or if your time can be better spent on other skills, I recommend you save your sanity and hire a developer... or at least the first time around. I have been attempting to grasp this for years... and have a library of marked up books to prove my efforts, all while trying to keep up with an ongoing client base that is always cramped. It's a wonder I still have my sanity... then again, I might not be the best person to determine that. Others might question it.
    That said, I still plan to master php... one of these days.

  • How to remove the time slider from my project and keep only buttons

    How to remove the time slider from my project and keep only buttons to interact with my project .

    If I understand you correctly, go to the skin editor (Project, Skin Editor in Captivate 4), select the Playback Control tab, uncheck the Progressbar check box.  Leave checked the buttons for play/pause, rewind, forward, back, etc.
    I hope this helps.
    Mister C.

  • How do I close a JInternalFrame when using subclasses and a separate cla...

    The heading should be: How do I close a JInternalFrame when using subclasses and a separate class for the actionListener?
    I have just created a JInternalFrame appclication and now I want to structure up my code. I have a Superclass that contains the usual settings for the two JInternalFrame:s, and the two subclasses with frame specific information. Both the JInternalFrames use the same OK button. I want to have the actionListener outside the classes to avoid repetition of code. But the dispose()-function does not work properly, it does not close the opened JInternalFrame. What�s wrong?
    class Superclass extends JFrame
         JButton b= new JButton("ok");    
         Superclass()
    class Subclass1 extends Superclass
         Subclass1 ()
              add(ok);
           ok.addActionListener(new Listener());
    class Subclass2 extends Superclass
         Subclass2 ()
              add(ok);
           ok.addActionListener(new Listener());
    class Listener extends Superclass implements ActionListener
         public void actionPerformed(ActionEvent e)
                   dispose();
    }How do I controll in the Listener class that the button in Subclass1 is beeing pressed?

    First of all I think I misunderstood your question. You said you had two internal frames, so I thought you wanted to close the internal frame.
    It now looks to me like you want to close the entire JFrame, which makes the code even a little easier. Something like:
    JComponent component = (JComponent)event.getSource();
    JFrame frame = (JFrame)SwingUtilities.windowForComponent( component );
    frame.dispose();
    Ok, I will make a try:
    public static Container getAncestorOfClass(Class c, Component comp)
    w.getAncestorOfClass(w, this); Fiirst you need to learn the basics of reading the API.
    "getAncestorOfClass()" is a static method. That means you don't use a variable to invoke the method. You use the class itself.
    "w" is a variable, which is a JFrame, but that is not what the first parameter should be. The first parameter is a "Class".
    "this" will refer to your Listener class, but you need the Component that generated the ActionEvent.
    When I thought you wanted to close an internal frame then the code would have been something like:
    JComponent component = (JComponent)event.getSource();
    Container container = SwingUtilities.getAncesterOfClass( JInternalFrame.class, component );
    JInternalFrame internalFrame = (JInternalFrame)container;
    internalFrame.invokeSomeMethodHere();If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html

  • Stopping a while loop using the time difference of two tick counts

    Hi Guys,
    I'm currently writing a code which test how long does it take for a formula node to perform its operation. The program uses a while loop to perform the calculation, and the program stops after calculating when tick count has reached 10 seconds. The program then displays the number of iterations it does in 10 seconds. 
    So initially I created 2 frames of sequence structure. In my first frame I have my initial tick count, and in my second frame I have my final tick count and the while loop. I used the subtract function and divide the output by 1000 to get the time difference. Then using the comparison function, I set if output > 10 then the program should stop, to do this I linked the output of the comparison function to the stop button inside the while loop. 
    However, when I tried to run the code, the program just didn't run. Hence I created a similar program which puts the last tick count in new frame sequence. When I ran this code, the program never stopped. 
    Do you guys have any idea what went wrong with my codes.
    Thank you!
    Erry
    Solved!
    Go to Solution.
    Attachments:
    1. Tick Count.vi ‏27 KB
    tickcoun2.vi ‏27 KB

    Dataflow!
    In both VI's the stop terminal of the while loop is controlled by a boolean whose source is ouside of the while loop.  So that loop will either run once, or run forever, depending on the value of the boolean that is calculated before the loop starts and shows up at the tunnel going into the loop.
    I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • Question about while loop using Timer?

    I am trying to use a while loop to read data from oscilloscope through
    GPIB card continously(lasting for a fixed time, for example,1 minute). I
    want a Timer, when it expires, the while loop will stop. But I do not
    know how to implement it.
    Any help would be greatly appriciated!
    Thanks in advance.
    zhljh
    Sent via Deja.com http://www.deja.com/
    Before you buy.

    In article <87q5t2$7kh$[email protected]>, wrote:
    >I am trying to use a while loop to read data from oscilloscope through
    >GPIB card continously(lasting for a fixed time, for example,1 minute). I
    >want a Timer, when it expires, the while loop will stop. But I do not
    >know how to implement it.
    So, you need it to count down, then I assume? Okay, you need to put a
    true/false node within your for loop. Set the true case to i=1 (iteration
    of the for loop) so that it will initialize one time (and be true one
    time). Then, add whatever time you need for the vi to run to that
    indicator (where you send a numeric value on the first iteration). Put a
    greater than comparison to the timer and the additoin of the indicator and
    your value. Let that be the term
    inating thing on your for loop.
    Now, this might present a problem with a circular reference. If it does,
    you'll need to basically do the same thing, only you'll need to send the
    value through a shift register in the for loop.
    Harry

  • While loop using a timer object

    Hello Technet,
    I have a file that gets created every night by a batch job and I need to send that file every night. So, I came up with a method (if there's a better way, I'd like to hear). I created a 2 hour timer object to run a while loop. While the time elapsed is less
    than 2 hours, the loop will run.  In the loop, I have a if condition to test for a file.  If the file is not there, then sleep for 10 minutes.  If the file is there, then send it to me with send-mailmessage. The problem is, I will get the file
    sent to me at every interval because the loop is terminated by the timer. I would like the loop to terminate once the email message is sent to me.  Here is my code snip. Can someone please help on getting the loop to terminate when the message is sent?
    $file = "c:\file.txt"
    $timeout = new-timespan -hours 2
    $sw = [diagnostics.stopwatch]::StartNew()
    while ($sw.elapsed -lt $timeout)
    if(!(test-path -path "$file1"))
    file is not there...yet
    start-sleep -seconds 600
    else
    $SmtpServer = "relay"
    $To = "my@emailaddr"
    $From = "me@emailaddr"
    $Subj = "Got it"
    $Attm = "$file1"
    $Body = "Please see Attachment"
    Send-MailMessage -smtpserver $SmtpServer -from $From -to $To -subject $Subj -body $Body -attachment $Attm

    Hi,
    You can use break:
    http://ss64.com/ps/break.html
    EDIT: Alternatively, you can try this:
    $filePath = 'c:\file.txt'
    $found = $false
    Do {
    $file = Test-Path -Path $filePath
    If ($file) {
    Send-MailMessage -To [email protected] -From [email protected] -Subject 'Got it' -Body 'Please see Attachment' -Attachments $filePath -SmtpServer smtp.domain.com
    $found = $true
    Else {
    Start-Sleep -Seconds 600
    Until ($found -eq $true)
    This will loop until the file is found instead of relying on a timer.
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • How do I make one while loop that runs 1 piece of data at a time?

    I have a question about a while loop.  Currently, I have 4 or 5 dynamic data lines that I would like to run through a while loop that will tell me if the data is within a certain range or not.  However, the ranges are different for each piece of data, and I dont know how to do each one separately.  Do I have to make 5 different while loops? Thanks!

    pg22aw wrote:
    I have a question about a while loop.  Currently, I have 4 or 5 dynamic data lines that I would like to run through a while loop that will tell me if the data is within a certain range or not.  However, the ranges are different for each piece of data, and I dont know how to do each one separately.  Do I have to make 5 different while loops? Thanks!
    Do you want to compare the value with a defined value and also the ranges for the 5 data is different?. What are you doing in the while loop. If the data is in an array of dynamic data you can seperate the amplitude value and check the whole array of value with the ranges that is also build same as the data theh you will get the output as a boolean array.
    The best solution is the one you find it by yourself

  • How to stop execution in while loop without stopping execution of other loops in the same vi

    HI
    I am quite a novice in Labview.
    I have a problem in my project. I used a while loop inside my vi to build an array of ten values along with other loops. Then I used a stop button to stop manually the while loop. But it seems like the loop doesn't stop in the middle of the array building and so other loops in the vi doesn't work until the while loop finishes building the array and as soon as while loop execution is over, the complete vi stops. But all that I wanted was to build the array using the shift register along with the control to stop building array anytime. And not to stop execution of other structures when the while loop finishes.
    Can anyone help me?
    Rahul

    Hi Rahul,
    Modified ur Vi to work with single button.
    But the subtract case is not in any loop.
    So, once both the loops stop, the subtract case will execute only once. Depending on state of subtaract boolean at that time, corresponding case will be executed and the Vi will stop.
    so think of a logic where u can put this also in a new loop.
    Or you can also incorporate it in one of the two loops and pass the other loop's data to it.
    Let us know how you will proceed in this regard
    I am posting your VI as well a VI with my modifications VI in Labview 7.0 so that Thomas can give his suggestions too
    Plus, always keep a time delay in your while loops.
    Oh sorry, the "arrayinouttestnewfinal.vi" is the modified vi
    Regards
    Dev
    Message Edited by devchander on 01-10-2006 06:15 AM
    Message Edited by devchander on 01-10-2006 06:19 AM
    Attachments:
    arrayinouttestnewfinalnew4.vi ‏59 KB
    arrayinouttestnewfinal.vi ‏63 KB

Maybe you are looking for