This should be very simple...

using the usb 9171 chassis and a ni-9411 module and Labview 2012
I have one reflective optical reader wired to the 9411.
this is mounted to the side of a conveyor bed to detect boxes passing by
I've been trying to setup a VI to count the number of boxes that pass by the optical reader (that part is the easy part) but to also give me a gage that tells me boxes per minute (which could be as low as 1 box passes by per minute or up to 60 boxes per minute)
any help??

You could set up a frequency measurement task to do this.
The tricky part is that the read is a blocking call--it waits until you have a sample available which only happens when a box passes by (starting with the 2nd box, the frequency measurement is computed by inverting the time between consecutive boxes).  You don't want to be stuck inside the DAQmx Read call for up to 1 minute.  A few ways to go about this:
You can set the read timeout to some low value and discard the timeout error (-200284).  If you're using too much CPU you might need to add a wait to your loop in the timeout case (or maybe this is one of the rare times that setting the DAQmx Read Wait Mode to "Sleep" might actually help).
You could poll the available samples per channel property to see when to read, but unfortunately polling available samples per channel does not query the onboard FIFO or initiate a transfer back to the software buffer (last I checked), so you'll be reading "0" for quite some time until the on-board FIFO starts filling up, at which point a large chunk of data will be transferred back to the DAQmx buffer in PC memory at once.  Note that this does not apply to PCI/PCIe DAQ devices which transfer data to the PC buffer pretty much as soon as possible--USB and Ethernet devices try to minimize the overhead of unnecessary data transfers but in this case it is a hindrance.
Using the DAQmx Every N Samples event has the same problem as #2.
Reading -1 samples returns whatever is in the DAQmx buffer in PC memory, so it also has the same problem as #2 (the read will return 0 samples until the hardware decides to transfer the data over to the PC).
In your case, you might have luck with #2, #3, or #4 by setting the CI.DataXferReqCond to "Onboard Memory not Empty", but without being able to validate any of these workarounds I think I'm just going to recommend you use suggestion #1:
You can either run this task in addition to your current edge count task (there are 4 counters on the 9171 which should be plenty given you can only have 1 module), or you can run it instead of it (poll back the Total Samples per Channel and add 1 to determine the count of boxes, however you wouldn't be able to distinguish between 0 and 1 boxes this way since the first sample is returned after the 2nd box passes).
Best Regards,
John Passiak

Similar Messages

  • Okay.... this should be very simple

    when i click on a text file... .php or .tcl or .c or whatever.... when i click on the source file i want it to open in a new console window in vi ....
    except from the command line i can;t even FIND vi or vim or gvim on this box...
    so, how do i associate text files with a given extension with vi (or the mac equivalent) so i can get some work done????

    The extension is of little relevance in Mac world. Find the file you want to open, Highlight it. Cick cnd+I. In the box that opens, down click the Open With triangle. Either select the applicatrion you want, or navigate to the application you want to open this. Thyen, hot "Change All.
    Is this what you want. I really have no idea what all the extensions are.

  • I am still having issues with the TOC. I finally got several chapters and sections to show different pictures in the TOC, but have spent hours trying to figure out how to repeat it. This should be so simple. Is there an update? Please help us Apple.

    I am still having issues with the TOC pictures. I got several chapter/section photos to show up, but can't seem to repeat this success. It is some mystery that happened during a time that I had practically given up. This should be such a simple thing. Drag and place a picture into the placeholder and it shows up in the TOC....right? Help, help help! want to get this thing done and it's taken two days of work just get some of the photos to show up. I am going to have to publish this ibook with no photos in several sections.....why can't this be simple? I have even had someone else spend hours trying to figure this out. This software is such a GREAT idea....come on...help with this little part of it.

    I had the same problem myself. I got to the point where I couldn't replace the photo, of a new chapter, in the TOC. What I did was to duplicate an existing chapter that was working and was able to replace it's TOC's photo. I also found that if you try different areas of the photo you can sometimes get it to replace correctly. For example, instead of dragging the new photo to the middle of an existing photo, try dragging it to the right top corner.

  • This is a very simple question,but I don't know.Please me.Thank you!

    I am a Chinese student in a university.I have a very simple question to ask.
    I have writed a EJB module,and I have deployed to Weblogic8.1 successfully.
    1.Now I want to write a client program.Is it necessary that the client program is packaged in the EJB package.For example ,the EJB package is Beans,is "package Beans " or "import Beans.*" necessary in my client program.
    2.If I only know the EJB interfaces,that means the EJB module is writed by other programer.I want to know how I can write the client program.How can I call EJB module's method writed by other programer.Could you give me a simple example?
    Thank you very much.

    I have writed a EJB module,and I have deployed to
    Weblogic8.1 successfully.:-)
    1.Now I want to write a client program.Is it
    necessary that the client program is packaged in the
    EJB package.For example ,the EJB package is Beans,is
    "package Beans " or "import Beans.*" necessary in my
    client program.You need not package your client with the EJB. It can be a JSP/servlet or a stand-alone application.
    2.If I only know the EJB interfaces,that means the
    EJB module is writed by other programer.I want to
    know how I can write the client program.How can I
    call EJB module's method writed by other
    programer.Could you give me a simple example?
    import java.util.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import examples.*;
    class TestEJBHello {
        public static void main(String[] args) {
            Context context   = null;
            Object object     = null;
            // Hashtable for environment properties.
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            env.put(Context.PROVIDER_URL, "t3://localhost:7001");
            HelloHome home            = null;
            HelloWorld hello          = null;
            try {
                context     = new InitialContext(env);
                object      = context.lookup("HelloWorldTest");
                System.out.println(" JNDI Looked up >>> " +object);
                home        = (HelloHome)PortableRemoteObject.narrow(object, HelloHome.class);
                hello       = home.create();
                System.out.println(hello.hello());
            } catch(Exception e) {
                e.printStackTrace();
            } finally {
                close(context);        // Closes the initial context.
        private static void close(Context context) {
            try {
                context.close();
                System.out.println("*** Context closed. ***");
            } catch (NamingException namingException) {
                namingException.printStackTrace();
            } catch(Exception exception) {
                exception.printStackTrace();
    }Here's a sample client app code I use for a HelloWorld EJB. You need to have a EJB client JAR containing the home and remote interfaces in the classpath during compile time and runtime.
    x

  • BreezySwing help requested (should be very simple)

    My final project for my beginning programming class is to create a calculator, much like the one built into Windows. It only needs to do what the basic one does, not the scientific.
    All I have so far is the GUI. The buttons do nothing yet.
    ////////////////////////////-A-//////////////////////////////////
    ///////////////////////-CALCULATOR-//////////////////////////////
    //////////////////////-FINAL PROJECT-////////////////////////////
    //////////////////////////-FOR-//////////////////////////////////
    ///////////////////////-MR. KAU'S-///////////////////////////////
    /////////////////-INTRODUCTION TO COMPUTERS-/////////////////////
    //////////////////////////-CLASS-////////////////////////////////
    //Imports
    import javax.swing.*;
    import BreezySwing.*;
    //Title
    public class Calculator extends GBFrame{
    //Vars
    private JButton CB, SevenB, EightB, NineB, DivideB, SquareRootB,
    FourB, FiveB, SixB, TimesB, PercentB, OneB, TwoB, ThreeB, MinusB,
    OneOverXB, ZeroB, NegativeB, DecimalB, AddB, EqualB;
    private DoubleField Window;
    //Constructor
    public Calculator(){
    //Fields
    Window = addDoubleField   (0    ,1,1,5,1);
    //Buttons
    CB = addButton ("C" ,2,3,1,1);
    SevenB = addButton ("7" ,3,1,1,1);
    EightB = addButton ("8" ,3,2,1,1);
    NineB = addButton ("9" ,3,3,1,1);
    DivideB = addButton ("/" ,3,4,1,1);
    SquareRootB = addButton ("sqrt" ,3,5,1,1);
    FourB = addButton ("4" ,4,1,1,1);
    FiveB = addButton ("5" ,4,2,1,1);
    SixB = addButton ("6" ,4,3,1,1);
    TimesB = addButton ("*" ,4,4,1,1);
    PercentB = addButton ("%" ,4,5,1,1);
    OneB = addButton ("1" ,5,1,1,1);
    TwoB = addButton ("2" ,5,2,1,1);
    ThreeB = addButton ("3" ,5,3,1,1);
    MinusB = addButton ("-" ,5,4,1,1);
    OneOverXB = addButton ("1/x" ,5,5,1,1);
    ZeroB = addButton ("0" ,6,1,1,1);
    NegativeB = addButton ("+/-" ,6,2,1,1);
    DecimalB = addButton ("." ,6,3,1,1);
    AddB = addButton ("+"  ,6,4,1,1);
    EqualB = addButton ("=" ,6,5,1,1);
    //Button Method, yo
    public void buttonClicked (JButton buttonObj){
    //EXE-CUTE-R OLO!!1!
    public static void main (String[] args){
    Calculator SCGUI = new Calculator();
    SCGUI.setLookAndFeel("MOTIF");
    SCGUI.setSize (250, 250);
    SCGUI.setVisible (true);
    } I'm sure there are easier ways to go about it than using BreezySwing, but that's what we were taught with, so... :sweat:
    I'm drawing a total blank on how to do this with a single Field. If someone could guide me in the correct direction, it would be much appreciated. I'm not asking for someone to finish my program, maybe just make it so it will add, and from that I'll figure out the division, multiplication, sqrt, etc. etc.
    Thanks in advance.

    Alright.
    I now seem to have come across a different problem. Being VERY new to Java, I am unable to make it so that the numbers 'add up' so to speak in the field. I press 5 and 5 shows up. I press 6, and 6 replaces the 5.
    if (buttonObj == TwoB){
    Window.setNumber(2.0);
    }I know that using setNumber will end up replacing it, but I'm not even sure how to get it so that when I press the 5 key, then the 6 key, that 56 will be in the field.
    Would I use getNumber, and then somehow add the setNumber? Should I not use setNumber at all?

  • I think this should be a simple question

    I doing a slide show of 20 slides and need them to be 20 seconds long. All my slides are done and I am having a bit of a hard time finding where I can set the timing per slide. I've got some builds on a few slides. Those are the only ones that stay up longer.
    Seems simple enough. Apple just works...right?
    This is for Pecha Kucha night.

    Greeting and Welcome to the Forum:
    In the Inspector > Slide > Transition menu, after you designate the Effect you want for the Transition, set the Start Transition window to Automatic and the Delay to 20 seconds. For those slides with Builds, you may need to adjust this Delay setting to achieve the pacing that you desire. With a little trial-and-error you should be able to get everything flowing properly.
    Good luck.

  • This should be a simple function but...

    i cant seem to figure it out.
    Hi everyone!
    I am working on a spreadsheet to help keep track of my finances but cannot figure out one very important formula. Heres an example of what i want to do. In cell A1, I've got the balance of my auto loan. In column C I've got a drop down menu of various bill; in the adjacent column i enter the amount I've paid towards that bill for that month. So when I select "Auto Loan" from the pull down menu, i want it to subtract the amount in the adjacent column from the amount in A1. I've tried using the VLOOKUP formula, however, this only returns one value, even when there is more than one cell with the matching criteria. I need it to return the sum of these cells.
    Can anyone help? Thanks! Rob

    Hi,
    I'm not sure how your table is formatted, but I thought this might illustrate a solution. I'm assuming that columns C contains all manner of daily expenses, food, clothing gas utilities, etc. I'm also assuming you are interested only in the "current" balance of you car payments, not intermediate balances from the initial amount. The formula is:
    =Auto Loan Balance Initial Balance-SUMIF(Expense,"Auto Loan",Monthly Payment)
    pw

  • HT1386 I cannot sync the calendar on my MacBook Pro with either iPhone 4s or my iPad -I followed the apple instructions to sync but the data is not registering. Sorry if this is something very simple!

    The info screen says my calendars are being synced over iCloud which they aren't pluse I want to sync them via the usb connection - how do i change that setting? Thanks

    Hello Danny,
    Thank you for using Apple Support Communities!
    I found this article for you to help troubleshoot why the calendar data is not syncing over to your devices.
    It is named Mac OS X: Resetting the SyncServices folder found here http://support.apple.com/kb/TS1627.
    There are different instructions depending on your OS in the article.
    If for some reason the issue persists, I would take a look at the article named Sync Services: Advanced troubleshooting for contact and calendar syncing located here: http://support.apple.com/kb/ts2481.
    All the very best,
    Sterling

  • Simple xerces DOMParser.  Why won't this validate? Very simple, xml schema

    I have written a java program called "Validate.java" to validate an xml file. The program uses the xerces DOMParser. When I try and validate a correct .xml file with a correct schema in an .xsd file I get the following errors:
    [Error] Document is invalid: no grammar found. line 2 column 6 - name5.xml
    [Error] Document root element "name", must match DOCTYPE root "null". line 2 column 6 - name5.xmlThe XML file, the XSD file, and the Validate.java program are all in the same directory. My CLASSPATH includes xml-apis.jar, xercesImpl.jar, and xercesSamples.jar.
    Here is the xml file (name5.xml):
    <?xml version="1.0"?>
    <name
        xmlns="http://www.myOwnURL.net/name"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.myOwnURL.net/name name5.xsd"
        title="Mr.">
      <first>John</first>
      <middle>Fitzgerald</middle>
      <last>Doe</last>
    </name>(I saved the file in the UTF-8 encoding, which causes it to look double spaced in some text editors.)
    The schema is in the following xsd file (name5.xsd):
    <?xml version="1.0"?>
    <schema
        xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.myOwnURL.net/name"
        xmlns:target="http://www.myOwnURL.net/name"
        elementFormDefault="qualified">
      <element name="name">
        <complexType>
          <sequence>
            <element name="first" type="string"/>
            <element name="middle" type="string"/>
            <element name="last" type="string"/>
          </sequence>
          <attribute name="title" type="string"/>
        </complexType>
      </element>
    </schema>(Again, the file is saved in UTF-8 format.)
    Here is the code for Validate.java:
    public class Validate implements org.xml.sax.ErrorHandler
        private String instance = null;
        private int warnings = 0;
        private int errors = 0;
        private int fatalErrors = 0;
        private org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
        public Validate() // constructor
            parser.setErrorHandler(this); // Set the errorHandler
        public void setInstance(String s)
            instance = s;
        public boolean doValidate()
            try
                warnings = 0;
                errors = 0;
                fatalErrors = 0;
                try
                    // Turn the validation feature on
                    parser.setFeature( "http://xml.org/sax/features/validation", true);
                    // Parse and validate
                    System.out.println("Validating source document...");
                    parser.parse(instance);
                    // We parsed... let's give some summary info of what we did
                    System.out.println("\nComplete " + warnings + " warnings " + errors + " errors " + fatalErrors + " fatal errors");
                    // Return true if we made it this far with no errors
                    return ((errors == 0) && (fatalErrors == 0));
                catch (org.xml.sax.SAXException e)
                    System.err.println("\nCould not activate validation features - " + e.getMessage());
                    return false;
            catch (Exception e)
                System.err.println("\n"+e.getMessage());
                return false;
        public void warning(org.xml.sax.SAXParseException ex)
            System.err.println("\n[Warning] " + ex.getMessage() + " line " + ex.getLineNumber()
            + " column " + ex.getColumnNumber() + " - " + instance);
            warnings++;
        public void error(org.xml.sax.SAXParseException ex)
            System.err.println("\n[Error] " + ex.getMessage() + " line " + ex.getLineNumber()
            + " column " + ex.getColumnNumber() + " - " + instance);
            errors++;
        public void fatalError(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
            System.err.println("\n[Fatal Error] " + ex.getMessage() + " line " + ex.getLineNumber()
            + " column " + ex.getColumnNumber() + " - " + instance);
            fatalErrors++;
            throw ex;
        public static void main(String[] args)
            Validate validate1 = new Validate();
            if (args.length == 0)
                System.out.println("Usage : java Validate <instance>");
                return;
            // Set the instance
            if (args.length >= 1) validate1.setInstance(args[0]);
            // Validate (the doValidate returns either true or false depending on
            // whether there were any errors.)
            if (!validate1.doValidate()) return;
    }My question is: why do I get those errors??? Why doesn't everything just validate like it is supposed to??? Also, why does the error even mention DOCTYPE -- I thought that was for DTDs, and I am using XML Schema.
    I will be very grateful to anyone who can tell me what is going on here.
    Thanks,
    Jon

    I have solved my problem. I just needed to add the following line to my java program:
    parser.setFeature("http://apache.org/xml/features/validation/schema", true);I'm still not sure how I was supposed to know this, however. I guess spending three hours searching on google is what you are supposed to do. Also, I was thrown for a bit of a loop by the following official faq found at http://xml.apache.org/xerces2-j/faq-pcfp.html:
    [faq]
    Question: How can I tell the parser to validate against XML Schema and not to report DTD validation errors?
    Answer: Currently this is impossible. We hope that JAXP 1.2 will provide this capability via its schema language property. Otherwise, we might introduce a Xerces language property that will allow specifying the language against which validation will occur.
    [faq]
    I am very new to XML (less than a week), but that FAQ sure makes it sound like using only XML Schema and completely avoiding DTDs is impossible. On the other hand, I think that is what I was able to achieve by adding the above line to my code.
    Oh well.
    Jon

  • This should be a simple answer to a simple question.

    Hey gurus,
    I've looked all over this Forum and the JDeveloper 9i tutorial but I can't figure out how to disable the picklist box from my resultset. The searchable object is assigned to "MessageChoice" for the search option but that picklist value shouldn't be showing up in the resultset. I've tried all reconfiguring many of the options in the Property Inspector but nothing works.
    Thanks,
    -Scott

    Which technology set are you using? Are you using OAF - if this is the case try the OAF specific forum.
    http://forums.oracle.com/forums/index.jspa?categoryID=84

  • This is a very simple question about multi-channel audio playback

    I have an mp4 file that i made and i made it 7.1 surround sound, and i'm pretty sure that this 7.1 surround sound works, as it can be played in VLC. i'm using netstream to load my files now. How do i make it so that flash can playback all 8-channels of sound? I suppose kglad would know the answer

    Flash doesn't support multi-channel audio (yet?)

  • This should be a simple AFP script..but no..

    Ultimately I'm trying to write this script to turn AFP on when it suddenly shuts off. However, I thought I would start easy and just use an echo command for the then statement.
    Anyway, if I use the spaces by the "=" in the "if" statement, then the script just exits and does nothing. However, if i take the spaces out, the script always does the then statement, regardless if the "if" part is true or not.
    So what am I doing wrong?
    #!/bin/sh
    if [ ps cx | grep AppleFileServer = "" ]
    then
    echo Not On!
    fi
    exit
    Thanks!!

    #!/bin/sh
    if [[ `ps cx | grep AppleFileServer` = "" ]]
    then
    echo "Not On!"
    fi
    exit 0
    I made 4 changes. The double square brackets in the test statement, the backticks around the ps|grep, double quotes on the echo string, and a 0 for the exit status. The tab in front of the echo statement is just for aesthetics.
    Roger

  • This should be rather simple...

    Hello, I'm new to Dreamweaver and a novice website builder. I
    have a website that I've designed in a table. The top two rows
    remain the same on every page as well as the navigation running
    down a column on the left side. Is there a way to setup a script
    where you could click on a navigation button and the content/text
    would change in the adjoing cell to the right?
    I'm sure I'm forgetting some crucial information here, so
    feel free to ask for more detail.
    Thank you for your help in advance!

    That would be frames... DO NOT USE FRAMES!
    SSI (Server Side Includes) would be your best bet. You can
    create your menu
    on the left side and your headers at the top. In reality the
    whole page
    will change but the effect will be the same.
    Study up on html code, SSI and CSS styling.
    The greatest advantage is that you can modify your menu, put
    only that file
    to the server and every page on your site will be instantly
    updated without
    ever touching them.

  • This should be a simple question...

    how do you change the music that plays during a photo slideshow in front row? thanks.

    yes, it can be deleted.
    http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh2284.html

  • Very simple question from a beginner

    I am currently doing a little exercise, but I ran into a problem. I have written a class that supports operations on rational number. The fields are two long variables, one each that stores the numerator and denominator.
    I have made add, subtract, multiply, and divide methods...
    1. what I need help in is: beingh able to store the rational number in reduced for, with the denominator always positive
    2. constructing a toString method, equals method, and compareTo method.
    3. it also says "make sure the toString method correctly handles the case in which the denominator is zero by throwing an exception.
    I have been working on this for a long time now, an I am stuck at this point.
    I know this will be very simple for you guys and gals, but I am a beginner. Please offer some input, advice, and/or some code to help me get past this problem.
    Thanks so much,
    Jason

    ok, here is what I have so far
    public class Rational {
         public long num, den;
         public Rational(long n,long d) {
              this.num = n;
              this.den = d;
         public static void main(String args[]) {
              Rational r = new Rational(1,2);
              Rational s = new Rational(3,4);
              Rational rmuls = r.multiply(s);
              Rational rdivs = r.divide(s);
              Rational radds = r.add(s);
              Rational rsubs = r.subtract(s);
              r.print();
              s.print();
              rmuls.print();
              rdivs.print();
              radds.print();
              rsubs.print();
         public void print(){
              System.out.println(this.num+ "/" +this.den);
         public Rational multiply(Rational t){
              long n;
              long d;
              n = this.num*t.num;
              d = this.den*t.den;
              Rational answer = new Rational(n,d);
              return answer;
         public Rational divide(Rational t){
              long n;
              long d;
              n = this.num*t.den;
              d = this.den*t.num;
              Rational answer = new Rational(n,d);
              return answer;
         public Rational add(Rational t){
              long n;
              long d;
              n = (t.den*this.num)+(t.num*this.den);
              d = t.den*this.den;
              Rational answer = new Rational(n,d);
              return answer;
         public Rational subtract(Rational t){
              long n;
              long d;
              n = (t.den*this.num)-(t.num*this.den);
              d = t.den*this.den;          
              Rational answer = new Rational(n,d);
              return answer;
         //public int compareTo (Rational t)??????

Maybe you are looking for

  • New MacBook Pro cannot connect to internet

    I've helped setup 2 MBP this week. Each of them could not connect to the wireless internet in my office using DHCP. In both cases I had to make a network setting of DHCP with manual address (I used 192.168.1.150 since my network is 192.168.1.x) and I

  • Not to hide the report when after applying in the filter

    Hi Experts, I have created the two reports in one tab one is present year report and another one is previous year report,In this the present year is should Get view and previous year report used by collapsible (+) in css style i have given as display

  • BAPI Receives unreadable parameters after unicode conversion

    Dear All, I have a strange issue, which i am stuck with and need your help to solve this. I have a BSP Application which resides in my BW Production system and it calls a custom BAPI in R/3 to fetch list of materials based on material-text search as

  • PDF in bestimmter Reihenfolge zusammenführen

    Moin, Moin und Gruß aus Hamburg! Sorry das ich meine Anfrage hier nur in deutsch stellen kann, aber mit englisch kann ich leider nicht dienen. Wir setzen in der Firma den Acrobat 9 ein um Dokumente zu scannen und zu archivieren. Gescannt wird mit dem

  • Re: access number inoperative

    I'm in Vancouver BC and also cannot get my access number to work.  Fast beeping sound.