13.07.2015 Views

CompuScope SDK Manua.. - Egmont Instruments

CompuScope SDK Manua.. - Egmont Instruments

CompuScope SDK Manua.. - Egmont Instruments

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The last routine, gage_trigger_control_2, is used to initialize the trigger circuitry. The external triggersource is configured with this routine along with the trigger, slope and threshold level that are used todetect trigger events. The number of samples to acquire after the trigger event, called the post-triggerdepth, is also set by this routine.The board settings will remain in effect between acquisitions. It is only necessary, therefore, to call theseroutines again when changes to the board parameters are required.Starting an AcquisitionThe gage_start_capture routine starts the <strong>CompuScope</strong> hardware acquiring pre-trigger data and awaiting atrigger event.This routine takes a parameter that is used to automatically start the data acquisition when the triggersource has been set to SOFTWARE. The software trigger may also be issued by callinggage_software_trigger after this routine, when the parameter passed is zero.When gage_start_capture finishes, the board has started its data acquisition sequence. This routine is agood candidate for optimization, since it does a lot of extra work ensuring that any <strong>CompuScope</strong> hardwaresystem (Master/Slave, Multiple Independent) is in a known state before trying to start the acquisition. For asystem consisting of only a single <strong>CompuScope</strong>, gage_start_capture can be replaced by gage_init_clockfollowed by gage_get_data. These two calls execute much faster than gage_start_capture. Please notethat a software trigger, if required, must then be issued explicitly.Completing an AcquisitionOnce acquiring, the <strong>CompuScope</strong> is generally queried repeatedly by the application in order to determine ifacquisition is complete. This is usually done in two steps. First, the <strong>CompuScope</strong> is polled until it hasbeen triggered using the gage_triggered routine. Once triggered, the <strong>CompuScope</strong> is polled until it is nolonger acquiring using the gage_busy routine.Usually, the application polls the <strong>CompuScope</strong> in a loop for a specified amount of time called the “timeout”.Depending on the application, trigger and busy timeouts should be carefully chosen by the user. Forinstance, a short trigger timeout is generally used for the capture of rapidly repeating triggers, while a muchlonger trigger timeout is used for one-shot triggers.Usually, if the trigger timeout is exceeded, the <strong>CompuScope</strong> is forced to trigger using thegage_force_capture routine. Similarly, if the busy timeout is exceeded, capture is generally aborted usingthe gage_abort_capture routine.A code example that illustrates polling for the trigger even and then for acquisition completion is shownbelow. The code uses the GetTickCount routine, which returns a time in milliseconds./* Check to see if a trigger has occurred. If one has not occurred within the specifiedamount of ticks, force one by calling gage_force_capture. If the trigger signal is slow,the value of the constant, TRIG_TIMEOUT, should be increased. It is not necessary tohave a trigger timeout.*/ticks = GetTickCount();while (!gage_triggered()){if (GetTickCount() >= ticks + TRIG_TIMEOUT)gage_force_capture(board.source);}/* Check to see if the acquisition is complete. If it is not within the specified amount of ticks, abortby calling gage_abort_capture. For slow sample rates, the value of the timeout constant,BUSY_TIMEOUT, should be increased. It is not necessary to have a busy timeout. */<strong>CompuScope</strong> <strong>SDK</strong> <strong>Manua</strong>l Page 35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!