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.

Useful program structures and variablesUseful program structures and variables have been used in all C/C++ <strong>SDK</strong> sample programs. Threeimportant structures, boarddef, srtype and irtype, are defined and initialized in each sample project. Thesethree structures are explained in the first few pages of the Appendix: Data Structures Used by GageDrivers. It is not necessary to use these structures; they are provided as a convenience.Initializing the <strong>CompuScope</strong> driver and hardwareInitializing the <strong>CompuScope</strong> driver and hardware is accomplished in two parts. First, the location of theinstalled hardware in the I/O and memory maps is established. This is generally done by reading theGAGESCOP.INC configuration file to find out the memory segment and I/O addresses of <strong>CompuScope</strong>sinstalled in the system. GAGESCOP.INC is created and updated by ComuScopes configuration utilitiessuch as Gage Config and Instrument Manager. The second part is the actual initialization of thedriver/hardware.For most users, initialization of the <strong>CompuScope</strong> driver and hardware can be done with a single subroutinecall that has been created for the <strong>CompuScope</strong> C/C++ <strong>SDK</strong>. This function is called InitBoard() and itssource code is in the app_supp.c source file that is included with each C sample program. Users who wantto know more about the initialization procedure can read through the description of gage_driver_inititalizein the <strong>CompuScope</strong> API Reference <strong>Manua</strong>l. Most users needed not concern themselves with initializationdetails. The drivers and hardware need only be initialized once using within an application program usingInitBoard().Preparing the <strong>CompuScope</strong> Card for Data CapturePreparing the <strong>CompuScope</strong> card for data capture can be done at any time prior to starting a data acquisitionsequence. An attempt to change the board settings during data capture can result in a poor andunpredictable behavior.For most users, Gage recommends use of the function called SetBoard(). Its source code is in theapp_supp.c source file that is included with each C sample program. SetBoard() uses a structure calledboard that is defined within each sample program. The <strong>CompuScope</strong> settings in the board structure areactually implemented on the <strong>CompuScope</strong> hardware by SetBoard(). SetBoard() executes multiple GageAPI calls in the correct sequence in order to implement the requested settings. Users who want to do themultiple board setting calls themselves should be careful to respect the call order used in SetBoard().SetBoard() also handles both single board and multiple board Master / Slave configurations. Users whowant to know more about the <strong>CompuScope</strong> setup procedure can read through the following text. Otherusers can move to the next section.Three routines are used to implement the <strong>CompuScope</strong> settings.The first routine is the gage_capture_mode, which sets the <strong>CompuScope</strong> operating mode. The singlechannel operation mode is used when the full memory depth of the <strong>CompuScope</strong> or the maximum samplerate are required. If neither the full sampling rate nor full memory usage are required, then dual channeloperation mode is recommended in order to simplify data transfer.The sample rate is also set using gage_capture_mode routine. There are two parameters used when settingthe sample rate. The first is the base rate and the second is the multiplier. These values should use the predefinedconstants, as the srtable definition illustrates in the Appendix on <strong>CompuScope</strong> Data Structures.The second routine is the gage_input_control routine, which initializes the input parameters for eachchannel. This routine must be called once for each channel that needs its input parameters updated. If thesettings for channel A require adjustment and the single channel operation mode is being used then channelB must be initialized to the same settings. For instance, if you are capturing in single channel mode usingthe ± 1 Volt input range, then you must set both channel A and B for the ± 1 Volt input range.Page 34<strong>CompuScope</strong> <strong>SDK</strong> <strong>Manua</strong>l

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

Saved successfully!

Ooh no, something went wrong!