I am trying to write a double buffered data acquisition program using MFC and a callback function.

i am trying to do a double buffer data acquisition using MFC application framework in Visual Studio.i want to use a callback function to notify when the buffer is half full.do you have some sample reference program that can help me?

What DAQ board are you using? When you installed NI-DAQ you should have selected to install the support files for VC++. Then there will be several examples on how to do double buffered data acquisition.
If you have already installed NI-DAQ 6.8 or higher and did not select to include the support files, you can run the NI-DAQ setup program and just add them. If you are using an older version, you will have to uninstall and reinstall.
Once you have the support files, follow this path to the examples.
>>Program Files>>National Instruments>>NI-DAQ>>Examaples>>Visual C>>
If you are doing digital acquistion, goto the di folder, if you are doing analog acquisition goto the ai folder.
As for the callback function, you can use the NI-DAQ function Config_DAQ_
Event_Message with DAQEvent Type = 1, where N would equal half your buffer.
Brian

Similar Messages

  • I am trying to open a .tiff file in photoshop by using bridge and it opens it as a photo in windows. If I go to file open it says could not complete request because it is not the right type of document. It is a file from a lesson folder from school. Can a

    I am trying to open a .tiff file in photoshop by using bridge and it opens it as a photo in windows. If I go to file<open it says could not complete request because it is not the right type of document. It is a file from a lesson folder from school. Can anyone help me?

    Hi,
    The D810 requires Camera Raw 8.6 or later - the latest version that is compatible with Photoshop Elements 12 is Camera Raw 8.5 as far as I can see.
    You need to either buy a new version of Photoshop Elements or use the free Adobe DNG converter.
    DNG  Converter 8.8
    Win – http://www.adobe.com/support/downloads/detail.jsp?ftpID=5888
    Mac – http://www.adobe.com/support/downloads/detail.jsp?ftpID=5887
    Useful Tutorial
    http://www.youtube.com/watch?v=0bqGovpuihw
    Brian

  • Can PCI 6031E handle multi-buffered data acquisition

    If so can anyone send me some instructions or LabView code. Thank you in advance.

    Greetings,
    The PCI-6031E can handle single or double buffered acquisitions. The two best sources for examples and instructions are LabVIEW itself and our web site. Go to the "Help -> Find Examples" pull-down menu in LabVIEW to search for shipping examples. Look in the folder "Hardware Input and Output -> DAQ -> Analog Input -> General." Here you will find many analog input examples. Specifically, you should pay attention to the ones with "buffered" in the title.
    In addition to LabVIEW itself you will find our web site's Developer Zone extremely useful.
    Development Library
    http://zone.ni.com/devzone/devzone.nsf/6ae7945502d89dea0625685500506e1f/4d58b1b80ec41ef70625683f006e1d6d?OpenDocument
    Regards,
    Justin Britten
    Applications Engineer
    Nati
    onal Instruments

  • Need to write a report to show who is using SAP and to what extent

    Hi Experts,
    I need to write a report which should display who are using SAP and to what extent to forcast future SAP license needs...
    and to ensure the compliance by allocating license types correctly.
    My report should helpfull to organization to reduce the current license requirements and costs.
    Actually my problem is where can i get all these details in SAP, means from which tables.
    in which table can we get the sap user ids using mail id...
    Thanks in advance........
    Ram

    Hi gajeramesh ,
    Goto transaction 'SU10'
    Here you have all the data selection regarding a particular user id, so what you can do is do F1 on any of the fields and see the technical help in that for the table names.
    some of the tables are :
                                     1) 'USUSERS'(User: Transfer structure for lists of users),
                                     2) 'USER_ADDR' (Users by address data)
                                     3) 'USUSERALL' (Users with All Data for List Output)
    I hope this helps you  !!

  • Buffered Data Acquisition at different rate

    Hi,
    I have a pb with my data acquisition : I'm using a PXI-4472 AI card and continuous acquiring data to file.
    Until now all channels are acquired at the same frequency : Ok. I know this card does not support multi-frequency acquisition.
    But I want save data at different rate : ex : first channel at the frequency desired (ex 10 KHz), second channel at frequency /2 : 5 Khz ... to reduce amouth of data in the saved file.
    I know the amouth of data retrieve et each AI-Read (ex 2048 scaled data / channel), and the frequency divisor / channel.
    What's the best way (performance) to process the scaled data tab (2 dim) from the AI-READ to save it in the file (using Write File +) with frequency divisor consideration.
    And how to re
    ad the data in the saved file after.
    Can you send me an example please ???
    Thanks
    Eddy DUCHENE
    12 F Chemin de Boutary
    69300 CALUIRE ET CUIRE
    [email protected]

    Hi kdm,
    please stick in one thread for the same topic!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Double page spread - but only using 1 and a half pages

    Hi there smart people who use Aperture.
    I'd like to create a double page spread in an Aperture book where the image only goes half way across the second page. Is this possible? I can't seem to enlarge an image so it crosses onto the second page, and I can't seem to reduce the size of an image that's inserted into a double page spread. Hope that makes sense and someone can help.
    Thanks,
    gtmonkey

    Hi again RB - thanks again for helping.
    I can't seem to open your page today, but I was able to see it last night and confirm that you can do what I'm trying to do.....lucky guy!
    I'm still using Aperture 2.1 - maybe that's why I can't resize those pages?
    However, I have discovered that if I drop a new image frame over the old one on the double page spread, I can play with that as much as I want. I can then delete the old image frame (the one that wouldn't resize) and get the result I want. That should do the trick.
    Thanks again for your help though....
    GT

  • It keeps trying to update but then says that the program is running and can't update then goes into a loop with these two boxes.

    I tried to Google a topic but when I clicked on the topic I wanted it posted a popup that said it had to update Firefox, followed immediately with a box that says it can't update firefox as it is running. These two boxes keep popping up as soon as you close the other one in one giant loop. I can only turn it off by shutting down the computer. I didn't have Firefox running when I tried to google the topic.

    If there are problems with updating or with the permissions then easiest is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox program and save the disk image (dmg) file to the desktop
    *Firefox 8.0.x: http://www.mozilla.com/en-US/firefox/all.html
    *Trash the current Firefox application to do a clean (re-)install
    *Install the new version that you have downloaded
    Your profile data is stored elsewhere in the Firefox Profile Folder, so you won't lose your bookmarks and other personal data if you uninstall and (re)install Firefox.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox

  • Am trying to get my Ipad1 to work via AirPrint using Pages and a Canon MG8250 printer. My iMac works ok  but the iPad attempt results in the printer trying to use the rear paper tray rather than the lower paper drawer. All drivers and firmware are latest

    My set up is Imac + Ipad1 + canon MG8250 printer. Wireless network. airprint in use and functions fine with the Imac. The Ipad initiates printing ok but always faults out with the error 'Printer out of paper' because it tries to use the rear paper tray (special paper ) instead of the paper drawer. 

    Johnmac@47-
    Could the iMac have printed something that required use of the rear tray?  That might have reset the printer's default.  Look in the printer manual to see if it has a setting to change the default paper tray.  (Note that the iMac does not use AirPrint, it uses the printer's native printing language.)
    Your problem may be a flaw in the Canon AirPrint implementation.  I suggest you report it to Apple at <iPad Feedback>, as well as to Canon.  There may be a simple correction that can be made to either the next iOS update or to the Canon printer firmware.
    Fred

  • I'm trying to buy the $99/yr iOS Developer Program in Canada, and trying to pay with a $100 Mastercard Gift Card, why is my payment not authorized and failing?

    Title says all..
    Program is $99 Canadian, and my card was just loaded with $100.
    Please let me know.

    The problem is you can't use a gift credit card.
    It has to be a card registered to you at your home address.

  • I have an apple account but i am trying to purchase something on a device ive never used before and its asking me these security questions i dont know. how do i reset the questions or get rid of them

    help plz

    Hi
    This should helps you reset your security questions:
    http://support.apple.com/kb/ht5312
    Hope this helps

  • I have created a doc in pages on my Imac and saved it to dropbox.  I tried to open it on my Ipad from dropbox using pages and it will not open

    I have been creating docs on my imac with pages and saved them to dropbox and then on my Ipad i go to dropbox and open my doc with pages.  Now with the updated pages on Imac and the new app on Ipad I cannot open the new docs on my ipad I created on my Imac. Help!

    Apple has changed the file formats and some online services are having trouble with them.
    Try Exporting them to Word .docx
    Peter

  • Speeding up FileIO - Double Buffered File Copy?

    We are trying to speed up file copy from disk to tape, and I need a little more speed. I have tried playing with the size of the buffer, but that isn't changing much (makeing it slower if anything).
    I'm trying to make a double buffered file copy and I can't figure out how to do it. I figured this would be a good place to get speed. Right now, my write is very simple:
    byte buffer = new buffer[8 * 1024 * 1024];
    FileInputStream in = new FileInputStream(srcFile);
    while(true) {
      int amountRead = in.read(buffer);
      if (amountRead == -1) { break; }
      write(buffer, 0, length);
    }So what i need to do it be able to read and write at the same time. So I was thinking that I could either make the write method a sperate thread, or some how make threaded buffers that read while the other is being writen. Has anyone tackled this problem before?
    If this isn't the right way to speed up File IO, can you let me know other ideas? Thanks in advance!
    Andrew

    Once again: I wish I could claim credit for these classes, but they were in fact posted a year or so ago by someone lese. If I had the name I would give credit.
    I've used these for two heavy-duty applications with never a problem.
    <code>
    package pipes;
    import java.io.IOException;
    import java.io.InputStream;
    * This class is equivalent to <code>java.io.PipedInputStream</code>. In the
    * interface it only adds a constructor which allows for specifying the buffer
    * size. Its implementation, however, is much simpler and a lot more efficient
    * than its equivalent. It doesn't rely on polling. Instead it uses proper
    * synchronization with its counterpart PipedOutputStream.
    * Multiple readers can read from this stream concurrently. The block asked for
    * by a reader is delivered completely, or until the end of the stream if less
    * is available. Other readers can't come in between.
    public class PipedInputStream extends InputStream {
    byte[] buffer;
    boolean closed = false;
    int readLaps = 0;
    int readPosition = 0;
    PipedOutputStream source;
    int writeLaps = 0;
    int writePosition = 0;
    * Creates an unconnected PipedInputStream with a default buffer size.
    * @exception IOException
    public PipedInputStream() throws IOException {
    this(null);
    * Creates a PipedInputStream with a default buffer size and connects it to
    * source.
    * @exception IOException It was already connected.
    public PipedInputStream(PipedOutputStream source) throws IOException {
    this(source, 0x10000);
    * Creates a PipedInputStream with buffer size <code>bufferSize</code> and
    * connects it to <code>source</code>.
    * @exception IOException It was already connected.
    public PipedInputStream(PipedOutputStream source, int bufferSize) throws IOException {
    if (source != null) {
    connect(source);
    buffer = new byte[bufferSize];
    * Return the number of bytes of data available from this stream without blocking.
    public int available() throws IOException {
    // The circular buffer is inspected to see where the reader and the writer
    // are located.
    return writePosition > readPosition ? // The writer is in the same lap.
    writePosition - readPosition : (writePosition < readPosition ? // The writer is in the next lap.
    buffer.length - readPosition + 1 + writePosition :
    // The writer is at the same position or a complete lap ahead.
    (writeLaps > readLaps ? buffer.length : 0)
    * Closes the pipe.
    * @exception IOException The pipe is not connected.
    public void close() throws IOException {
    if (source == null) {
    throw new IOException("Unconnected pipe");
    synchronized (buffer) {
    closed = true;
    // Release any pending writers.
    buffer.notifyAll();
    * Connects this input stream to an output stream.
    * @exception IOException The pipe is already connected.
    public void connect(PipedOutputStream source) throws IOException {
    if (this.source != null) {
    throw new IOException("Pipe already connected");
    this.source = source;
    source.sink = this;
    * Closes the input stream if it is open.
    protected void finalize() throws Throwable {
    close();
    * Unsupported - does nothing.
    public void mark(int readLimit) {
    return;
    * returns whether or not mark is supported.
    public boolean markSupported() {
    return false;
    * reads a byte of data from the input stream.
    * @return the byte read, or -1 if end-of-stream was reached.
    public int read() throws IOException {
    byte[] b = new byte[0];
    int result = read(b);
    return result == -1 ? -1 : b[0];
    * Reads data from the input stream into a buffer.
    * @exception IOException
    public int read(byte[] b) throws IOException {
    return read(b, 0, b.length);
    * Reads data from the input stream into a buffer, starting at the specified offset,
    * and for the length requested.
    * @exception IOException The pipe is not connected.
    public int read(byte[] b, int off, int len) throws IOException {
    if (source == null) {
    throw new IOException("Unconnected pipe");
    synchronized (buffer) {
    if (writePosition == readPosition && writeLaps == readLaps) {
    if (closed) {
    return -1;
    // Wait for any writer to put something in the circular buffer.
    try {
    buffer.wait();
    catch (InterruptedException e) {
    throw new IOException(e.getMessage());
    // Try again.
    return read(b, off, len);
    // Don't read more than the capacity indicated by len or what's available
    // in the circular buffer.
    int amount = Math.min(len,
    (writePosition > readPosition ? writePosition : buffer.length) - readPosition);
    System.arraycopy(buffer, readPosition, b, off, amount);
    readPosition += amount;
    if (readPosition == buffer.length) {
    // A lap was completed, so go back.
    readPosition = 0;
    ++readLaps;
    // The buffer is only released when the complete desired block was
    // obtained.
    if (amount < len) {
    int second = read(b, off + amount, len - amount);
    return second == -1 ? amount : amount + second;
    } else {
    buffer.notifyAll();
    return amount;
    package pipes;
    import java.io.IOException;
    import java.io.OutputStream;
    * This class is equivalent to java.io.PipedOutputStream. In the
    * interface it only adds a constructor which allows for specifying the buffer
    * size. Its implementation, however, is much simpler and a lot more efficient
    * than its equivalent. It doesn't rely on polling. Instead it uses proper
    * synchronization with its counterpart PipedInputStream.
    * Multiple writers can write in this stream concurrently. The block written
    * by a writer is put in completely. Other writers can't come in between.
    public class PipedOutputStream extends OutputStream {
    PipedInputStream sink;
    * Creates an unconnected PipedOutputStream.
    * @exception IOException
    public PipedOutputStream() throws IOException {
    this(null);
    * Creates a PipedOutputStream with a default buffer size and connects it to
    * <code>sink</code>.
    * @exception IOException It was already connected.
    public PipedOutputStream(PipedInputStream sink) throws IOException {
    this(sink, 0x10000);
    * Creates a PipedOutputStream with buffer size <code>bufferSize</code> and
    * connects it to <code>sink</code>.
    * @exception IOException It was already connected.
    public PipedOutputStream(PipedInputStream sink, int bufferSize) throws IOException {
    if (sink != null) {
    connect(sink);
    sink.buffer = new byte[bufferSize];
    * Closes the input stream.
    * @exception IOException The pipe is not connected.
    public void close() throws IOException {
    if (sink == null) {
    throw new IOException("Unconnected pipe");
    synchronized (sink.buffer) {
    sink.closed = true;
    flush();
    * Connects the output stream to an input stream.
    * @exception IOException The pipe is already connected.
    public void connect(PipedInputStream sink) throws IOException {
    if (this.sink != null) {
    throw new IOException("Pipe already connected");
    this.sink = sink;
    sink.source = this;
    * Closes the output stream if it is open.
    protected void finalize() throws Throwable {
    close();
    * forces any buffered data to be written.
    * @exception IOException
    public void flush() throws IOException {
    synchronized (sink.buffer) {
    // Release all readers.
    sink.buffer.notifyAll();
    * writes a byte of data to the output stream.
    * @exception IOException
    public void write(int b) throws IOException {
    write(new byte[] {(byte) b});
    * Writes a buffer of data to the output stream.
    * @exception IOException
    public void write(byte[] b) throws IOException {
    write(b, 0, b.length);
    * writes data to the output stream from a buffer, starting at the named offset,
    * and for the named length.
    * @exception IOException The pipe is not connected or a reader has closed
    * it.
    public void write(byte[] b, int off, int len) throws IOException {
    if (sink == null) {
    throw new IOException("Unconnected pipe");
    if (sink.closed) {
    throw new IOException("Broken pipe");
    synchronized (sink.buffer) {
         if (sink.writePosition == sink.readPosition &&
         sink.writeLaps > sink.readLaps) {
         // The circular buffer is full, so wait for some reader to consume
         // something.
         try {
         sink.buffer.wait();
         catch (InterruptedException e) {
         throw new IOException(e.getMessage());
         // Try again.
         write(b, off, len);
         return;
         // Don't write more than the capacity indicated by len or the space
         // available in the circular buffer.
         int amount = Math.min(len,
         (sink.writePosition < sink.readPosition ?
         sink.readPosition : sink.buffer.length)
    - sink.writePosition);
         System.arraycopy(b, off, sink.buffer, sink.writePosition, amount);
         sink.writePosition += amount;
         if (sink.writePosition == sink.buffer.length) {
         sink.writePosition = 0;
         ++sink.writeLaps;
         // The buffer is only released when the complete desired block was
         // written.
         if (amount < len) {
         write(b, off + amount, len - amount);
         } else {
         sink.buffer.notifyAll();
    </code>

  • Double Buffering +MVC

    been trying to implement double buffering but to no avail, have read a lot of articles online about implementing double buffering which seems relitivly straight forward and code that I developed matches what they have; the only problem that I have is that it is not calling update(graphics g) to get it to repaint, but instead calls update(Observable arg0, Object arg1) which I use for my mvc implementation. I've been toiling wiht this for days and not getting anywhere with it.
    Any Ideas - on how this could be resolved??
    TIA

    i'm using swing, Then your question should be posted in the Swing forum.
    but doesn't call the update method that I have overriddenI don't know why you are overriding update(). If you want a component to repaint itself then you use the repaint() method.
    This posting, from the Swing forum, has a couple examples of animation.

  • I'm trying to write an Applescript: when I add a file to a folder, I want finder to name it "1" and increment the other files in the folder by 1. i.e. once I drop a new file into the folder, the file originally called "1" will be renamed "2" etc

    I'm trying to write an Applescript. I have never used Applescript but my boss has just asked me to write a script so I dutifully nodded and said "Yes Boss"...
    The funtionality I need is that I want finder to rename the files in folder when I drop a new file in. When I add the new file (file neame: "1") to a folder, I want to increment the other file names in the folder by 1.
    So when I drop a my new "1" file into the folder, the file original file called "1" will be renamed "2", the original file named "2" will be renamed "3" etc
    I'm creating a 'stream' of images. When I add a new image i want it to nudge the other images in the folder along.
    Thanks guys!

    Maybe this will help. If you monitor the "More Like This" box (top right), other threads appear. Opening them usually displays other threads.
    https://discussions.apple.com/message/1986834#1986834

  • How can I do a buffered digital acquisition on a single line?

    I am using a NI PCI 6110 DAQ and I need to do a continuous buffered data acquisition (sample rate near or above 5 kS/s). The thing is, the acquisition must be done on a single digital line. Some other lines of the digital port are used for something else (some in write mode, others in read), so they have to remain unaffected by the process.
    It would certainly be better if it could acquire data at the same speed as an analog input (which will be executing at the same time). In fact, it would have been much easier to only add a channel to the AI and I would have got exactly the results I want, but all the AI (4) of the board have already been used .
    The picture I uploaded shows what I'm tryi
    ng to do: I acquire analog data and I want to automatically show the moment a deconnection occured. The purple/pink line, which I added manually, is the one causing me trouble. It shows the voltage (0-5V) of the relay doing the deconnection (that's why it have to be done at the same time than an AI data acquisition).
    Thanks for reading this to the end
    Attachments:
    Graph.jpg ‏55 KB

    Well, you can't get hardware-timed DIO with the 6110, but you can probably use its counters to capture the timestamp you need.
    One method would be to set up a buffered edge-counting task. The analog input's sample clock would be specified as the source signal. This will cause the counter's value to increment at the beginning of each sampling cycle, acting as a measure of time from the start of analog input.
    The falling edge of the relay signal would be the counter's gating signal. For each instance that the relay disconnects, the count value ("time") at that instant will be stored in the counter's buffer for subsequent retrieval.
    Note one small timing subtlety: while the very first sample clock edge puts analog data into the 0th array inde
    x, it will also be incrementing the counter time to 1. This off-by-one deviation will persist.
    There are other variations on this theme, depending on whether you also need to capture re-connection times, or whether there is always one and only one disconnect of interest, etc. You can likely get just the behavior you need using one or both of the on-board counters.
    -Kevin P.

Maybe you are looking for

  • Showmount: HOSTNAME: RPC: Program not registered

    I am new to solaris. I have solaris 10 installed in one of my machines. When i try to list the remote mounts using the command "showmount", i am getting the error "RPC:Program not registered" . I am not aware of which services i have to check/start t

  • Interestind DB Server Setup

    Hi I work at this place that it does almost everything row-by-row. And also almost all the core business logic uses triggers. And because of that there is a need to implement an application lock so the triggers would not cause dead-lock. From the obs

  • Upload Gos Document Problem?

    Hi friends.I wrote this code.I want to download gos attachment from computer . Where is problem? thansk for all replies. Data : Lv_Instid_b Like Srgbtbrel-Instid_b. Data : Lt_Folder Like  Soodk Occurs 0 With Header Line  ,           Lt_Object Like  S

  • Original date on photos

    Hello, I use Photoshop Elements to edit photos. Even after editing with P.E. I can see the original date the photo was taken (as well as the modified date). When I import into iPhoto, I get a brand new date (the date of import) and cannot see the ori

  • Thinking of upgrading camera but with different fps: problems?

    Working with PrePro and After Effects CS6 I have a Panasonic HDC SD90 which is a low end 1080p camera shooting at 59.97 fps. It is very shaky to Zoom and the light meter is not stable and gives me fluctuating exposure levels. Costco has a sale on thi