What is the simplest way to toggle the counter terminal when time has elapsed in the Complete PWM Example?

I have successfully downloaded and executed this: http://www.ni.com/white-paper/2991/en
and I know it works because I can see the pulse train on channel #1 on my osciloscope. 
I have modified the sample code from the website to use pulse width and frequency knobs that may change dynamically:
What I would like to do is toggle the "Dev1/ctr1" to "Dev1/ctr0" every 10 seconds.  I have investigated into the "Elapsed Time" express vi and I am able to successfully count the number of times the time has elapsed, however when 10 seconds have gone by I cannot simply update toggle input to "CO Pulse Freq" with a different counter input because it has already past that object and is busy running in the loop above.  How can I reset the pulse to execute with a different counter input?
In short, the Elapsed Time express VI works perfectly by itself, but when the time has elapsed how do I force restarting the pulse train with "Dev1/ctr0"?
Solved!
Go to Solution.

assuming you want to toggle control from 1 to 0 and back every ten secs and zeroing out the other channel...index the array to write values to one or the other channel.
Spoiler (Highlight to read)
note: if needed...use shift registers to hold onto the last freq/pulse width values for the last channel when toggling to the other. use 'n channel' for multiple counters, concatenate multiple channels on your counter constant
Spoiler (Highlight to read)
Attachments:
toggle.vi ‏47 KB

