Home
DAQPilot
Contents
1. ActiveX Controls and NET Component Function Reference DAQPilot Write Method 2 The output data type depends on the task type the enabled number of channel and UnsignedToSigned Property When only one channel is enabled the output data type is VT Ul1 or VT UI2 or VT_UI4 or VT_R8 When the UnsignedToSigned Property is enabled the output data type is VT l1 or VT I2 or VT 14 or VT R8 When multiple channels are enabled the output data type is VT Ul1 VT ARRAY or VT_I1 VT_ARRAY or VT UI2 VT ARRAY or VT 12 VT ARRAY or VT_UI4 VT_ARRAY or VT 14 VT ARRAY or VT R8 VT ARRAY Example Private Sub btnUpdate Click Dim vChNumList As Variant Dim bytArray As Byte Get channel no list VChNumList DAOPilot1 EnabledChNumList If UBound vChNumList 0 Then Single channel DAQPilotl Write 1 Else Multiple channels ReDim bytArray UBound VChNumList For i 0 To UBound vChNumList bytArray i i Next i DAQPilotl Write bytArray End If End Sub ActiveX Controls and NET Component Function Reference 167 DAQPilot Start Method 6 18 Start Method Perform a DAQ task start Syntax VB Function object Start As Long VC long object GetStart BCB long object gt Start Delphi function object Start LongInt VB NET Function object Start As Long VC long object GetStart Return Value The return value may be a sta
2. 5 227 DAQPilot DO WriteLine 5 28 DAQPilot DO WriteChannels 5 229 DAQPilot DO ReadBackPort 5 30 DAQPilot DO ReadBacKkLine 5 31 DAQPilot DO ReadBackChannels 5 32 DAQPilot GetDOBuffer 5 33 DAQPilot SetDOPattern 5 34 DAQPilot TC GetValue 5 35 DAQPilot GetNotifyEvent 5 36 DAQPilot TC ReadCounters 6 ActiveX Controls and NET Component FUNCTION Reference s sssssssss 2 6 1 AutoSize Property i eeseseeneeinno 6 2 EnabledChNumList Property 6 3 MultiThread Property nesese 6 4 ShowErrorMessage Property 6 5 Status Property 0 0 cceececeeeeeeeeeeeessteeeeeeeees 6 6 UnsignedToSigned Properiy 6 7 LoadTask Method eeecceeeeeeeteeeeeeeeeteeeeeees 6 8 CreateTask Method eii 6 9 EndTask Method eeeeeeeeei 6 10 SetChannelProperty Method 6 11 GetChannelProperty Method Table of Contents DAQPilot User s Manual DAQPilot User s Manual 6 12 6 13 6 14 6 15 6 16 6 17 6 18
3. get ShowErrorMessage object SetShowErrorMessage bShowErrorMessage set ShowErrorMessage BCB bool bShowErrorMessage bShowErrorMessage object ShowErrorMessage get ShowErrorMessage object ShowErrorMessage bShowErrorMessage set ShowErrorMessage Delphi bShowErrorMessage WordBool bShowErrorMessage object ShowErrorMessage get ShowErrorMessage object ShowErrorMessage bShowErrorMessage set ShowErrorMessage VB NET Dim bShowErrorMessage As Boolean bShowErrorMessage object ShowErrorMessage get ShowErrorMessage object ShowErrorMessage bShowErrorMessage set ShowErrorMessage VC bool bShowErrorMessage bShowErrorMessage object GetShowErrorMessage get ShowErrorMessage object SetShowErrorMessage bShowErrorMessage set ShowErrorMessage 146 ActiveX Controls and NET Component Function Reference DAQPilot ShowErrorMessage Property Settings Value Description True The detailed error message is reported by message box False No detailed error message is reported Default Remarks Regardless of the ShowErrorMessage status the component trig gers a DAGPilotError event when the function fails ActiveX Controls and NET Component Function Reference 147 DAQPilot Status Property 6 5 Status Property Obtains the status of a specific DAQ task Data Type VB Long VC long BCB long Delphi LongInt BCB nteger
4. Return Values The return value is the DAQPilot status ID Remark This function is available only for DAQPilot_TASK_TC_MODE_OPERATION Example HANDLE hDAQPilotTask NULL DAQPilotDigitalData DAQPilotData DAQPilotStatusID eError DP_STATUS_NOERROR int j 0 k 0 Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask TCModeOperation TRUE Enable channel 0 DAQPilot_SetChannelPropertyBool hDAQPilotTask 0 CP Enable TRUE DAOPilot Start hDAOPilotTask eError DAOPilot TC ReadCounters hDAOPilotTask DAOPilotData if eError DP STATUS NOERROR Display caption for k 0 k lt DAQPilotData nNumOfChannel k printf Counter d DAQPilotData lpPortOrLineList k printf Nn 138 APIs Function Reference DAQPilot DAQPilot_TC_ReadCounters Now the DAOPilotData lpRawData contains the data You may process the data here for j 0 j lt DAQPilotData nNumOfChannel j switch DAQPilotData nRawDataBits case 16 printf Su WORD DAQPilotData lpRawData j break case 32 printf Slu DWORD DAOPilotData lpRawData j break printf n DAQPilot_Stop hDAQPilotTask DAOPilot EndTask hDAOPilotTask APIs Function Reference 139 DAQPilot DAQPilot_TC_ReadCounters 140 APIs Function Reference 6 ActiveX Controls and NET Compo nent Function Refere
5. BCB long object SetDProperty BSTR PropertyName TVariant Value Delphi function object SetDProperty const PropertyName WideString Value OleVariant LongInt VB NET Function object SetDProperty PropertyName As String Value As Object As Long VC long object GetSetDProperty string PropertyName Object vValue Arguments PropertyName As String Property string Value As Variant Property value Return Value The return value is the DAQPilot status ID as defined in DAQPilo tAdvancedProperties h Remarks 1 Different devices support different parameters 2 See Chapter 4 Programming with DAGPilot for more information gt Edit Control data range from 1 79769313486232E308 to 1 79769313486232E308 gt Combo Box Control configure Enum data gt Check Box Control configure Boolean data ActiveX Controls and NET Component Function Reference 159 DAQPilot SetDProperty Method 3 For quick and minor modifications you may use the Set DProperty method to directly configure specific parame ter with the appropriate label in the Configuration frame However it is suggested that you finish the main task using the DAQPilot Wizard property page For example use object SetDProperty Clock source Conversion source to modify the clock source and use object SetDProperty Sampling rate per channel to modify the sampling rate per channel 160 ActiveX Controls an
6. Error DAQPilot_Start hDAOPilotTask Get the data and set timeout as 10 seconds 10000 ms eError DAQPilot_GetAIWaveform hDAQPilotTask DAOPilotData 10000 if eError DP STATUS NOERROR Display caption printf No for k 0 k lt DAQPilotData nNumOfChannel k printf Channel d DAOPilotData lpChannelNoList k printf Nn for i 0 i lt DAOPilotData dwNumOfScan i printf d i for j 0 j lt DAOPilotData nNumOfChannel j printf f double DAQPilotData lpScaledData i DAQ PilotData nNumOfChannel j oO printf Nn DAOPilot EndTask hDAOPilotTask APIs Function Reference DAQPilot DAQPilot AO WriteChannel 5 18 DAQPilot AO WriteChannel Outputs an analog value to a specific channel DAOPilotStatusID DAOPilot AO WriteChannel HANDLE hTask double dbValue Parameters hTask Task handle dbValue Output analog value Return Values The return value is DAQPilot status ID Remarks This function is available only for the following tasks DAQPilot_TASK_AO_VOLTAGE_OUTPU DAQPilot_TASK_AO_CURRENT_OUTPU Example HANDLE hDAQPilotTask NULL double dbVoltageValue 1 0 Load your DAQPilot task hDAQPilotTask DAQPilot_LoadTask AOVoltage TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAQPilotTask 0 DAOPilot AO WriteChannel hDAQPilotTask dbVolta
7. Cho th 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 4 999390 0 000000 zi Start Programming with DAQPilot 77 DAQPilot Component Example for Borland C Builder Source Codes include lt vcl h gt pragma hdrstop include Unit1 h include C ADLINK DAQPilot include DAQPilotA dvancedProperties h pragma package smart init pragma link DAQPILOTAXLib OCX pragma resource dfm TForml Form1 __fastcall TForm1 TForml TComponent Owner TForm Owner void fastcall TForml Button1Click TObject Sender DAQPilot1 SetChannelProperty 2 WideString Enable TVariant true DAQPilot1 SetChannelProperty 2 WideString Range TVariant 203 DAQPilot1 SetChannelProperty 2 WideString Range TVariant DPV RANGE B 2 5 V DAOPilot1 gt SetDProperty WideString Number of scan s TVariant 100 DAOPilot1 gt SetDProperty WideString Sampling rate per channel TVariant 1000 78 Programming with DAQPilot DAQPilot Component Example for Borland C Builder TVariant vDAQPilotValue vDAQPilotValue DAQPilot1 gt GetChannelProperty 2 WideString Enable vDAQPilotVal
8. double dwCyclEnumOfSamples 2 3 14159 dbAmplitude break Put AO Buffer to DAQPilot driver DAOPilot SetDOPattern hTask DAQPilotData eError DAOPilot Start hDAOPilotTask DAQPilot_EndTask hDAQPilotTask APIs Function Reference 135 DAQPilot DAQPilot_TC_GetValue 5 34 DAQPilot_TC_GetValue Gets a counter value DAQPilot comes with two counter modes Simple Counter or Mode Operation DAOPilotStatusID DAQPilot_TC_GetValue HANDLE hTask DWORD pdwValue Parameters hTask Task handle pdwValue The pointer to a WORD memory space to save the counter value Return Values The return value is the DAGPilot status ID Remarks 1 This function is available only for the following tasks DAOPilot TASK TC COUNTER DAOPilot TASK TC MODE OPERATION 2 Default counter bit width is 16 But DAQPilot Simple Counter mode can count to 32 bits width by software Therefore if the application s sampling rate is higher than 100Hz we suggest user to use Mode Operation instead Example HANDLE hDAOPilotTask NULL DWORD dwValue FALSE Load your DAOPilot task hDAOPilotTask DAOPilot LoadTask TCSimpleCounter TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAOPilotTask 0 DAOPilot Start hDAOPilotTask DAOPilot TC GetValue hDAOPilotTask sdwValue Now the dwValue contains current counter value printf Counter value u n dwValue DAO
9. DAQPilotAnalogData stGetDatalnfo double dbAmplitude 3 DWORD i 0 j 0 k 0 DWORD dwCyclEnumOfSamples 0 Load your DAOPilot task hDAOPilotTask DAOPilot LoadTask AOSingleShot TRUE Configure parameters and build default AO buffer eStatus DAOPilot Config hTask Get default AO Buffer info DAOPilot GetAOBuffer hTask amp stGetDataInfo 0 dwCyclEnumOfSamples stGetDatalnfo dwNumOfScan for i 0 i lt stGetDataInfo dwNumOfScan i for j 0 j DWORD stGetDataInfo nNumOfChannel j 11 k i stGetDataInfo nNumOfChannel j if k stGetDataInfo nNumOfChannel stGetDataInfo lpScaledData k l dbAmplitude 2 i dbAmplitude dwCyclEnumOfSamples else stGetDataInfo lpScaledData k sin double i double dwCyclEnumOfSamples 2 3 14159 dbAmplitude Put AO Buffer to DAQPilot driver DAOPilot SetAOWaveform hTask amp stGetDataInfo eStatus DAOPilot Start nDAQPilotTask DAQPilot_EndTask hDAOPilotTask APIs Function Reference 117 DAQPilot DAQPilot_DI_ReadPort 5 22 DAQPilot_DI_ReadPort Acquires the digital value from a digital port DAOPilotStatusID DAQPilot_DI_ReadPort HANDLE hTask DWORD pdwValue i Parameters hTask Task handle pdwValue Pointer to the DWORD memory space for acquiring digital port Return Values The return value is the DAQPilot status ID Remarks This function is available only for
10. s manual 10 Installation DAQPilot DAQPilot Task Manager 2 4 Getting to Know DAGPilot DAQPilot Task Manager The DAQPilot Task Manager window is divided into two panes task left and task information right The task manager is embedded in the ADLINK DAQMaster The DAQPilot task man ager is integrated with the ADLINK DAQMaster to enable efficient and easy management of DAQ tasks and robust configuration and control of DAQ devices using a single interface DAQMastes SE QU Bevice i KP sonware Manager 2 Task Manac Propasty DA A E eA Task Manager AlContinuous AlContinuous Create new task I A t RPA Ss Navigating through the task manager If you choose to install predefined DAQ task samples during the DAQPilot installation these tasks appear on the left pane of the DAQPilot Task Manager window Otherwise the left pane is empty during initial launch Nineteen predefined DAQ tasks samples appear in the task pane You may use or modify these tasks depending on your specifica tions When you select a task the corresponding task information appears on the right pane You can develop a DAQ application based on these predefined tasks DAQPilot also features a virtual device that allows you to test these predefined DAQ tasks With virtual device you can test these functions even before you install the DAQ device Installation 11 DAQPilot DAQPilot Task Manager Defining a
11. 6 19 6 20 6 21 6 22 6 23 6 24 6 25 6 26 SetDProperty Method ccceeeeeeeeeeeeeeeeeeeeeeeteeeeeeeees 159 GetDProperty Method ee eee lesennssnnneenanee 161 Config Method e ee seseessenneesennnnaaannneeane 162 EnableSingleChannel Method e iio 163 Read Method seeeeeeennneeeennnnkneannnnnkeetano 164 Write Method osa eee ea roarou 166 Start Method re as assist o nrakantoo latalo an ornata varekab tao as 168 Stop Method wcities reece gemaj kupron ioovtl etae nemon da keer kiA 169 ShowPropertyPage Method eee iner liio 170 ShowlnstantTestPanel Method 171 DataArrival Event eeeeeeeeeeeeeeeeeaneetettao 172 UpdateData Event eeeeeeeeseseeeesensneenee 174 SendComplete Event cccccsceceeseeeeeseeeseseeeesseeeseneees 176 Timerlnterrupt Event cece eeeeeeeeeeeeeeeeeeeeeeeeeaaeeeeeeenaes 177 DAQPilotError Event ccccceceeeeeeeeeeeeseeeeeeeeeeseaeeeeeees 178 Table of Contents 1 DAQPilot Introduction Thank you for choosing DAQPilot This task oriented DAQ driver comes with an intuitive wizard to assist you in developing cutting edge DAQ applications in an instant DAQPilot also functions as software development kit SDK to assist programmers in develop ing DAQ
12. Borland BDE DB Components V Borland C Builder COM Server Components Sample Package C MADLINK DAGPilot bin BCBE DAQPilotPkg bpl Add Remove E Components Runtime packages 9 Build with runtime packages I Default Cancel Help 70 Programming with DAQPilot DAQPilot Component Example for Borland C Builder Setting Properties at Design Time After placing a component on a Borland C Builder form you can configure the component by setting its properties with the DAQPi lot custom control property pages Refer to the figure below Form o x You may launch the Object Inspector from the View menu The DAQPilot component embeds a custom Property Pages that is the DAQPilot Wizard to replace the traditional ActiveX Control Property Page and to assist you easily in setting up the properties You may select the Property Pages option from the pop up menu to launch the DAQPilot wizard Programming with DAQPilot 71 DAQPilot Component Example for Borland C Builder When the DAQ Pilot wizard appears set the DAQ parameters In this example we would like to perform a single shot waveform acquisition with a virtual device ANALOG OUTPUT E R smonvineomagumon DIGITAL INPUT DIGITAL OUTPUT TIMER CTR DAQPilor Your pilot to data acquisition world A ADLN lt Back Next gt Cancel Refer to Chapter 3 Creating DAQ Tasks for more information on the DAQPilo
13. DAQPilot_GetChannelProperty double DAOPilot GetChannelPropertyF64 HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID i LPCSTR DAOPilot SetChannelPropertySTR HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID i Parameters hTask Task handle nChannelNum Channel number IpszChanne lPropertyID Channel property string eChannelPropertyID Channel property ID defined in the DAGPilotAdvancedProperties h Return Values The return value is the channel property Remarks 1 Different devices support different channel parameters 2 For various data type you may use the appropriate API to query the value For example you may use the DAGPilot GetChannelPropertyl4 to configure data that ranges from 100 to 100 Refer to the edit controls below gt Edit Control Use DAQPilot GetChannelPropertyl4 function to set the data that ranges from 2147483648 to 2147483647 gt Edit Control Use DAQPilot_GetChannelPropertyU4 function to set the data that ranges from 0 to 4294967295 APIs Function Reference 91 DAQPilot DAQPilot_GetChannelProperty gt Edit Control Use DAQPilot_GetChannelPropertyF64 function to set the data that ranges from 1 79769313486232E308 to 1 79769313486232E308 Edit Control Use DAQPilot GetChannelPropertySTR function to set string data Combo Box Control Use DAGPilot GetChannelPropertyEnum function to set Enum data
14. For Check Box Control Use the DAQPilot_GetChannelPropertyBool function to set the Boolean data 3 You may launch the DAQPilot wizard to know more about function usage 4 See Chapter 4 Programming with DAQPilot for more information Example HANDLE hDAOPilotTask NULL DAQPilotValueID eValue DPV_UNDEF Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot eValue TRUE DAQPilot_GetChannelPropertyEnum hDAQPilotTa sk 0 CP Range DAQPilot_EndTask hDAQPilotTask 92 APIs Function Reference DAQPilot DAQPilot_SetProperty 5 6 DAQPilot_SetProperty DAQPilot uses a series of APIs to set all properties You may directly modify the parameters to a specific task DAQPilotStatusID DAQ HANDLE hTask LPCSTR lpszPropertyl VARIANT vValue DAQPil HANDLI DAQPilo VARIANT tStatusID DAQ hTask tPropertyID e vValue O a DAOPi HANDLI DAOPil BOO tStatusID DAQ ask OLPropertyID e bValue LO n p L DAQPil HANDLI DAOPi DAQ tStatusID DAQ ask tPropertyID e O mn N Lo Pilo Pil DLI Pil DAQ O HAN DAQ int tStatusID DAQ hTask otPropertyID e nValue p DAQF HAN DAQF DWO tStatusID DAQ hTask LotPropertyID e dwValue DAOEF HAN DAOE doub tStatusID DAQ hTask LotPropertyID e le dbValue DAQF HAN DAQPil LPCST tStatusID DAQ hTask
15. Line Output Outputs a line value to a TEZI itp aii E I selected digital line value gr Port Output Outputs a port value to a taj selected port Single shot Pattern Outputs a predefined single A Generation shot digital pattern to a selected port Continuous Pattern Outputs a predefined pattern l Generation continuously to a selected port Timer Counter z Simple Counter Simple event counter ste Timer Interrupt Generates timer interrupts periodically Mode Operation Provides mode operations a 6 Introduction DAQPilot Supported Cards 1 4 Supported Cards DAQPilot supports the following ADLINK DAQ cards gt NuDAQ Series 6208 6216 6308 7200 7224 7230 7233 7234 7248 7250 7256 7258 7260 7296 7300 7348 7396 7432 7433 7434 7442 7443 7444 7452 8554 9111 9112 9113 9114 9118 9221 9810 9812 9820 gt DAQ 2000 Series 2005 2006 2010 2016 2204 2205 2206 2208 2213 2214 2501 2502 1 5 Where to Get DAQPilot is available from the DAQPilot Installation CD You may also download a copy from the ADLINK Test and Measurement website at http www adlinktech com TM Introduction 7 DAQPilot Where to Get 8 Introduction DAQPilot Before You Proceed 2 Installation This chapter provides information on DAQPilot system require ments installation and user interface 2 1 Before You Proceed System Requirements Make sure your system meets the follo
16. Use DAQPilot_GetPropertyEnum function to set Enum data For Check Box Control Use the DAQPilot_GetPropertyBool function to set the Boolean data 3 You may launch the DAQPilot wizard to know more about function usage 4 See Chapter 4 Programming with DAGPilot for more information APIs Function Reference 97 DAQPilot DAQPilot_GetProperty Example HANDLE hDAOPilotTask NULL DWORD dwValue 0 Load your DAQPilot task hDAQPilotTask DAQPilot_LoadTask AISingleShot TRUE dwValue DAQPilot_GetPropertyU4 hDAQPilotTask P_TIMING_NUM_OF_SCAN DAQPilot_EndTask hDAOPilotTask 98 APIs Function Reference DAQPilot DAQPilot_GetTaskStatus 5 8 DAQPilot_GetTaskStatus Gets the status of specific DAQ task DAOPilotStatusID DAQPilot_GetTaskStatus HANDLE hTask 7 Parameters hTask Task handle Return Values DP_STATUS_DEVICE_STOP_AND_DIRTY The device stops If you call DAQPilot_Start to restart the task DAQPilot_Start automatically calls the DAQPilot_Config func tion before running DP_STATUS_DEVICE_STOP The device stops You can call DAQPilot_Start to restart the task but the DAQPilot_Start function does not automatically call DAQPilot_Config function before running DP_STATUS_DEVICE_RUNING The device is running Example HANDLE hDAOPilotTask NULL hDAQPilotTask DAQPilot_LoadTask AOSingleShot TRUE DAOPil
17. ud Formi amp es NO Cho Chl iss 0 4 9993896484375 1 444091796875 1 49993896484375 4 55535888671 2 4 99938964843 0 55572509765 3 4 99938964843 3 443603515625 4 4 99938964843 2 55584716796 5 49993896484375 1 4434814453125 6 4 9993896484375 4 55596923828 7 4 99938964843 0 55633544921 A g A QQQIAQAARA 2 4490031KANA Source Codes 34 using System using System Collections Generic using System ComponentModel using System Data using System Drawing using System Text using System Windows Forms using daqpilotengine id namespace WindowsApplicationl public partial class Forml Form public Forml InitializeComponent private void buttonl1_Click object sender EventArgs e Programming with DAQPilot DAQPilot NET Component Example for C NET dagPilotEnginel SetChannelProperty 1 Enable true daqPilotEnginel SetChannelProperty 1 Range 203 dagqPilotEnginel SetChannelProperty 1 Range dagqpilotengine id DAQPilotValueID DPV_RANGE_B 2 5 V daqPilotEnginel SetDProperty Number of scan s 100 daqPilotEnginel SetDProperty Sampling rate per channel 10000 daqPilotEnginel Start private void dagPilotEnginel_DataArrival object sender adlink daqpilot engine v1 DAQPilotEngine DAQP ilotDataEventArgs e int i j long NumOfScan string strCaption strValue double data e Data as double Initial
18. ActiveX Controls and NET Component Function Reference DAQPilot Read Method Example Private Sub btnPolling_Click Dim i As Integer Dim vData As Variant Dim a As VbVarType vData DAQPilot1l Read Is it a multi channel array If vbArray And VarType vData Then For i 0 To UBound vData ListData List i vData i Next i Else ListData List 0 vData End If End Sub ActiveX Controls and NET Component Function Reference 165 DAQPilot Write Method 6 17 Write Method Writes the values to multiple channels Syntax VB Function object Write Data As Variant As Long VC long object GetWrite const VARIANT amp Data BCB long object Write TVariant Data Delphi function object Write Data OleVariant LongInt VB NET Function object Write vData As Object As Long VC long object Write object vData Arguments Data As Variant Write values to multiple channels Output data must be wrapped in a VARIANT variable Return Value The return value is DAQPilot status ID These status IDs are defined in DAQPilotAdvancedProperties h Remarks 1 This function is available only for the following task DAQ DAQ DAQ DAQ DAQ DAQ DAQ DAQ 166 Pilot_TASK_AO_VOLTAGE_OUTPU Pilot_TASK_AO_CURRENT_OUTPU Pilot_TASK_AO_ONESHO Pilot_TASK_AO_CONTINUE Pilot_TASK_DO_LINE_OUTPU Pilot_TASK_DO_PORT_OUTPU Pilot_TASK_DO_ONESHOT Pilot_TASK_DO_CONTINUE
19. DAQPilot s Task Manager is a powerful tool that creates and manages your DAQ tasks The DAQPilot wizard may be launched from the task manager for convenient step by step DAQ task development With the task manager you may visually create modify rename and delete DAQ tasks and review all related information The wizard automatically recognizes the hardware performs hardware classification according to supported tasks revises the related parameters according to various task condi tions and revises incorrect parameters For your convenience the DAQPilot Task Manager is integrated with the ADLINK DAQMaster to form a unified and an integrated interface for more efficient and faster DAQ programming Reference code generation Through the DAQPilot Task Manager you may generate the refer ence code of the selected task for further programming Instant test panel The DAQPilot Task Manager also enables you to instantly test the DAQ task parameters to ensure if these are correct Introduction 3 DAQPilot Highlights DAGPilot Driver Engine The DAQPilot driver and SDK is a data acquisition DLL library and the device driver for DAQ application development The driver pro vides a common set of APIs to control data acquisition cards DAQPilot s task oriented concept allows the use of the same code to control various devices performing the same DAQ task The DAQPilot runtime engine also loads and executes the DAQ task generated by ta
20. DAQPilot TASK DI PORT INPUT Example HANDLE hDAOPilotTask NULL DWORD dwValue FALSE Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask DIPortInput TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAOPilotTask 0 DAOPilot DI ReadPort nDAQPilotTask amp dwValue Now the dwValue contains port value of input signal printf Port value u n dwValue DAOPilot EndTask hDAOPilotTask 118 APIs Function Reference DAQPilot DAQPilot DI ReadLine 5 23 DAQPilot DI ReadLine Acquires a digital value from a digital line DAOPilotStatusID DAOPilot DI ReadLine HANDLE hTask BOOL pbValue Parameters hTask Task handle pbValue Pointer to the Boolean memory space for acquiring digital line Return Values The return value is the DAQPilot status ID Remarks This function is available only for DAQPilot_TASK_DI_LINE_INPUT Example HANDLE hDAQPilotTask NULL BOOL bValue FALSE Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask DILineInput TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAQPilotTask 0 DAOPilot DI ReadLine hDAOPilotTask amp bValue Now the bValue contains line value of input signal printf Line value s n bValue TRUE FALSE DAOPilot EndTask hDAOPilotTask APIs Function Reference 119 DAQPilot DAQPilot DI ReadChannels 5 24 DAQPilot DI ReadChannels Acquires
21. DAQPilot Task Manager Generating the reference code After testing the task using the instant test panel you may now generate the reference code for further programming To do this 1 Right click the task from the task pane 2 A window appears with the C reference code mi ADhe 0 WONO deliria DaPino sla CADP RAD ala seas main ammo DA PkAT ach ADAP sa comet tT mk LDADPIAD ala 0 3 Copy the reference code then compile and run it in your programming application 16 Installation DAQPilot Specifying the Task 3 Creating DAQ Tasks The chapter describes the procedure on how to create a custom ized DAQ task using the DAQPilot wizard Creating a DAQ task involves four basic steps gt Specifying the task gt Setting the parameters Testing the task gt Generating the code 3 1 Specifying the Task The DAQPilot wizard uses step by step instructions to guide you when creating a new task To launch the wizard from the DAQPilot task manager right click a DAQ task from the task pane then select Create a new task The Create Task wizard appears Create Task ANALOG INPUT ANALOG OUTPUT DIGITAL INPUT DIGITAL OUTPUT TIMER CTR Copyright 2007 ADUNK Technology Inc All Rights Reserved lt Beck Next Cancel Creating DAQ Tasks 17 DAQPilot Right click on a task class function then select the task category from the pop up menu Create Task EAB
22. Lists Sorting Column Headers Color Font Picture MousePointer 0 ceDefaul i View v 7 HideColumnHeaders Arrange 0 wNone s HideSelection V Labelwray LabeEdk 0 Ivw utomatice x FN PESO BorderStyle 1 ccFixedSingle v 9 Enabled Appearance eeo I AllowColumnReorder I Checkboxes OLEDragMode g gi O ccOLEDragManual ov I FlatScrolibar OLEDropMode q ccOLEDropNone 7 FulRowSelect I Gridlines I HotTracking I HoverSelection Cancel Apply Help Programming with DAQPilot 53 DAQPilot ActiveX Example for Microsoft Visual Basic Place a Button component tagged as Start Refer to the figure below Project Formi Form DER To call a method attach the method name to the component If the method does not need any parameters you can directly call the method with this syntax object method For example the Start method can launch the task function which is predefined in the component DAQPilot1 Start Developing Event Handlers After configuring the components you may continue to create event handlers in your program to hook appropriate events gener ated on the components For example the DAQPilot component has a DataArrival event that is triggered if the hardware DMA is finished In addition to develop the event routine code most programming environments generate a skeleton function to be the code template The code slice for processing the event of DMA da
23. Reference DAQPilot DAQPilot_DO_ReadBackChannels printf Port Sd DAQPilotData lpPortOrLineList k printf n Now the DAOPilotData lpRawData contains the data You may process the data here for j 0 j lt DAOPilotData nNumOfChannel j switch DAQPilotData nRawDataBits case 8 printf Sc BYTE DAQPilotData lpRawData j break case 16 printf Su WORD DAQPilotData lpRawData j break case 32 printf Slu DWORD DAQPilotData lpRawData j break printf n DAOPilot EndTask hDAOPilotTask APIs Function Reference 131 DAQPilot DAQPilot GetDOBuffer 5 32 DAGPilot GetDOBuffer Prepare a buffer for digital output The space is used to perform a digital pattern output includes one shot and continuous acquisition mode DAOPilotStatusID DAOPilot GetDOBuffer HANDLE hTask DAQPILOTDigitalData pstDatalnfo DWORD dwTimeOut i Parameters hTask Task handle pstDatalnfo The pointer to the DAQPILOTDigitalData structure memory space for data to output dwTimeOut The time out interval milliseconds If dwTimeOut is O the function tests the object s state and returns immediately If dwTimeOut is INFINITE the function will keep running until data acquisition completed Return Values The return value is DAQPilot status ID Remarks 1 This function is available only for the following tasks DAQPilot TASK DO LINE OUTP
24. Running the Application After you have finished coding press the Start Debugging button to run the application and display the data Refer to the illustration below ex EAWorking DAQAgent Samples aPI C Bim aISingleShot exe ple will perform single shot waveform acquisition task on channel Channel 8 832886 872864 912842 952820 992798 032776 2 072754 2 112732 2 152710 2 192688 ress any key to exit the progran m Programming with DAQPilot 63 DAQPilot API Example for Microsoft Visual Studio C Source Codes include stdafx h include conio h include windows h include DAQPilot h int _tmain int argc _TCHAR argv Declare variables DAQPilotAnalogData DAQPilotData DAQPilotStatusID dwError DP_STATUS_NOERROR DWORD dwDisplayCount 0 HANDLE hDAQPilotTask NULL DWORD i 0 int j 0 k 0 Load your DAQPilot task hDAQPilotTask DAQPilot LoadTask AISingleS hot TRUE if hDAQPilotTask printf Load task fail n return 0 printf This sample will perform single shot waveform acquisition task on channel 0 n Execute your DAQPilot task For Single shot Waveform Acquisition task you should use DAQPilot_Start API dwError DAQPilot_Start hDAQPilotTask LPCSTR lpszMsg DAQPilot GetErrorMessage dwError Get the data and set timeout as 10 seconds 10000 ms dwError DAQPilot_GetAIWaveform hDAQPilotTask amp DAQPilot
25. String As Variant VC VARIANT object GetGetChannelProperty long ChannelNum LPCTSTR ChannelProperty BCB TVariant object GetChannelProperty long ChannelNum BSTR ChannelProperty Delphi function object GetChannelProperty ChannelNum LongInt const ChannelProperty WideString OleVariant VB NET Function object GetChannelProperty ChannelNum As nteger ChannelProperty As String As Object VC object object GetGetChannelProperty int ChannelNum string ChannelProperty Arguments ChannelNum As Long Channel number ChannelProperty As String Channel property string Return Value The return value is the channel property value Remarks 1 Different devices support different channel parameters 2 You may launch the DAQPilot wizard to know more about function usage gt Edit Control data range is from 1 79769313486232E308 to 1 79769313486232E308 gt Combo Box Control get Enum data gt Check Box Control get Boolean data 3 See Chapter 4 Programming with DAQPilot for more information 158 ActiveX Controls and NET Component Function Reference DAQPilot SetDProperty Method 6 12 SetDProperty Method DAQPilot provides a method to set all properties You may directly modify the parameters in a specific task Syntax VB Function object SetDProperty PropertyName As String Value As Variant As Long VC long object GetSetDProperty LPCTSTR PropertyName const VARIANT amp Value
26. Type VB Boolean VC BOOL BCB bool Delphi WordBool BCB Boolean Delphi bool Syntax VB Dim bMultiThread As Boolean bMultiThread object MultiThread get MultiThread object MultiThread bMultiThread set MultiThread VC BOOL bMultiThread bMultiThread object GetMultiThread get MultiThread object SetMultiThread bMultiThread set MultiThread BCB bool bMultiThread bMultiThread object MultiThread get MultiThread object MultiThread bMultiThread set MultiThread Delphi bMultiThread WordBool bMultiThread object MultiThread get MultiThread object MultiThread bMultiThread set MultiThread VB NET Dim bMultiThread As Boolean bMultiThread object MultiThread get MultiThread object MultiThread bMultiThread set MultiThread VC bool bMultiThread bMultiThread object GetMultiThread get MultiThread object SetMultiThread bMultiThread set MultiThread 144 ActiveX Controls and NET Component Function Reference DAQPilot MultiThread Property Settings Value Description True Use multiple threads to trigger event False Use single thread main thread to trigger event Default Remarks 1 When accessing data multi threaded applications require rigid handling than single threaded applications Since there are multiple independent paths of execution used simultaneously in a multi threaded application the MFC and Windows UI obj
27. applications in various ADE environments including Micosof Visual Basic NET Micosoft Visual Ci NET Microsoft Visual Basic Microsoft Visual C Borland Del phi and Borland C Builder DAQPilot provides easy creation of DAQ task specification and offers powerful task management reference code generation including ActiveX control generation and instant test panel With DAQPilot you don t need to deal with complex functions and parameters so you focus more on the task operations An intuitive wizard guides you when setting all necessary parameters for the specified task with automatic checking mechanism After defining a task you may simply load the task specification to your program then execute DAQPilot accelerates your DAQ development 300 times faster than traditional DAQ programming When you want to create a DAQ application quickly the DAQPilot wizard guides you in finishing a DAQ task in just about 45 seconds for instant testing In addition if you need to effectively control sev eral DAQ devices DAQPilot provides universal APIs to help you develop your DAQ application You may create your DAQ applica tion in minutes with DAQPilot API ActiveX or NET Assembly using a task oriented approach Equipped with intuitive built in components including an instant test panel and automatic refer ence code generation DAQPilot lets you land quickly in a variety of DAQ programming environments Introduction DA
28. column header listViewl Columns Clear listViewl Columns Add NO 100 for i 0 i lt e ChNumList Length i strCaption Ch Convert ToString e ChNumList i listViewl Columns Add strCaption 200 NumOfScan data Length Programming with DAQPilot 35 DAQPilot NET Component Example for C NET e NumberOfChannel Dump the data listViewl Items Clear for i 0 i lt NumOfScan i strValue Convert ToString i listViewl Items Add strValue for j 0 j e NumberOfChannel j strValue data i e NumberOfChannel j ToString listViewl Items i SubItems Add strValue private void Forml FormClosing object sender FormClosingEventArgs e daqPilotEnginel Stop 36 Programming with DAQPilot DAQPilot NET Component Example for Microsoft Visual Basic NET 4 2 NET Component Example for Microsoft Visual Basic NET This section provides instructions on how to create a DAQ applica tion using DAQPilot s NET component The process involves seven steps Creating the Visual Studio VB NET project Adding DAQPilot component to the project s toolbox Setting the properties at design time Editing the properties at runtime Working with control methods Developing event handlers Running the application vvvvvvyv Creating the Visual Studio VB NET DAQ Project Use the New Project dialog to start a new project in the Visual Studio developmen
29. digital values from multiple channels DAOPilotStatusID DAOPilot DI ReadChannels HANDLE hTask DAOPilotDigitalData pstDataInfo Parameters hTask Task handle psiDatalnfo Pointer to the DAQPilotDigitalData structure memory space that will receive the digital data Return Values The return value is the DAQPilot status ID Remarks This function is available only for the following tasks DAQPilot_TASK_DI_LINE_INPU DAQPilot_TASK_DI_PORT_INPUT 120 APIs Function Reference DAQPilot DAQPilot_DI_ReadChannels Example HANDLE hDAOPilotTask NULL DAQPilotDigitalData DAQPilotData DAOPilotStatusID eError DP STATUS NOERROR int j 0 k 0 Load your DAOPilot task hDAOPilotTask DAOPilot LoadTask DILineInput TRUE Enable both channel 0 and channel 1 DAQPilot_SetChannelPropertyBool hDAQPilotTask 0 CP Enable TRUE DAQPilot_SetChannelPropertyBool hDAQPilotTask 1 CP_Enable RUE eError DAOPilot DI ReadChannels hDAOPilotTask amp DAQPilotData if eError DP STATUS NOERROR Display caption for k 0 k lt DAQPilotData nNumOfChannel k printf Line d DAOPilotData lpPortOrLineList k printf Nn Now the DAOPilotData lpRawData contains the data You may process the data here for j 0 j lt DAOPilotData nNumOfChannel j printf Ss LPBYTE DAQPilotData lpRawData j TRUE FALSE printf Nn DAOPilot EndTask hDAOPil
30. properties at design time Editing the properties at runtime Working with control methods Developing event handlers Creating the Visual Basic DAQ Project Use the New Project dialog to start a new project in Visual Basic development environment Click New Project from the File menu Select Standard EXE then press OK to apply Refer to the figure below Microsoft Visual Basic o is File Edit View Project Format Debug Run Query Diagram Tools Add Ins Window Help yh Bg ULAS RAR EER xi xi General New Project zx rh jj pi m 5 E Standard EXE ActiveXEXE ActiveXDLL ActiveX Control Help GA h bd bd X SF 2 Ui k x VB Application VB Wizard Activex Activex Wizard Manager Document Dil Document Exe 2 l Categorized we X YR Addin Data Project DHTML IIS Application Application mo Form Layout x Programming with DAQPilot DAQPilot ActiveX Example for Microsoft Visual Basic Adding DAQPilot ActiveX Control to the Project s Toolbox You need to install DAQPilot s ActiveX controls to Visual Basic before building an application After installation you may use the integrated DAQPilot ActiveX controls to conveniently carry out all task functions To add the DAQPilot component to the project s toolbox 1 From a new Visual Basic project right click on the Tool box menu then select Choose Items The Compo nents window appears 2 Click the Controls tab locat
31. that belong to the same series except PCI 7300A Rev A and PCI 7300A Rev B the assigned sequence number depends on the PCI slot order For example if there is a PCI 9111DG card installed in the first PCI slot one PCI 9111HR card and two ActiveX Controls and NET Component Function Reference 153 DAQPilot CreateTask Method PCI 9112 cards installed on other PCI slots the PCI 9111DG will be registered with nBoardlndex 0 and the PCI 9111HR card with nBoardlndex 1 The PCI 9112 card in the first slot will be registered with nBoardIndex 0 while the second PCI 9112 card will be registered with nBoardlndex 1 For PCI 7256 PCI 7258 PCI 7260 PCI 7442 PCI 7443 PCI 7444 and PCI 7452 series cards you may use the onboard switch to set the board index Return Value When the function succeeds the return value is True If it fails the return value is False You may obtain the relative error information when ShowErrorMessage Property is True Remarks 1 This function generates a simple task with default config uration DAQPilot LoadTask or DAQPilot CreateTask only loads or creates the specified task If you want to apply the task configuration to the hardware call DAQPilot_Config to complete the configuration 3 Call DAQPilot Close to release the DAQPilot task 4 You may launch the DAQPilot wizard to know more 154 about function usage See Chapter 4 Programming with DAQPilot for m
32. voltage value of input signal printf Voltage value f n dbVoltageValue DAQPilot_EndTask hDAOPilotTask 106 APIs Function Reference DAQPilot DAQPilot Al ReadChannels 5 16 DAGPilot Al ReadChannels Acquires analog values from multiple channels DAOPilotStatusID DAOPilot AI ReadChannels HANDLE hTask DAQPILOTAnalogData pstDataInfo Parameters hTask Task handle pstDatalnfo A pointer to the DAQPILOTAnalogData structure memory space which will receive the analog data information Return Values The return value is DAQPilot status ID Remarks This function is available only for DAQPilot_TASK_AI_VOLTAGE_POLLING Example HANDLE hDAQPilotTask NULL DAQPilotAnalogData DAQPilotData DAQPilotStatusID eError DP_STATUS_NOERROR int j 0 k 0 Load your DAQPilot task hDAOPilotTask DAOPilot LoadTask AIPolling TRUE Enable both channel 0 and channel 1 DAQPilot_SetChannelPropertyBool hDAQPilotTask 0 CP Enable TRUE DAQPilot_SetChannelPropertyBool hDAQPilotTask 1 CP_Enable RUE eError DAOPilot AI ReadChannels hDAOPilotTask amp DAQPilotData if eError DP STATUS NOERROR Display caption for k 0 k lt DAQPilotData nNumOfChannel k APIs Function Reference 107 DAQPilot DAQPilot Al ReadChannels printf Channel d DAQPilotData lpChannelNoList k printf n Now the DAOPilotData lpSc
33. 0000246 IOO 00401249 jmp 0x00405098 CS 001B NF 0 0040124aE mov eax 0x40508B DS 0023 RF 0 00401253 shl eax OxO2 ss 0023 VI O NNAN1I2RA mow TNOyANGOAFI sav E ES 0023 I aca OO12FFDO 7FFDEOOO 00410008 000000 0000 00 DO 00 oo e bi 00410010 00 00 00 00 00 00 00 DO OH 00410018 000000 0000 00 00 00 gt OO1ZFFCS KORREO nn4innan An AA NN NAN NAN AH AN AN l OO 00 00 OO 00 Programming with DAQPilot 69 DAQPilot Component Example for Borland C Builder Do any of the following to solve this problem gt Copy the DAQPilotPkg bpl file to the project folder Refer to the illustration below SZO NO HAD ANARA TAD NED a Q X O f no ae m KUO SC Progam FoBor Peke Pape i Eee RHE x J di u o Kivi aj Wort ce WKB SHER MAS FF 041 C Docemeab ard Settings D Foopeetl oh 10KB inkmeint fe mma TOI s al Kinki Exponse Proce Pome Ms 220KB TEER INE FF on 2 O Progam Ries Ao 29 KB lntronmdmte fle TIAS FF 081 2000 Sarise Scope Connsct Sova C D 13 KE Lex OTRO FF 06 a Cones E Co DLE E tote Agkat E E Ades zl l Jo SEN Gee TMM 22805 255MB Yamai Remove DAGPilotPkg from the runtime packages Refer to the illustration below Project Options for Project exe ix Packages Design packages CZ ADLINK DAGPilot BCB Component Borland ActionBar Components VI Borland ADO DB Components V Borland Base Cached ClientD ataset Component V
34. 142 ActiveX Controls and NET Component Function Reference DAQPilot EnabledChNumList Property 6 2 EnabledChNumList Property Gets the enabled channels list Data Type VB Variant Integer array VC VARIANT short array BCB TVariant short array Delphi OleVariant SmallInt array VB NET Object short array VC Array short array Syntax VB Dim vEnabledChNumList As Variant vEnabledChNumList object EnabledChNumList get EnabledChNumList VC VARIANT vEnabledChNumList vEnabledChNumList object GetEnabledChNumList get EnabledChNumList BCB TVariant vEnabledChNumList vEnabledChNumList object EnabledChNumList get EnabledChNumList Delphi vEnabledChNumList OleVariant vEnabledChNumList object EnabledChNumList get EnabledChNumList VB NET Dim vEnabledChNumList As object vEnabledChNumList object EnabledChNumList get EnabledChNumList VC H Short vEnabledChNumList vEnabledChNumList object EnabledChNumList get EnabledChNumList Sample Dim vChNumList As Variant Get channel no list VChNumList DAOPilot1 EnabledChNumList For i 0 To UBound vChNumList nEnabledChNo vChNumList i Next i ActiveX Controls and NET Component Function Reference 143 DAQPilot MultiThread Property 6 3 MultiThread Property Gets or sets a value that determines whether or not to use multi thread to trigger event Data
35. A ADLINK PRL DAQPilot Task Oriented DAQ Driver and Wizard User s Manual Manual Rev 2 01 Revision Date August 30 2007 Part No 50 11233 1000 Recycled Paper Advance Technologies Automate the World DAQPilot User s Manual Copyright 2007 ADLINK TECHNOLOGY INC All Rights Reserved Disclaimer The information in this document is subject to change without prior notice in order to improve reliability design and function and does not represent a commitment on the part of the manufacturer In no event will the manufacturer be liable for direct indirect spe cial incidental or consequential damages arising out of the use or inability to use the product or documentation even if advised of the possibility of such damages This document contains proprietary information protected by copy right All rights are reserved No part of this manual may be repro duced by any mechanical electronic or other means in any form without prior written permission of ADLINK Trademark Information DAGPilot and DAQMaster are registered trademarks of ADLINK Technology Inc Product names mentioned herein are used for identification pur poses only and may be trademarks and or registered trademarks of their respective companies DAQPilot User s Manual Getting service Customer satisfaction is our top priority Contact us should you require any service or assistance ADLINK TECHNOLOGY INC Web Site Sales 8 Service Te
36. AGPilot ANALOG INPUT A Polling E Single shot Waveform Acquisition ENS VN Koye xo LAUU esma DIGITAL INPUT DIGITAL OUTPUT TIMER CTR Copyright 2007 ADLINK Technology Inc All Rights Reserved lt Back Next gt Cancel 18 Creating DAQ Tasks DAQPilot Task Name and Description 3 2 Setting the Parameters After specifying the DAQ task class the wizard guides you in set ting the task parameters Task Name and Description When prompted assign a name and a description for the new DAQ task Click Next when finished Analog Input Continuous Waveform Acquisition DAQPilof Assign Task Name Please add the description of your task here A proper easier description will help you manage your tasks Creating DAQ Tasks 19 DAQPilot Device and Channels Device and Channels After you have assigned a name and a description for the task select the device and configure the channels from this window Analog Input Continuous Waveform Acquisition DAQPilor Copyright 2007 ADUNK Technology Inc All Rights Reserved lt Back Next gt Cencel The wizard allows you to select which device to use and define the corresponding channel settings This window also enables you to easily set the Range and RefGround by selecting a supported value from the drop down combo box Click Next when finished 20 Creating DAQ Tasks DAQPilot Acquisition Parameters Acquisition Parameters
37. AOVoltage TRUE Call DAQPilot_GetAOBuffer function to get the default DAQPilotAnalogData eError DAQPilot_GetAOBuffer hDAOPilotTask DAOPilotData 0 i eError DP STATUS NOERROR fill AO Buffer for i 0 i lt DAOPilotData nNumOfChannel i printf Channel d Voltage value DAOPilotData lpChannelNoList i scanf Sf sfVoltageValue DAQPilotData lpScaledData i fVoltageValue printf Nn eError DAOPilot AO WriteChannels hDAOPilotTask DAOQPilotData DAOPilot EndTask hDAOPilotTask APIs Function Reference 115 DAQPilot DAQPilot SetAOWaveform 5 21 DAQPilot SetAOWaveform Performs an analog waveform output for single channel or multiple channels Output mode may be in one shot or continuous mode DAOPilotStatusID DAOPilot SetAOWaveform HANDLE hTask DAQPILOTAnalogData pstDatalnfo i Parameters hTask Task handle psiDatalnfo Pointer to the DAQPILOTAnalogData structure memory space where analog data is used to output Return Values The return value is DAQPilot status ID Remarks 1 This function is available only for the following tasks DAQPilot_TASK_AO_ONESHOT DAQPilot_TASK_AO_CONTINUE 2 Use DAGPilot Start to output the waveform data 116 APIs Function Reference DAQPilot DAQPilot SetAOWaveform Example HANDLE hDAOPilotTask NULL DAQPilotAnalogData DAOPilotData DAOPilotStatusID eStatus DP STATUS NOERROR
38. Add Web Reference Set as Startup Project Debug k at 3 X Remove Rename Unload Project Name Specifies the project name Programming with DAQPilot 61 DAQPilot API Example for Microsoft Visual Studio C 62 2 Type the task file path in the Additional Dependencies textbox then press OK Refer to the illustration below AlSingleShot Property Pages Configuration Active Debug Platform ActiveQWin32 gt Configuration Manager G Common Properties Configuration Properties General Debugging fH C C Linker General Input Manifest File Debugging System Optimization Embedded IDL Advanced Command Line Manifest Tool XML Document Generat Browse Information Build Events Custom Build Step a Web Deployment E E E E 5 Additic C ADLINK DAQPilot lib DAQPilotEngine lib EJ Ignore All Default Libraries No Ignore Specific Library Module Definition File Add Module to Assembly Embed Managed Resource File Force Symbol References Delay Loaded DLLs Assembly Link Resource Additional Dependencies Specifies additional items to add to the link line ex kernel32 lib configuration specific Editing the Task File Even after you have generated the task file you may further mod ify the properties using the DAQPilot Task Manager Refer to section 2 4 Programming with DAQPilot DAQPilot API Example for Microsoft Visual Studio C
39. Data 10000 64 Programming with DAQPilot DAQPilot API Example for Microsoft Visual Studio C Setting Timeout to INFINITE will execute synchronous operation dwError DAQPilot GetAIWaveform hDAQPilotTask amp DAQPilotData INFINITE Setting Timeout to 0 will execute asynchronous operation dwError DAQPilot_GetAIWaveform hDAQPilotTask amp DAQPilotData 0 if dwError DP_STATUS_NOERROR Display caption printf No for k 0 k lt DAQPilotData nNumOfChannel k printf Channel d DAQPilotData lpChannelNoList k printf Nn Now the DAOQPilotData lpScaledData contains the waveform You may process the data here dwDisplayCount min 10 DAQPilotData dwNumOfScan for i 0 i lt dwDisplayCount i printf d i for j 0 j lt DAQPilotData nNumOfChannel j print f sf double DAQPilotData lpScaledData i DAQPilotData nNumOfChannel j printf n Programming with DAQPilot 65 DAQPilot API Example for Microsoft Visual Studio C printf Press any key to exit the program _getch Finally close your DAQPilot task DAQPilot_EndTask hDAQPilotTask return 0 66 Programming with DAQPilot DAQPilot Component Example for Borland C Builder 4 5 Component Example for Borland C Builder This section provides instructions on how to create a DAQ applica tion using the DAQPilot component for Borland C Builder The process i
40. Delphi nt Syntax VB Dim 1Status As Long 1Status object Status get Status VC long 1Status lStatus object GetStatus get Status BCB long 1Status lStatus object Status get Status Delphi lStatus LongInt object Status lStatus get Status VB NET Dim lStatus As Integer 1Status object Status get Status VCH nt lStatus lStatus object GetStatus get Status Return Values DP STATUS DEVICE STOP AND DIRTY 1 The device stopped You may call Start to restart the task Start automatically calls Config method before running This is the default return value DP STATUS DEVICE STOP 2 The device stopped You may call Start to restart the task but the Start method does not automatically call Config method before running DP STATUS DEVICE RUNING 3 The device is running 148 ActiveX Controls and NET Component Function Reference DAQPilot UnsignedToSigned Property 6 6 UnsignedToSigned Property This flag determines whether or not to convert an unsigned value Data Type VB Boolean VC BOOL BCB bool Delphi WordBool BCB Boolean Delphi bool Syntax VB Dim bUnsignedToSigned As Boolean bUnsignedToSigned object UnsignedToSigned get UnsignedToSigned object UnsignedToSigned bUnsignedToSigned set UnsignedToSigned VC BOOL bUnsignedToSigned bUnsignedToSigned object GetUnsignedToSigned get UnsignedToS
41. Deslgnj x Sokaion Explorer WIndowAppliationi U x pizar DAQPIlot wizard will help to establish the properties 28 Programming with DAQPilot DAQPilot NET Component Example for C NET When the DAQ Pilot wizard appears set the DAQ parameters In this example we would like to perform a single shot waveform acquisition with a virtual device ANALOG OUTPUT DIGITAL INPUT DIGITAL OUTPUT TIMER CTR INK Technology ine All Rights Reserved Back Next Cancel Refer to Chapter 3 Creating DAQ Tasks for more information on the DAQPilot wizard parameters and supported tasks Programming with DAQPilot 29 DAQPilot NET Component Example for C NET 30 Edit Properties at Runtime You can dynamically set and read the properties of the component in Visual Studio C by using this syntax to set the property object SetProperty property string expression For example if you want to change the values during program execution Enable Chl by method daqPilotEnginel SetChannelProperty 1 Enable True Without add DAQPilot cs file daqPilotEnginel SetChannelProperty 1 Range 203 DPV RANGE B 2 5 V Add DAQPilot cs file daqPilotEnginel SetChannelProperty 1 Range daqpilotengine id DAQPilotValueID DPV RANGE B 2 5 V Change number of scan property to 100 by method daqPilotEnginel SetDProperty Number of scan s 100 dagPilotEnginel SetDProperty Sampling rat
42. ID i HANDLE hTask DAQPilotPropertyID ePropertyID HANDLE hTask DAOPilotPropertyID ePropertyID int nValue DWORD DAOPilot GetPropertyU4 HANDLE hTask DAQPilotPropertyID ePropertyID double DAQPilot_GetPropertyF64 HANDLE hTask DAQPilotPropertyID ePropertyID i LPCSTR DAQPilot_GetPropertySTR HANDLE hTask DAOPilotPropertyID ePropertyID i DAQPilotValueID DAQPilot_GetPropertyEnum DAOPilotStatusID DAOPilot GetPropertyI4 96 APIs Function Reference DAQPilot DAQPilot_GetProperty Parameters hTask Task handle IpszPropertyID Property string ePropertyID Property ID Return Values The return value is the DAQPilot property value Remarks 1 Different devices support different channel parameters 2 For various data type you may use the appropriate API to query various data types For example you may use the DAQPilot_GetPropertyl4 to configure data that ranges from 100 to 100 Refer to the edit controls below Edit Control Use DAQPilot_GetPropertyl4 function to set the data that ranges from 2147483648 to 2147483647 Edit Control Use DAQPilot_GetPropertyU4 function to set the data that ranges from 0 to 4294967295 Edit Control Use DAQPilot_GetPropertyF64 function to set the data that ranges from 1 79769313486232E308 to 1 79769313486232E308 Edit Control Use DAQPilot GetPropertySTR function to set string data Combo Box Control
43. ID DAOPilot DO ReadBackPort HANDLE hTask DWORD pdwValue Parameters hTask Task handle pdwValue The pointer to the DWORD memory space to save the digital port value Return Values The return value is the DAGPilot status ID Remarks This function is available only for DAOPilot TASK DO PORT OUTPUT Example HANDLE hDAOPilotTask NULL DWORD dwValue 0 Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask DOPortOutput TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAQPilotTask 0 DAQPilot_DO_ReadBackPort hDAQPilotTask amp dwValue Now the dwValue contains value of digital output port printf Port value u n dwValue DAOPilot EndTask hDAOPilotTask 128 APIs Function Reference DAQPilot DAQPilot_DO_ReadBackLine 5 30 DAQPilot DO ReadBackLine Reads the current line value from digital output line DAOPilotStatusID DAOPilot DO ReadBackLine HANDLE hTask BOOL pbValue Parameters hTask Task handle pbValue The pointer to the Boolean memory space to save the digital output line Return Values The return value is the DAQPilot status ID Remarks This function is available only for DAQPilot_TASK_DO_LINE_OUTPUT Example HANDLE hDAQPilotTask NULL BOOL bValue FALSE Load your DAQPilot task hDAOPilotTask DAQPilot_LoadTask DOLineOutput TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAQPi
44. OtPropertyID e R lpszValue APIs Function Reference Pilot SetStringProperty D Pilot_SetProperty PropertyID Pilot SetPropertyBool PropertyID Pilot SetPropertyEnum PropertyID tValueID nAgentID Pilot SetPropertyI4 PropertyID Pilot SetPropertyU4 PropertyID Pilot SetPropertyF64 PropertyID Pilot SetPropertySTR PropertyID 93 DAQPilot DAQPilot_SetProperty Parameters hTask Task handle IpszPropertyID Property string ePropertyID Property ID Return Values The return value is the DAQPilot status ID Remarks 1 Different devices support different channel parameters 2 For various data type you may use the appropriate API to configure various data For example you may use the DAQPilot_SetPropertyl4 to set the data that ranges from 100 to 100 Refer to the edit controls below gt Edit Control Use DAQPilot_SetPropertyl4 function to set the data that ranges from 2147483648 to 2147483647 gt Edit Control Use DAQPilot_SetPropertyU4 function to set the data that ranges from 0 to 4294967295 gt Edit Control Use DAQPilot_SetPropertyF64 function to set the data that ranges from 1 79769313486232E308 to 1 79769313486232E308 gt Edit Control Use DAQPilot_SetPropertySTR function to set string data gt Combo Box Control Use DAQPilot_SetPropertyEnum function to set Enum data gt For Check Box Control Use the DAQPilo
45. Pilot Stop hDAQPilotTask DAOPilot EndTask hDAOPilotTask 136 APIs Function Reference DAQPilot DAQPilot_GetNotifyEvent 5 35 DAQPilot GetNotifyEvent Gets the notification event This function is for DAQPilot s Timer Interrupt function mode HANDLE DAOPilot GetNotifyEvent HANDLE hTask i Parameters hTask Task handle Return Values Returns the notification handle object of event Remarks This function is available only for DAQPilot_TASK_TC_TIMER_INTERRUPT Example HANDLE hDAOPilotTask NULL Load your DAQPilot task hDAOPilotTask DAOPilot LoadTask TCTimerInterrupt TRUE DAOPilot Start hDAOPilotTask Get DAQPilot notify event hNotifyObject DAQPilot_GetNotifyEvent hDAQPilotTask do dwReturn WaitForSingleObject hNotifyObject 10000 if dwReturn WAIT_OBJECT_0O printf Get timer interrupt n else break while TRUE DAQPilot_Stop hDAQPilotTask DAOPilot EndTask hDAOPilotTask APIs Function Reference 137 DAQPilot DAQPilot_TC_ReadCounters 5 36 DAQPilot_TC_ReadCounters Reads the counter values from multiple counters This function performs the DAGPilots Mode Operation mode DAOPilotStatusID DAOPilot TC ReadCounters HANDLE hTask DAQPilotDigitalData pstDataInfo i Parameters hTask Task handle psiDatalnfo Pointer to the DAQPilotDigitalData structure memory space to save the counter data
46. Project s Toolbox 27 Setting Properties at Design Time 28 Edit Properties at Runtime l ieo 30 Working with Control Methods ee seeseeeii 31 Developing Event Handlers ito 32 Running the Application eee eee e ses eeeitei 34 4 2 NET Component Example for Microsoft Visual Basic NET ccsseceeeeeesseeeees 37 Creating the Visual Studio VB NET DAQ Project 37 Adding DAQPilot Component to the Project s Toolbox 38 Table of Contents i DAQPilot User s Manual Setting Properties at Design Time 39 Edit Properties at Runtime e eee ee eee 41 Working with Control Methods 42 Developing Event Handlers ee eee 43 Running the Application eeeeeeeese eseon 45 4 3 ActiveX Example for Microsoft Visual Basic 48 Creating the Visual Basic DAQ Project 48 Adding DAQPilot ActiveX Control to the Project s Toolbox o eeceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 49 Setting Properties at Design Time 50 Edit Properties at Runtime ue eee ee eee 52 Working with Control Methods 53 De
47. Properties Windows from the popup menu The DAQPilot ActiveX control provides a custom Property Pages that is the DAQPilot wizard to replace the traditional ActiveX Con trol Property Page and to assist you easily in setting up the proper ties You may select the Property Page item from the pop up menu to launch the DAQPilot wizard Projectl Formi Form View Code Align to Grid 50 Programming with DAQPilot DAQPilot ActiveX Example for Microsoft Visual Basic When the DAQ Pilot wizard appears set the DAQ parameters In this example we would like to perform a single shot waveform acquisition with a virtual device ANALOG OUTPUT DIGITAL INPUT DIGITAL OUTPUT TIMER CTR DAGPilof RefGround Single Ended Single Ended Single Ended Single Ended A ADLINIS Beko Nexto Cencel Refer to Chapter 3 Creating DAQ Tasks for more information on the DAQPilot wizard parameters and supported tasks Programming with DAQPilot 51 DAQPilot ActiveX Example for Microsoft Visual Basic Edit Properties at Runtime You can dynamically set and read the properties of the control in Visual Basic by using this syntax to set the property object SetProperty property string expression For example if you want to change the values during program execution Enable Chl by method DAQPilot1 SetChannelProperty 1 Enable True Without add DAQPilot bas module file DAQPilot1 SetChannelPr
48. Property eesis seleno 86 5 5 DAQPilot GetChannelProperty tss s sensen niii 90 5 6 DAQPilot SetProperty iiseeisennessennnnnnannnettno 93 5 7 DAQPilot_GetProperty ccccccceeeeeeeeeeeeeeeeeeeeesteeestees 96 5 8 DAQPilot_GetTaskStatus ssssseseseseeeeeeeenennano 99 5 9 DAGPilot GetEnabledChannelList 100 5 10 DAQPilot EnableSingleChannel 101 ii Table of Contents 5 111 DAQPilot GetErrorMessage 5 12 DAQPilot Config esee e sssnesieno 5 13 DAQPilot Start e ses sennenennnnnnteoo 5 14 DAQPilot Stop sss o otos eare et ias 5 15 DAQGPilot Al ReadChannel 5 16 DAGPilot Al ReadChannels 5 117 DAQPilot GetAlWaveform 5 18 DAQPilot AO WriteChannel 5 19 DAQGPilot AO WriteChannels 5 20 DAQPilot GetAOBuUffer 5 221 DAQPilot SetAOWaveforM 5 22 DAQPilot DI ReadPort 5 223 DAQPilot DI ReadLine 5 224 DAQGPilot DI ReadChannels 5 25 DAQGPilot GetDIPattern 5 26 DAQPilot DO WritePort
49. QPilot Features 1 1 gt gt Features Easy to use task oriented DAQ driver with wizard Supports mainstream and new generation OS including gt 32 bit Editions of Windows 98 NT 2000 XP Server 2003 Vista gt 64 bit Editions of Windows XP Server 2003 Vista Supports various application development environments including gt Microsoft Visual C NET gt Microsoft Visual Basic NET Microsoft Visual Basic gt Microsoft Visual C gt Borland Delphi gt Borland C Builder Supports a complete line of ADLINK DAQ cards and is com patible with all ADLINK DAQ hardware functions Windows based utility easily configures and diagnoses the DAQ hardware Bundled example programs speed up DAQ programming Comprehensive I O functions including analog input analog output digital input output timer counter and event Offers three programming methods gt DAQPilot API gt DAQPilot ActiveX control gt DAQPilot NET assembly Introduction DAQPilot Highlights 1 2 Highlights Rapid DAQ development In a traditional way users must call a series of driver API to control different types of DAQ cards This is followed by a user specified algorithm to process the data In a task oriented approach the task represents the measurement process you want to perform Based on the DAQ task you write the code not only for a specific device but also for other devices that will use the same task Task manager The
50. TASK DO CONTINUE DAOPilot TASK TC COUNTER DAOPilot TASK TC TIMER INTERRUPT DAOPilot TASK TC MODE OPERATION ActiveX Controls and NET Component Function Reference 169 DAQPilot ShowPropertyPage Method 6 20 ShowPropertyPage Method Displays the DAQPilot wizard property page Syntax VB object ShowPropertyPage VC object GetShowPropertyPage BCB object ShowPropertyPage Delphi procedure object ShowPropertyPage VB NET object ShowPropertyPage VC object GetShowPropertyPage Return Value Null Remarks You may use this method to change the properties in runtime period 170 ActiveX Controls and NET Component Function Reference DAQPilot ShowlnstantTestPanel Method 6 21 ShowlnstantTestPanel Method Displays a standard test panel Syntax VB Function object ShowInstantTestPanel IsModalDialog As Boolean Caption As String As Boolean VC BOOL object GetShowInstantTestPanel BOOL IsModalDialog LPCTSTR Caption BCB bool object gt ShowInstantTestPanel bool IsModalDialog BSTR Caption Delphi function object ShowInstantTestPanel IsModalDialog WordBool const Caption WideString WordBool VB NET Function object ShowInstantTestPanel IsModalDialog As Boolean Caption As String As Boolean VOH bool object GetShowInstantTestPanel bool IsModalDialog string Capt
51. The next window enables you to set the acquisition parameters for the task This includes the setting for the clock source sampling rate etc Analog Input Continuous Waveform Acquisition DAGQPilor Timing Setting Copyright 2007 ADUNK Technology Inc All Rights Reserve d Bek Next gt Cencel Click Next when finished Creating DAQ Tasks 21 DAQPilot Setting the Trigger Setting the Trigger You may define the trigger condition and set the trigger source through this window Some trigger conditions are automatically adjusted depending on the value of the trigger source Analog Input Continuous Waveform Acquisition DAQPilof D2K Trigger Setting Copyright 2007 ADLINK Technology Inc AlI Rights Reserve d lt Back Next gt Cancel Click Next when finished 22 Creating DAQ Tasks DAQPilot Setting the Trigger 3 3 Testing the Task After setting the task parameters you may use the built in test panel in the wizard to know if the task parameters are in range and if the task works properly Click gt to begin testing the task To stop testing click 1 You may also click e to change the instant test panel window set tings MI Instant Test Panel AIContinuous Ce After task verification click Finished to close the wizard and return to the DAQPilot task manager Creating DAQ Tasks 23 DAQPilot Setting the Trigger 3 4 Generating the Code T
52. U DAQPilot TASK DO PORT OUTPU DAQPilot TASK DO ONESHOT DAQPilot TASK DO CONTINUE 2 Without this function user needs to prepare the DAQPI LOTDigitalData data 132 APIs Function Reference DAQPilot DAQPilot_GetDOBuffer Example HANDLE hDAQPilotTask NULL DAQPilotDigitalData DAOPilotData DAOPilotStatusID eError DP STATUS NOERROR int i 0 int nValue 0 Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask DOLineOutput TRUE Call DAQPilot_GetDOBuffer function to get the default DAQPilotDigitalData eError DAOPilot GetDOBuffer hDAQPilotTask amp DAQPilotData 0 if eError DP STATUS NOERROR fill DO Buffer for i 0 i lt DAQPilotData nNumOfChannel i printf Line d output value DAOPilotData lpPortOrLineList i scanf d snValue DAQPilotData lpRawData i nValue printf Nn eError DAOPilot DO WriteChannels hDAOPilotTask amp DAQPilotData DAOPilot EndTask hDAOPilotTask APIs Function Reference 133 DAQPilot DAQPilot_SetDOPattern 5 33 DAQPilot_SetDOPattern Prepares the output pattern for one shot and continuous DO modes DAOPilotStatusID DAOPilot SetDOPattern HANDLE hTask DAQPILOTDigitalData pstDataInfo Parameters hTask Task handle pstDatalnfo The pointer to the DAQPILOTDigitalData structure memory space for data to output Return Values The r
53. aledData contains the data You may process the data here for j 0 j lt DAOPilotData nNumOfChannel j Printi SE double DAQPilotData lpScaledData j printf n DAOPilot EndTask hDAOPilotTask 108 APIs Function Reference DAQPilot DAQPilot_GetAl Waveform 5 17 DAQPilot GetAlWaveform Acquires continuous analog input signal from a single channel or from multiple channels Acquisition mode may be in one shot or continuous mode DAOPilotStatusID DAOPilot GetAIWaveform HANDLE hTask DAQPILOTAnalogData pstDatalnfo DWORD dwTimeOut Parameters hTask Task handle pstDatalnfo A pointer to the DAQPILOTAnalogData structure memory space that will receive the analog data dwTimeOut The timeout interval in milliseconds If dwTimeOut is 0 the function tests the object s state then returns immediately If dwTimeOut is INFINITE the function continues until data acquisition is completed Return Values The return value may be a status a warning or an error Remarks This function is available only for the following tasks DAOPilot TASK AI ONESHOT DAOPilot TASK AI CONTINUE APIs Function Reference 109 DAQPilot DAQPilot_GetAl Waveform Example 110 HANDLE hDAOPilotTask NULL DAQPilotAnalogData DAQPilotData DAQPilotStatusID eError DP_STATUS_NOERROR int j 0 k 0 Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE
54. alog Input Polling The single channel or multi channel voltage polling acquires the analog input signal from selected channels a Single shot Waveform Acquires the analog input Acquisition signal from selected channels in a period eo cs Continuous Waveform Acquires the analog input fall Acquisition signal continuously from selected channels Analog Output Voltage Output Outputs a specific voltage to E HL a selected single or multi channel configuration Current Output Outputs a specific current to selected channels in single channel or multi channel configuration Zu u 1 Single shot Waveform Generates analog Generation waveforms to selected channels in a period 2 Kj A Continuous Waveform Generates analog Generation waveforms continuously to selected channels a Function Generation Generates common waveforms such as sine square triangle and sawtooth to selected channels in a period p gt Introduction 5 DAQPilot Supported Tasks Digital Input j Line Input Acquires a digital line value from a selected line Port Input Acquires a digital port value from a selected port Single shot Pattern Acquires a single shot digital Acquisition pattern from a selected port Continuous Pattern Acquires continuous digital Acquisition pattern from a selected port Digital Output
55. automatically updated when you change a DAQ task AISingle fF 2 aOContir AOCurre AOFunGe Installation HIV acsingleShat Xl AOVoltage I ue ify AIContinuous Copy AIContinuous Rename AIContinuous Delete AIContinuous Instant test panel for AIContinuous C reference code for AIContinuous Task File Location Last Update 6 A i DIContinuous Em DILinelnput kr p 7 Eri DIPortInput 13 DAQPilot DAQPilot Task Manager Using the instant test panel After customizing a DAQ task right click the task from the left pane then select Instant test panel from the popup menu A test panel window appears Click to begin testing the task To stop testing click 1 You may also click a to change the instant test panel window settings MI instant Test Panel AIContinuons kvu il ku j If you are planning to use two ADLINK DAQ cards with SSI func tion the DAQPilot task manager allows you to simultaneously generate two different task specifications and two separate instant test panels to show you the task test result while designing the application 14 Installation DAQPilot DAQPilot Task Manager To display two instant test panels for SSI functionality 1 Create a DAQ task for each card 2 Set the SSI parameters for both DAQ tasks 3 Launch the instant test panels of the DAQ tasks to test Installation 15 DAQPilot
56. ax No Mailing Address market adlinkchina com cn 86 10 5885 8666 86 10 5885 8625 Room 801 Building E Yingchuangdongli Plaza No 1 Shangdidonglu Haidian District Beijing China ADLINK TECHNOLOGY SHANGHAI CO LTD Sales amp Service Telephone No Fax No Mailing Address market adlinkchina com cn 86 21 6495 5210 86 21 5450 0414 Floor 4 Bldg 39 Caoheting Science and Technology Park No 333 Qinjiang Road Shanghai China ADLINK TECHNOLOGY SHENZEN CO LTD Sales 8 Service Telephone No Fax No Mailing Address market Qadlinkchina com cn 86 755 2643 4858 86 755 2664 6353 C Block 2nd Floor Building A1 Cyber tech Zone Gaoxin Ave 7 S High tech Industrial Park S Nanshan District Shenzhen Guangdong Province China DAQPilot User s Manual Using this manual Audience and scope This manual guides you when using the task oriented DAQPilot development application This manual also describes how to install and use the DAQPilot when creating programs for your soft ware applications How this manual is organized This manual is organized as follows Chapier 1 Introduction This chapter introduces the DAQPilot application including it main features highlights and supported tasks and devices Chapter 2 Installation This chapter provides information on DAQPilot system requirements installation and user interface Chapter 3 Creating DAQ Tasks The chapter describes the pro cedure o
57. ction Reference
58. ctions on how to create a DAQ applica tion using DAQPilot s AlSingleShot and demonstrates basic AlSin gleShot usage The process involves five steps Creating the configuration task file Creating the Visual Studio C project Integrating the library file Editing the task files Running the application vvv vV V Creating the Configuration Task File Create a configuration task file using DAQPilot Refer to Chapter 3 Creating DAQ Tasks for more information The cre ated configuration task file is stored in this default directory C ADLINK DAQPilot Task Folder Take note of the task file location Programming with DAQPilot 59 DAQPilot API Example for Microsoft Visual Studio C Creating the Visual Studio C Project Use the New Project dialog to start a new project in Visual Studio C development environment Click File from the main menu then click on New gt Project Select Visual C from the project type section then select Win32 Console Application from the Press OK to apply Refer to the figure below templates section slim Project types Templates B Visual C Visual Studio installed templates 4 kases lias Custom Wizard windows Forms Application ka a peN EM CLR Console Application Win32 Console Application es sek ATL Project dls MFC Application 5 Other Languages S Makefile Project ASP NET Web Service i Visual Basic J ATL Server Project i ATL Ser
59. d NET Component Function Reference DAQPilot GetDProperty Method 6 13 GetDProperty Method DAQPilot provides a method to get all properties You may query the parameters from a specific task Syntax VB Function object GetDProperty PropertyName As String As Variant VC VARIANT object GetGetDProperty LPCTSTR PropertyName BCB TVariant object GetDProperty BSTR PropertyName Delphi function object GetDProperty const PropertyName WideString OleVariant VB NET Function object GetDProperty PropertyName As String As Object VC object object GetGetDProperty string PropertyName di Arguments PropertyName As String Property string Return Value The return value is the property value Remarks 1 Different devices support different parameters 2 You may launch the DAQPilot wizard property page to get additional property information gt Edit Control data range from 1 79769313486232E308 to 1 79769313486232E308 gt Combo Box Control get Enum data gt Check Box Control get Boolean data 3 See Chapter 4 Programming with DAGPilot for more information ActiveX Controls and NET Component Function Reference 161 DAQPilot Config Method 6 14 Config Method Pre initializes the system resource before executing any tasks If you do not execute Config before Start the Start method automatically initializes the relative configuration and you may not immediately start th
60. e to release the DAQPilot task 4 You may launch the DAQPilot wizard to know more about function usage See Chapter 4 Programming with DAQPilot for more information Example 84 HANDLE hDAQPilotTask NULL Load your DAOPilot task hDAOPilotTask DAQPilot_CreateTask DAOPilot TASK AI ONESHOT DEVICEID VIRTUAL DEVICE 0 TRUE DAOPilot EndTask hDAOPilotTask APIs Function Reference DAQPilot DAQPilot_EndTask 5 3 DAQPilot_EndTask Releases the DAQPilot s memory threads and related system resource The function must be called at the end of a DAQPilot application BOOL DAQPilot_EndTask HANDLE hTask Parameters hTask Task handle Return Values TRUE DAQPilot closed successfully FALSE DAQPilot failed to close Example HANDLE hDAOPilotTask NULL Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE DAOPilot EndTask hDAOPilotTask APIs Function Reference 85 DAQPilot DAQPilot_SetChannelProperty 5 4 DAQPilot_SetChannelProperty DAQPilot provides a series of APIs to set all channel properties You may directly modify the parameters to suit a specific task DAOPilotStatusID DAQPilot_SetChannelStringProperty HANDLE hTask int nChannelNum LPCSTR lpszChannelPropertyID VARIANT vValue i DAOPilotStatusID DAQPilot_SetChannelProperty HANDLE hTask int nChannelNum ChannelProper
61. e All selected components now appear in the Tool Palette Project Options for Default exe x 1 Click Component gt Install Packages from the main menu to display the Package dialog box Click Add to display the Add Design Package window then locate the DAQPilotPkg bpl file from the following Design packages C2 ADLINK DA Pilot BCE Component Borland ActionB ar Components i V Borland ADO DB Components V Borland Base Cached ClientDataset Component Borland BDE DB Components M Borland C Builder COM Server Components Sample Package Zi C SADLINK DAGPilot bin BCBE DAGPilotPkg bpl Add Remove Components Runtime packages IV Build with runtime packages delocxdbexpress dbxcdsindy bcb2kakserverDAQPIotPkd Add Programming with DAQPilot DAQPilot Component Example for Borland C Builder Access Violation When the application fails to find the package library DAQPilot Pkg bpl an Access Violation warning message appears when using a DAQPilot component 17 CPU n xi 0x0040122E Thread 0x00000ES8 fIr e 0040129C jmp Ox40124E EBX 7FFDEOOO 1 0040129E bound di edx ECX 0012FFBO AFO 00401241 inc ebx EDX 7C92EB94 ZF 1 00401242 sub ebp ebx ESI 00000000 SF 0 00401244 dec eax EDI 00000000 TF 0 00401245 dec edi EBP 0012FFFO IF 1 00401246 dec edi _Jlesp ooizrrca oF o 00401247 dec ebx EIP 0040129C OF Oo 00401248 nop EFL 0
62. e per channel 1000 object vDaqpilotValue vDaqpilotValue daqPilotEnginel GetChannelProperty 1 Enable vDaqpilotValue dagqPilotEnginel GetChannelProperty 1 Range vDaqpilotValue daqPilotEnginel GetDProperty Number of scan s Programming with DAQPilot DAQPilot NET Component Example for C NET Working with Control Methods Place a ListView NET component on Form1 with property value Details as its View property Refer to the figure below Properties ix listView1 System Windows Forms l ES TabStop True Ta Tag B TileSize 0 0 UseWaitCursor False View Details VirtualListSize Largelcon VirtualMode al Visible Smallicon View Selects one of fiv that items can be shown in Place a Button NET component tagged as Start Refer to the fig ure below Formi cs Form1 cs Design x A dagPilotEngine1 Programming with DAQPilot 31 DAQPilot NET Component Example for C NET To call a method attach the method name to the component If the method does not need any parameters you can directly call the method with this syntax object method For example the Start method can launch the task function which is predefined in the component DAQPilotEnginel Start Developing Event Handlers After configuring the components you may continue to create event handlers in your program to hook appropriate events gener a
63. e task application Syntax VB Function object Config As Long VC long object GetConfig BCB long object gt Config Delphi function object Config LongInt VB NET Function object Config As Long VC long object Config Return Value The return value may be a status a warning or an error These status IDs are defined in the DAQPilotAdvancedProperties h Remarks 1 Since Config is a time consuming method of initializing hardware allocating memory generating thread etc it is recommended that you complete this function before executing Start 2 If you changed the channel property or property call Config method to apply the modification s 162 ActiveX Controls and NET Component Function Reference DAQPilot EnableSingleChannel Method 6 15 EnableSingleChannel Method Enables only a single channel Syntax VB Function object EnableSingleChannel nChannelNum As Long As Long VC long object GetEnableSingleChannel long nChannelNum BCB long object gt EnableSingleChannel long nChannelNum i Delphi function object EnableSingleChannel nChannelNum LongInt LongInt VB NET Function object EnableSingleChannel nChannelNum As nteger As Long VC long object GetEnableSingleChannel int nChannelNum i Arguments nChannelNum As Long Channel number Return Value The return value is DAQPilot status ID These status IDs are defined in DAQP
64. e the ADLINK DAQPilot ActiveX Control v1 0 from the list then click on the checkbox before the component name to select Components Controls Designers Insertable Objects 1 VideoSoft vsFlex3 Controls Active Setup Control Library ADAXLib 1 0 Type Library CA ADLINK DAQPilot ActiveX Control v1 0 AxBrowse C WINDOWS system32 DBUI ocx C WINDOWS system2 msconf dll C WINDOWS system2 tde ocx Cdla cic 1 0 Type Library CompatUI 1 0 Type Library ComSnap 1 0 Type Library a Crystal Common File Dialog Library 2 7 v ENE lt gt 7 Selected Items Only ADLINK DAQPilot Activex Control v1 0 Location C ADLINK DAQPilot DAQPilatAx ocx Cancel Apply 3 Select all related components you want to add in your project by clicking on the checkboxes 4 When finished click OK to close the window All selected components now appear in the toolbox Programming with DAQPilot 49 DAQPilot ActiveX Example for Microsoft Visual Basic Setting Properties at Design Time After placing a component on a Visual Basic form you can config ure the component by setting its properties with the DAQPilot cus tom control property pages Refer to the figure below Each component has its own set of default properties such as component name Do any of the following to open the Properties window Select Properties Window from the View menu then click the Properties Window button from the toolbar gt Directly launch the
65. ects are not thread safe at the object level for size and performance reasons This means that you can have two separate threads manipu lating two different MFC objects but not two threads manipulating the same MFC object 2 To use the DAQPilot ActiveX control set MultiThread Property to False There is no more need to look after complex multi threading programming with critical sec tion mechanism 3 Some IDE such as in VB6 and VEE cannot handle mul tiple threaded components properly in terms of memory allocation while using these continuous I O functions DAQPilot_TASK_AI_CONTINUE DAQPilot_TASK_AO_CONTINUE DAQPilot_TASK_DI_CONTINUE DAQPilot_TASK_DO_CONTINUE 4 If you are a multiple thread program expert enable the MultiThread property to enhance task performance However provide access to the same object with appro priate Win32 synchronization mechanisms ActiveX Controls and NET Component Function Reference 145 DAQPilot ShowErrorMessage Property 6 4 ShowErrorMessage Property A flag that determines whether or not to report an error message Data Type VB Boolean VC BOOL BCB bool Delphi WordBool BCB Boolean Delphi bool Syntax VB Dim bShowErrorMessage As Boolean bShowErrorMessage object ShowErrorMessage get ShowErrorMessage object ShowErrorMessage bShowErrorMessage set ShowErrorMessage VC BOOL bShowErrorMessage bShowErrorMessage object GetShowErrorMessage
66. eenseaes 7 V5 Where to Gel arn sbiacsasssnnacsatannneccacanencceasasbevsindaviasteas 7 2 Installation s ss cactiseavencediaavtes seavidesdieadaiwsneinaetena senkon uatan 9 2 1 Before You Proceed e ees eeseseeenennnsnennennnnnanaii 9 System Requirements esse eseenensanannneeaen 9 22 Installino DAQPIlot sss aa nar esas 10 2 3 Checking the DAQ Card Drivers 10 2 4 Getting to Know DAGPilot esee ee seeeessseeeein 11 DAQPilot Task Manager ccecceeeseeeeeeeeeeeeeeeeeneees 11 3 Creating DAQ Tasks sesa eene n okopa ker raan dead 17 3 1 Specifying the Task eeeeeeseeenesennnnenannnetan 17 3 2 Setting the Parameters e eeeessenennenannnetan 19 Task Name and Description ee eeeeeeeeeeeeeeeeeeeeees 19 Device and Channels ssssssssssssssusassseno 20 Acquisition Parameters cccccceeeseeeeeeeeeeeeeeeeeeeeeeeees 21 Setting the Trigger c cccsscceeeeeeeeseeeeeeereesenaeeeeeeeess 22 3 3 Testing the Task snr aa denials 23 3 4 Generating the Code cceceeceseeeeeeeeeeeceeeeeeeeteaeeneeees 24 4 Programming with DAGPilot s ieo 25 4 1 NET Component Example for Cif ee esse eee 25 Creating the Visual Studio C DAQ Project 26 Adding DAQPilot Component to the
67. ence DAQPilot DAQPilot GetDI Pattern Display caption nNumOfPort DAOPilotData nNumOfChannel printf No for k 0 k nNumOfPort k printf Port d DAQPilotData lpPortOrLineList k printf n Now the DAQPilotData lpRawData contains the digital data You may process the data here for i 0 i lt DAQPilotData dwNumOfScan i printf d i for j 0 j nNumOfPort j k i nNumOfPort j switch DAQPilotData nRawDataBits case 8 printf Sc BYTE DAQPilotData lpRawData k break case 16 printf Su WORD DAQPilotData lpRawData k break case 32 printf Slu DWORD DAQPilotData lpRawData k break printf n DAQPilot_EndTask hDAQPilotTask APIs Function Reference 123 DAQPilot DAQPilot_DO_WritePort 5 26 DAQPilot DO WritePort Outputs a digital value to a digital port DAOPilotStatusID DAOPilot DO WritePort HANDLE hTask DWORD dwValue Parameters hTask Task handle dwValue The digital port value to output Return Values The return value is DAQPilot status ID Remarks This function is available only for DAQPilot_TASK_DO_PORT_OUTPUT Example HANDLE hDAQPilotTask NULL DWORD dwValue 1 Load your DAQPilot task hDAQPilotTask DAQPilot_LoadTask DOPortOutput TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAOPilotTask 0 DAOPilot DO WritePo
68. eturn value is DAQPilot status ID Remarks 1 This function is available only for the following tasks DAOPilot TASK DO ONESHOT DAOPilot TASK DO CONTINUE 2 Use DAQPilot SetDOPattern to prepare the output pat tern Then use DAGPilot Start to output the data Example DAQPilotDigitalData DAOPilotData DAOPilotStatusID eError DP STATUS NOERROR DWORD dwCyclEnumOfSamples 0 DWORD dwNumOfPort 0 double dbAmplitude 1 DWORD i 0 j 0 k 0 Load your DAQPilot task hDAOPilotTask DAQPilot_LoadTask DOSingleShot TRUE Configure parameters and build default DO buffer eError DAOPilot Config hDAOPilotTask Get default DO Buffer info DAQPilot_GetDOBuffer hDAOPilotTask DAOPilotData 0 dwCyclEnumOfSamples DAOPilotData dwNumO Scan 134 APIs Function Reference DAQPilot DAQPilot_SetDOPattern dwNumOfPort DAOPilotData nNumOfChanne for i 0 i lt DAOPilotData dwNumOfScan i for j 0 j DWORD dwNumOfPort j k i dwNumOfPort j switch DAQPilotData nRawDataBits case 8 BYTE DAQPilotData lpRawData k BYTE sin double i double dwCyclEnumOfSamples 2 3 14159 dbA mplitude break case 16 WORD DAQPilotData lpRawData k WORD sin double i double dwCyclEnumOfSamples 2 3 14159 dbAmplitude break case 32 DWORD DAOPilotData lpRawData k DWORD sin double i
69. ext i End Sub 44 Programming with DAQPilot DAQPilot NET Component Example for Microsoft Visual Basic NET Running the Application Press the Start button in your sample application to run and dis play the data No Cho chi 0 1 7648315 2 1951293 3 03558343 4 58801 26 0 5841 064 2 9931 6406 3 52508544 0 9588623 3 44879150 4 5104980 4 18670654 3 1948852 1 6876220 4 22302246 4 63348388 4 3395996 0 75134277 1 12457275 cooooooOPOPGPODPOGODO Programming with DAQPilot 45 DAQPilot NET Component Example for Microsoft Visual Basic NET Source Codes Public Class Forml Private Sub Buttonl_Click ByVal sender As System Object ByVal e As System EventArgs Handles Button1 Click DagPilotEnginel SetChannelProperty 1 Enable True DagPilotEnginel SetChannelProperty 1 Range 203 DagPilotEnginel SetChannelProperty 1 Range DAQPilotValueID DPV_RANGE_B 2 5 V DaqPilotEnginel SetDProperty Number of scan s 100 DaqPilotEnginel SetDProperty Sampling rate per channel 1000 Dim vDagpilotValue As Object vDaqpilotValue DaqPilotEnginel GetChannelProperty 1 Enable vDaqpilotValue DaqPilotEnginel GetChannelProperty 1 Range vDaqpilotValue DaqPilotEnginel GetDProperty Number of scan s DaqPilotEnginel Start End Sub Private Sub DaqPilotEnginel DataArrival ByVal sender As System Object ByVal e As adlink daqgpilo
70. f DAOPilot start result s An lpszMessage DAOPilot EndTask hDAOPilotTask 102 APIs Function Reference DAQPilot DAQPilot_Config 5 12 DAQPilot_Config Pre initializes the system resource before executing any task job If you do not execute DAQPilot Config before DAQPilot_Start DAQPilot_Start automatically initializes all related configurations and does not allow a task application to immediately start DAOPilotStatusID DAQPilot_Config HANDLE hTask 7 Parameters hTask Task handle Return Values The return value may be a status a warning or an error NOTE DAQPilot_Config is a time consuming function to initial ize hardware allocate memory generate thread and so on So it is better to complete this function before execut ing DAGPilot Start If you have changed channel property by DAGPilot SetChannelProperty and DAQPilot_SetProperty respectively you may call DAQPilot_Config function to apply the modification Example HANDLE hDAOPilotTask NULL DAOPilotStatusID eStatus DP STATUS NOERROR Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE eStatus DAOPilot GetTaskStatus hDAQPilotTask eStatus DP STATUS DEVICE STOP AND DIRTY DAQPilot Config hDAOPilotTask eStatus DAOPilot GetTaskStatus hDAOPilotTask eStatus DP STATUS DEVICE STOP device is ready to run DAOPilot Start hDAOPilotTask Start task immediately DAOPi
71. geValue DAOPilot EndTask hDAOPilotTask APIs Function Reference 111 DAQPilot DAQPilot_AO_WriteChannels 5 19 DAGPilot AO WriteChannels Outputs analog data to multiple channels DAOPilotStatusID DAOPilot AO WriteChannels HANDLE hTask DAQPILOTAnalogData pstDatalnfo I Parameters hTask Task handle pstDatalnfo A pointer to the DAQPILOTAnalogData structure memory space for data to output Return Values The return value is DAQPilot status ID Remarks This function is available only for the following tasks DAQPilot_TASK_AO_VOLTAGE_OUTPU DAQPilot_TASK_AO_CURRENT_OUTPU 112 APIs Function Reference DAQPilot DAQPilot_AO_WriteChannels Example HANDLE hDAOPilotTask NULL DAQPilotAnalogData DAQPilotData DAQPilotStatusID eError DP_STATUS_NOERROR int i 0 float fVoltageValue 0 Load your DAOPilot task hDAOPilotTask DAOPilot LoadTask AOVoltage TRUE Call DAQPilot_GetAOBuffer function to get the default DAQPilotAnalogData eError DAQPilot_GetAOBuffer hDAOPilotTask DAOPilotData 0 i eError DP STATUS NOERROR fill AO Buffer for i 0 i lt DAOPilotData nNumOfChannel i printf Channel d Voltage value DAOPilotData lpChannelNoList i scanf Sf sfVoltageValue DAQPilotData lpScaledData i fVoltageValue printf Nn eError DAOPilot AO WriteChannels hDAOPilotTask DAOQPilotData DAOPilot E
72. he name of the created task now appears in the list of tasks in the task pane Right click on the task to generate the C code fdo e ebra a tread brutan ha harde Be amol marchon ORO WIAR Trees reL YOO Paani MOeclie vsestine HANDLE IOAGP RaT ab MUL WOM OPa WAL rt ODi D WORD debncinCoure 0 DP itin oe DAPR ote HDAC UAT ace HANDLE Paran TAnzkay canon rthuebiChornel DADPs ie natie parnet E DA PKA ah oO Noted ki ebhumDOhanrat kaj ERRE Charred IA KOPLO LI i Iama lemas BONNE l esma setero postem DADPS D dinar DAF seda aver OADPIST ach ADAGIO a INFINITE mens 5 0 md ecan aron porkon oman een gt DADP Cette yekan DAPET ak DADPkAD ala 0 Akkor 1 DO STATUS NOLEROR Another window opens with the generated code Copy the code then compile and run it in your programming application 24 Creating DAQ Tasks DAQPilot NET Component Example for C NET 4 Programming with DAGPilot The chapter describes the integration of DAQPilot with main stream programming languages to streamline the development of DAQ applications 4 1 NET Component Example for CH NET This section provides instructions on how to create a DAQ applica tion using DAQPilot s NET Assembly The process involves seven steps Creating the Visual Studio C DAQ project Adding DAQPilot component to the project s toolbox Setting the properties at design time Editing the properties at runtime Working with c
73. iewl Items Clear ListViewl Columns Clear SAFEARRAY sa ChNumList vt amp VT BYREF kxChNumList pparray ChNumList parray DWORD dwElements sa rgsabound 0 cElements SafeArrayLock amp sa for UINT i 0 i lt dwElements i AnsiString strColumn strColumn sprintf Ch d short sa pvData i ListViewl Columns Add ListViewl Columns Items i Caption strColumn ListViewl Columns Items i Width 80 SafeArrayUnlock amp sa Programming with DAQPilot 75 DAQPilot Component Example for Borland C Builder Display the data sa Data gt vt amp VT BYREF Data gt pparray Data gt parray dwElements sa rgsabound 0 cElements DWORD dwDisplayCount dwElements NumberOfChannel SafeArrayLock amp sa for UINT i 0 i lt dwDisplayCount i AnsiString strValue strValue sprintf SE double sa pvData i NumberOfChannel1 0 TListItem ListItem ListItem ListViewl Items Add ListItem Caption strValue for int j 1 j NumberOfChannel j strValue sprintf Sf double sa pvData i NumberOfChannel j ListItem SubItems Add strValue SafeArrayUnlock amp sa 76 Programming with DAQPilot DAQPilot Component Example for Borland C Builder Running the Application Press the Start button in your sample application to run and dis play the data Formi lof x
74. igned object SetUnsignedToSigned bUnsignedToSigned set UnsignedToSigned BCB bool bUnsignedToSigned bUnsignedToSigned object UnsignedToSigned get UnsignedToSigned object UnsignedToSigned bUnsignedToSigned set UnsignedToSigned Delphi bUnsignedToSigned WordBool object UnsignedToSigned bUnsignedToSigned get UnsignedToSigned bUnsignedToSigned object UnsignedToSigned set UnsignedToSigned VB NET Dim bUnsignedToSigned As Boolean bUnsignedToSigned object UnsignedToSigned get UnsignedToSigned object UnsignedToSigned bUnsignedToSigned set UnsignedToSigned VC bool bUnsignedToSigned bUnsignedToSigned object GetUnsignedToSigned get UnsignedToSigned object SetUnsignedToSigned bUnsignedToSigned set UnsignedToSigned ActiveX Controls and NET Component Function Reference 149 DAQPilot UnsignedToSigned Property Settings r lil IIlll BBKa B e SE Value Description True Display tick above graph False Do not display tick about graph Default Remarks This property is intended for languages which do not support unsigned data type such as VB and VEE When you use DAQPi lot ActiveX component with these IDE tool and gets a Variant Unsupported variant type error message set this property to True 150 ActiveX Controls and NET Component Function Reference DAQPilot LoadTas
75. ilotAdvancedProperties h Remarks This function disables all channels then enables the specified channel ActiveX Controls and NET Component Function Reference 163 DAQPilot Read Method 6 16 Read Method Acquires the values from multiple channels Syntax VB Function object Read As Variant VC VARIANT object GetRead BCB TVariant object Read Delphi function object Read OleVariant VB NET Function object Read As Object VC object object GetRead Return Value Acquired values from multiple channels wrapped in a VARIANT variable Remarks 1 164 This function is available only for the following tasks DAQPilot_TASK_AI_VOLTAGE_POLLING DAQPilot_TASK_DI_LINE_INPU DAQPilot_TASK_DI_PORT_INPU DAQPilot_TASK_DO_LINE_OUTPU DAQPilot_TASK_DO_PORT_OUTPU DAQPilot_TASK_TC_COUNTER DAQPilot_TASK_TC_MODE_OPERATION The return data type depends on the task type enabled number of channels and UnsignedToSigned Property When only channel is enabled the return data type is VT Ul1 or VT_Ul2 or VT_Ul4 or VT R8 When the UnsignedToSigned Property is enabled the return data type is VT l1 or VT_l2 or VT 14 or VT R8 When multi ple channels are enabled the return data type is VT_UI1 VT_ARRAY or VT_I1 VT_ARRAY or VT UI2 VT ARRAY or VT_l2 VT_ARRAY or VT_UI4 VT_ARRAY or VT_l4 VT_ARRAY or VT_R8 VT_ARRAY
76. ilotValueID DPV RANGE B 2 5 V Change number of scan property to 100 by method DaqPilotEnginel SetDProperty Number of scan s 100 DaqPilotEnginel SetDProperty Sampling rate per channel 1000 Dim vDagpilotValue As Object vDaqpilotValue DaqPilotEnginel GetChannelProperty 1 Enable vDaqpilotValue DaqPilotEnginel GetChannelProperty 1 Range vDaqpilotValue DaqPilotEnginel GetDProperty Number of scan s Programming with DAQPilot 41 DAQPilot NET Component Example for Microsoft Visual Basic NET Working with Control Methods Place a ListView NET component on Form1 with property value Details as its View property Refer to the figure below Properties E g a 21 TabStop True a Tag A TileSize 0 0 UseWaitCursor False View Details VirtualListSize Largelcon VirtualMode E Visible Smallicon View List Selects one of fivi klaj that items can be shown in Place a Button NET component tagged as Start Refer to the fig ure below m daqPilotEngine1 42 Programming with DAQPilot DAQPilot NET Component Example for Microsoft Visual Basic NET To call a method attach the method name to the component If the method does not need any parameters you can directly call the method with this syntax object method For example the Start method can launch the task function which is predefined in the component DAQPilotEnginel S
77. ion Arguments IsModalDialog As Boolean True False Caption As String Return Values A modal dialog box prompts you to enter information or cancel the dialog box before allowing the application to continue A modeless dialog box allows you to enter information and return to a previous task without closing the dialog box Standard test panel caption TRUE Function is successfully excuted FALSE Function failed ActiveX Controls and NET Component Function Reference 171 DAQPilot DataArrival Event 6 22 DataArrival Event DAQPilot ActiveX control gets the data in analog digital input task Syntax VB Sub ControlName DataArrival NumberOfChannel As Long ChNumList As Variant Data As Variant VC afx_msg void OnDataArrival long NumberOfChannel VARIANT FAR ChNumList VARIANT FAR Data BCB void __fastcall DataArrival long NumberOfChannel TVariant ChNumList TVariant Data Delphi procedure DataArrival NumberOfChannel LongInt ChNumList OleVariant Data OleVariant VB NET Sub ControlName DataArrival ByVal sender As System Object ByVal e As DAQPilotEngine DAQPilotDataEventArgs Note e NumberOfChannel As Int32 e ChNumList As Intl6 e Data As Object VC void ControlName_DataArrival object sender DAQPilotEngine DAQPilotDataEventArgs e Note int e NumberOfChannel short e ChNumList ref object e Data Arguments NumberOfChannel As Long Numbe
78. k Method 6 7 LoadTask Method Loads the DAQPilot task specification from the DAQ task file This function must be called before calling other operations Syntax VB Function object LoadTask lpszTaskName As String As Boolean VC BOOL object GetLoadTask LPCTSTR lpszTaskName BCB bool object gt LoadTask BSTR lpszTaskName Delphi function object LoadTask const lpszTaskName WideString WordBool VB NET Function object LoadTask lpszTaskName As String As Boolean VC bool object LoadTask string lpszTaskName Arguments lpszTaskName As String The task filename to load This function loads the task file tsk from the default folder INSTALL DIR Task Folder If DAQPilot does not install in the target folder you must store the application file and the task file in the same folder Return Value When the function succeeds the return value is True If it fails the return value is False You may obtain the relative error information when ShowErrorMessage Property is True ActiveX Controls and NET Component Function Reference 151 DAQPilot LoadTask Method Remarks 1 The lpszTaskName parameter does not need a full file name with extension For example AlSingleShot repre sent AlSingleShot tsk 2 DAQPilot_LoadTask or DAQPilot_CreateTask only loads or creates the specified task If you want to apply the task configuration to the hardware call DAQGPilot Config to complete
79. le use DAQPilot_SetChannelStringProperty 0 Range to modify the range and use DAQPilot_SetChannelStringProperty 0 RefGround to assign the reference base Example HANDLE hDAOPilotTask NULL Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE DAQPilot_SetChannelPropertyEnum hDAQPilotTask 0 CP Range DPV RANGE B 2 5 V DAOPilot EndTask hDAOPilotTask APIs Function Reference 89 DAQPilot DAQPilot_GetChannelProperty 5 5 DAQPilot_GetChannelProperty DAQPilot provides a series of APIs to get all channel properties You can query the parameters from a specific task VARIANT DAQPilot_GetChannelStringProperty HANDLE hTask int nChannelNum LPCSTR lpszChannelPropertyID i VARIANT DAQPilot_GetChannelProperty HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID i BOOL DAQPilot_GetChannelPropertyBool HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID i DAQPilotValueID DAQPilot_GetChannelPropertyEnum HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID i int DAOPilot GetChannelPropertyI4 HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID i DWORD DAQPilot_GetChannelPropertyU4 HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID i 90 APIS Function Reference DAQPilot
80. lephone No Fax No Mailing Address http www adlinktech com service Qadlinktech com 886 2 8226 5877 886 2 8226 5717 9F No 166 Jian Yi Road Chungho City Taipei Hsien 235 Taiwan ROC ADLINK TECHNOLOGY AMERICA INC Sales amp Service Toll Free Fax No Mailing Address info adlinktech com 1 866 4 ADLINK 235465 1 949 727 2099 8900 Research Drive Irvine CA 92618 USA ADLINK TECHNOLOGY EUROPEAN SALES OFFICE Sales amp Service Toll Free Fax No Mailing Address emea adlinktech com 49 211 4955552 49 211 4955557 Nord Carree 3 40477 Dusseldorf Germany ADLINK TECHNOLOGY SINGAPORE PTE LTD Sales amp Service Telephone No Fax No Mailing Address singapore adlinktech com 65 6844 2261 65 6844 2263 84 Genting Lane 07 02A Cityneon Design Center Singapore 349584 ADLINK TECHNOLOGY SINGAPORE PTE LTD INDIA Liaison Office Sales amp Service Telephone No Fax No Mailing Address india adlinktech com 91 80 57605817 91 80 2667 1806 No 1357 Ground Floor Anupama Aurobindo Marg JP Nagar Ph 1 Bangalore 560078 DAQPilot User s Manual ADLINK TECHNOLOGY INC KOREA Liaison Office Sales amp Service Telephone No Fax No Mailing Address korea adlinktech com 82 2 20570565 82 2 20570563 4F Kostech Building 262 2 Yangjae Dong Seocho Gu Seoul 137 130 South Korea ADLINK TECHNOLOGY BEIJING CO LTD Sales amp Service Telephone No F
81. lot EndTask hDAQPilotTask APIs Function Reference 103 DAQPilot DAQPilot_ Start 5 13 DAGPilot Start Performs a DAQ task start DAOPilotStatusID DAOPilot Start HANDLE hTask Parameters hTask Task handle Return Values The return value may be a status a warning or an error Remarks 1 This function is available only for the following tasks DAQPilot_TASK_AI_ONESHO DAQPilot_TASK_AI_CONTIN DAOPilot TASK AO ONESHO DAOPilot TASK AO CONTIN DAOPilot TASK AO FUNCTIO O N O C E E Q LEI Z DAQPilot_TASK_DI_ONESH DAQPilot_TASK_DI_CONTI DAQPilot_TASK_DO_ONESH DAQPilot_TASK_DO_CONTINU DAQPilot_TASK_TC_COUNTER DAQPilot_TASK_TC_TIMER_INTERRUPT DAQPilot_TASK_TC_MODE_OPERATION E 2 To improve the function performance refer to the DAGPilot Config function Example HANDLE hDAOPilotTask NULL Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE DAOPilot Start hDAOPilotTask DAOPilot EndTask hDAOPilotTask 104 APIs Function Reference DAQPilot DAQPilot_Stop 5 14 DAQPilot_Stop Stops a DAQ task DAOPilotStatusID DAOPilot Start HANDLE hTask 7 Parameters hTask Task handle Return Values The return value is the DAQPilot status ID Remarks This function is available only for the f
82. lotDigitalData DAOPilotData DAOPilotStatusID eError DP STATUS NOERRO int nValue 0 int i 0 Load your DAOPilot task R hDAOPilotTask DAQPilot_LoadTask DOPortOutput TRUE Enable both channel 0 and channel 1 DAQPilot_SetChannelPropertyBool hDAQPilotT 0 CP Enable TRUE DAQPilot_SetChannelPropertyBool hDAQPilotT 1 CP_Enable TRUE ask ask Call DAOPilot GetDOBuffer function to get the default DAQPilotDigitalData eError DAOPilot GetDOBuffer hDAOPilotTas DAOPilotData 0 if eError DP STATUS NOERROR fill DO Buffer k 126 APIs Function Reference DAQPilot DAQPilot_DO_WriteChannels for i 0 i lt DAOPilotData nNumOfChannel i printf Port d output value DAQPilotData lpPortOrLineList i scanf d snValue switch DAQPilotData nRawDataBits case 8 BYTE DAQPilotData lpRawData i BYTE nValue break case 16 WORD DAQPilotData lpRawData i WORD nValue break case 32 DWORD DAQPilotData lpRawData i DWORD nValue break printf n eError DAQPilot_DO WriteChannels hDAQPilotTask amp DAQPilotData DAOPilot EndTask hDAOPilotTask APIs Function Reference 127 DAQPilot DAQPilot_DO_ReadBackPort 5 29 DAQPilot DO ReadBackPort Reads the current port value from digital output port DAOPilotStatus
83. lotTask 0 DAQPilot_DO_ReadBackLine hDAQPilotTask bValue Now the bValue contains value of digital output line printf Line value s n bValue TRUE FALSE DAOPilot EndTask hDAOPilotTask APIs Function Reference 129 DAQPilot DAQPilot_DO_ReadBackChannels 5 31 DAQPilot_DO ReadBackChannels Reads the counter values from multiple counters DAOPilotStatusID DAOPilot DO ReadBackChannels HANDLE hTask DAQPilotDigitalData pstDataInfo Parameters hTask Task handle pstDatalnfo The pointer to the DAQPilotDigitalData structure memory space to save the digital data Return Values The return value is DAQPilot status ID Remarks This function is available only for these tasks DAQPilot_TASK_DO_LINE_OUTPU DAQPilot_TASK_DO_PORT_OUTPU Example HANDLE hDAQPilotTask NULL DAQPilotDigitalData DAQPilotData DAQPilotStatusID eError DP_STATUS_NOERROR int j 0 k 0 Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask DOPortOutput TRUE Enable channel 0 and channel 1 DAOPilot SetChannelPropertyBool hDAOPilotTa sk 0 CP Enable TRUE DAQPilot_SetChannelPropertyBool hDAQPilotTask 1 CP_Enable TRUE eError DAOPilot DO ReadBackChannels hDAOPilotTask amp DAQPilotData if eError DP STATUS NOERROR Display caption for k 0 k lt DAQPilotData nNumOfChannel k 130 APIs Function
84. lphi procedure TimerInterrupt VB NET Sub ControlName TimerInterrupt ByVal sender As Object ByVal e As EventArgs VC void ControlName TimerInterrupt object sender EventArgs e Remarks This event is available only for this task DAQPilot_TASK_TC_TIMER_INTERRUPT ActiveX Controls and NET Component Function Reference 177 DAQPilot DAQPilotError Event 6 26 DAGPilotError Event When a DAQPilot ActiveX control encounters an error the DAQPi lot ActiveX control initiates a DAQPilotError event Syntax VB Sub ControlName DAOPilotError ErrorCode As Long ErrorString As String VC afx_msg void OnDAQPilotError long ErrorCode LPCISTR ErrorString BCB void __fastcall DAOPilotError long ErrorCode BSTR ErrorString Delphi procedure DAQPilotError ErrorCode LongInt const ErrorString WideString VB NET Sub ControlName DAOPilotError ErrorCode As System Int32 ErrorString As System String VC void ControlName_DAQPilotError int ErrorCode string ErrorString Arguments ErrorCode As Long The DAQPilot status ID The status ID may be a status warning or an error These status IDs are defined in the DAQPilotAdvancedProperties h ErrorString As String DAGPilot status string Example Private Sub DAOPilot1 Error ByVal ErrorCode As Long ByVal ErrorString As String MsgBox ErrorString End Sub 178 ActiveX Controls and NET Component Fun
85. ls then enables the specified channel Example HANDLE hDAOPilotTask NULL WORD pChNoList NULL int nNumOfChannel 0 Load your DAQPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE Enable channel 0 and channel 1 multiple channels DAOPilot SetChannelPropertyBool hDAOPilotTa sk 0 CP Enable TRUE DAOPilot SetChannelPropertyBool hDAOPilotTask 1l CP Enable TRUE nNumOfChannel DAOPilot GetEnabledChannelList hDAOPilotTas k amp pChNoList nNumOfChannel 2 pChNoList 0 0 pChNoList 1 1 Enable channel 2 only DAQPilot_EnableSingleChannel hDAQPilotTask 2 nNumOfChannel DAOPilot GetEnabledChannelList hDAQPilotTas k amp pChNoList nNumOfChannel 1 pChNoList 0 DAOPilot EndTask hDAOPilotTask APIs Function Reference 101 DAQPilot DAQPilot_GetErrorMessage 5 11 DAQPilot_GetErrorMessage Gets the error message from status ID LPCSTR DAQPilot_GetErrorMessage DAOPilotStatusID eStatusCode 3 Parameters eStatusCode DAQPilot status ID Return Value The return value is the DAQPilot status string Example HANDLE hDAOPilotTask NULL DAOPilotStatusID eStatus DP STATUS NOERROR LPCSTR lpszMessage NULL Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot FALSE eStatus DAOPilot Start hDAOPilotTask lpszMessage DAOPilot GetErrorMessage eStatus print
86. mmon Files ADLINK DAOPilot adlink dagqpilot engine vl dll 3 Locate the DAQPilotEngine component from the list then click on the checkbox before the component name to select 4 Select all related components you want to add in your project by clicking on the check boxes 5 When finished click OK to close the window All selected components now appear in the toolbox Programming with DAQPilot 27 DAQPilot NET Component Example for C NET Setting Properties at Design Time After placing a component on a Visual Studio C form you can configure the component by setting its properties with the DAQPi lot custom control property pages Refer to the figure below Each component has its own set of default properties such as component name Do any of the following to open the Properties window Select Properties Window from the View menu then click the Properties Window button from the toolbar gt Directly launch the Properties Windows from the popup menu The DAQPilot NET component provides a custom Property Pages that is the DAQPilot wizard to replace the traditional ActiveX Control Property Page and to assist you easily in setting up the properties You may select the Property option from the pop up menu to launch the DAQPilot wizard Windowsippiication Microso Visual Stadio ieee File Edi View Project Buld Debug Data Tools Window Community Help aus ua a 9 b Debug m Any CPU JJF SRAI Formis
87. n how to create a customized DAQ task using the DAQPi lot wizard and task manager Chapter 4 Programming with DAQPilot The chapter describes the integration of DAQPilot with mainstream programming lan guages to streamline the development of DAQ applications Chapter 5 APIs Function Reference The chapter lists the DAQPilot Application Programming Interfaces APIs for advanced programming Chapter 6 ActiveX Controls and NET Components Function Reference The chapter lists the DAQPilot ActiveX Controls and NET components for advanced programming DAQPilot User s Manual Conventions Take note of the following conventions used throughout the man ual to make sure that you perform certain tasks and instructions properly NOTE Additional information aids and tips that help you per form particular tasks IMPORTANT Critical information and instructions that you MUST perform to complete a task WARNING Information that prevents physical injury data loss mod ule damage program corruption etc when trying to com plete a particular task DAQPilot User s Manual Table of Contents 1 IniroduclloOn sss se ieseb ipri blon sacsccsnsesdenundaveccentevanrsatanvercates 1 1 1 Features ss sis siicasdas rated knara ZEE a E deveusavacnsees 2 12 HIGNIIGKIS53 sse etosplena a 3 1 3 Supported Tasks esee eseneeesennnessennnnnaannnetan 5 14 Supported Cards eecececceecsseeeeeeceeeeseeeseaeeseeseeeeea
88. nce This section lists all DAQPilot ActiveX controls and NET compo nents for your reference Unless otherwise specified the following programming applications are abbreviated for brevity Programming application Abbreviation Microsoft Visual Basic VB Microsoft Visual C VC Microsoft Visual Basic NET VB NET Microsoft Visual C NET VC Borland C Builder BCB Borland Delphi Delphi ActiveX Controls and NET Component Function Reference a 141 DAQPilot AutoSize Property 6 1 AutoSize Property Returns a Boolean value to indicate whether or not the control will automatically resize to fit the original bitmap resolution Data Type VB Boolean VC BOOL BCB bool Delphi WordBool Syntax VB Dim bAutoSize As Boolean bAutoSize object AutoSize get AutoSize object AutoSize bAutoSize set AutoSize VC BOOL bAutoSize bAutoSize object GetAutoSize get AutoSize object SetAutoSize bAutoSize set AutoSize BCB bool bAutoSize bAutoSize object AutoSize get AutoSize object gt AutoSize bAutoSize set AutoSize Delphi bAutoSize WordBool bAutoSize object AutoSize get AutoSize object AutoSize bAutoSize set AutoSize Settings E ao a a a LL Value Description True The control automatically resizes to fit original bitmap resolution Default False User can set the width and height at design time
89. nd saving a task file When you create a DAQ task all corresponding settings and parameters are recorded in a task file All task files are stored in this default path and folder C ADLINK DAQPilot Task Folder From DAQMaster you may change the path folder for created task files using the DAQPilot task manager To do this 1 Click Option gt DAQ Task Folder A window appears prompting you to specify the path folder 2 Click then point to the new path folder where you want to save all task files S Device Manager gA Software Manager 2b Task Manager m DA Specify the folder for Task files Master UNT i A BEBO A ADUNK New Folder A O Analog Output Modules o Digital 1 0 Modules ME Digtizer Modules J GPIB Modules MI Multifunction Modules BRS Simultaneous Modules JRE Switch Modules T v 4 MS Timer Counter Modules 14 DiptalvOModules 7280 v L 3 Click OK when finished Task files are identified with a filename that corresponds with the selected task in the DAQPilot task manager window 12 Installation DAQPilot DAQPilot Task Manager Customizing pre defined DAQ tasks You may customize predefined DAQ tasks using the DAQPilot Task Manager Right click a task from the left pane then select the operation you want to perform from the popup menu You may modify copy rename or delete the selected task The corre sponding task file is
90. ndTask hDAOPilotTask APIs Function Reference 113 DAQPilot DAQPilot GetAOBuffer 5 20 DAGPilot GetAOBuffer Obtains a data buffer for analog output and performs analog out put to single channel or multiple channels Output mode may be in one shot or continuous mode DAOPilotStatusID DAOPilot GetAOBuffer HANDLE hTask DAQPILOTAnalogData pstDatalInfo DWORD dwTimeOut Parameters hTask Task handle psiDatalnfo Pointer to the DAQPILOTAnalogData structure The analog data will output to multiple channels dwTimeOut The timeout interval in milliseconds If dwTimeOut is 0 the function tests the object s state then returns immediately If dwTimeOut is INFINITE the function continues until data acquisition is completed Return Values The return value is the DAQPilot status ID Remarks 1 This function is available only for the following tasks DAQPilot_TASK_AO_VOLTAGE_OUTPU DAQPilot_TASK_AO_CURRENT_OUTPU DAQPilot_TASK_AO_ONESHO DAQPilot_TASK_AO_CONTINUE 2 Without this function you need to manually allocate memory space to the DAQPILOTAnalogData structure 114 APIs Function Reference DAQPilot DAQPilot_GetAOBuffer Example HANDLE hDAOPilotTask NULL DAQPilotAnalogData DAQPilotData DAQPilotStatusID eError DP_STATUS_NOERROR int i 0 float fVoltageValue 0 Load your DAOPilot task hDAOPilotTask DAOPilot LoadTask
91. nvolves seven steps Creating the Borland C Builder project Adding the DAQPilot component to the Tool Palette Setting the properties at design time Editing the properties at runtime Working with control methods Developing event handlers Running the application vvvvvvyv Creating the Borland C Builder Project Use the New Items dialog to start a new project in Borland C Builder development environment Click New gt Others from the File menu Select Application then press OK to apply Refer to the figure below Data Modules Business Web Documents WebSnap WebServices New ActiveX Multiier Forms Dialogs Projects A a A Batch File C File CLX CLX Data Application Module CLX Form CLX Frame CLX Thread Component Console Object Wizard A a BL m Control Panel Control Panel Cpp File Data Module DLL Wizard Application Module g E oj Programming with DAQPilot 67 DAQPilot Component Example for Borland C Builder Adding DAGPilot Component to the Tool Palette You need to install the DAQPilot component to the Borland C Builder tool palette before building an application After installa tion you may use the integrated DAQPilot component to conve niently carry out all task functions To add the DAQPilot component to the tool palette 68 C ADLINK DAQPilot bin BCB6 Click the checkbox before the ADLINK DAQPilot BCB Component then click OK button to clos
92. ollowing task categories DAOPilot TASK AI ONESHO DAOPilot TASK AI CONTIN DAOPilot TASK AO ONESHO DAOPilot TASK AO CONTINUE DAOPilot TASK AO FUNCTION GI ej N o ti z DAOPilot TASK DI ONESH DAOPilot TASK DI CONTI DAOPilot TASK DO ONESEH DAOPilot TASK DO CONTINUE DAOPilot TASK TC COUNTER DAOPilot TASK TC TIMER INTERRUPT DAOPilot TASK TC MODE OPERATION Example HANDLE hDAOPilotTask NULL Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE DAOPilot Start hDAOPilotTask DAQPilot_Stop hDAQPilotTask DAOPilot EndTask hDAOPilotTask APIs Function Reference 105 DAQPilot DAQPilot Al ReadChannel 5 15 DAQGPilot Al ReadChannel Acquires an analog value from a specific channel DWORD DAOPilot AI ReadChannel HANDLE hTask double pdbValue Parameters hTask Task handle pdb Value Acquired analog value Return Values The return value is the DAQPilot status ID Remarks This function is available only for DAQPilot_TASK_AI_VOLTAGE_POLLING Example HANDLE hDAQPilotTask NULL double dbVoltageValue 0 Load your DAQPilot task hDAOPilotTask DAQPilot_LoadTask AIPolling TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAOPilotTask 0 DAOPilot AI ReadChannel hDAOPilotTask dbVoltageValue Now the dbVoltageValue contains
93. ontrol methods Developing event handlers Running the application vvvvvvy Programming with DAQPilot 25 DAQPilot NET Component Example for C NET Creating the Visual Studio C DAQ Project Use the New Project dialog to initialize a new project in Visual Studio development environment Click New gt Project from the the File menu select Windows Application then press OK Refer to the illustration below U Migowk Visial Stadio oilers File Edt View Took Window Community Help MEA E E g9razWo se T New Project VEZ suzmbopbe Ex Project types Templates TISearch Online Templates A project for creating an application with a Windows user irtortoco mops Spe Name WiedomAgpiicationt Location oksion Name Yi Creme directory for sokaion Dasenpton Fe une Column Project 26 Programming with DAQPilot DAQPilot NET Component Example for C NET Adding DAGPilot Component to the Project s Toolbox You need to install the DAQPilot s NET component to Visual Stu dio C before building an application After installation you may use the integrated DAQPilot component to conveniently carry out all task functions To add the DAQPilot component to the project s toolbox 1 From a new Visual Studio C project right click on the Toolbox menu then select Choose Items The Choose Toolbox Items window appears 2 Click on Browse to add the DaqPilotEngine file from this path Drive Program Files Co
94. operty 1 Range 203 DPV_RANGE_B 2 5 V Add DAQPilot bas module file DAQPilot1 SetChannelProperty 1 Range DAQPilotValueID DPV_RANGE_B 2 5 V Change number of scan property to 100 by method DAQPilot1 SetDProperty Number of scan s 100 DAQPilot1 SetDProperty Sampling rate per channel 1000 Dim vDAQPilotValue As Variant vDAQPilotValue DAQPilot1 GetChannelProperty 1 Enable vDAQPilotValue DAQPilot1 GetChannelProperty 1 Range vDAQPilotValue DAQPilot1 GetDProperty Number of scan s 52 Programming with DAQPilot DAQPilot ActiveX Example for Microsoft Visual Basic Working with Control Methods Place a ListView control on Formi with property value 3 lvwRe port as its View property Refer to the figure below Components Controls Designers Insertable Objects Microsoft SysInfo Control 6 0 Microsoft Tabbed Dialog Control 6 0 Microsoft Windows Common Control t Windows Comm Microsoft Windows Common Controls 2 5 0 SP Microsoft Windows Common Controls 2 6 0 Microsoft Windows Common Controls 3 6 0 I Microsoft Winsock Control 6 0 MS Video Control 1 0 Type Library MSFlexGrid Wizard Msie Activex Control module msinfo32 1 0 Type Library MSIOFF10 Activex Control module Ni gt 7 Selected Items Only Browse Microsoft Windows Common Controls 6 0 SP4 Location C WINDOWS system32 mscomctl ocx ce Property Pages General Image
95. operty As String Channel property string Value As Variant Channel property value Return Value The return value is the DAQPilot status ID as defined in the DAQPilotAdvancedProperties h 156 ActiveX Controls and NET Component Function Reference DAQPilot SetChannelProperty Method Remarks 1 Different devices support different channel parameters gt Edit Control Data ranges from 1 79769313486232E308 to 1 79769313486232E308 gt Combo Box Control Sets the Enum data gt Check Box Control Sets the Boolean data 2 You may launch the DAQPilot wizard to know more about function usage 3 See Chapter 4 Programming with DAGPilot for more information 4 For quick and minor modifications you may use the DAQPilot_SetChannelProperty to directly configure spe cific parameters with the appropriate caption in the Channel configuration frame However it is suggested that you finish the main task using the DAQPilot wizard For example use object SetSetChannelProperty 0 Range to modify the range and use object SetSetChannelProperty 0 RefGround to assign the reference base ActiveX Controls and NET Component Function Reference 157 DAQPilot GetChannelProperty Method 6 11 GetChannelProperty Method Gets all channel properties You may query the parameters from a specific task Syntax VB Function object GetChannelProperty ChannelNum As Long ChannelProperty As
96. ore information ActiveX Controls and NET Component Function Reference DAQPilot EndTask Method 6 9 EndTask Method This method is used at the end of a DAQPilot application to release related system memory threads and resource Syntax VB Sub object EndTask VC object GetEndTask BCB object EndTask Delphi procedure object EndTask VB NET Sub object EndTask VC object EndTask ActiveX Controls and NET Component Function Reference 155 DAQPilot SetChannelProperty Method 6 10 SetChannelProperty Method DAQPilot provides a single method of setting all channel proper ties You may directly modify the parameters in a specific task Syntax VB Function object SetChannelProperty ChannelNum As Long ChannelProperty As String Value As Variant As Long VC long object GetSetChannelProperty long ChannelNum LPCTSTR ChannelProperty const VARIANT amp Value BCB long object SetChannelProperty long ChannelNum BSTR ChannelProperty TVariant Value Delphi function object SetChannelProperty ChannelNum LongInt const ChannelProperty WideString Value OleVariant LongInt VB NET Function object SetChannelProperty ChannelNum As nteger ChannelProperty As String Value As Object As Long VC long object SetChannelProperty int ChannelNum string ChannelProperty object value Arguments ChannelNum As Long Channel number ChannelPr
97. ot DAQPilot ActiveX Example for Microsoft Visual Basic Source Codes Option Explicit Private Sub Commandl Click DAQPilotEnginel SetChannelProperty 2 Enable True DAQPilotEnginel SetChannelProperty 2 Range 203 DPV RANGE B2 5 V DAQPilotEnginel SetChannelProperty 2 Range DPV RANGE B 2 5 V DAQPilotEnginel SetProperty Number of scan 100 DAQPilotEnginel SetProperty Sampling rate per channel 10000 DAQPilotEnginel Start End Sub Private Sub DAQPilotl DataArrival ByVal NumberOfChannel As Long ChNumList As Variant Data As Variant Dim i j As Long Dim strCaption strValue As String Initial column header ListViewl ColumnHeaders Clear ListViewl ColumnHeaders Add No 600 For i 0 To UBound ChNumList strCaption Ch amp ChNumList i ListViewl ColumnHeaders Add strCaption 1200 Next i Dim NumOfScan As Long NumOfScan UBound Data 1 NumberOfChannel Programming with DAQPilot 57 DAQPilot ActiveX Example for Microsoft Visual Basic Dump the data ListViewl ListItems Clear For i 0 To NumOfScan 1 strValue i ListViewl ListItems Add strValue For j 0 To NumberOfChannel 1 strValue Data i NumberOfChannel j ListViewl ListItems Item i 1 SubItems j 1 strValue Next j Next i End Sub 58 Programming with DAQPilot DAQPilot API Example for Microsoft Visual Studio C 4 4 API Example for Microsoft Visual Studio C This section provides instru
98. ot Start hDAOPilotTask printf Wait for AO output finish while DP STATUS DEVICE RUNING DAOPilot GetTaskS tatus hDAOPilotTask DAOPilot EndTask hDAOPilotTask APIs Function Reference 99 DAQPilot DAQPilot_GetEnabledChannelList 5 9 DAQPilot_GetEnabledChannelList Gets the number of enabled channels and the channels list int DAQPilot_GetEnabledChannelList HANDLE hTask WORD ppChNoList Parameter hTask Task handle ppChNoList WORD pointer address for obtaining enabled channel number list Return Values Numbers of all enabled channels Example HANDLE hDAOPilotTask NULL WORD pChNoList NULL int nNumOfChannel 0 int i 0 Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE Display channel number nNumOfChannel DAOPilot GetEnabledChannelList hDAOPilotTas k amp pChNoList for i 0 i lt nNumOfChannel i printf Channel d pChNoList i printf n DAQPilot_EndTask hDAQPilotTask 100 APIs Function Reference DAQPilot DAQPilot_EnableSingleChannel 5 10 DAQPilot EnableSingleChannel Enables a single channel only configuration DAOPilotStatusID DAQPilot EnableSingleChannel HANDLE hTask int nChannelNum Parameters hTask Task handle nChannelNum Channel number Return Values The return value is the DAQPilot status ID Remarks This function disables all channe
99. otTask APIs Function Reference 121 DAQPilot DAQPilot GetDI Pattern 5 25 DAGPilot GetDIPattern Acquires a digital pattern from a digital port This performs a one shot or a continuous digital data acquisition DAOPilotStatusID DAOPilot GetDIPattern HANDLE hTask DAQPILOTDigitalData pstDatalnfo DWORD dwTimeOut Parameters hTask Task handle psiDatalnfo Pointer to the DAQPilotDigitalData structure memory space that will receive the digital data dwTimeOut The timeout interval in milliseconds If dwTimeOut is 0 the function tests the object s state then returns immediately If dwTimeOut is INFINITE the function continues until data acquisition is completed Return Values The return value may be a status a warning or an error Remarks This function is available only for the following tasks DAQPilot_TASK_DI_ONESHOT DAQPilot_TASK_DI_CONTINUI Example ti HANDLE hDAQPilotTask NULL DAQPilotAnalogData DAQPilotData DAOPilotStatusID eError DP STATUS NOERROR int j 0 k 0 Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask DISingleShot TRUE Error DAOPilot Start hDAOPilotTask Get the data and set timeout as 10 seconds 10000 ms Error DAOPilot GetDIPattern hDAOPilotTask DAOPilotData 10000 if eError DP STATUS NOERROR oO Sy oO 122 APIs Function Refer
100. p the data Dim i j As Long Dim strValue As String vDataList ListItems Clear For i 0 To NumOfScan 1 strValue i vDataList ListItems Add strValue For j 0 To NumberOfChannel 1 strValue Data i NumberOfChannel j vDataList ListItems Item i 1 SubItems j 1 strValue Next j Next i End Sub ActiveX Controls and NET Component Function Reference 173 DAQPilot UpdateData Event 6 23 UpdateData Event The DAQPilot ActiveX control requires the data for analog digital output task Syntax VB Sub ControlName UpdateData NumberOfChannel As Long ChNumList As Variant Data As Variant VC afx_msg void OnUpdateData long NumberOfChannel VARIANT FAR ChNumList VARIANT FAR Data BCB void __fastcall UpdateData long NumberOfChannel TVariant ChNumList TVariant Data Delphi procedure UpdateData NumberOfChannel LongInt ChNumList OleVariant Data OleVariant VB NET Sub ControlName UpdateData ByVal sender As Object ByVal e As DAQPilotEngine DAQPilotDataEventArgs Note e NumberOfChannel As Int32 e ChNumList As Intl6e e Data As Object VC void ControlName_UpdateData object sender DAQPilotEngine DAQPilotDataEventArg s e Note int e NumberOfChannel short e ChNumList ref object e Data Arguments NumberOfChannel As Long Number of channels ChNumList As Variant VT 12 VT ARRAY Enabled channel number list Data As Variant Data is output to a
101. printf f double sa pvData 1 NumberOfChann el j ListItem SubItems gt Add strValue SafeArrayUnlock amp sa void fastcall TForml FormCloseQuery TObject Sender bool amp CanClose DAQPilot1 Stop Programming with DAQPilot DAQPilot DAQPilot_LoadTask 5 APIs Function Reference The chapter lists the DAQPilot Application Programming Inter faces APIs NOTE For additional information on function usage variations for different DAQ devices refer to the user and function reference manuals of PCIS DASK D2K DASK and WD DASK 5 1 DAQPilot_LoadTask Loads a DAQPilot task specification from a DAQ task file Use this function before any other operations HANDLE DAQPilot_LoadTask LPCSTR lpszTaskName BOOL bShowErrorMessage Parameters lIpszTaskName The task filename to load This function loads the task file tsk from the default folder INSTALLDIR Task Folden If DAQPilot does not install in the default target folder you must store the application file and the task file in the same folder bShowErrorMessage TRUE The detailed error message will be reported by a message box FALSE No detailed error message will be reported Return Values The function returns the handle of the new task when properly executed When the function fails with a NULL return you will receive the relative error information if bShowErrorMessage is set to TRUE APIs Function Refe
102. property Refer to the figure below Object Inspector x ListView El Properties Events ParentShowHir true e PopupMenu ReadOnly false RowSelect false ShowColumnH true ShowHint false ShowWorkAre false Smallmages SortType stone Statelmages TabOrder 1 TabStop true Tag 0 Visible Width All shown Place a Button component named Start Refer to the figure below a Start To call a method attach the method name to the component If the method does not need any parameters you can directly call the method with this syntax object method For example the Start method can launch the task function which is predefined in the component DAQPilot1 Start 14 Programming with DAQPilot DAQPilot Component Example for Borland C Builder Developing Event Handlers After you have configured the components you may continue cre ating event handlers in your application to hook appropriate func tions and process the received data For example the DAQPilot component has a DataArrival event that is triggered when the hardware DMA function is finished To develop the event routine code most programming tools can generate the skeleton code as the code template A code slice to process data is shown below for your reference void __fastcallTForm1 DAQPilot1DataArrival TObjec t Sender int NumberOfChannel Variant ChNumList Variant Data Initial Column header ListV
103. r of channel ChNumList As Variant VT 12 VT ARRAY Enabled channel number list Data As Variant DAQ acquisition data Remarks 1 This event is available only for the following tasks DAOPilot TASK AI ONESHO DAOPilot TASK AI CONTINUE DAOPilot TASK DI ONESHO DAOPilot TASK DI CONTINUE 172 ActiveX Controls and NET Component Function Reference DAQPilot DataArrival Event 2 When you run DAGPilot TASK Al ONESHOT or DAGPilot TASK Al CONTINUE task the return data type depends on the Data format property When you run DAGPilot TASK DI ONESHOT or DAGPilot TASK DI CONTINUE task the return data type depends on the Port width property 3 The return data type also depends on the UnsignedTo Signed property When this property is enabled the return data type is VT_H VT_ARRAY or VT_l2 VT_ARRAY or VT_l4 VT_ARRAY or VT_R8 VT_ARRAY When disabled the return data type is VT_UNM VT_ARRAY or VT_UI2 VT_ARRAY or VT_UI4 VT_ARRAY or VT R8 VT ARRAY 4 Data is a one dimensional array wrapped in a VARIANT For example Data a1 b1 c1 a2 b2 c2 a3 b3 c3 a100 b100 c100 NumberOfChannel 3 af series represents 1st channel data bf series represents 2nd channel data and cf series represents the channel data Example Private Sub DAQPilot1l_DataArrival ByVal NumberOfChannel As Long ChNumList As Variant Data As Variant Dim NumOfScan As Long NumOfScan UBound Data 1 NumberOfChannel Dum
104. rence 81 DAQPilot DAQPilot_LoadTask Remarks 1 The lpszTaskName parameter does not need a full file name with extension For example AlSingleShot repre sent AlSingleShot tsk 2 DAQPilot LoadTask or DAQPilot CreateTask only loads or creates the specified task If you want to apply the task configuration to the hardware call DAQGPilot Config to complete the configuration 3 Call DAQPilot Close to release the DAQPilot task 4 The order of search for the task file is as follows gt Default task files folder INSTALLDIR Task Folder gt Current directory Example HANDLE hDAOPilotTask NULL Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE DAOPilot EndTask hDAQPilotTask 82 APIs Function Reference DAQPilot DAQPilot_CreateTask 5 2 DAQPilot_CreateTask Creates the DAQPilot task handle with simple parameters HANDLE DAQPilot_CreateTask int nSubTaskID AllDeviceTypeID eDeviceID int nBoardIndex BOOL bShowErrorMessage Parameters nSubTaskID eDevicelD nBoardlndex These Sub Task IDs are defined in the DAQPilotAdvancedProperties h For more information on DAQPilot supported task classes and categories see section 1 3 The type of card that performs the task The Device IDs are defined in the DAQPilotAdvancedProperties h Each installed card has its own sequence number for identification For similar or same type cards a
105. rt hDAOPilotTask dwValue DAOPilot EndTask hDAOPilotTask 124 APIs Function Reference DAQPilot DAQPilot_DO_WriteLine 5 27 DAQPilot DO WriteLine Outputs a digital value to a digital line DAOPilotStatusID DAOPilot DO WriteLine HANDLE hTask BOOL bValue Parameters hTask Task handle bValue Digital line value Bollean to output Return Values The return value is the DAQPilot status ID Remarks This function is available only for DAQPilot_TASK_DO_LINE_OUTPUT Example HANDLE hDAQPilotTask NULL BOOL bValue TRUE Load your DAQPilot task hDAOPilotTask DAQPilot_LoadTask DOLineOutput TRUE Switch to Channel 0 DAQPilot_EnableSingleChannel hDAOPilotTask 0 DAOPilot DO WriteLine hDAOPilotTask bValue DAQPilot_EndTask hDAOPilotTask APIs Function Reference 125 DAQPilot DAQPilot_DO_WriteChannels 5 28 DAQPilot DO WriteChannels Outputs digital values to multiple channels DAOPilotStatusID DAOPilot DO WriteChannels HANDLE hTask DAQPilotDigitalData pstDataInfo i Parameters hTask Task handle psiDatalnfo Pointer to the DAQGPilotDigitalData structure that will output the digital data to multiple channels Return Values The return value is DAQPilot status ID Remarks 1 This function is available only for the following tasks DAQPilot TASK DO LINE OUTPU DAOPilot TASK DO PORT OUTPU Example HANDLE hDAOPilotTask NULL DAOPi
106. s NET Framework Components COM Components 2 Click on Browse to add the DaqPilotEngine file from this path Drive Program Files Common Files ADLINK DAQPilot adlink dagqpilot engine vl dll 3 Locate the DAQPilotEngine component from the list then click on the checkbox before the component name to select 4 Select all related components you want to add in your project by clicking on the check boxes 5 When finished click OK to close the window All selected components now appear in the toolbox Programming with DAQPilot DAQPilot NET Component Example for Microsoft Visual Basic NET Setting Properties at Design Time After placing a component on a Visual Basic NET form you can configure the component by setting its properties with the DAQPi lot custom control property pages Refer to the figure below Each component has its own set of default properties such as component name Do any of the following to open the Properties window Select Properties Window from the View menu then click the Properties Window button from the toolbar gt Directly launch the Properties Windows from the popup menu The DAQPilot NET component provides a custom Property Pages that is the DAQPilot wizard to replace the traditional ActiveX Control Property Page and to assist you easily in setting up the properties You may select the Property option from the pop up menu to launch the DAQPilot wizard Windo
107. s defined in argument eDevicelD or cards that belong to the same series except PCI 7300A_Rev A and PCI 7300A Rev B the assigned sequence number depends on the PCI slot order For example if there is a PCI 9111DG card installed in the first PCI slot one PCI 9111HR card and two PCI 9112 cards installed on other PCI slots the PCI 9111DG will be registered with nBoardlndex 0 and the PCI 9111HR card with nBoardlndex 1 The PCI 9112 card in the first slot will be registered with nBoardlndex 0 while the second PCI 9112 card will be registered with nBoardindex 1 For PCI 7256 PCI 7258 PCI 7260 PCI 7442 PCI 7443 PCI 7444 and PCI 7452 series cards you may use the onboard switch to set the board index APIs Function Reference 83 DAQPilot DAQPilot_CreateTask bShowErrorMessage TRUE The detailed error message will be reported by a message box FALSE No detailed error message will be reported Return Values The function returns the handle of the new task when properly executed When the function fails with a NULL return you will receive the relative error information if bShowErrorMessage is set to TRUE Remarks 1 This function generates a simple task with default config uration DAQPilot_LoadTask or DAQPilot_CreateTask only loads or creates the specified task If you want to apply the task configuration to the hardware call DAQPilot_Config to complete the configuration 3 Call DAQPilot_Clos
108. sk manager and performs pre defined properties for cost effective DAQ card operations New generation ActiveX control In addition to DAQPilot APIs DAQPilot also comes with Activex control for developing component based DAQ applications The new generation ActiveX control is embedded in the DAQPilot wiz ard to provide you with a more intuitive interface when setting the DAQ properties and easily configure DAQ devices better than the traditional way Equipped with four functions read write start and stop you may execute any type of DAQ task Since the ActiveX component technology is popular with many programming languages it is highly recommended that you use the DAQPilot ActiveX controls when developing applications in main develop ment environments such as Visual Basic High performance runtime engine The DAQPilot runtime engine an invisible component of the DAQPilot efficiently executes the DAQ task specification When your program executes a task specification the runtime engine parses the settings and performs the corresponding hardware operations The runtime engine guarantees execution of all kinds of data acquisition operations for ADLINK DAQ products 4 Introduction DAQPilot Supported Tasks 1 3 Supported Tasks DAQPilot supports four major task categories and a timer counter function These categories and function come with 19 tasks Refer to the list below Class Function Icon Category An
109. t engine vl DAQPilotEng ine DAQPilotDataEventArgs Handles DaqPilotEnginel DataArrival Dim i j As Int16 Dim strCaption strValue As String 46 Programming with DAQPilot DAQPilot NET Component Example for Microsoft Visual Basic NET Initial column header ListViewl Items Clear ListViewl Columns Clear ListViewl Columns Add No 70 For i 0 To UBound e ChNumList strCaption Ch amp e ChNumList i ListViewl Columns Add strCaption 100 Next i Dim NumOfScan As Long NumOfScan UBound e Data 1 e NumberOfChannel Dump the data ListViewl Items Clear For i 0 To NumOfScan 1 strValue i ListViewl Items Add strValue For j 0 To e NumberOfChannel 1 strValue e Data i e NumberOfChannel j ListViewl Items i SubItems Add strVa lue Next j Next i End Sub Private Sub Forml FormClosing ByVal sender As System Object ByVal e As System Windows Forms FormClosingEvent Args Handles MyBase FormClosing DaqPilotEnginel Stop End Sub End Class Programming with DAQPilot 47 DAQPilot ActiveX Example for Microsoft Visual Basic 48 4 3 ActiveX Example for Microsoft Visual Basic This section provides instructions on how to create a DAQ applica tion using DAQPilot s ActiveX control The process involves seven steps gt Creating the Visual Basic DAQ project vvvvvyy Running the application Adding DAQPilot ActiveX control to the project s toolbox Setting the
110. t environment Click New gt Project from the File menu Select Visual Basic Language as the project type then select Windows Application from the templates Press OK to apply Refer to the figure below New Project Project types Templates a B Visual C Visual Studio installed templates Windows EE windows Application Class Library Hi soreaj E console Application Windows Control Library atabase i 3 Starter Kits Sel crystal Reports Application E Device Application Other Languages My Templates Visual Basic Search Online Templates Windows w Smart Device Database Starter Kits 3 Visual J a Visual C a Other Project Types A project for creating an application with a Windows user interface Name WindowsApplication1 Location CXApplication Data Solution Name WindowsApplication1 7 Create directory for solution OK Cancel Programming with DAQPilot 37 DAQPilot NET Component Example for Microsoft Visual Basic NET 38 Adding DAGPilot Component to the Project s Toolbox You need to install the DAQPilot s NET component to the Visual Studio VB NET before building an application After installation you may use the integrated DAQPilot component to conveniently carry out all task functions To add the DAQPilot component to the project s toolbox 1 From a new Visual Studio VB NET project right click on the Toolbox menu then select Choose Items The Choose Toolbox Items window appear
111. t wizard parameters and supported tasks 72 Programming with DAQPilot DAQPilot Component Example for Borland C Builder Edit Properties at Runtime You can dynamically set and read the properties of the DAQPilot component in Borland C Builder gt For example use this syntax to set the property Object SetDProperty property string value For example if you want to change the values in runtime Enable Channel 2 by method DAQPilotl1 SetChannelProperty 2 WideString Enable TVariant true DAQPilotl SetChannelProperty 2 WideString Range TVariant 203 DPV RANGE B 2 5V DPV RANGE B 2 5 V is defined in DAQPilotAdvancedProperties h DAQPilotl1 SetChannelProperty 2 WideString Range TVariant DPV RANGE B 2 5 V Change number of scan property to 100 by following method DAQPilot1 SetDProperty WideString Number of scan s TVariant 100 DAQPilot1 SetDProperty WideString Sampling rate per channel TVariant 1000 TVariant vDAQPilotValue vDAQPilotValue DAQPilot1 gt GetChannelProperty 2 WideString Enable vDAQPilotValue DAQPilot1 gt GetChannelProperty 2 WideString Range vDAQPilotValue DAQPilot1 gt GetDProperty WideString Number of scan s Programming with DAQPilot 73 DAQPilot Component Example for Borland C Builder Working with Control Methods Place a ListView component on Form1 with property value vsre port as its View
112. t_SetPropertyBool function to set the Boolean data 94 APIs Function Reference DAQPilot DAQPilot_SetProperty 3 You may launch the DAQPilot wizard to know more about function usage 4 See Chapter 4 Programming with DAGPilot for more information 5 For quick and minor modifications you may use the DAQPilot_SetStringProperty to directly configure spe cific parameters with the appropriate caption in the Channel configuration frame However it is suggested that you finish the main task using the DAQPilot wizard For example use DAQPilot_SetStringProperty Clock source Conversion source to modify the clock source and use DAQPilot_SetStringProperty Sampling rate per channel to modify the sampling rate per channel Example HANDLE hDAOPilotTask NULL Load your DAOPilot task hDAOPilotTask DAQPilot_LoadTask AISingleShot TRUE DAOPilot SetPropertyU4 hDAOPilotTask DP TIMING NUM OF SCAN 1000 DAOPilot EndTask hDAOPilotTask APIs Function Reference 95 DAQPilot DAQPilot_GetProperty 5 7 DAQPilot_GetProperty DAQPilot uses a series of APIs to get all properties You can query the parameters from a specific task VARIANT DAOPilot GetStringProperty HANDLE hTask LPCSTR lpszPropertyID VARIANT DAOPilot GetProperty HANDLE hTask DAOPilotPropertyID ePropertyID i BOOL DAQPilot_GetPropertyBool HANDLE hTask DAOPilotPropertyID eProperty
113. ta arrival based on the skeleton from Visual Basic is illustrated next page 54 Programming with DAQPilot DAQPilot ActiveX Example for Microsoft Visual Basic Private Sub DAQPilotl DataArrival ByVal nNumberOfChannel As Long ChNumList As Variant Data As Variant Dim i j As Long Dim strCaption strValue As String Initial column header ListViewl ColumnHeaders Clear ListViewl ColumnHeaders Add No 600 For i 0 To UBound ChNumList strCaption Ch amp ChNumList i ListViewl ColumnHeaders Add strCaption 1200 Next i Dim NumOfScan As Long NumOfScan UBound Data 1 nNumberOfChannel Dump the data ListViewl ListItems Clear For i 0 To NumOfScan 1 strValue i ListViewl ListItems Add strValue For j 0 To nNumberOfChannel 1 strValue Data i nNumberOfChannel 3 ListViewl ListItems Item i 1 SubItems j 1 strValue Next j Next i End Sub Programming with DAQPilot 55 DAQPilot ActiveX Example for Microsoft Visual Basic Running the Application Press the Start button in your sample application to run and dis play the data Cho 1 7648315 2 1951293 3 03558349 4 5880126 o z 0 5841 064 2 99316406 3 52508544 0 9588623 3 44879150 4 5104980 4 18670654 3 1948852 1 6876220 4 22302246 4 63348388 4 3395996 0 75134277 1 12457275 oooooooDoOODOPOGOPOGOJN 56 Programming with DAQPil
114. tart Developing Event Handlers After configuring the components you may continue to create event handlers in your program to hook appropriate events gener ated on the components For example the DAQPilot component has a DataArrival event that is triggered if the hardware DMA is finished In addition to develop the event routine code most programming environments generate a skeleton function to be the code template Below is the code slice for processing the event of DMA data arrival based on the skeleton from Visual Studio Programming with DAQPilot 43 DAQPilot NET Component Example for Microsoft Visual Basic NET Private Sub DaqPilotEnginel DataArrival ByVal sender As System Object ByVal e As adlink daqpilot engine v1 DAQPilotEngine DAQP ilotDataEventArgs Handles DaqPilotEnginel DataArrival Dim i j As Int16 Dim strCaption strValue As String Initial column header ListViewl Items Clear ListViewl Columns Clear ListViewl Columns Add No 70 For i 0 To UBound e ChNumList strCaption Ch amp e ChNumList i ListViewl Columns Add strCaption 100 Next i Dim NumOfScan As Long NumOfScan UBound e Data 1 e NumberOfChannel Dump the data ListViewl Items Clear For i 0 To NumOfScan 1 strValue i ListViewl Items Add strValue For j 0 To e NumberOfChannel 1 strValue e Data i e NumberOfChannel j ListViewl Items i SubItems Add strValue Next j N
115. ted on the components For example the DAQPilot component has a DataArrival event that is triggered if the hardware DMA is finished In addition to develop the event routine code most programming environments generate a skeleton function to be the code template Below is the code slice for processing the event of DMA data arrival based on the skeleton from Visual Studio 32 Programming with DAQPilot DAQPilot NET Component Example for C NET private void daqPilotEnginel DataArrival object sender adlink daqpilot engine v1 DAQPilotEngine DAQP ilotDataEventArgs e ant i J long NumOfScan string strCaption strValue double data e Data as double Initial column header listViewl Columns Clear listViewl Columns Add NO 100 for i 0 i lt e ChNumList Length i strCaption Ch Convert ToString e ChNumList i listViewl Columns Add strCaption 200 NumOfScan data Length e NumberOfChannel Dump the data listViewl Items Clear for i 0 i NumOfScan i strValue Convert ToString i listViewl Items Add strValue for j 0 j e NumberOfChannel j strValue data i e NumberOfChannel j ToString listViewl Items i SubItems Add strValue Programming with DAQPilot 33 DAQPilot NET Component Example for C NET Running the Application Press the Start button in your sample application to run and dis play the data
116. the configuration 3 Call DAQPilot_Close to release the DAQPilot task 4 The order of search for the task file is as follows gt Default task files folder INSTALLDIR Task Folder gt Current directory 152 ActiveX Controls and NET Component Function Reference DAQPilot CreateTask Method 6 8 CreateTask Method Creates a DAQPilot task with simple parameters Syntax VB Function object CreateTask nSubTaskID As Long eDeviceID As Long nDaskIndex As Long As Boolean VC BOOL object GetCreateTask long nSubTaskID long eDeviceID long nDaskIndex BCB bool object CreateTask long nSubTaskID long eDeviceID long nDaskIndex Delphi function object CreateTask nSubTaskID LongInt eDeviceID LongInt nDaskIndex LongInt WordBool VB NET Function object CreateTask nSubTaskID As Integer eDeviceID As Integer nDaskIndex As Integer As Boolean VC bool object GetCreateTask int nSubTaskID int eDeviceID int nDaskIndex Arguments nSubTaskID As Long These Sub Task IDs are defined in DAQPilotAd vancedProperties h For more information on DAQPi lot supported task classes and categories see section 1 3 eDevicelD As Long The type of card that performs the task The Device IDs are defined in the DAQPilotAdvancedProper ties h nDasklndex As Long Each installed card has its own sequence number for identification For similar or same type cards as defined in argument eDevicelD or cards
117. tus a warning or an error These status IDs are defined in DAQPilotAdvancedProperties h Remarks 1 This function is available only for the following tasks DAOPilot TASK AI ONESHO DAOPilot TASK AI CONTINUE DAOPilot TASK AO ONESHO DAOPilot TASK AO CONTINUE DAOPilot TASK AO FUNCTION GEN DAOPilot TASK DI ONESHO DAOPilot TASK DI CONTINUE DAOPilot TASK DO ONESHO DAOPilot TASK DO CONTINUE DAOPilot TASK TC COUNTER DAOPilot TASK TC TIMER INTERRUPT DAOPilot TASK TC MODE OPERATION 2 To improve the function performance refer to the Con fig method 168 ActiveX Controls and NET Component Function Reference DAQPilot Stop Method 6 19 Stop Method Stops a DAQ task Syntax VB Function object Stop As Long VC long object GetStop BCB long object gt Stop Delphi function object Stop LongInt VB NET Function object Stop As Long VC long object Stop Return Value The return value is the DAQPilot status ID The status IDs are defined in the DAQPilotAdvancedProperties h Remarks This function is available only for the following tasks DAOPilot TASK AI ONESHO DAOPilot TASK AI CONTIN DAOPilot TASK AO ONESHO DAOPilot TASK AO CONTIN DAOPilot TASK AO FUNCTION GEN o N o DAOPilot TASK DI ONESH DAOPilot TASK DI CONTI DAOPilot TASK DO ONESH DAOPilot
118. ty Remarks 1 Different devices support different channel parameters 2 For various data type you may use the appropriate API to set the value For example you may use the DAQPilot_SetChannelPropertyl4 to configure data that ranges from 100 to 100 Refer to the edit controls below gt Edit Control Use DAQPilot SetChannelPropertyl4 function to set the data that ranges from 2147483648 to 2147483647 gt Edit Control Use DAQPilot SetChannelPropertyU4 function to set the data that ranges from 0 to 4294967295 gt Edit Control Use DAQPilot SetChannelPropertyF64 function to set the data that ranges from 1 79769313486232E308 to 1 79769313486232E308 gt Edit Control Use DAQPilot SetChannelPropertySTR function to set string data 5 Combo Box Control Use DAGPilot SetChannelPropertyEnum function to set Enum data gt For Check Box Control Use the DAQPilot_SetChannelPropertyBool function to set the Boolean data 3 You may launch the DAQPilot wizard to know more about function usage 4 See Chapter 4 Programming with DAQPilot for more information 5 For quick and minor modifications you may use the DAQPilot_SetStringProperty to directly configure spe cific parameters with the appropriate caption in the Channel configuration frame However it is suggested that you finish the main task using the DAQPilot wizard 88 APIs Function Reference DAQPilot DAQPilot_SetChannelProperty For examp
119. tyID eChannelPropertyID VARIANT vValue i DAQPilotStatusID DAQPilot_SetChannelPropertyBool HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID BOOL bValue i DAOPilotStatusID DAQPilot_SetChannelPropertyEnum HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID DAOPilotValueID nAgentID i DAOPilotStatusID DAQPilot_SetChannelPropertyl4 HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID int nValue 86 APIs Function Reference DAQPilot DAQPilot_SetChannelProperty DAQPilotStatusID DAOPilot SetChannelPropertyU4 HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID DWORD dwValue i DAQPilotStatusID DAQPilot_SetChannelPropertyF64 HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID double dbValue i DAQPilotStatusID DAQPilot_SetChannelPropertySTR HANDLE hTask int nChannelNum ChannelPropertyID eChannelPropertyID LPCSTR lpszValue i Parameters hTask Task handle nChannelNum Channel number IpszChannelPropertyID Channel property string eChannelPropertyID Channel property ID defined in DAQPilotAdvancedProperties h vValue bValue nAgentID nValue dwValue dbValue IpszValue Channel property value Return Values The return value is the DAQPilot status ID APIs Function Reference 87 DAQPilot DAQPilot_SetChannelProper
120. ue DAQPilot1 gt GetChannelProperty 2 WideString Range vDAQPilotValue DAQPilot1 gt GetDProperty WideString Number of scan s DAQPilot1 gt Start void fastcall TForml DAQPilotlDataArrival TObject Sender int NumberOfChannel Variant ChNumList Variant Data Initial Column header ListViewl zItems Clear ListViewl Columns Clear SAFEARRAY sa ChNumList vt 6 VT BYREF kChNumList pparray ChNumList gt parray DWORD dwElements sa rgsabound 0 cElements SafeArrayLock amp sa for UINT i 0 i lt dwElements i AnsiString strColumn strColumn sprintf Ch d short sa pvData i ListViewl Columns Add ListViewl Columns Items i gt Caption strColumn ListViewl Columns Items i Width 80 SafeArrayUnlock amp sa Programming with DAQPilot 79 DAQPilot Component Example for Borland C Builder Display the data 80 sa Data gt vt amp VT_BYREF Data gt pparray Data parray dwElements sa rgsabound 0 cElements DWORD dwDisplayCount dwElements NumberOfChannel SafeArrayLock amp sa for UINT i 0 i lt dwDisplayCount i AnsiString strValue strValue sprintf f double sa pvData 1 NumberOfChann el 0 TListItem ListItem ListItem ListViewl gt Items sAdd ListItem Caption strValue for int j 1 j NumberOfChannel j strValue s
121. umberOfChannel dwCycleNumOfSamples dwNumOfScan dbAmplitude 5 For i 0 To dwNumOfScan 1 For j 0 To NumberOfChannel 1 k i NumberOfChannel j If j Mod NumberOfChannel Then Data k 1 dbAmplitude 2 i dbAmplitude dwCycleNumOfSamples Else Data k Sin CDbl i CDbl dwCycleNumOfSamples 2 3 14159 dbAmplitude End If Next j Next i End Sub ActiveX Controls and NET Component Function Reference 175 DAQPilot SendComplete Event 6 24 SendComplete Event When analog digital output task finish the DAQPilot activex con trol will fire SendComplete event Syntax VB Sub ControlName SendComplete VC afx msg void OnSendComplete BCB void __fastcall SendComplete Delphi procedure SendComplete VB NET Sub ControlName SendComplete ByVal sender As Object ByVal e As EventArgs VC Void ControlName_SendComplete object sender EventArgs e Remarks This event is available only for the following tasks DAQPilot_TASK_AO_ONESHO DAQPilot_TASK_DO_ONESHO 176 ActiveX Controls and NET Component Function Reference DAQPilot Timerlnterrupt Event 6 25 Timerlnterrupt Event When the Timerlnterrupt task gets the interrupt the DAQPilot ActiveX control initiates a Timerlnterrupt event Syntax VB Sub ControlName TimerInterrupt VC afx msg void OnTimerInterrupt BCB void __fastcall TimerInterrupt De
122. veloping Event Handlers ecese 54 Running the Application e eee eeeeese sesio 56 4 4 API Example for Microsoft Visual Studio C 59 Creating the Configuration Task File 59 Creating the Visual Studio C Project 60 Integrating the Library File ee eeeecco 61 Editing the Task File eeseeeeeeesseeieno 62 Running the Application esee eeeeese sesio 63 4 5 Component Example for Borland C Builder 67 Creating the Borland C Builder Project 67 Adding DAQPilot Component to the Tool Palette 68 Setting Properties at Design Time 71 Edit Properties at Runtime eee esee 73 Working with Control Methods 74 Developing Event Handlers eee 75 Running the Application sees eeeeese sesio 77 5 APIs Function Reference ssssss 22222 81 5 1 DAQPilot LoadTask seseseeeeeeeseeneeneenennnnnnan 81 5 2 DAQPilot CreateTask ss see es ses eeeeeenennnnnnnnnns 83 5 3 DAQPilot EndTask ees ssssesesessseseneennennnnntao 85 5 4 DAQPilot SetChannel
123. ver Web Service im Visual Je ladar Smart Device Project Faclass Library Visual C FEICLR Empty Project Empty Project E c Other Project Types HS MFC Activex Control MS MFC DLL Siig MFC Smart Device Activex Control 38 MFC Smart Device Application i MFC Smart Device DLL sar Server Project FAwin32 Smart Device Project Win32 Project Bl windows Forms Control Library My Templates la Search Online Templates windows Service A project for creating a Win32 console application Name AlSingleShot Location CX Solution Name AISingleShot X Browse 7 Create directory for solution ok nea 60 Programming with DAQPilot Integrating the Library File You need to include the DAQPilotEngine lib to the project To do this 1 Click on AlSingleShot then select Properties from the popup menu SingleShot MicroroR Visual Studio fda View ject Buld Debug Tools Window Community Help Du uug ia b Debug Wak amp calbaaddr a ADO a DAQPilot API Example for Microsoft Visual Studio C Se San fago ASinole hotpp x Solution Explorer x d ua gt 3 Global scope i int tanln int argc TCHAR argv return 0 Errore O 0 Errors J 0 Warnings 0 Messages Descripson Fle une Column a aj soksion ASingiashot 1 u buid Robutd Clean Project Only profite Guided Optmiation Custom Build Rules Tool Build Order Ado References
124. waveform pattern Remarks 1 This event is available only for the following tasks DAOPilot TASK AO ONESHO DAOPilot TASK AO CONTINUE DAOPilot TASK DO ONESHO DAOPilot TASK DO CONTINUE 2 When you run DAQPilot TASK AO ONESHOT or DAGPilot TASK AO CONTINUE task the update data type depends on the Data format property When you run DAQPilot TASK DO ONESHOT or 174 ActiveX Controls and NET Component Function Reference DAQPilot UpdateData Event DAQPilot_TASK_DO CONTINUE task the return data type depends on the Port width property 3 The update data type also depends on the UnsignedTo Signed property When this property is enabled the update data type is VT_I VT_ARRAY or VT_l2 VT_ARRAY or VT_l4 VT_ARRAY or VT R8 VT ARRAY When the property is disabled the update data type is VT UI1 IVT ARRAY or VT_UI2 VT_ARRAY Or VT_UI4 VT_ARRAY or VT R8 VT ARRAY 4 Data is a one dimensional array wrapped in a VARIANT For example Data a1 b1 c1 a2 b2 c2 a3 b3 c3 a100 b100 c100 NumberOfChannel 3 af series represents 1st channel data bf series represents 2nd channel data and cf series represents channel data Example Private Sub DAQPilot1 UpdateData ByVal NumberOfChannel As Long ChNumList As Variant Data As Variant Update the output buffer in here Dim dwNumOfScan dwCycleNumOfSamples As Long Dim dbAmplitude As Double Dim i j k As Long dwNumOfScan UBound Data 1 N
125. wing requirements before you install DAQPilot gt Yv vV vV V Windows 98 NT 2000 or 32 64 bit editions of Windows XP Server 2003 Vista operating system PC with Intel Pentium class CPU or higher VGA display or higher Minimum 64 MB of memory Minimum 40 MB of free hard disk space Mouse Installation 9 DAQPilot System Requirements 2 2 Installing DAQPilot This section provides instructions on how to install DAQPilot in your system To install DAQPilot 1 Place the DAQPilot Installation CD to the computer s optical drive or double click on the DAQPilot setup file you downloaded from the ADLINK website 2 When the installation window appears click on the Install DAQPilot button NOTE If Autorun is not enabled in your computer explore the CD then double click on the SETUP EXE to display the installation window 2 3 Checking the DAQ Card Drivers To check if the DAQ card is properly installed and detected by the system 1 Launch the Windows Device Manager 2 Expand the NuDAQ Boards item then double click on the listed DAQ device s 3 Click the Resources tab and check if the device I O port and IRQ resources are allocated correctly NOTE The necessary DASK drivers are automatically installed during the DAQPilot installation These libraries hold the PCIS DASK D2K DASK and WD DASK system files For more information on these DASK drivers install the corresponding software packages to view the user
126. wsipplicationl Microsoft Visual Studio ISE File Edt View Project Buld Debug Data Tool Window Community Help ud sua a 9 b Debug Any CPU g SetOhamnelProperty Form1 vb Design i Fount QO Errors 2 0 Warnings U 0 Messages Programming with DAQPilot 39 DAQPilot NET Component Example for Microsoft Visual Basic NET When the DAQ Pilot wizard appears set the DAQ parameters In this example we would like to perform a single shot waveform acquisition with a virtual device ANALOG OUTPUT DIGITAL INPUT pret IA DIGITAL OUTPUT A SDUNES TIMER CTR TNK Technology Ine All Rights Reserved DAQ 221 DAREXI 2501 Z lt Back Next gt Cancel Refer to Chapter 3 Creating DAQ Tasks for more information on the DAQPilot wizard parameters and supported tasks 40 Programming with DAQPilot DAQPilot NET Component Example for Microsoft Visual Basic NET Edit Properties at Runtime You can dynamically set and read the properties of the component in Visual Studio VB NET by using this syntax to set the property object SetProperty property string expression For example if you want to change the values during program execution Enable Chl by method DaqPilotEnginel SetChannelProperty 1 Enable True Without add DAQPilot vb file DaqPilotEnginel SetChannelProperty 1 Range 203 DPV RANGE B 2 5 V Add DAQPilot vb file DaqPilotEnginel SetChannelProperty 1 Range DAQP
Download Pdf Manuals
Related Search
Related Contents
Manuel d`utilisation du formulaire ( PDF - 573.7 ko) Manuale di installazione e manutenzione Driver servomotore Polk Audio DR-3 User's Manual Manual uso ventiladores Mach Copyright © All rights reserved.
Failed to retrieve file