From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DIG_BLOCK_CHECK never gives PointsRemaining==0

I'm running into a problem with my code:  PointsRemaining never actually reaches 0.  It goes from 1 to 800 and starts counting down again.  Is there a way to force it not to wrap around?  It seems to default to wrapping around in the built-in examples also.

------------------------------------------------
    memorylocation = (char*) MapViewOfFile(hmemmap, FILE_MAP_WRITE, 0, numberofbuffersmapped*buffersize*2, buffersize*2);
    iStatus = DIG_Block_In(iDevice, iGroup, (short*) memorylocation, buffersize);

    // number of buffers mapped can't change unless the line that says how big of a file to create changes.
    while ( ((end-start)/1000 < 10) && (numberofbuffersmapped < 6500))
    {
        end = clock();
        
        if (PointsRemaining <= 0)
        {
            numberofbuffersmapped++;
            UnmapViewOfFile(memorylocation);
            
            memorylocation = (char*) MapViewOfFile(hmemmap, FILE_MAP_WRITE, 0, numberofbuffersmapped*1600, 1600);
            iStatus = DIG_Block_In(iDevice, iGroup, (short*) memorylocation, 800);

            start = clock();
        }
        iStatus = DIG_Block_Check( iDevice, iGroup, &PointsRemaining);
    }
0 Kudos
Message 1 of 5
(3,481 Views)

Hi,

I'm going to need a little better picture of your application in order to understand what you're trying to do.

1)First off, what hardware are you using?

2)Is there a reason you're not using the DAQmx driver instead of the Legacy DAQ driver? This may be due to your hardware, but if you're able, the DAQmx driver offers much greater functionality and ease of programming than the Legacy DAQ driver.

3) You said you used some built in examples, what examples were these?

Once I get this information we can better take a look at this application.

Thanks!

B Spears

0 Kudos
Message 2 of 5
(3,458 Views)
I'm using a 6533 PCMCIA card. It is not suported by DAQmx.  I'm not using an example, I just noticed the examples did the same thing. For instance, the continuous input pattern generation example calls block_in once to take in a half buffer, but takes in a total of 10 buffers.  Presumably, points remaining only gives how many points are remaining for the current half-buffer and wraps around when it starts to take in the new half buffer.  Is there a way to prevent the wrapping around?
0 Kudos
Message 3 of 5
(3,450 Views)

Thanks for the information.

Can you tell me what mode you're using and what exactly you're trying to do in your application?

0 Kudos
Message 4 of 5
(3,423 Views)
I wasn't running in Pattern I/O with a external clock trigger.  I was trying to increase the speed of the card, but just using Block_in to store the data into memory instead of using block_in then db_transfer.  I need to take in more data than I can hold in the buffer I pass to Block_In, though.  I was trying to restart block_in when it filled one buffer with another buffer, but, I just realized, that will give me too much lag and I will miss data.  Thanks for the help, but I think I need to find another way to do this.
0 Kudos
Message 5 of 5
(3,411 Views)