Similar Messages

  • What is the simplest way to remove duplicates on both iMac and iPad2?

    What is the simplest way to remove duplicate photos from both iMac & iPad2?

    The implication here is that your music is only on the iPod, for if it is in iTunes, you need only do the restore. So you are really asking how you move the music from your iPod back into iTunes, so that when you restore it will go back to the iPod. Take a look at Para. 8 in this summary post I worked up.

  • What is the simplest  way to get a xml-file from 10g R2 -database ?

    Hi,
    I'm new in xml, there are so many tools to work with xml:
    what is the simplest way to get a xml-file from 10g R2 -database ?
    I have : 10g R2 and a xsd.file to describe the xml-structure
    thank you
    Norbert

    There is no automatic way to generate XML documents from an arbitary set of relational tables using the information contained in an XML Schema. Typically the easiest way to generate XML from relational data is to use the SQL/XML operators (XMLElement, XMLAGG, XMLAttribtues, XMLForest). There are many examples of using these operators in the forums You can validate the generated XML against the XML Schema by registering the XML Schema with XML DB and then using the XMLType.SchemaValidate() method

  • What is the simplest way to make a movie from BufferedImages?

    I have a 3d rendered animation from which I can grab BufferedImages of each frame. What is the simplest way I can create a movie from these images?
    I've seen the JpegImagesToMovie.java file and not only is it suprisingly overcomplicated, it requires me to change the code so that I can get images from memory rather than from files.
    Is there some simple way of creating a movie which requires a few statements? I'm also prepared to use QuickTime for Java. I don't care about the format, since I can just use any video converter to convert it to my desired video format.

    I recently came up with a simplified JpegImagesToMovie program. It generates QuickTime movies with a single video track output as a file. Input is a series of jpegs (currently as a list of file names, but easily modified to a take any form of jpeg data.) Since the compression used by the movie is JPEG, if you have an uncompressed image buffer, you'll need to convert that into jpeg data bytes with some quality setting. (Since its a movie file, go with something low if you have a lot of similar images.) This will even run without a full install of jmf--no native code is called (as far as I could tell..)
    Here is the source code, sorry about the formatting!
    import java.awt.Dimension;
    import java.io.File;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import java.net.URL;
    import java.util.Vector;
    import javax.media.Buffer;
    import javax.media.Format;
    import javax.media.MediaLocator;
    import javax.media.format.VideoFormat;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.FileTypeDescriptor;
    import com.sun.media.multiplexer.video.QuicktimeMux;
    * This program takes a list of JPEG image files and converts them into a
    * QuickTime movie.
    * This was based on Sun's JMF Sample Code JpegImagesToMovie.java 1.3 01/03/13
    * This code is an attempt to reduce the complexity to demonstrate a very basic
    * JPEG file list to movie generator. It does not use a Manager or Processor
    * class, so it doesn't need to implement any event listening classes. One
    * advantage of this simplified class is that you can just link it with the
    * jvm.jar file. (you might also need to track down the com.ms.security library
    * stubs, use google. You'll need PermissionID.java and PolicyEngine.java.)
    * I tried to get it to generate AVI files without success.
    * These output files are could use further compression.
    * A Vector of jpeg image paths was one way to do this--the appropriate
    * methods can be overwritten to grab images from another source
    * --zip file, http, etc.
    * - Brad Lowe; Custom7; NuSpectra; 2/10/2005
    * The existing Copyright from Sun follows.
    * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
    * modify and redistribute this software in source and binary code form,
    * provided that i) this copyright notice and license appear on all copies of
    * the software; and ii) Licensee does not utilize the software in a manner
    * which is disparaging to Sun.
    * This software is provided "AS IS," without a warranty of any kind. ALL
    * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
    * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
    * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
    * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
    * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
    * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
    * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
    * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY
    * OF SUCH DAMAGES.
    * This software is not designed or intended for use in on-line control of
    * aircraft, air traffic, aircraft navigation or aircraft communications; or in
    * the design, construction, operation or maintenance of any nuclear facility.
    * Licensee represents and warrants that it will not use or redistribute the
    * Software for such purposes.
    public class SimpleMovie
    Vector images; // jpeg image file path list
    VideoFormat format; // format of movie to be created..
    // Sample code.
    public static void main(String args[])
    try
    // change imageDir to the location of a directory
    // of images to convert to a movie;
    String imageDir = "images";
    File d = new File(imageDir);
    SimpleMovie imageToMovie = new SimpleMovie();
    // change width, height, and framerate!
    // Excercise: Read width and height of first image and use that.
    imageToMovie.init(320, 240, 10.0f);
    imageToMovie.setFiles(d);
    File dest = new File("simple.mov");
    imageToMovie.createMovie(dest);
    System.err.println("Created movie " + dest.getAbsolutePath() + " "
    + dest.length() + " bytes.");
    } catch (Exception e)
    System.out.println(e.toString());
    e.printStackTrace();
    // return jpeg image bytes of image zIndex (zero-based index)
    public byte[] getImageBytes(int zIndex) throws IOException
    if (images == null)
    return null;
    if (zIndex >= images.size())
    return null;
    String imageFile = (String) images.elementAt(zIndex);
    // Open a random access file for the next image.
    RandomAccessFile raFile = new RandomAccessFile(imageFile, "r");
    byte data[] = new byte[(int) raFile.length()];
    raFile.readFully(data);
    raFile.close();
    return data;
    // Call this before converting a movie;
    // Use movie width, height;
    public void init(int width, int height, float frameRate)
    format = new VideoFormat(VideoFormat.JPEG,
    new Dimension(width, height), Format.NOT_SPECIFIED,
    Format.byteArray, frameRate);
    // Set up the files to process
    public void setFiles(Vector inFiles)
    images = inFiles;
    // point converter to jpeg directory. Only does one level,
    // but could recurse, but then sorting would be interesting..
    public void setFiles(File dir) throws Exception
    if (dir.isDirectory())
    if (images == null)
    images = new Vector();
    String l[] = dir.list();
    for (int x = 0; x < l.length; x++)
    if (l[x].toLowerCase().endsWith(".jpg"))
    File f = new File(dir, l[x]);
    images.addElement(f.getAbsolutePath());
    // Crank out the movie file.
    public void createMovie(File out) throws Exception
    if (format == null)
    throw new Exception("Call init() first.");
    String name = out.getAbsolutePath();
    QuicktimeMux mux = null; // AVI not working, otherwise would use
    // BasicMux
    if (out.getPath().endsWith(".mov"))
    mux = new QuicktimeMux();
    mux.setContentDescriptor(new ContentDescriptor(
    FileTypeDescriptor.QUICKTIME));
    } else
    throw new Exception(
    "bad movie file extension. Only .mov supported.");
    // create dest file media locator.
    // This sample assumes writing a QT movie to a file.
    MediaLocator ml = new MediaLocator(new URL("file:"
    + out.getAbsolutePath()));
    com.sun.media.datasink.file.Handler dataSink = new com.sun.media.datasink.file.Handler();
    dataSink.setSource(mux.getDataOutput()); // associate file with mux
    dataSink.setOutputLocator(ml);
    dataSink.open();
    dataSink.start();
    // video only in this sample.
    mux.setNumTracks(1);
    // JPEGFormat was the only kind I got working.
    mux.setInputFormat(format, 0);
    mux.open();
    // Each jpeg goes in a Buffer.
    // When done, buffer must contain EOM flag (and zero length data?).
    Buffer buffer = new Buffer();
    for (int x = 0;; x++)
    read(x, buffer); // read in next file. x is zero index
    mux.doProcess(buffer, 0);
    if (buffer.isEOM())
    break;
    mux.close();
    // close it up
    dataSink.close();
    // Read jpeg image into Buffer
    // id is zero based index of file to get.
    // Always starts at zero and increments by 1
    // Buffer is a jmf structure
    public void read(int id, Buffer buf) throws IOException
    byte b[] = getImageBytes(id);
    if (b == null)
    System.err.println("Done reading all images.");
    // We are done. Set EndOfMedia.
    buf.setEOM(true);
    buf.setOffset(0);
    buf.setLength(0);
    } else
    buf.setData(b);
    buf.setOffset(0);
    buf.setLength(b.length);
    buf.setFormat(format);
    buf.setFlags(buf.getFlags() | Buffer.FLAG_KEY_FRAME);
    }

  • What is the simplest way to get video from mini DV tapes into computer

    My computer has no firewire connection. What is the simplest way to get the video from my camera (JVC GR-D340EK) ?

    Mikeathome
    Thanks for the reply.
    The reason that I asked if this was a one time thing or not was related to my thoughts about asking you to look at the relative costs of have the DV data capture firewire done professional or by a friend versus going through looking for slots on your computer for a firewire card or purchasing a computer that still comes with a firewire port.
    We will be watching for further developments.
    Thanks.
    ATR

  • What is the simplest way to create slide show

    What is the simplest way to create a slide show ?  (Premiere Elements 12)

    saploe
    What computer operating system is your Premiere Elements 12 running on? Premiere Elements 12 Mac does not have a Slideshow option in its Elements Organizer 12. So, that situation would not yield the two choices of creating the slideshow in the Elements Organizer and taking it into Premiere Elements OR doing the whole project solely in Premiere Elements.
    What is going into this slideshow....photos (how many, original pixel dimensions), videos (formats and duration), etc?
    What is a description of your computer resources?
    How do you intent to export this slideshow...
    a. burn to DVD-VIDEO standard or widescreen on DVD disc
    b. burn to AVCHD format on DVD disc
    c. burn to Blu-ray disc format on Blu-ray disc
    d. to file saved to the computer hard drive?
    We will customize a reply based on the information that you supply.
    Thanks.
    ATR

  • TS1424 Can you help Plz? What is the simplest way to transfer my music from old computer to new.

    what is the simplest way to transfer my music in iTune from my old computer to the new plz.

    Move or copy the ENTIRE iTunes folder from the old computer to the new computer.

  • I want to load movies in to my iPad through itune in my pc that runs window XP. First of all I am not able to add the movies to the itune ,leave aside sync to iPad .can some one suggest what is the simplest way to load movies in my iPad.

    I have plenty of DVD which I load in my laptop and watch the movies while travel, however I am not able to do that in my iPad .
    I would appreciate some one guide me the simplest way of loading the movies in to my iPad. I tried the conventional procedure of loading/copying in to itune then sync to the iPad to load all movies in it, but failed to do the first step( not able to load /copy in itune) leave aside the sync to iPad next.
    Do I need to sellout some 20 odd $ to buy a conversion software that would help?
    Is it that Apple trying to make money by not making this simplest of thing possible by the user.( ref. windows, every thing is possible with little IQ of the user).
    If it is so , I would stop many of my friends to restrain from buying a device like this by spending some 1000$   ,rather look at a good Droid that is catching up so well.

    If you are the only user on your computer you probably don't have multiple user accounts set up and can disregard that.  If you are using iTunes 11 go to View>Show Sidebar.  Now see if your iPad appears under Devices on the left side when you connect it.  If it does, click on the name of your iPad on the left side and your iTunes sync settings options will appear in folders with tabbed headings to the right.
    If it doesn't appear on the left side, follow the troubleshooting steps shown in this article: http://support.apple.com/kb/TS1538.

  • The simplest way for plsql procedure to return multiple rows

    Hi,
    What is the simplest way for plsql procedure to return multiple rows (records). There are many combination of ways to do it but I am looking for a solution that is appropriate for plsql beginners. Many solutions use cursors, cursor variables, collections and more that kind of things that are complex on the face of it. Is it somehow possible to achieve the same with less effort?
    Sample query would be: SELECT * FROM EMPLOYEES;
    I want to use returned rows in APEX to compose APEX SQL(in that context plsql) report.
    It is enough to use just SELECT * FROM EMPLOYEES query in APEX but I want to use plsql procedure for that.
    Thank you!

    Hi,
    It depends :-).
    With +...that is appropriate for plsql beginners...+ in mind... it still depends!
    The list of techniques (ref cursors, cursor variables, collections, arrays, using explict SQL) you have referenced in your post can be made to work. but...
    +Is it somehow possible to achieve the same with less effort?+ Less effort : That needs to be defined (measured). Especially in the context of pl/sql beginners (who is a beginner?) .
    What is the level of "programming experience" ?
    What is the level of understanding of "Relational Result set" as processible in Oracle?
    If you are looking for
    Process_the_set_of rows_in APEX () kind of capabilitywhich "abstracts/hides" relation database from developers when working on relation database, it may not be the best approach (at least strategically). Because I believe it already is abstracted enough.
    I find REF CUROSOR most effective for such use, when the "begginer" has basic understanding of processing SQL result set .
    So in a nut shell, the techniques (that you already are familiar with) are the tools available. I am not aware of any alternative tools (in pure Oracle) that will simplify / hide basics from develpers.
    vr,
    Sudhakar B.

  • The simplest way to get a line chart

    Hi there. Could You tell me what's the simplest way to get such effect as below:
    http://docs.xuiframework.com/xchart/images/lineChart.jpg
    A piece of code would be very helpful. I'm not thinking of GFW_PRES_SHOW FModule, because it has limitations 32 data elements whilst I need more than 32.
    I'd be very thankful for suggestions. Greetings.

    Amitava De
    I need to put chart into screen container
    a®s
    Unfortunately not

  • Password encrypt - looking for the simplest way

    I�m implementing a web application which needs to encrypt the user password and store it in a database... (the classic scenario).
    what is the simplest way to encrypt the user password?
    I need only the encryption method..

    There are several ways: You do a secure hash of the password and store that. Then, when you want to verify the password, you do the same hash of the proposed password and if they match, you call it macaroni. Alternately, you can encrypt the password using DES or some other private key encryption technique. The technique for authentication is the same: encrypt the proposed password and if the cipertext matches that stored in your DB, the user is authenticated.
    You can do an SHA-1 hash or DES encryption using the JCE.
    See here:
    http://www.ja.net/CERT/Belgers/UNIX-password-security.html
    http://www.itworld.com/nl/unix_sec/12062001/

  • I have an old iPhone (3s) that I've now replaced with a newer one.   I would like to use the old iPhone in the same way I do an touch.   When I plug it into my Mac laptop, there is no recognition on my computer of this old iPhone.   What can I do?

    I have an old iphone that I've replaced with a newer one :-) and I'd like to use the old one in the same way I do an itouch.   When I plug it into my Mac laptop, there is no recognition of it as a device.   Help!   What do I do????

    http://support.apple.com/kb/ht3406

  • Is the a way to restore my iPhone 5 when it is no longer activated since i erased all content and data it keeps giving me this window that says my simcard is not recognizable does anyone know what to do?

    is the a way to restore my iPhone 5 when it is no longer activated since i erased all content and data it keeps giving me this window that says my simcard is not recognizable does anyone know what to do?

    Unfortunately yes, though technology would never move on if it kept to older standards and did not strive to do more.
    The app store always gives you the option to use a previous version of the app IF it is available for your device.
    Sorry but you are stuck without new hardware.
    PJRS

  • What is the best way to charg my ipod tuch is it bad to kill the batery fully our leve it in the red pleses get back to me asap thxs

    what is the best way to charg my ipod tuch is it bad to kill the batery fully our leve it in the red pleses get back to me asap thxs
    pleses i dont want to distroy my ipod thxs
    chad

    Whatever you do in terms of charging will not destroy your iPod.
    Many people charge when it's convenient. Others just connect the iPod for syncing to the computer and leave it charging overnight, regardless of the ramaining charge level. Life of modern batteries is measured in full charge cycles. A charge cycle is either a full charge or any combination of small charges that adds up to 100% charge.
    The only real recommendations I've seen (including from Apple) is to keep the batteries away from heat and have a full charge once a month. For this, discharge the battery to about 20%, then fully charge.

  • My Mum( a pensioner) is wanting to purchase both an iPhone and iPad.  What is the best way for her to manage her data /calls/txt etc. obviously the cost needs to be as low as possible.  Currently does not have WiFi but uses dongle

    My Mum( a pensioner) is wanting to purchase both an iPhone and iPad.  What is the best way for her to manage her data /calls/txt etc. obviously the cost needs to be as low as possible.  Currently does not have WiFi but uses dongle

    My Mum( a pensioner) is wanting to purchase both an iPhone and iPad.  What is the best way for her to manage her data /calls/txt etc. obviously the cost needs to be as low as possible.  Currently does not have WiFi but uses dongle

Maybe you are looking for

  • How to find out who has released the purchase order?

    Hi All, I have a PR number lets say 10231322 and somebody has release it. Could any one please tell me how to find out who has release it? Waiting for your kind replies...... Thanks in advance. Regards, Faisal

  • Declare global table in web dynpro

    Hi, How can I declare a global table in web dynpro?

  • Changing profile/user name

    Hello, I would like to change my community username, as it is currently my full name (which shows up in Google search results). In the event that a username cannot be changed, then I will instead request that my community account be deleted entirely.

  • Premiere Pro CS3 shutting down

    Sorry to ask such a simple question, but I am new to Premiere Pro CS3.  Basically, whenever I start it up, I get to the point of importing some video (a small file), and then it seems like 3 out of 4 times when I try to do anything with the program a

  • Upgrading CS4 from CS or CS2

    I would like to upgrade to PS CS5. I have CS, which from its absence on the upgrade eligibility charts suggests it is not upgradeable. Maybe this is a stupid question but does Adobe ever relax their upgrade policies on a one-on-one basis? If not, the