How do I reduce the time from the detection of a input threshold to changing the output?

Hi,
I am using LabWindows 8.1 and a PXI-4461 with Vista (home) on a 2.81 GHz Dual Core Processor.  I wrote code to do the following:
(1) output a ramp, input a signal concurrently (precise sychronization of these two is not important at this point)
(2) if the input signal rises above 0.5 V, hold the output constant for 2 seconds, while continuing the input
(3) finish the ramp
More info: I do a continuous sampling, with 4 samples per Write, to do the output.  The input is read and analyzed with RegisterEveryNSamples (where N = 4).  The communication between the tasks is through a global variable "trap," which is set to 1 when threshold is reached.  I achieve holding the output constant by stopping the task (maintain existing value = true), and then restarting after the pause.  At 40kHz and 4 samples per Write, the limit imposed by the discrete data blocks would be  0.1 msec, but in fact I am getting delays of about 2.5 msec.  My write buffer is 120x4 samples, just so that there is space for me to write.  I do need to save the input data after the
acquisition, preferably the whole sweep, but most importantly the data
while the output is held constant.  
So my questions are:
(a) Does it really take 2 ms to stop a task? When I put in "Timer()"  functions as below, I get a difference of 0.002, which is of course limited to the resolution of the Timer() function. Returning from a function (the EveryN callback) should not take that long, right?
(b) Can you suggest any better ways of doing this?
/*****begin excerpt *****/
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(inputTaskHandle,DAQmx_Val_Acquired_Into_Buffer,4 ,0,EveryNCallback,NULL));
DAQmxErrChk (DAQmxWriteAnalogF64(outputTaskHandle,480,0,10.0,DAQmx_Val_GroupByChannel,outData,&written, NULL));
DAQmxErrChk (DAQmxStartTask(inputTaskHandle));
DAQmxErrChk (DAQmxStartTask(outputTaskHandle));
    for (count =120;count<10000; count++)
        if (trap==0) {
            DAQmxErrChk (DAQmxWriteAnalogF64(gTaskHandle,4,0,10.0,DAQmx_Val_GroupByChannel,&outData[count*sampsToWrite],&written,NULL));
        } else {
                DAQmxErrChk (DAQmxStopTask(outputTaskHandle));
                time2 = Timer();
                done = 1;
                ProcessDrawEvents();
                ProcessSystemEvents();
                Delay (2.0);
                trap = 0;
                count++;
                DAQmxErrChk (DAQmxWriteAnalogF64(outputTaskHandle,480,0,10.0,DAQmx_Val_GroupByChannel,&outData[count*4],&written,NULL));
                count = count+119;
                DAQmxErrChk (DAQmxStartTask(outputTaskHandle));
/*****end excerpt *****/
int32 CVICALLBACK EveryNCallback(TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples,void *callbackData)
    DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,nSamples,10.0,DAQmx_Val_GroupByScanNumber,&readData[inCount*nSamples],nSamples,&numRead,NULL));
    if (trap == 0 && done == 0) {
        for (i=0; i<nSamples; i++) {
            if (readData[inCount*nSamples+i] > 0.5) {
                trap = 1;
                time1 = Timer();
                break;
    } else done = 1;
    inCount++;
Error:
    return 0;
I would appreciate any help or advice! Thanks.  (Sorry about oddities in the code.)

There are a number of applictations like Carbonite, Aperture, Entourage, VM Fusion, Parellels, etc that treat any change to the application as a complete change to application's database.
So, if you make one small email change in Entourage for example, the entire database is backed up on the next pass. As you might imagine, this can fill up a Time Capsule very quickly.
Suggest that you download a utility like BackupLoupe to find out exactly what is being backed up on each pass. Then you can exclude that item from backups if you wish.
http://soma-zone.com/BackupLoupe/

Similar Messages

Maybe you are looking for

  • Date Calculation

    Hi All, I need to understand the link between sales order item schedule line and planned GI date in delivery? (Multiple line item scenario) Schedule line in a sales order is at the item level and Planned GI date in the delivery is at the header level

  • Who can I complain to about a new order being canc...

    Please can someone help me before I go totally insane!! On 14th March I placed an order online with BT for Phone & Broadband with free BT Sport and paying the line rental in advance with it due to go live on 30th March. Transfer date came and went wi

  • Problem converting air-ap1131ag-a-k9 to Lwapp

    i have a person on my team who converted some autonomoous air-ap1131ag-a-k9 to lwapp. I don't think they did it right. what they did is , booted the ap ( at this point it was running in autonomous mode), set the ip to 192.168.1.200 and their laptop t

  • GR Slip Print

    Dear SAP Guru, In the time of GR via MIGO, I did not tick "Print via Output Control". Now I want to take a print. How do I get the print out. Thanks for your kind advance co-operations. Best Regards, Shoyeb

  • I want to delete a Parameter but it won't let me...

    I want to delete the parameter @Subtitle but it won't let me. It has a green check mark beside it and in the Report definition it has the following. How do I find where this is and delete it? CR 8.5 dev edition Kelvin ++++++++++++++++++++++++++++++++