Home

ActiveDAQ User's Manual

image

Contents

1. 110 Table A 17 DAQPulse Pulse Output Control Methods ooooconccicconocccoccccccnccconccnnccnncno 111 Table A 18 DAQAlarm Alarm Control Properties ccecceeeceeseeseeeeeereeeeeeeeeeeeeeeeaeens 112 Table A 19 DAQAlarm Alarm Control Methods en 113 Table A 20 DAQAlarm Alarm Control Events c ccecceeceeeseeeeeeeeeeseeeeeseeeseseenseeeaeees 113 Table B 17 ErrorCode Fotmati s stiti svit vibe ae t iadaan daard atn 116 Table B 2a ErrorCode SUMMA Y cccceescceceeeeeeeeeeeeeeeeeeeeeeeecaeeseeeeaeeeaeeeeeseseseeeeeeees 117 Table B 2b ErrorCode SUMMA Y s sisien iiaiai iaai i 118 Table B 2c ErrorCode Summary nana 119 Table B 3 ActiveDAQ control s internal error listing 120 Table C 1 ActiveDAQ Hardware Support Listing Table C 2 ActiveDAQ Hardware Support Listing Table C 3 ActiveDAQ Hardware Support Listing Table C 4 ActiveDAQ Hardware Support Listing Table C 5 ActiveDAQ Hardware Support Listing Table C 6 ActiveDAQ Hardware Support Listing Table C 7 ActiveDAQ Hardware Support Listing Preface xvii xviii ActiveDAQ User s Manual CHAPTER Introduction to ActiveDAQ Controls 1 1 Introduction to ActiveDAQ 1 2 The following is an overview of ActiveDAQ lists the ActiveDAQ system requirements describes how to install and uninstall the software and explains the basics of ActiveX controls What is
2. CHAPTER Hardware Support Listing C 1 Hardware Support Listing Device Controls Methods PCL PCL PCL 818 816 812PG Series o o o Analog input Rawlnput Reallnput AcquireStart AcquireStatus GetBufferData AcquireStop GetlnputRange Select Daughter ThermoRead Analog output RawOutput RealOutput OutputStart OutputStatus OutputStop SetRawDataBuffer SetRealDataBuffer SynchronousOutput Digital input Bitinput Bytelnput EnableByteScan EnableBitScan EnableEvent Digital output ByteReadBack ByteOutput BitOutput BitReadBack Counter EnableCounter EnableFrequency ResetCounter Pulse output EnablePulseOut ResetPulse Alarm EnableAlarm ResetAlarm 2122 Z e 212 2 2 212 Lje Lje jeje ejeje jejejeje ejeje jejejejeje ejeje jejejejeje ejeje jejejejejeje ejeje jejejejejeje ejeje jejejejeje ej je L AAA 7 vay a E y V IN JN y E E volil 4 y xD RS ES y V IC E ES y V IC RS i y 212 Z 22 Z e 22 Z e jejeje ej e Z Z 212 Z Z 212 Z 2l Je 212 Z jejeje 2 LZ e jeje e Z e Z e Z jejeje Z e jeje e Z e Z jeje 22212 Z e jeje LZ Je 212 2 e e Leje jeje ejeje jeje e Z je Z jeje 22 2 2 Z e e Z Z LZ Je LZ e 2 2 je Je LZ e Z jeje Z podi Table C 1 ActiveDAQ Hardware Support Listing 1
3. 22 Y y Table C 3 ActiveDAQ Hardware Support Listing 124 ActiveDAQ User s Manual Control PCI 1720 PN kuka a 7 Reallnput AcguireStat AcquireStatus GetBufferData PAcauireStop GetInputRange SelectDaughter______ ThermoRead Analog output RawOutput v RealOutput v OutputStat vV OutputStatus v OutputStop v SetRawDataBufter Y SetRealDataBuffer v SynchronousOutput v Digital input Bitinput Bytelmput________ EnableByteScan EnableBitScan EnableEvent Digital output ByteReadBack ByteOutput BitOutput BitReadBack Table C 4 ActiveDAQ Hardware Support Listing 212121221212 Appendix C Hardware Support Listing 125 Device Control PCL 734 735 Methods MIC 2750 2752 2760 igital in BitInput Bytelnput EnableByteScan EnableBitScan EnableEvent Digital output ByteReadBack ByteOutput BitOutput BitReadBack Counter EnableCounter EnableFrequency ResetCounter Pulse output EnablePulseOut ResetPulse OD c a R N 2 jeje JE Z Z tte Z Z jejeje e nema 22 22212 212 2 2 22 jeje 2 122 Z e jejeje 2 12 212 Lje jejeje e e e 2 2 2 2 Table C 5 ActiveDAQ Hardware Support Listing 126 ActiveDAQ User s Manual Device Control Methods Ana
4. 16 Single ended PCL 818HD C petetane 2 z Range sv oz r Clock Selection m DMA Selection r D A Voltage Ref Channel 1 S 1MHz C Level C Extemal Internal C 10MHz Level3 Voltage o s y Cancel Options Help About Figure 1 16 Card Device Setup dialog box PCL 818L shown Chapter 1 Introduction to ActiveDAQ Controls 13 6 The card s model and name will now appear in the upper pane of the I O Device Installation window If you want to change the configuration settings highlight the entry and then click the Setup button To remove it from your system click the Remove button 170 Device Installation Installed Devices 000 PCL 818L 1 0 300H List of Devices Advantech PCI Advantech PC Advantech PCL 816 Figure 1 17 I O Device Installation Window Showing Installed Devices 7 Installation and configuration of your Advantech board is now complete Close the Device Installation Utility by selecting File Exit from the Device Installation Utility s main menu The above example showed the installation of the DLL driver for only one Advantech board You can install drivers for other boards by following the same procedure 14 ActiveDAQ Users Manual 1 3 4 Uninstalling the ActiveDAQ Controls and DLL Drivers ActiveDAQ includes an uninstallation utility to remove the files from your computer To uninstall all the ActiveDAQ controls DLL drivers and their related fil
5. Figure 1 3 ActiveDAQ Setup Program Welcome Screen 4 An information screen is displayed Click Next to advance to the next screen Information Figure 1 4 Installation Program Information Screen Chapter 1 Introduction to ActiveDAQ Controls 5 5 You have to specify a file path on your local computer to install the ActiveDAQ and DLL driver files The default path for both Windows 95 98 and Windows NT systems is C Program Files Advantech You can choose a different directory path by clicking the Browse button Choose Destination Location Figure 1 5 Choose Destination Directory for Program Files ActiveDAQ Users Manual 6 Choose the kind of installation you want to perform Your choices are a ActiveDAQ Only b ActiveDAQ with Windows 95 98 Driver 1 11 c ActiveDAQ with Windows NT Driver 1 11 Choose a only if you have previously installed the version 1 11 DLL drivers that are appropriate for your operating system Most users should choose options b or c Click the Next button after making your selection ActiveDAQ Onl ActveDSQ with Wind 98 Driver 1 11 i ActiveDAQ with Windows NT Driver 1 11 Figure 1 6 Choose the type of installation for your operating system Chapter 1 Introduction to ActiveDAQ Controls 7 7 The ActiveDAQ installation program will copy a program shortcut to your Windows Programs menu The name for the shortcut is Advantech ActiveDAQ You can change the name of the program
6. e Device Installation Utility Installed Devices window 33 Start Visual Basic m The Visual Basic Integrated Development Environment The Visual Basic Components dialog box Figure 3 11 Designing the form sccccsccsscsesescsesseneccessnsssessscsseessecscesesseteesteestansneaeees xiv ActiveDAQ User s Manual Figure 3 12 Press F5 key to run your program oe eee eee eee cess e teat tees seeeeeaeeeaeeeee Figure 3 13 Press Select Device button on the form ei Figure 3 14 Running the example nn Figure 3 15 Starting Inprise Delphi 4 Figure 3 16 Delphi 4 main program se Figure 3 17 Delphi s Import ActiveX Control dialog box Figure 3 18 Installing the ActiveDAQ Al control Figure 3 19 Importing an ActiveDAQ control into Delphi de Figure 3 20 Installing the ActiveDAQ control into Delphi Figure 3 21 Component Palette showing loaded ActiveDAQ control Figure 3 22 Components dialog box showing two ActiveDAQ controls wath Figure 3 23 The ActiveX tab in the Component Palette 00 0 0 ceeeeeeeeeeeeereeeeeeeeeeereeees Figure 3 24 Form design for the Delphi DAQDevice DAQAI example Figure 3 25 Object Inspector showing DAQAI1 properties Figure 3 26 Example program startup screen Figure 3 27 Delphi example dialog window oonoonconicnnonnoconoconancncnnana
7. Boolean Sets the output data with binary format to the internal buffer and returns FALSE if successful SetRealBuffer IN Variant DataArray Boolean Sets the output data with real format to the internal buffer and returns FALSE if successful SetSynchronous Boolean Enabled Boolean Enables synchronization of the multiple channel output Only used for PCI 1720 SynchronousOutput None Boolean Synchronizes the outputs of the multiple channels Only used for PCI 1720 Table A 7 DAQAO Analog Output Control Methods Appendix A Properties Methods and Events Reference 101 A 3 3 Events Name Arguments Description OnCompleted None Triggered when the output count reaches the NumberOfOutputs property OnTerminated None Triggered when the output count reaches the NumberOfOutputs property for noncyclic mode 102 Table A 8 DAQAO Analog Output Control Events ActiveDAQ User s Manual A 4 Digital Input Control DAGDI A 4 1 Property List Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation Utility DEVINST EXE DeviceName String The device name for the DeviceNumber property ErrorCode Long Itis used for storing the result of calling any methods If it is completed normally it is equal to zero otherwise nonzero See Appendix B for er
8. Your form should look similar to the one shown below 54 ActiveDAQ User s Manual Device l ae Gre E Select Device Ft Read Ea Figure 3 42 Form design in the Visual C example 3 4 4 Step 4 Configure the Al Control s Properties 1 Right click on the DAQAI control on the form and select Proper ties Select 1 adReal in the DataType field MR General Contol Temperature Setting AI DataType DaughterChannel 0 DaughterName No Daughter Board DeviceName No Device DeviceNumber JA ErrorCode 0 ErrorMessage OK EventEnabled False Figure 3 43 Configuring the properties of the DAQAI control 3 4 5 Step 5 Writing Code for the ActiveDAQ Controls 1 Right click on the IDC DEVICENAME edit box control on the form and select ClassWizard A dialog box is displayed then select the Member Variables tab in the dialog box The result is shown as below Chapter 3 Tutorial 55 MFC ClassWizard IDC_AIVALUE IDC Figure 3 44 The Class Wizard dialog box Member Variables tab 2 Press the Add Variable button and a dialog box is shown as below Add Member Variable EA Control ha cet i Figure 3 45 The Class Wizard dialog box Member Variables tab 3 Enter m_DeviceName in the Member variable name field select Control in the Category field and select CEdit in the Variable type field Then press the OK button The new variable in shown
9. DAQAO scsscssscssscssceees 100 A 3 Property List mission eos Seder apli upi ne 100 A32 Methods ia SENA ele eee ee eee 101 AS SEV EDS ss cede isidro iaa eines 102 A 4 Digital Input Control DAODD cesscsssscsssscssscsserees 103 A441 Property Listin atorado aaa ee 103 ASA 2 Method mit as 104 AA 3 EV Ents it AA A As 105 A 5 Digital Output Control DAQDO ccscsssscsssecssseees 106 A 5 1 Property List asustan pica si ida 106 A 5 2 Methods si sne ea i nehi 107 A 6 Counter Control DAOCounter csssccssssscessseeeees 108 A 6A Property List irracional rare 108 A 62 Method dd ee es 109 A 7 Pulse Output Control DA QPulse sscsssscssscsscsees 110 ACL A Property Litio eta weed 110 ASTD ME OSS cri cd a a td 111 A 8 Alarm Control DAQAlarm cssccccssssccsssscesssseceesees 112 A 8 U Property List s00 sist ida eee din dica 112 AB 2Metdo Sitio airis 113 A OD A TEREE EI SEE O 113 xii ActiveDAQ User s Manual Appendix B Error Messages 115 B 1 Driver Error Messages sccssscssssssssscsssscsssscssscessssssssees 116 B 2 ActiveDAQ Error Messages mccccmocccooccooocconccrnocrocscracocnos 120 Appendix C Hardware Support Listing 121 C 1 Hardware Support Listing oooooomsm 122 C 2 Notice About Support For Advantech Products 128 INAdEX ivana ee E ea aaa 129 Preface xiii Figure 1 1 Figure
10. Properties Events Cursor jeDetaut o CyclicMode False DataType z DaughterChannel 0 MEN DaughterName No Daughter Board DeviceName No Device i PS E oo ErrorCode 0 EnoMessage KI EventEnabled False ExtT rigger False 0 FIFOEnabled False FIFOSize 0 Height 32 HelpContext Gm Hint InputRangeList Unknown _InputRangeMode 0 adOverallRange Left 152 MaxDifferentialChan 0 _MaxSingleEndedCh 0 Name DAGAN NumberOfSamples 512 OveralllnputRange 0 SampleRate 100 Kai Figure 3 25 Object Inspector showing DAQAI1 properties 3 3 5 Step 5 Writing Code for the ActiveDAQ Controls 44 1 Go back to the form and double click on the Select Device button Delphi generates the routine skeleton in the code window and you write the following code procedure TForml cmdSelectDeviceClick Sender TObject begin DAODevicel SelectDevice txtDeviceName Text DAODevicel DeviceName end ActiveDAQ User s Manual 2 Double click on the Read button on the form and enter the following code procedure TForml cmdReadClick Sender TObject begin DAQAI1 DeviceNumber DAQDevicel DeviceNumber DAQAI1 OpenDevice TxtAlValue Text FloatTostr DAQAT1 RealInput 0 DAQAT1 CloseDevice end 3 3 6 Step 6 Test Your Program 1 Press F9 to run the program The startup screen is shown as below Device txtDeviceN ame Select Device Analog Input fistdlValue R
11. handler code here m_DeviceCtrl SelectDevice m_DeviceName SetWindowText m_DeviceCtrl GetDeviceName 7 Right click on the Select Device button on the form and select Events A dialog box is shown as below 58 ActiveDAQ User s Manual New Windows Message and Event Handlers for class CDAQAIDIg 21 x New Windows messages events Existing message event handlers OK Cancel Add and Edit EditEmstina Class or object to handle IDC_DAQAICTRL1 a IDC_DAQDEVICECTRL1 imi IDC_DEVICENAME biter for messages avataule to class Dialog z ies Indicates the user clicked a button Figure 3 49 VC Windows Message and Event Handlers configuration 8 Select IDC_READ entry in the Class or object to handle field and select the BN_CLICKED entry in the New Windows messages events field Then press the Add and Edit button to edit code Write the following code void CDAQATD1g OnRead TODO Add your control notification handler code here char buffer 50 CString value m AICtrl SetDeviceNumber m DeviceCtrl GetDeviceNumber m AICtrl OpenDevice _gcvt m_AICtrl RealInput 0 7 buffer value buffer m AIValue SetWindowText value m AICtrl CloseDevice Chapter 3 Tutorial 59 3 4 6 Step 6 Testing Your Program 1 Press Ctrl F5 to execute the program The startup screen is shown below Device Figure 3 50 Running the example 2 Press the Select Device button on the form
12. 1 2 Figure 1 3 Figure 1 4 Figure 1 5 Figure 1 6 Figure 1 7 Figure 1 8 Figure 1 9 Figure 1 10 ActiveDAQ Shortcuts on the Windows Start Menu Figures Run setup exe from the installation CD ROM disc 4 Loading the ActiveDAQ Setup Program ccececeeseeseeeeeeeeeeseeeeeeeeetaeeeeatene ActiveDAQ Setup Program Welcome Screen ee Installation Program Information Screen eeeeeeeeeeeeeeeseeteeeeeeeeeeeeeeeaeeas Choose Destination Directory for Program Files Choose the type of installation for your operating system ai Making Shortcuts on Windows Start Menu Copying Files to Hard Disk Drive Installation Program Setup Complete Window Figure 1 11 VB Components Dialog Box Showing ActiveDAO Figure 1 12 Visual Basic Toolbar Showing ActiveDAQ Control Figure 1 13 Device Installation Utility Main Screen Figure 1 14 Device Installation Utility I O Device Installation Window Figure 1 15 Choose Board Driver That You Want to Install Figure 1 16 Card Device Setup dialog box PCL 818L shown Figure 1 17 I O Device Installation Window Showing Installed Devices 14 Figure 1 18 Add Remove Programs in the Windows Control Panel Figure 1 19 Click Yes to Uninstall ActiveDAQ eceeccecceceeseeeeeeeeeeeeeeeeeeseeaeeeeeeneeneea
13. 1 Device Control DAQDevice A 1 1 Property List Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation Utility DEVINST EXE DeviceName String The device name corresponding to the DeviceNumber property SubDeviceNumber Long Specifies the sub device number previously defined through configuration using the Device Installation Utility DEVINST EXE For example the serial port is a device and the ADAM modules attached to the serial port are its sub devices SubDeviceName String The sub device name corresponding to the SubDeviceNumber property ErrorCode Long Used for storing the result of calling any methods If it is completed normally it is equal to zero otherwise non zero See Appendix B for error code listing ErrorMessage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing NumOfDevice Short Number of devices NumOfSubDevice Short Number of sub devices GetModuleList Boolean Enables TRUE to retrieve sub devices Table A 1 DAQDevice Control Property List 94 ActiveDAQ User s Manual A 1 2 Methods Name Arguments Returned Type Description SelectDevice None Long Opens a dialog box for selecting the desired device to perform l O operations and returns the result in the DeviceNumber proper
14. 3 The I O Device Installation window loads The pane at the top of the I O Device Installation window displays the Advantech boards that are installed on the computer this pane will be blank the first time you run the utility Click the Add button to display the list of devices for which you can install the driver 170 Device Installation Installed Devices Figure 1 14 Device Installation Utility O Device Installation Window 12 ActiveDAQ User s Manual 4 The I O Device Installation window expands to show a list of devices for which you can install the DLL driver Choose the card name and model in the List of Devices list box When the card that you want to install is highlighted click the Install button 170 Device Installation Installed Devices Cancel Setup Remove About List of Devices isat Advantech PCL 711 711B Advantech PCL 816 z Help Figure 1 15 Choose Board Driver That You Want to Install 5 The Card Device Setup dialog box appears Enter your configura tion settings that you want to use for the hardware Consult your hardware documentation for more information about how to configure the hardware The following figure shows the Setup dialog box for Advantech s PCL 818L data acquisition card Advantech PCL 818L H HD HG Data Acquisition Card Setup EG p Board Type p Base Address A D Channels Configuration epee ic 8 Differential C PCL 818H c A c m Interrupt Channel
15. A dialog box is displayed as follows E ADSDAQ 000 Advantech DEMO 1 0 1H Figure 3 51 Running the example 3 Select 000 Advantech DEMO I O 1H item and press the Select button The selected device is shown in the Device field Then press the Read button the data will appear as below 60 ActiveDAQ User s Manual Ez DAQAI 000 Advantech DEMO 1 0 1H E Figure 3 52 Running the example Chapter 3 Tutorial 61 62 ActiveDAQ User s Manual CHAPTER 4 Using ActiveDAG Controls 4 1 Using ActiveDAQ Controls 4 2 This chapter describes how can you use the ActiveDAQ controls to perform input or output operations with Advantech hardware It explains each control and their most commonly used properties methods and events The following lists the available controls 4 1 1 ActiveDAQ Controls and their Operations DAQDevice Generates a dialog box to let user select a device for T O operations DAQAT Performs analog input or temperature measurement DAQAO Performs analog output DAQDI Performs digital input DAQDO Performs digital output DAQCounter Performs event counting or frequency measure ment DAQPulse Performs pulse output operations DAQAlarm Performs alarm checking and monitoring Each ActiveDAQ control contains properties methods and events based on the operation type and on the capabilities of the I O device that ActiveDAQ supports Some of the properties and
16. O C WINDOWS SYSTEM refedit dil O C AWINDOWS SYSTEM TDC OCK 4 Returns sets the text displayed in an objects title bar or below an object s E Figure 3 10 Visual Basic toolbox showing Analog Input and Device Controls 3 2 3 Step 3 Design the Form 1 Place a DAQDevice and a DAOAI control from the toolbox on the form Use the default names 2 Place two TextBox controls from the toolbox on the form Then switch to the Property Window and enter txtAI Value and txtDevi ceName as their Name properties 3 Place two Label controls from the toolbox on the form Enter Device and Analog input as their Caption fields 4 Place two CommandButton controls from the toolbox on the form Enter cmdSelectDevice cmdRead as their Name properties Enter Select Device and Read as the Caption properties Your form should look similar to the one shown below Chapter 3 Tutorial 35 lo je Edt Wew Project Format Debug Run Tools Add ins Window Help zlsixi S o EU VSE A So s MSFAFR UH 00 gi 4920x3015 Figure 3 11 Designing the form 3 2 4 Step 4 Configure Al Control in the Property Sheet 1 Click on the Properties Window from the View menu 2 Select DAQAIN from the top of the Property Window 3 Select adReal in the DataType field of the DAQAII Property Window 3 2 5 Step 5 Writing Code for the ActiveDAQ Controls 1 Double click on the Select Device button on the form and write the following
17. as below 56 ActiveDAQ Users Manual MFC ClassWizard CTRLI IDC_DAQDEVICECTRL1 IDC_DEVICENAME IDC_READ IDC_SELECTDEVICE IDCANCEL IDOK Figure 3 46 Defining a new member variable 4 Follow the previous steps to add the following variables for IDC AIVALUE IDC DAGAICTRLI and IDC DAODEVICECTRLI entries m AIValue type CEdit m AICtrl type CDAQAD and m DeviceCtrl type CADDEVCtrl The result is shown as below MFC ClassWizard IDC AIVALUE CDAGAL m CADDEVCtI m_DeviceCtrl CEdit m_DeviceName Figure 3 47 The result after configuring the member variables Chapter 3 Tutorial 57 5 Right click on the Select Device button on the form and select Events A dialog box is shown as below New Windows Message and Event Handlers for class CDAQAIDIg 21x New Windows messages events Evistng message event handlers OK Edit Existing Class or object to handle IDC_DAQDEVICECTRL1 m IDC_DEVICENAME IDC READ E Eiter for messages available to class Piatos z BEE Indicates the user clicked a button Figure 3 48 VC Windows Message and Event Handlers configuration 6 Select IDC_SELECTDEVICE entry in the Class or object to handle field and select the BN_CLICKED entry in the New Windows messages events field Then press Add and Edit button to edit code Write the following code as below void CDAQATD1g OnSelectdevice TODO Add your control notification
18. assigning a member variable 27 configuring properties 26 55 controls boolbar 25 controls toolbar 47 designing the form 54 loading ActiveDAO controls 25 MFC AppWizard 49 testing your program 60 tutorial 47 writing event routines 27 55 W warranty v
19. code Private Sub cmdSelectDevice_Click DAQDevicel SelectDevic txtDeviceName Text DAQDevicel DeviceNam End Sub 2 Double click on the Read button on the form and enter the follow ing code 36 ActiveDAQ User s Manual Private Sub cmdAcguire Click DAQAI1 DeviceNumber DAODevicel DeviceNumber DACAI1 OpenDevice txtAIValue DAQAT1 RealInput 0 DAQAT1 CloseDevice End Sub 3 2 6 Step 6 Test Your Program 1 Press F5 to run the program The startup screen is shown below Figure 3 12 Press F5 key to run your program 2 Press the Select Device button on the form A dialog box is displayed as follows ADSDAQ Devices Figure 3 13 Press Select Device button on the form Chapter 3 Tutorial 37 3 Select 000 Advantech DEMO I O 1H item and press the Select button The selected device is shown in the Device field Then press the Read button the data will appear as follows 000 Advantech DEMO 0 1H a 0 78217 Figure 3 14 Running the example 38 ActiveDAQ Users Manual 3 3 ActiveDAQ Tutorial for Delphi Applications 3 3 1 Step 1 Add Demo Board With DEVINST EXE 1 The same as step for making a Visual Basic application Please see step on page 30 3 3 2 Step 2 Load ActiveDAQ Controls into Delphi Component Palette 1 Go into the Start menu and click on the Delphi 4 icon in the Borland Delphi 4 folder a Ej Internet Explorer gt
20. control 2 methods 95 properties 94 DAQDI digital input control 2 76 digital input with event 77 events 105 methods 104 properties 103 single point digital input 76 waveform digital input 76 DAQDO digital output control 23 1 example 77 methods 107 properties 106 DAQPulse pulse output control 2 85 example 82 methods 111 properties 110 Delphi 22 calling methods 23 Component Palette 22 39 designing a form 43 Object Inspector 23 44 setting properties at run time 23 testing your program 45 tutorial 39 writing event rountines 24 44 Device Installation Utility 12 installing DLL drivers with 30 running 12 Index 129 DEVINST EXE See Device Installation Utility documentation 10 E error messages ActiveDAQ 120 driver 116 examples 10 F file path 6 I installation 3 kinds of 7 path 6 program shortcut 8 10 M methods 66 calling with code 20 CloseDevice 66 O overview Vi properties 20 64 DeviceNumber code sample 65 ErrorCode 66 ErrorMessage 66 setting at run time 20 S system requirements 3 130 ActiveDAQ User s Manual T technical support iii offices iv U uninstallation 15 V Visual Basic 11 Components dialog box 11 configuring controls 19 designing a form 35 loading ActiveDAQ into 18 Object Browser 21 property sheets 19 example 36 testing a program 37 toolbar 11 toolbox 18 tutorial 30 using ActiveDAO with 18 writing event routines 21 example 36 Visual C 25
21. in Visual C You must instead use the functions of the wrapper class created by Visual C to map to the control to read and set the properties These functions are named starting with Get or Set followed by the name of the properties For example to set the OverallInputRange property of the ActiveDAQ s analog input control use SetOverallInputRange function of the wrapper class You can then view the available property functions for a control by clicking on the ClassView tab from the button of Workspace window You can also use the functions of the wrapper class to access the methods of a control To call a method append the method name of the control to the member variable name mapped to the control and pass the appropriate parameters 2 4 4 Developing ActiveDAQ Controls Event Routines The ActiveDAQ controls generate the events in response to some occurrence in the controls To develop the event routine code right click on a control and select ClassWizard Then select the Message Maps tab In the Message Maps tab select the desired control in the ObjectIDs field and select the desired event from the Messages field At last press the Add Function button to generate the event handler routine and press the Edit Code button to edit the event handler routine Chapter 2 Building ActiveDAQ Applications with Various Languages 27 OnEventRaw OnEventReal OnTerminated IDC DAOAICTALI IDCANCEL IDOK Figure 2 12 Ac
22. nano nanannonrnonaccnnn Figure 3 28 Delphi example dialog window dos Figure 3 29 Starting Microsoft Visual C ceceecceceeseeseeeeeeeeeeeeeeeeeeeeeaeeaeseeeeseeteaeeateaes Figure 3 30 The main screen of the Microsoft Visual C IDE Figure 3 31 Click File New form the Visual C main menu bo i Figure 3 32 The Visual C MFC AppWizard nn Figure 3 33 The Visual C MFC AppWizard cococococccccocccococannconcnnnoncocnnnon con nonnonccnncnnnns Figure 3 34 The skeleton program after running the Visual C MFC AppWizard 50 Figure 3 35 Viewing the DAQAI resources in the WorkSpace 51 Figure 3 36 Double click the IDD_DAQAI_DIALOG entry in the resource tree 52 Figure 3 37 VC Components and Controls Gallery dialog box s Figure 3 38 Inserting the DAQDevice control into your project Figure 3 39 DAQAI and DAODevice controls loaded into VC application 53 Figure 3 40 Entering the ID field values in the Properties window ui Figure 3 41 Entering the properties for the button Controls Figure 3 42 Form design in the Visual C example Figure 3 43 Configuring the properties of the DAQAI control die Figure 3 44 The Class Wizard dialog box Member Variables tab 56 Figure 3 45 The Class Wizard dialog box M
23. the IDD DAOAI DIALOG entry in the resource tree A dialog based form is displayed as below Chapter 3 Tutorial 51 Dagai Microsoft Developer Studio CDAQAIDIg x ll class members 4 CDAQAIDIg Figure 3 36 Double click the IDD DAGAI DIALOG entry in the resource tree 9 Select Add to Project gt Components and Controls from the Project menu and double click on Registered ActiveX Controls The result should be as below Components and Controls Gallery ae E Reses on zel cl RE F Crystal Report Control 4 6 DAGDI Control EDADA Control ig DAQDO Control 3 DAGAlarm Control te DAQPulse Control E DAQAD Control AE DBGrid Control EF DAGCounter Control cia Class Ex DAQDevice Control IM HHCtl Object Figure 3 37 VC Components and Controls Gallery dialog box 52 ActiveDAQ Users Manual 10 Scroll down to the DAQAT Control and press the Insert button in the Components and Controls Gallery Again scroll down to the DAQDevice Control and press the Insert button Components and Controls Gallery BEI Choose a component to insert into your project Look in S Registered ActiveX Controls x El ex EJE E Crystal Report Control 4 6 DAGDI Control E DAQAI Control Gy DAGDO Control Hi DAOAlarm Control EE DAGPulse Control E DAQAD Control BE DBGrid Control ji DAQCounter Control lx FolderChooser Class BE DAO Device Control ME HHC Object mi m File name DAQDevice Controlink antech ActiveD
24. 217 Wait For Message Time Out Error On Port d MACID XH 218 Open CAN Card Failed 219 Close CAN Card Failed 220 DeviceNet Reset Failed Table B 2c ErrorCode Summary Appendix B Error Messages 119 B 2 ActiveDAQ Error Messages Besides the error messages from DLL drivers there are some error messages that are caused from the invalid call or improper configura tion generated by ActiveDAQ controls They are listed below Error Code Description ErrorMessage 10001 Create the control failed 10002 The OpenDevice method must be called before performing any I O operations 10003 The I O operation is still running at background You can not perform other I O operations 10004 Retrieve or set buffer data failed 10005 The number of outputs must equal to the size of output data buffer 10006 Retrieve or set buffer data failed at stopping running 10007 Requested data range is out of the buffer range 10008 Allocate or free memory failed 10009 The high alarm limit can not be less than the low alarm limit 10010 The number of samples must be multiple of half of FIFO size 10011 The number of samples or outputs must be more than 4K size 10012 The sample rate is too high 10013 Invalid number of samples or outputs 120 Table B 3 ActiveDAQ control s internal error listing ActiveDAQ User s Manual
25. 22 ActiveDAQ User s Manual Control Method Analog input RawOutput Y RealOutput Y OutputStart Y OutputStatus Y OutputStop S Yo SetRawDataBuffer_______ Y SetRealDataBuffer_______ Y SynchronousOutput Digital input BitInput Yo Bytelmput Yo EnableByteScan Y J EnableBitScan J Y ____ Digital output ByteReadBack J Y o ByteOutput To Y BitQuiput_______ _ Y BitReadBack Y Counter functions EnableCouner J Y EnableFrequency Y ResetCounter Y ETT zo z o o Table C 2 ActiveDAQ Hardware Support Listing Appendix C Hardware Support Listing 123 Control PCIA PCL 728 Method 71A B C MIC2728 Analog input Rawlnput Reallnput AcquireStart AcquireStatus GetBufferData AcquireStop GetlnputRange Select Daughter ThermoRead Analog output RawOutput OutputStatus OutputStop SetRawDataBuffer SynchronousOutput Digital input Bytelnput EnableByteScan EnableBitScan EnableEvent Digital output ByteReadBack ByteOutput BitOutput BitReadBack 212 Z e e Z Z e e Z e jejejeje Z 2212 Z Z e Z e lt 2e jejejejeje 212 212 Z 2 lt 212 1212 212 jeje 212 a ER LZ e e je 22 212 22 Z e Lje jeje Lje e lt Z Z EnableAlarm ResetAlarm
26. 36 nvalid Number of Event Count On I O XH 7 Create or Open Event Failed On I O XH 3 8 nva nterrupt Process Failed On I O XH 39 id digital output direction setting COM d Address XH 40 41 nvalid Event Type On I O XH The Time out Interval Elapsed in Milliseconds Parameter On I O XH Table B 2a ErrorCode Summary Appendix B Error Messages 117 100 An error occured while starting the device 101 The device has not been created 102 The handle passed to the function is not a valid 104 Passed to the driver contains an invalid parameter 105 Attempts to access a port which has not been defined in DEVINST 108 The driver creates notification event failure On l O XH The system resource is insufficient Onl O XH 111 The driver opens notification event failure On I O XH Allocate DMA buffer failure On I O XH Allocate MDL for DMA buffer failure On l O XH The buffer of requisition must be bigger that PAGE SIZE On l O XH Table B 2b ErrorCode Summary 118 ActiveDAQ User s Manual 206 No Response On Port d MACID XH 207 Busy On Network On Port d MACID XH 208 Unknown Response On Port d MACID XH 209 Message Length Is Too Long on Port d MACID XH 213 Event Enable Disable Error On Port d MACID XH 214 Device Net Driver Create Open Event Failed On Port d MACID XH 215 IO Message Request Error On Port d MACID XH 216 Get Event Name From CAN Driver Failed On Port d MACID XH
27. 69 4 3 4 Example Waveform Analog Input With Software Triggering uee iie 69 4 4 Analog Output Control ccsscssssccssscsssesssecssessssssseess 73 4 4 1 Single Point Analog Output 73 4 4 2 Waveform Analog Output 73 4 4 3 Example Single Analog Output 74 4 5 Digital Input Control scsssscssssccsssccssssessscessescssssseess 76 4 5 1 Single Point Digital Input 76 4 5 2 Waveform Digital Input 76 4 5 3 Digital Input with Event oooooonconocccocccocnnonnnonnnoncconacnocnno 77 4 6 Digital Output Control ooocoooocconoconnocconocccncconocccrnocroncnno 77 4 6 1 Example Waveform Digital Input Digital Output TI 4 7 Counter Control ane anje lea 81 4 7 1 Event Counting se dane pesi pene Ski S in 81 4 7 2 Frequency Measurement nee 82 4 7 3 Example Event Counting coooococcnoccnoccnononanannonancnnncnnncns 82 4 8 Pulse Output Control coooommosscsms 85 4 9 Alarm Control 5 aa aaa alel ei 86 4 9 1 Example Alarm Monitoring for Analog Input 87 Preface xi Appendix A Properties Methods and Events Reference ccccccssessseeeeeeeseeeens 93 A 1 Device Control DA QDeViICE sssccccsssscccsssecessseecessseres 94 A 1 U Property Listos Si nie dildo 94 LR A AN 95 A 2 Analog Input Control DAQAD onccccnocccnoccconoconococrociroccss 96 A 2 U Property LiStiiniasti cintia aid reams 96 A 2 2 Methods epi Da ni 98 Av 2 SEV ODS toa 99 A 3 Analog Output Control
28. AQ Device Control Close More Info Path to control EXWINDOWS SYSTEM DEVCTRL OCX Figure 3 38 Inserting the DAQDevice control into your project 11 The VC toolbar will show the the DAQAI and DAQDevice controls in your Visual C application and toolbar Controls El Figure 3 39 DAQAI and DAQDevice controls loaded into VC application Chapter 3 Tutorial 53 3 4 3 Step 3 Design the form 1 Place a DAQDevice control and a DAOAI control from the Controls toolbar on the dialog based form 2 Place two Edit Box controls from the Controls toolbar on the form Then right click on them on the form and select the Properties and enter IDC_DEVICENAME and IDC_AIVALUE in their ID fields A General Styles Extended Styles Z Visible T Group T Help ID F Disabled IZ Tab stop Figure 3 40 Entering the ID field values in the Properties window 3 Place two Static Text controls from the Controls toolbar on the form Then right click on them and select Properties Then enter Device and Analog input in their Caption fields 4 Place two Button controls on the form Then right click on them and select Properties Then enter Select Device and Read in the Caption fields and enter IDC_SELECTDEVICE and IDC_READ in the ID fields M General Styles Extended Styles y Caption Select Device JZ Visible T Group F Help ID T Disabled V Tab stop Figure 3 41 Entering the properties for the button controls
29. ActiveDAQ 2 ActiveDAQ is a collection of ActiveX controls for performing I O operations within any compatible ActiveX control container such as Visual Basic Delphi etc You can easily perform the I O operations through properties events and methods Specific information about the properties methods and events of the individual ActiveX controls can be found later in this manual With ActiveDAQ you can perform versatile I O operations to control your Advantech devices The ActiveDAQ package contains the following components DAQDevice opens a dialog box for the user to select the device that they want to operate DAQATI performs single analog input and waveform analog input operations DAQAO performs analog output and waveform output operation DAQDI performs digital input operation DAQDO performs digital output operation DAQCounter performs event counting and frequency measure ment operation DAQPulse performs pulse output DAQAlarm performs alarm settings and alarm checking You can use these ActiveX controls in any application that supports them including Microsoft Visual C Visual Basic and Delphi ActiveDAQ User s Manual 1 3 Installing ActiveDAQ The ActiveDAQ setup program installs ActiveDAQ through a process that lasts approximately five minutes Installing the necessary soft ware to use the ActiveDAQ ActiveX controls in your application involves two main steps 1 Installing the Acti
30. Advantech ActiveDAQ Alarm Control Cl Advantech ActiveDAQ AO Control Advantech ActiveDAQ Counter Control C Advantech ActiveDAQ Device Control C Advantech ActiveDAQ DI Control Advantech ActiveDAQ DO Control C Advantech ActiveDAQ Pulse Control C C WINDOWSISYSTEMrefedit dll C C WINDOWSISYSTEMYTDC OCX spi Browse T Selected Items Only Location C Acrobat3 Reader Activex PDF OCX ter iret Le Cancel Apply Figure 3 9 The Visual Basic Components dialog box 4 Select the Advantech ActiveDAQ Analog Input Control and Advantech ActiveDAQ Device Control from the list in the Controls tab Click the Apply button Icons that represent these controls will appear in the Visual Basic toolbox as below Then press the OK button to exit the dialog box ActiveDAQ Users Manual m Project Microsoft Visual Basic design Ele Edit view Project Format Debug Run Tools Add Ins Window Help J A BSE MET V TEO MBR o E Components Ei Controls Designer Insetable Objects Project1 Projectl E S Forms C Acrobat Control for Activex O Formi Forni O Active Setup Control Library O ActiveEx type library V Advantech ActiveDAQ Al Control O Advantech ActiveDAQ Alarm Control O Advantech ActiveDAO AO Control O Advantech ActiveDAQ Counter Control DAQ Device Contr C Advantech ActiveDAQ DI Control C Advantech ActiveDAQ DO Control C Advantech ActiveDAQ Pulse Control
31. Copyright Notice This document is copyrighted 1999 by Advantech Co Ltd All rights are reserved Advantech Co Ltd reserves the right to make improve ments to the products described in this manual at any time without notice No part of this manual may be reproduced copied translated or transmitted in any form or by any means without the prior written permission of Advantech Co Ltd Information provided in this manual is intended to be accurate and reliable However Advantech Co Ltd assumes no responsibility for its use nor for any in fringements upon the rights of third parties which may result from its use Acknowledgements IBM and PC are trademarks of International Business Machines Corporation Intel is a trademark of Intel Corporation MS DOS is a trademark of Microsoft Corporation ActiveX Visual Basic and Visual C are trademarks of Microsoft Corporation Delphi is a trademark of Inprise Corporation All other product names or trademarks are the properties of their respective owners ActiveDAQ User s Manual Advantech Customer Services Each and every Advantech product is built to the most exacting specifications to ensure reliable performance in the harsh and demanding conditions typical of industrial environments Whether your new Advantech equipment is destined for the laboratory or the factory floor you can be assured that your product will provide the reliability and ease of operation for which the na
32. D Ath Floor 108 3 Min Chuan Road Shing Tien City Taipei County Taiwan ROC Tel 886 2 2218 4567 Fax 886 2 2218 1989 E mail IA Support advantech com tw Advantech Germany Karlsruherstr 11 1 D 70771 Leinf Echterdingen Germany Tel 49 0 711 797 333 60 Fax 49 0 711 797 333 85 Advantech Italy Via Don Verderio 4 B 20060 Cassina de Pecchi MI Italy Tel 39 2 95343054 Fax 39 2 95343067 Beijing office No 7 6th Street Shang Di Zone Haidian District 100085 Beijing China Tel 86 10 62984345 47 62986314 17 Fax 86 1 62984341 42 Shanghai office Room 701 7th Floor Hua Fu Building A 585 Long Hua W Road 200232 Shanghai China Tel 86 21 64696831 64697910 Fax 86 21 64696834 iv ActiveDAQ User s Manual Limited Warranty Advantech Corporation does not warrant that the ActiveDAQ software package will function properly in every hardware software environ ment Advantech Corporation makes no representation or warranties of any kinds whatsoever with respect to the contents of this manual and specifically disclaims any implied warranties or fitness for any particular purpose Advantech Corporation shall not be held liable for errors in this manual or for incidental or consequential damages in connection with the use of this manual or its contents Advantech Corporation reserves the right to revise this manual at any time without prior notice Preface About This Manual This manual con
33. Delphi 4 Project ed File Edit Search View Project Run Component Database Tools Workgroups Help D S E E S B ig 9 Date Coto Midas Decision Cube OReoat Dialoos Win 31 Samples ActiveX halle leasa ula all gt AY m iy w a oy Figure 3 23 The ActiveX tab in the Component Palette 2 Place a DAQDevice control and a DAQAI control from the Component Palette on the form Use the default names DAQAT1 and DAQDevicel 3 Switch to the Standard tab from the Component Palette and place two Edit controls on the form Then enter txtAIValue and txtDevi ceName as their Name properties in the Object Inspector 4 Place two Label controls under the Standard tab on the form Enter Device and Analog Input as their Caption fields in the Object Inspector 5 Place two Button controls on the form Enter cmdSelectDevice cmdRead as their Name properties and Select Device and Read as the Caption properties in the Object Inspector Your form should look similar to the one shown below iii Forml of x Device EN txtDeviceName Select Device Analog Input haave O E Read Figure 3 24 Form design for the Delphi DAQDevice DAQAI example Chapter 3 Tutorial 43 3 3 4 Step 4 Configure the Al Control in the Object Inspector 1 Click on the DAQAIN control on the form Its properties are shown in the Object Inspector window Select 1 adReal in the DataType field DAQAN TDAQA z
34. Device End Sub 4 Write the code of the alarm events to check the alarm state Private Sub DACAlarml OnHiAlarm chkHigh Value Checked chkLow Value Unchecked chkNormal Value Unchecked End Sub Private Sub DAOAlarml OnHiToNormal chkHigh Value Unchecked chkLow Value Unchecked chkNormal Value Checked End Sub Chapter 4 Using ActiveDAQ Controls 89 90 Private Sub DAQAlarm1_OnLoAlarm chkHigh Value Unchecked chkLow Value Checked chkNormal Value Unchecked End Sub Private Sub DAQAlarm1_OnLoToNormal chkHigh Value Unchecked chkLow Value Unchecked chkNormal Value Checked End Sub Write the code of the timer to display input data Private Sub Timerl Timer txtValue Text DAQAlarml Value End Sub ActiveDAQ User s Manual Step 4 Testing your program 1 Press the Select Device button and choose the device that supports event counting 2 Press the Start button You will then view the alarm status and input value as follows 000 Advantech DEMO 0 1H K A prem NE Figure 4 14 Running the alarm monitoring for analog input example We provide examples for the Alarm Control in the Examples path of the installation directory Please refer to them for more information about the control s advanced features Chapter 4 Using ActiveDAQ Controls 91 92 ActiveDAQ User s Manual APPENDIX Properties Methods and Events Reference A
35. Device This method must be called when all I O operations are complete EnablePulseOut IN Boolean Enabled Boolean Starts TRUE or stops FALSE the operation of pulse output ResetPulse None Boolean Resets the counter for pulse output Table A 17 DAQPulse Pulse Output Control Methods Appendix A Properties Methods and Events Reference 111 A 8 Alarm Control DAQAlarm A 8 1 Property List Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation Utility DEVINST EXE DeviceName String The device name for the DeviceNumber property ErrorCode Long It is used for storing the result of calling any methods If it is completed normally it is egual to zero otherwise nonzero See Appendix B for error code listing ErrorMessage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing Channel Short Specifies the channel to perform alarm monitoring ScanTime Float Specifies the rate of the alarm checking in milliseconds AlarmMode Short Specifies the alarm mode momentary or latched If the alarm is in Latched mode the alarm will stay on even when the input value returns within limits An alarm in Latched mode can be turned OFF by setting the RetriggerAlarm property to TRUE When the alarm i
36. GB BDE Administrator FE Microsoft Reference Fl Database Desktop EF Microsoft Visual Basic 5 0 EY Datapump H Microsoft Web Publishing gt PEN FE Online Services E Delphi 4 Readme gt h Image Editor gt 8 Register Now ERY SOL Explorer 1E SOL Monitor BB MS DOS Prompt LJ Windows Explorer Figure 3 15 Starting Inprise Delphi 4 Windows95 A 2 Delphi 4 will launch as shown below Chapter 3 Tutorial 39 Formi TFormt zi Figure 3 16 Delphi 4 main program 3 Select Import ActiveX Control from the Component menu The Import ActiveX Control list dialog box loads Import ActiveX Versior trol Version 1 0 Advantech ActiveDAQ AO Control Version 1 0 Advantech ActiveDAQ Counter Control Version 1 0 Advantech ActiveDAQ Device Control Version 1 0 Advantech ActiveDAQ DI Control Version 1 0 Advantech ActiveDAQ DO Control Version 1 0 Figure 3 17 Delphi s Import ActiveX Control dialog box 4 Scroll down to the Advantech ActiveDAQ AI Control and click the Install button A dialog box is displayed as follows 40 ActiveDAQ Users Manual Figure 3 18 Installing the ActiveDAQ Al control 5 Enter ActiveDAQ into the File name field under the Into new package tab and press OK Then scroll down to the Advantech ActiveDAQ Device Control in the Import ActiveX dialog box Import ActiveX Figure 3 19 Importing
37. Specifies external trigger TRUE or pacer trigger FALSE OutputType Short Specifies voltage or current output Current output is for PCI 1720 MaxChannel Short Returns number of the available output channels for the specified device Table A 6 DAQAO Analog Output Control Properties 100 ActiveDAQ User s Manual A 3 2 Methods Name Arguments Returned type Description OpenDevice None Boolean Initializes the device previously specified with the DeviceName property This method must be called before any other methods that perform I O operations CloseDevice None Boolean Resets the device previously used by OpenDevice This method must be called when all I O operations are complete RawOutput IN Short Data Boolean Outputs one binary data to the channel specified by the Channel property and returns FALSE if successful RealOutput IN Float Data Boolean Outputs one real data voltage or current to the channel specified by the Channel property Returns FALSE if successful See also the OutputType property and the RawOutput method OutputStart None Boolean Starts the waveform output operation OutputStatus None Long Returns the buffer location for the current output data OutputStop None Boolean Terminates the waveform output operation See also the OutputStart method SetRawBuffer IN Variant DataArray
38. The Channel property specifies which Channel is used to perform the operation 4 7 1 Event Counting Before starting the operation you have to configure the PresetValue and Direction properties The PresetValue property sets the initial value when the program starts running and the Direction property determines whether the counter counts up or down You can then call the EnableCounter method to start the counting as follows DAOCounterl EnableCounter TRUE You can retrieve the counter value by accessing the CounterValue property After you finish the operation you have to stop and reset the counter by calling the following methods DAOCounterl EnableCounter FALSE DAQCounterl ResetCounter Chapter 4 Using ActiveDAQ Controls 81 4 7 2 Frequency Measurement To start the operation call the EnableFrequency method as follows DAQCounterl EnableFrequency TRUE You can retrieve the measurement value of the frequency by access ing the FrequencyValue property After you finish the operation you have to stop and reset the counter by calling the following methods ES DAOCounterl EnableFreguency FALSE DAOCounterl ResetCounter 4 7 3 Example Event Counting Step 1 Designing the form 1 2 Open a new project and form Load the Advantech ActiveDAQ Device Control and Counter Control from the Project Components menu Place a DAQDevice a DAQCounter and a Timer control on the form Use the default names Place
39. Utility DEVINST EXE DeviceName String The device name for the DeviceNumber property ErrorCode Long Used for storing the result of calling any methods If it is completed normally it is equal to zero otherwise nonzero See Appendix B for error code listing ErrorMessage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing InputRangeMode Short Specifies overall input range adOverallRange or 0 or different input ranges adDifferentRange or 1 for the scanned channels OveralllnputRange Short Specifies the overall input range when the InputRangeMode property is configured for overall input range InputRangeList Short Array Specifies the input ranges for the scanned channels when the InputRangeMode property is configured for different input ranges StartChannel Short Specifies the start channel for multiple channel reading The available channels are specified in the MaxSingledEndedChannel property or MaxDifferentialChannel property StopChannel Short Specifies the end channel for multiple channel reading Refer to the StartChannel property NumberOfSamples Long Specifies number of samples for reading SampleRate Double Specifies sample rate in Hz CyclicMode Boolean Specifies cyclic TRUE or non cyclic FALSE DataType Short Specifies the returned data type raw adRaw or 0 or converted adReal or 1 TransferMode Short Specifies the data transfer mode Sof
40. a VC Project Chapter 2 Building ActiveDAQ Applications with Various Languages 25 5 Select one registered ActiveX controls to insert into the Controls Toolbar and your project 2 4 2 Configuring ActiveDAQ Controls Properties After you add the ActiveDAQ controls to the Visual C Controls Toolbar select the corresponding icon from the toolbox and place it on the dialog form as below ai resources 5 3 Dialog E IDD ABOUTBOX let vs EIDD_Al DIALOG English U S E Icon a String Table S E Version Figure 2 10 Placing an ActiveDAQ on a dialog form You can then edit or configure its properties in the property sheet To access it right click on it and select Properties For example the property sheet of ActiveDAQ s Analog Input Control is shown in the figure below e False DataType 1 Real data DaughterChannel 0 DaughterName No Daughter Board DeviceName No Device DeviceNumber 1 ErrorCode 0 ErrorMessage OK EventEnabled False ExtTrigger False FIFOEnabled False FIFOSize 879521650 Figure 2 11 Analog Input Control Property Sheet ActiveDAQ Users Manual 2 4 3 Programming with ActiveDAQ Controls Before you can use the properties or methods of a control assign a member variable name to the control You can use the ClassWizard to add a member variable and map it to the control Unlike Visual Basic or Delphi you don t read and set the properties directly
41. an ActiveDAQ control into Delphi 6 Press the Install button A dialog box is displayed as below Click the OK button Figure 3 20 Installing the ActiveDAQ control into Delphi Chapter 3 Tutorial 41 7 The ActiveDAQ AI and ActiveDAQ Device controls are loaded into the Component Palette You can check it by clicking on Install Package from the Component menu A dialog box is shown as below Project Options Packages Design packages M Borland Sample Components M Borland Sample Imported ActiveX Controls M Borland Standard Components Borland TeeChart Components F M Borland Web Wizard Package id C Program Files Borland Delphi4 Lib ActiveD AG bpl Add Remove Edit components M Runtime packages T Build with runtime packages VCL40 VCLX40 VCLDB40VCLDBX40 VCLSMP40 QRPT4 Ada I Default Cancel Help Figure 3 21 Component Palette showing loaded ActiveDAQ control 8 Scroll down to the ActiveDAQ bpl item in the list and press the Components button A dialog box is shown as below There are two controls in the Installed components list the AI and Device controls Components x Installed components TDAGAL TDAGDevice Figure 3 22 Components dialog box showing two ActiveDAG controls 42 ActiveDAQ Users Manual 3 3 3 Step 3 Design the form 1 Switch to the form and select the ActiveX tab from the Component Palette isi
42. an Enabled Boolean Enable TRUE or disable FALSE digital waveform scan for bit data EnableEvent IN Boolean Enabled Boolean Enable TRUE or disable FALSE to fire events Table A 10 DAQDI Digital Input Control Methods 104 ActiveDAQ User s Manual A 4 3 Events Name Arguments Description OnByteScan OUT Short Data It is triggered for every scan period specified by the ScanTime property and it is started with the EnableByteScan method Then returns the byte data OnBitScan OUT Boolean Data It is triggered for every scan period specified by the ScanTime property and it is started with the EnableBitScan method Then returns the bit data OnEvent None Triggered when the digital input count reaches the interrupt EventTrigCount property It is used for the device with DI Table A 11 DAQDI Digital Input Control Events Appendix A Properties Methods and Events Reference 105 A 5 Digital Output Control DAQDO A 5 1 Property List Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation Utility DEVINST EXE DeviceName String The device name for the DeviceNumber property ErrorCode Long Itis used for storing the result of calling any methods If it is completed normally it is equal to zero otherwise nonzero See Appendix B for error code listing ErrorM
43. annel on card for temperature measurement and returns the selected channel and sets it to the ThermoDasChannel property ThermoRead None Floating point Reads the temperature value GetFirstInputRange OUT String Boolean Get first InputRange data item from InputRange device User has to allocate a string buffer of a minimum of 30 bytes GetNextInputRange OUT String Boolean Get the other InputRange data item InputRange User has to allocate a string buffer of a minimum of 30 bytes Delphi users Please see important note on page 99 Table A 4 DAQAI Analog Input Control Methods 98 ActiveDAQ User s Manual Note For Delphi applications you should use the GetFirstInpu tRange and GetNextInputRange methods to get the list of the input range instead of the GetInputRange method An example is shown below var strGain WideString bRet Boolean begin SetLength strGain 30 bRet DAQAI1 GetFirstInputRange strGain while bRet False do begin bRet DAQAT1 GetNextInputRange strGain end end A 2 3 Events Name Arguments Description OnEventRaw Long DataCount Triggered when the sample count reaches the Variant Data NumberOfSamples property and requested returned data type is raw or binary OnEventReal Long DataCount Triggered when the sample count reaches the Variant Data NumberOfSamples property and requested returned data type is real or voltage OnTerminated No
44. ch the program and view the related documentation Ls PC cillin Ver 5tor Windows FE RoboHTML B UistReaderexe O Internet Explorer in Outlook Express FE Trend OfficeScan Win95 Advantech ActveD AQ K ActveDAQ Help El ActiveD AQ Readme Figure 1 10 ActiveDAQ Shortcuts on the Windows Start Menu Examples and documentation were copied to the file path that you specified in step 5 You can open your Windows Explorer to verify that these files were copied correctly Specifically the default file paths are c Program Files Advantech ActiveDAQ which contains examples and additional documentation about the ActiveDAQ controls and c Program Files Advantech Adsapi that contains the Device Installation Utility for loading the DLL drivers to enable communication between the ActiveDAQ controls and your hardware 10 ActiveDAQ Users Manual If you want to verify that that the ActiveX controls were installed correctly and registered to your computer you can open your devel opment tool and check to see that the ActiveX controls are available For example in Microsoft Visual Basic the ActiveDAQ controls that were installed will appear in the Components dialog box by choosing Project Components from Visual Basic s main menu Components xi Controls Designers Insertable Objects Active Setup Control Library ActiveEx type library El ACTIVEKB OLE Control module Activex Confer
45. e End Sub For the Stop button enter the following code Private Sub cmdStopScan Click DAQDI1 EnableByteScan False DAQDI1 CloseDevice End Sub Write the following code for the DAODI1 OnByteScan event to display data Private Sub DAQDI1_OnByteScan ByVal Data As Integer txtDiValue Text Data End Sub For the Write button write the following code Private Sub cmdDoWrite Click DAODO1 DeviceNumber DAODevicel DeviceNumber DAODO1 OpenDevice DAODO1 ByteCutput Val txtDoValue Text DAQDO1 CloseDevice End Sub Step 4 Testing your program 1 Press the Select Device button and choose the device that supports digital input Press the Scan button You will then view the data in the digital input field 3 Press the Stop button to terminate the digital input operation Press the Select Device button again and choose the device with digital output Enter the output data in the digital output field then press the Write button The result should be like below ActiveDAQ User s Manual Figure 4 9 Running the waveform digital input and digital output example 4 7 We provide examples for using the Digital Input Control and Digital Output control in the Examples path of the installation directory Please refer to them for more information about the controls advanced features Counter Control Use the Counter control DAQCounter to perform event counting or frequency measurement
46. e code 1 For the Select Device button write the following code Private Sub cmdSelectDevice_Click DAQDevicel SelectDevic txtDeviceName Text DAODevicel DeviceName End Sub 2 For the Acguire button write the following code Private Sub cmdAcguire Click DAQAI1 DeviceNumber DAODevicel DeviceNumber DAQAT1 OpenDevice DAQAT1 EventEnabled True DAQAT1 AcquireStart End Sub Chapter 4 Using ActiveDAQ Controls 71 3 For the Stop button write the following code Private Sub cmdStop_Click DAQAI1 AcquireStop DAQAT1 CloseDevice End Sub 4 Write the following code for the DAGAII OnEventReal event to display data The data stores the returned values The size is equal to the NumberOfSamples property Private Sub DAQAT1 OnEventReal ByVal Data Count As Long ByVal Data As Variant txtValue Text Data 0 End Sub Step 4 Testing your program 1 Press the Select Device button and choose the demo board 2 Press the Acquire button You will view the data in the txtValue field as follows a Forml O00 Advantech DEMO 1 0 1H Figure 4 5 The running waveform analog input with software triggering example 72 3 Press the Stop button to terminate the program We provide some examples for the Analog Input Control in the Examples path of the installation directory These examples cover analog input and temperature measurement Please refer to them for more information and to learn more abo
47. eDAQ into the Component Palette 22 2 3 2 Using the Object Inspector eee ee ceeeeeeeeeeeeneeeeeees 23 2 3 3 Using ActiveDAQ Controls Methods 23 2 3 4 Developing ActiveDAQ Controls Event Routines 24 2 4 Developing Visual C Applications cccscsssscsssseees 25 2 4 1 Loading ActiveDAQ into the Controls Toolbar 25 2 4 2 Configuring ActiveDAQ Controls Properties 26 2 4 3 Programming with ActiveDAQ Controls 27 2 4 4 Developing ActiveDAQ Controls Event Routines 27 2 5 Compatibility With VB Delphi and Visual C 28 Preface Chapter 3 Tutorial nana 29 3 1 ActiveDAQ Introductory Tutorial ccscsssccsssecsscees 30 3 2 ActiveDAQ Tutorial for Visual Basic Applications 30 3 2 1 Step 1 Add Demo Board With DEVINST EXE 30 3 2 2 Step 2 Load ActiveDAQ Controls into VB Toolbox 33 3 2 3 Step 3 Design the Form 35 3 2 4 Step 4 Configure AI Control in the Property Sheet 36 3 2 5 Step 5 Writing Code for the ActiveDAQ Controls 36 3 2 6 Step 6 Test Your Program ooooconoconoconoconoccnnnnonncnnaconannos 37 3 3 ActiveDAQ Tutorial for Delphi Applications 39 3 3 1 Step 1 Add Demo Board With DEVINST EXE 39 3 3 2 Step 2 Load Controls into Delphi Component Palette 39 3 3 3 Step 3 Design the form oconoccnnccnocococononononc
48. ead Figure 3 26 Example program startup screen 2 Press the Select Device button on the form A dialog box is displayed as shown in the following figure Chapter 3 Tutorial 45 ADSDAQ Devices E ADSDAQ 000 Advantech DEMO VO 1H Figure 3 27 Delphi example dialog window 3 Select the 000 Advantech DEMO I O 1H item and press the Select button The selected device is shown in the Device field When you press the Read button the data will appear as shown below l Ea 000 Advantech DEMO 0 1H 0 782169997692108 Figure 3 28 Delphi example dialog window 46 ActiveDAQ Users Manual 3 4 ActiveDAQ Tutorial for Visual C Applications 3 4 1 Step 1 Add Demo Board With DEVINST EXE 1 The same as step in the Visual Basic example Please see page 30 3 4 2 Step 2 Load ActiveDAQ Controls into the VC Controls Toolbar 1 Click on the Microsoft Visual C 5 0 icon in the Microsoft Visual C 5 0 folder in the Windows Start menu CA Process Viewer 42 Release Notes A Spy 47 Technical Support A WinDitt Windows95 Figure 3 29 Starting Microsoft Visual C 2 The Visual C program will launch as shown below Chapter 3 Tutorial 47 Microsoft Developer Studio 151 4 Developer Products Tools and Technologies Platform SDK and DDK D Figure 3 30 The main screen of the Microsoft Visual C IDE 3 Select New from the File menu A dialog box is show
49. ect Properties Window from the View menu For example the property sheet of ActiveDAQ s Analog Input Control is shown in the figure below Chapter 2 Building ActiveDAQ Applications with Various Languages 19 Properties DAQAI1 x DAQAI1 DAOAI z Alphabetic Categorized False 1 adReal o No Daughter Board No Device a o o InputRangelist InputRangeMode 0 adOverallRage Left 840 MaxDifferentialChannel 0 IMaxSinaleEndedChannel 0 INumberOfSamples 512 JoverallinputRange o Name Returns the name used in code to identify an object Figure 2 2 ActiveDAQ Analog Input Control property sheet in Visual Basic 20 In addition you also can read and set the properties of ActiveDAQ controls at runtime programmatically For example you can set the gain code of a device by setting the property of the ActiveDAQ s analog input control Adainl OverallinputRange 1 2 2 3 Using ActiveDAQ Controls Methods To call a method of an ActiveDAQ control add the name of the method after the name of the control For example you can call the Rawlnput method of ActiveDAQ s analog input control Reading Adainl RawInput channel ActiveDAQ User s Manual 2 2 4 ActiveDAQ Controls Event Routines The ActiveDAQ controls generate events in response to some occurrence in the controls To develop the event s routine code double click on the control to open the code editor Then select the desired event and w
50. ees Figure 1 20 Uninstallation utility removing ActiveDAQ programs Figure 2 1 Figure 2 2 Figure 2 3 Figure 2 4 Figure 2 5 Figure 2 6 Figure 2 7 Figure 2 8 Figure 2 9 Figure 2 10 Placing an ActiveDAQ on a dialog form Visual Basic Components list dialog box showing ActiveDAQ controls 19 ActiveDAQ Analog Input Control property sheet in Visual Basic 20 Event routine generated by ActiveDAQ Analog Input Control 21 ActiveDAQ in the Visual Basic Object Browser 21 Delphi s Import ActiveX Control dialog box showing ActiveDAQ controls 22 ActiveDAQ Analog Input Control property sheet in Delphi 23 The Object Inspector s View Tab Analog Input Control Event Routine Adding ActiveDAQ Controls to a VC Project 25 Figure 2 11 Analog Input Control Property Sheet e Figure 2 12 ActiveDAQ Control Event Handler Routine seee 28 Figure 3 1 Figure 3 2 Figure 3 3 Figure 3 4 Figure 3 5 Figure 3 6 Figure 3 7 Figure 3 8 Figure 3 9 Figure 3 10 Visual Basic toolbox showing Analog Input and Device Controls Start DEVINST EXE bi Device Installation Utility interface o n oniinninnninnnicninnonnconacanananocananananannon Device Installation Utility Setup window n Select the DEMO board from the Setup window ki Demo board setup configuration window
51. egin Figure 2 8 Analog Input Control Event Routine 24 ActiveDAQ Users Manual 2 4 Developing Visual C Applications To create a Visual C application working with ActiveDAQ controls you can use the Visual C MFC AppWizard to create a skeleton project and program After you create a project with ActiveX control support you can follow the procedure to develop an applica tion using ActiveDAQ controls The following procedure uses a dialog based application to illustrate the procedure 2 4 1 Loading ActiveDAQ into the Controls Toolbar Before using ActiveDAQ controls to build an application you must add them to the Controls Toolbar You can follow the procedure to add them 1 Open the workspace window by selecting Workspace from the View menu Select the Resource View tab from the button of the Workspace window 3 Double click on one dialog entry in the resource tree Select Add to Project gt Components and Controls from the Project menu and double click on Registered ActiveX Controls Components and Controls Gallery 12 x Choose a component to insert into your project Look in Fa Registered Activex Controls El ex E HA DAGD Control DAQDO Control E DAQPulse Control BE DBGrid Control MA HHCt Object GE Ikonic Button Control mi HM File name Dana Control lnk Close More Info Path to control JEAWINDOWS SYSTEM ADAIN OCX Figure 2 9 Adding ActiveDAQ Controls to
52. ember Variables tab 56 Figure 3 46 Defining a new member variable e Figure 3 47 The result after configuring the member variables Figure 3 48 VC Windows Message and Event Handlers configuration Figure 3 49 VC Windows Message and Event Handlers configuration Figure 3 50 Running the example Figure 3 51 Running the example Figure 3 52 Running the example 2s Figure 4 1 DEVINST EXE showing DeviceName and DeviceNumber Figure 4 2 Dialog box created by the DAQDevice control Figure 4 3 The form for the waveform analog input with software triggering example 70 Figure 4 4 Configuring the properties of the DAQAI Control Figure 4 5 The running waveform analog input with software triggering example Figure 4 6 Designing the form for the single analog output example site Figure 4 7 Designing form for waveform digital input digital output example Preface xv Figure 4 8 Configuring the properties of the DADDO control Figure 4 9 Running the waveform digital input and digital output example Figure 4 10 Form design in the event counting example Figure 4 11 Running the event counting example Figure 4 12 Form design for the alarm mo
53. ence Control Advantech ActiveDAQ AI Control Advantech ActiveDAQ Alarm Control Advantech ActiveDAQ AO Control Advantech ActiveDAQ Counter Control Advantech ActiveDAQ Device Control Advantech ActiveDAQ DI Control Advantech ActiveDAQ DO Control Advantech eDAQ Pulse Control Blue Sky Software Active Popup Browse K K K K K K RK K K Blue Sky Software WebPopupHelp xl TO Selected Items Only Advantech ActiveDAQ Pulse Control l Location C WINDOWSISYSTEMI ADPULSE OCX Figure 1 11 VB Components Dialog Box Showing ActiveDAQ When added to your current VB project the ActiveX controls will appear on the Visual Basic toolbar J E ue El Figure 1 12 Visual Basic Toolbar Showing ActiveDAQ Control Chapter 1 Introduction to ActiveDAQ Controls 11 1 3 3 Running the Device Installation Utility You must run the Device Installation utility to install the DLL driver for your Advantech card before using the ActiveDAQ controls 1 Start the Device Installation Utility by double clicking on the Devinst exe program icon in your Windows Explorer or choose the program shortcut on your Windows Start menu 2 The Device Installation Utility loads Choose Setup Device on the Device Installation Utility s main menu Advantech Device Installation fx Fle Setup Heb Figure 1 13 Device Installation Utility Main Screen
54. es complete the following procedure 1 Choose Settings Control Panel from your Windows Start menu 2 Double click on the icon labeled Add Remove Programs Select the item labeled Advantech ActiveDAQ and click the Add Remove button Add Remove Programs Properties 1 Install Uninstall Windows Setup Startup Disk pa To install a new program from a floppy disk or CD ROM drive click Install Z2 The following software can be automatically removed by Windows To remove a program or to modify its installed components select it from the list and click Add Remove 3Com NIC Diagnostics Adobe Acrobat 3 01 Adobe FrameMaker v5 5 Adobe PageMaker 6 5 Advantech ActveDSQ Bloomberg Chinese Traditional Language Support Enhanced Font List for Word 97 VBA PowerT ool HP LaserJet 4000 Printing System zi Figure 1 18 Add Remove Programs in the Windows Control Panel 4 Confirm that you want to delete the files by clicking Yes Confirm File Deletion 2 Are you sure you want to completely remove Advantech ActiveDAQ and all of its components E Figure 1 19 Click Yes to Uninstall ActiveDAQ Chapter 1 Introduction to ActiveDAQ Controls 15 5 The uninstallation utility will start running Click the OK button when uninstallation is completed Remove Programs From Your Computer unlnstallShield will remove the software Advantech ActiveDAQ from your computer Please wait while each of the follow
55. essage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing Port Short Specifies the digital output port It s 8 bits Refers to the MaxPortNumber property Bit Short Specifies the digital output line or bit Mask Short Specifies the mask for digital output It can be used to mask some of the digital lines when performing digital output The masked digital lines will not change the states at output The Mask property is bit wise For example you want to mask the bit 3 and bit 5 then set the property to 00101000 that is equal to 40 MaxPortNumber Short Returns number of the available ports for the specified device Table A 12 DAQDO Digital Output Control Properties 106 ActiveDAQ User s Manual A 5 2 Methods Name Arguments Returned Description type OpenDevice None Boolean Initializes the device previously specified with the DeviceName property This method must be called before any other methods that perform I O operations CloseDevice None Boolean Resets the device previously used by OpenDevice This method must be called when all I O operations are complete ByteReadBack None Short Reads the value of the digital output port 8 bit back Then returns the value ByteOutput IN Short Data Boolean Outputs one byte data to the specified port Returns FALSE if successful BitOutput IN Boolean B
56. ferential mode Refers to MaxSingleEndedChannel FIFOSize Long Returns the hardware FIFO size Table A 3b DAQAI Analog Input Control Properties Appendix A Properties Methods and Events Reference 97 A 2 2 Methods Name Arguments Returned Description type OpenDevice None Boolean Initializes the device previously specified with the DeviceName property This method must be called before any other methods that perform I O operations CloseDevice None Boolean Resets the device previously used by OpenDevice This method must be called when all I O operations are complete Rawlnput IN Short Channel Short Reads one sample in binary data format Reallnput IN Short Channel Floating point Reads one sample in voltage or converted data format AcquireStart None Boolean Starts the reading and returns FALSE if successful AcquireStatus None Long Returns the buffer location for the current incoming data GetBufferData IN Long BufferStart Boolean Retrieves sample data from the IN Long Count internal buffer and returns FALSE if OUT Variant successful ReturnedData AcquireStop None Boolean Terminates the reading and returns FALSE if successful GetlnputRange OUT Short Count Boolean Gets the list of the input range for OUT Variant the specified device and returns InputRanges FALSE if successful SelectDaugher None Short Generates a dialog box for selecting the ch
57. g and dual DMA triggering The TransferMode property specifies the data acquisition mode Software triggering data acquisi tion means sampling the data based on the software timer Interrupt DMA and Dual DMA triggering data acquisitions use the on board pacer to trigger the sampling operation and acknowledge the driver through a hardware interrupt To use hardware with FIFO feature e g PCL 818HD you should set the FIFOEnabled property to TRUE and set TransferMode for interrupt triggering According to the count for hardware FIFO interrupt the NumberOfSamples property must be a multiple of the count For example PCL 818HD supports half full FIFO size for the interrupt This means the NumberOfSamples property must be a multiple of half the FIFO size that is kept in the FIFOSize property Note For DMA triggering the NumberOfSamples property must be in excess of 4K samples Note Dual DMA triggering is only supported in the PCL 1800 The methods to perform waveform data reading are AcquireStart and AcquireStop Use the AcquireStart method to start the acquisition and the AcquireStop method to stop the acquisition In contrast to single data reading the waveform data reading needs an internal buffer to store the sample data The size of the internal buffer is specified in the NumberOfSamples property You can retrieve the buffer data either manually or by event If you enable the event method the control will fire an event when the nu
58. he OpenDevice and CloseDevice methods are not supported for the DAQDevice control 4 2 3 ErrorCode and ErrorMessage Properties In addition to the DeviceNumber and DeviceName properties and the OpenDevice and CloseDevice methods the ErrorCode is another common property It is used for storing the result of calling any method If the error code is equal to zero the operation is completed normally If the value is non zero the corresponding error message is returned in the ErrorMessage property Appendix B lists the possible error codes and error messages ActiveDAQ Users Manual 4 3 Analog Input Control The Analog Input Control DAQAJ is used to perform analog input operation or temperature measurement It can acquire single data waveform data with specified sampling rate or temperature reading To acquire single data and waveform data from data acquisition and control DA amp C cards you may specify the input range properties OverallInputRange or InputRangeList If all channels have the same input range you can set the property OverallInputRange to an appropriate value and set the input range mode InputRangeMode for overall The value of OverallInputRange property is the correspond ing index of the input range list returned from the GetInputRange method You can also use the GetInputRange method to get the input range support for the device specified by DeviceNumber To scan multiple channels with different input ranges you mus
59. he gating mode no gating 0 high level gating 1 low level gating 2 rising edge 3 and falling edge 4 for AMD Am9513A chip If the mode is with gating the counter may be started by separate external hardware input It uses an external device to trigger the gate input of the counter GatePeriod Short Specifies gating period in seconds for AMD Am9513A chip and frequency measurement MaxCounterNumber Short Returns number of the available counters for the specified device Table A 14 DAQCounter Counter Control Properties 108 ActiveDAQ User s Manual A 6 2 Methods Name Arguments Returned Description Type OpenDevice None Boolean Initializes the device previously specified with the DeviceName property This method must be called before any other methods that perform V O operations CloseDevice None Boolean Resets the device previously used by OpenDevice This method must be called when all I O operations are complete EnableCounter IN Boolean Enabled Boolean Starts or stops the operation of event counting EnableFrequency IN Boolean Enabled Boolean Starts or stops the operation of the frequency measurement ResetCounter None Boolean Resets the counter for event counting or frequency measurement Table A 15 DAQCounter Counter Control Methods Appendix A Properties Methods and Events Reference 109 A 7 Pulse Output Control DAQPulse A 7 1 Property Lis
60. hem 1 Select Components from the Project menu 2 Scroll down to the ActiveDAQ controls which you can find in the Controls list 3 Select the controls you want to use in your project If ActiveDAQ controls are not shown in the list press the Browse button to select the desired controls from the WINDOWS S YSTEM 32 directo ry ActiveDAQ User s Manual The Components list dialog box is as below Components x Controls Designers Insertable Objects _ Acrobat Control for Activex C Active Setup Control Library DactiveEx type library M Advantech ActiveDAQ AI Control M Advantech ActiveDAQ Alarm Control M Advantech ActiveDAQ AO Control M Advantech ActiveDAQ Counter Control M Advantech ActiveDAQ Device Control Advantech ActiveDAQ DI Control M Advantech ActiveDAQ DO Control Advantech ActiveDAQ Pulse Control O CAWINDOWSISYSTEMIrefedit dll C CAWINDOWSISYSTEMJTDC OC zi Browse of JO Selected Items Only ea ActiveDAQ Pulse Control Location C WINDOWS SYSTEM ADPULSE OCX Figure 2 1 Visual Basic Components list dialog box showing ActiveDAQ controls 2 2 2 Configuring Controls with Property Sheets After you add the ActiveDAQ controls to the Visual Basic toolbox select the corresponding icon in the toolbox and place it on a Visual Basic form You can then edit or configure its properties in the Visual Basic default property sheet To access the sheet select a control and sel
61. ing components is removed Shared program files Standard program files Folder items Program folders Program directories NON NINN Program registry entries Figure 1 20 Uninstallation utility removing ActiveDAQ programs 16 ActiveDAQ User s Manual CHAPTER Building ActiveDAQ Applications With Various Languages 2 1 Using Various Development Environments 2 2 This chapter describes how can you use the ActiveDAQ controls with the following development tools Microsoft Visual C for Windows 95 NT version 5 0 Microsoft Visual Basic for Windows 95 NT version 5 0 Inprise Delphi for Windows 95 NT version 4 0 If you are not using one of these development tools consult your development tool reference manual for details on creating applications with ActiveX controls This chapter assumes that you are familiar with the basic concepts of using Visual Basic Delphi and Visual C including selecting the type of application designing the form placing the control on the form configuring the properties of the control creating the code event handler routines for this control Developing Visual Basic Applications 18 To use ActiveDAQ controls complete the following procedure 2 2 1 Loading ActiveDAQ Controls into the VB Toolbox Before using ActiveDAQ controls to build an application you must add them to the Visual Basic toolbox You can follow the procedure to add t
62. iption ErrorMessage Not Enough Memor nvalid Device Handle 5 Analog Input Failure On I O X H nvalid Scaled Value On l O XH 6 Section Not Supported On l O XH 7 8 9 nvalid Channel On l O XH nvalid Gain Code On I O XH Data Not Ready On I O XH ali 1 nvalid Input Parameter On l O XH 7 0 1 12 Vi No Expansion Board Configuration in Registry Configuration File On l O XH nvalid Analog Output Value On l O XH Configure DIO Port Failure On 1 O XH 1 Open COM d Failure 4 15 Unable to Transmit to COM d Address XH 16 Unable to Receive from COM d Address XH Invalid Data Received from COM d Address XH 1 Configure Communication Port Falied on COM d 7 2 8 9 Checksum Error from COM d Address XH 0 Initialization Failure On l O XH 2 No Buffer Allocated for DMA 3 Background Operation Is Still Running On l O XH 2 Board ID Is Not Supported On l O XH 25 1 22 The Sample Rate Exceeds the Upper Limit On l O XH 2 4 Time Interval For Frequency Measurement Is Too Small On I O XH 2 Call CreateFile Failed Function Not Supported Load Library Failed nvalid Driver Handle Module Type Not Existence On l O XH 3 6 27 28 30 31 2 The Value is Out of Range On l O XH nvalid Windows Handle of Destination on l O XH 3 3 alid Numver of Conversion On l O XH 4 nv 35 nvalid Number of Interrupt Count On I O XH
63. le you will get an overall view about how to program using ActiveDAQ controls This chapter assumes that you are familiar with the basic concepts of using Visual Basic Delphi and Visual C ActiveDAQ Tutorial for Visual Basic Applications 3 2 1 30 Step 1 Add Demo Board With DEVINST EXE 1 Go into the Start menu and click on the Device Installation icon in the Advantech ActiveDAQ folder L InterBase Client 5 1 LE Intemet Explorer z Microsoft Reference jz Microsoft Visual Basic 5 0 Microsoft Visual C 5 0 Microsoft PowerPoint TY Microsoft Word BB MS DOS Prompt GY Windows Explorer Figure 3 1 Start DEVINST EXE ActiveDAQ Users Manual 2 Then it will launch the Device Installation Program as below J Advantech Device Installation To fx File Setup Help Figure 3 2 Device Installation Utility interface 3 Click on the Device from the Setup menu A dialog box is displayed 170 Device Installation Installed Devices Figure 3 3 Device Installation Utility Setup window 4 Press the Add gt gt button and select Advantech DEMO Board item in the List of Devices field Chapter 3 Tutorial 31 170 Device Installation Beles Unlisted Boards for Direct 1 0 Access a h DEMO Board Advantech COM Devices Advantech PCL 812 812PG Figure 3 4 Select the DEMO board from the Setup window 5 Press the Install button and a configuration dialog box is dis played as be
64. lectDaugher method will assign the DaugherChannel and DaugherName properties automatically 4 3 4 Example Waveform Analog Input With Software Triggering Step 1 Designing the form 1 Open a new project and form 2 Load the Advantech ActiveDAQ Device Control and Advantech ActiveDAQ AI Control from the Project Components menu 3 Place a DAQDevice and a DAQAI control on the form Use the default names 4 Place two TextBox controls on the form and enter txtValue and txtDeviceName in their Name fields 5 Place three CommandButton controls on the form Enter cmdSe lectDevice cmdAcquire and cmdStop for their name properties Then enter Select Device Acquire and Stop for their caption properties Your form should look similar to the one shown below Chapter 4 Using ActiveDAQ Controls 69 70 ia Forml n a mu e T CELEC Figure 4 3 The form for the waveform analog input with software triggering example Step 2 Configuring the properties of the DAGAI1 control 1 Enter 2 in the NumberOfSample field 2 Select True in the CyclicMode field 3 4 Select adReal in the DataType field Select True in the EventEnabled field ActiveDAQ Users Manual No Daughter Board 000 Advantech DEMO I 0 1H 0 0 OK True False False 0 O adOverallRange 5040 IMaxSingleEndedChannel 0 NumberOfSamples 2 Figure 4 4 Configuring the properties of the DAQAI control Step 3 Writing th
65. llation directory Please refer to them for more detailed information and advanced features of the Analog Output Control Digital Input Control 76 Use the Digital Input Control DAQDD to perform digital input operations The digital input lines bits on each data acquisition device are grouped into logical units called ports Each port has eight bits or lines The Port and Bit properties specify the digital input line or lines For example if Port 1 and Bit 3 then the digital input line starts from the eleventh one The Digital Input Control provides the following three kinds of functions 4 5 1 Single Point Digital Input Use the BitInput or ByteInput method to read single line or eight line data The syntax in Visual Basic is as below Value DAQDI1 BitInput 4 5 2 Waveform Digital Input Waveform digital input allows you to scan the digital lines with a fixed period The ScanTime property specifies the scan period The EnableByteScan or EnableBitScan method is used to start the wave form operation When each scan period expires the Digital Input Control fires an event called OnByteScan or OnBitScan along with the input data After the operation is complete call the EnableByteScan or EnableBitScan method with a FALSE value as input to stop the operation ActiveDAQ User s Manual 4 6 4 5 3 Digital Input with Event This function supports the devices with DI interrupt You configure the count for triggering an even
66. log input ADAM 4052 4053 50 51 5052 Rawlnput Reallnput Z 2 a 2 AcquireStart AcquireStatus GetBufferData Z 2 AcquireStop LZ e 2 2 2 2 2 2 2 a a GetInputRange SelectDaughter ThermoRead Analog output RawOutput Z RealOutput OutputStart OutputStatus OutputStop SetRawDataBuffer SetRealDataBuffer SynchronousOutput BitInput Bytelnput EnableByteScan EnableBitScan 2 2 2 2 2 2 2 2 2 2 2 2 EnableEvent Digital output ByteReadBack ByteOutput BitOutput BitReadBack Counter 2leleje 2leleje Lje jeje EnableCounter 2 EnableFrequenc 2 2 ResetCounter Alarm EnableAlarm ResetAlarm Z 2 2 Z 2421 Je Je y y Table C 6 ActiveDAQ Hardware Support Listing Appendix C Hardware Support Listing 127 4060 50 4080D 4530 4521 5050 4050 Methods 56 5060 BitInput Bytelnput EnableByteScan Bope v _ Vv EnableCounter pe io es AAA E ar E AA EA AH EnableBitScan EnableEvent v v KREN E E EnableFrequenc ResetCounter y Table C 7 ActiveDAQ Hardware Support Listing C 2 Notice About Support For Advantech Products 128 Advantech ActiveDAQ controls are based on the standard Advantech DLL drivers The ActiveDAQ controls provide support for new hardware as long as the hardware feature is supported by the cont
67. low Advantech Demo board Setup s cene Hep abou Figure 3 5 Demo board setup configuration window 6 Use the default value and press the OK button You will see a new entry in the Installed Devices list 32 ActiveDAQ Users Manual 1 0 Device Installation 000 Advantec h DER 40 1 0 1 H 1 0 Access Figure 3 6 Device Installation Utility Installed Devices window 7 Press the Close button and exit the Device Installation Utility 3 2 2 Step 2 Load ActiveDAQ Controls into VB Toolbox 1 Go into the Start menu and click on the Visual Basic 5 0 icon in the Microsoft Visual Basic 5 0 folder Figure 3 7 Start Visual Basic Chapter 3 Tutorial 33 34 2 Then it will launch Visual Basic 5 0 program as below Format Debug Run Tools Add Ins Window Help x Bp A ActiveX EXE ActiveX DLL Activex VB Application Y Y Y VB Enterprise Addin Activex ActiveX Edition Co Document DLL Document EXE JO Dont show this dialog in the future Figure 3 8 The Visual Basic Integrated Development Environment 3 Select Standard EXE icon and press the Open button A new project is created Click on Components from the Project menu The Components dialog box is loaded as shown below Components x Controls Designers Insertable Objects Acrobat Control for Active C Active Setup Control Library C ActiveEx type library C Advantech ActiveDAQ AI Control C
68. mber of sample data reaches the NumberOfSamples property You can then retrieve the sample data in the event handler routine named OnEventRaw or OnEventReal according to the DataType property To enable the event method set the EventEnabled property to TRUE Another event handler routine is OnTerminated which is triggered for noncyclic mode and event enabled ActiveDAQ User s Manual To retrieve the buffer data manually the Analog Input Control provides the GetBufferData method The GetBufferData method accepts the starting buffer location and data count parameters and then returns the buffer data You can also use the AcquireStatus method to get the current buffer location for the next incoming data 4 3 3 Temperature Measurement You can also use the Analog Input Control to perform temperature measurement The properties used include DaughterChannel Ther moDasChannel ThermoDasGain ThermoType and ThermoScale The ThermoDasChannel property specifies the channel on the card The ThermoDasGain property specifies the gain code on the channel of the card The DaughterChannel property specifies the scanned channel on the daughter board After you configure the property use the ThermoRead method to read the temperature value You can assign the DaughterChannel property directly or use the SelectDaugh ter method It generates a dialog box for you to select the Daughter Channel After you select the scanned channel of the daughter board the Se
69. me Advantech has come to be known Your satisfaction is our primary concern Here is a guide to Advantech s customer services To ensure you get the full benefit of our services please follow the instructions below carefully Technical Support We want you to get the maximum performance from your products So if you run into technical difficulties we are here to help For the most frequently asked questions you can easily find answers in your product documentation These answers are normally a lot more detailed than the ones we can give over the phone So please consult this manual first If you still cannot find the answer gather all the information or questions that apply to your problem and with the product close at hand call your dealer Our dealers are well trained and ready to give you the support you need to get the most from your Advantech products In fact most problems reported are minor and are able to be easily solved over the phone In addition free technical support is available from Advantech engineers every business day We are always ready to give advice on application requirements or specific information on the installation and operation of any of our products Preface iii Technical Suppport Offices USA Asia Europe Mainland China American Advantech Corporation 750 East Arques Avenue Sunnyvale CA 94086 Tel 408 245 6678 Fax 408 245 5678 E mail AInfo advantech com Advantech Co LT
70. methods for each control are common to all ActiveDAQ controls such as Device Number DeviceName OpenDevice CloseDevice ErrorCode and ErrorMessage Other properties are specific to the control and the type of operations that it supports Common Properties and Methods 64 4 2 1 DeviceNumber and DeviceName Properties Each control has a DeviceNumber property which specifies the device that you want to perform the I O operations The DeviceNumber is initially defined through configuration using the Device Installation Utility DEVINST EXE After the DeviceNumber is selected the corresponding device name is returned in the property DeviceName ActiveDAQ User s Manual The following is the configuration dialog box of the Device Installa tion Utility It lists the installed devices For the third entry of the device 002 PCL 818L 1 0 300H the DeviceNumber is equal to 002 and the DeviceName is 002 PCL 818L 1 0 300H lO Device Installation O00 Advantech DEMO 0 1H 001 COM2 002 PCL 818L 140 300H Figure 4 1 DEVINST EXE showing DeviceName and DeviceNumber You can assign the DeviceNumber property of each control directly Alternatively you can use an individual control DAODevice to generate a dialog box for selecting the desired device and return the selected device in the DeviceNumber and DeviceName properties You can pass the results to the other controls The following is a Visual Basic example It uses
71. must be in excess of 4K The methods to perform waveform generation are OutputStart and OutputStop Use the OutputStart method to start the operation and the OutputStop method to stop the operation In contrast to single point output the waveform output needs an internal buffer to store the output data The buffer size is equal to the Chapter 4 Using ActiveDAQ Controls 73 NumberOfOutputs property You have to set the buffer data before performing the output operation According to the DataType property raw or real you have to use the SetRawBuffer or SetRealBuffer method to set the buffer data If you enable the event method the control will fire an event when the number of output data reaches the NumberOfOutputs property You can then set the next output data in the event handler routine named OnCompleted To enable the event method set the EventEnabled property to TRUE Another event handler routine is OnTerminated that is triggered for non cyclic mode and event enabled In addition to enabling the event to inform the output status the Analog Output Control also provides the OutputStatus method The OutputStatus method returns the current buffer location for the next output data 4 4 3 Example Single Analog Output Step 1 Designing the form 1 Open a new project and form 2 Load the Advantech ActiveDAQ Device Control and Advantech ActiveDAQ AO Control from the Project Components menu 3 Place a DAQDevice and a DAQAO con
72. n as below ATL COM Appwizard Custom AppWizard DAGAL Database Project DevStudio Add in Wizard ISAPI Extension Wizard C PROGRAM FILESSDEVSTU ks Makefile MFC ActiveX Controlwizard MFC App Wizard dll O X New Database Wizard Wwin32 Application in32 Console Application 8 win32 Dynamic Link Library win32 Static Library MIWin32 Figure 3 31 Click File New form the Visual C main menu 48 ActiveDAQ Users Manual 4 Click on the MFC AppWizard exe entry in the list and enter DAQAT in the Project name field Then press the OK button A dialog box is displayed as below MFC AppWizard Step 1 English United States APPWZENU DLL v Figure 3 32 The Visual C MFC AppWizard 5 Select the Dialog based entry and press the Next gt button The MFC AppWizard Step 2 of 4 dialog box is shown as below Leave the default values and press Finish button Figure 3 33 The Visual C MFC AppWizard 6 After completing the MFC Wizard some skeleton code and class are created Chapter 3 Tutorial 49 All class members C boutDlg E E Globals Figure 3 34 The skeleton program after running the Visual C MFC AppWizard 7 Click on the Resource View tab from the Workspace and expand the DAQAI resources as below 50 ActiveDAQ User s Manual E DAQAI resources E Dialog 8 IDD_ABOUTBOX s Figure 3 35 Viewing the DAGAI resources in the workspace 8 Double click on
73. nd a DAQDO control on the form Use the default names 4 Place three TextBox controls and enter txtDiValue txtDoValue and txtDeviceName as their Name properties Chapter 4 Using ActiveDAQ Controls 77 5 Place four CommandButton controls on the form Enter cmdSe lectDevice cmdStartScan cmdStopScan and cmdWrite as their Name properties Then enter Select Device Scan Stop and Write as their Caption properties 6 Place three Label controls on the form Enter Device Digital input and Digital output in their Caption fields Your form should look similar to the one shown below i CU JJ V Figure 4 7 Designing form for waveform digital input digital output example Step 2 Configuring the properties of the DAQDO1 control 1 Enter 255 in the Mask field of the DAQDO1 control in the Properties window 78 ActiveDAQ Users Manual Properties DAQDO1 DAQDO1 DAQDO z DAQDO1 0 No device 1 O OK 3960 255 Figure 4 8 Configuring the properties of the DADDO control Step 3 Developing the code 1 For the Select Device button enter the following code Private Sub cmdSelectDevice_Click DAODevicel SelectDevice txtDeviceName Text DAODevicel DeviceNam End Sub 2 For the Scan button enter the following code Chapter 4 Using ActiveDAQ Controls 79 80 Private Sub cmdStartScan_Click DAQDI1 DeviceNumber DAQDevicel DeviceNumber DAODI1 OpenDevice DAODIl EnableByteScan Tru
74. ne Triggered when the sample count reaches the NumberOfSamples property for noncyclic mode Table A 5 DAQAI Analog Input Control Events Appendix A Properties Methods and Events Reference 99 A 3 Analog Output Control DAQAO A 3 1 Property List Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation Utility DEVINST EXE DeviceName String The device name for the DeviceNumber property ErrorCode Long Used for storing the result of calling any methods If it is completed normally it is equal to zero otherwise nonzero See Appendix B for error code listing ErrorMessage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing Channel Short Specifies the output channel The available output channels are specified in the MaxChannel property NumberOfOutputs Long Specifies number of output data OutputRate Double Specifies output rate in Hz CyclicMode Boolean Specifies cyclic TRUE or noncyclic FALSE DataType Short Specifies the output data type binary 0 or adRaw or real 1 or adReal TransferMode Short Specifies the data transfer mode Software triggering adSoftTrig or 0 Interrupt adINTTrig or 1 and DMA adDMATrig or 2 EventEnabled Short Enable 1 or disable 0 to fire events ExtTrigger Boolean
75. nical Support ccccssscccssscssscotesscccnsascsesesecsseenesssenaeensenee 111 Technical Suppport Offices ene 1v Limited Warranty oeseri e i oea a R EE eA v About This Manual vi Organization of This Manual vi Chapter 1 Introduction to ActiveDAQ Controls 1 1 1 Introduction to ActiveDAO ane nnneenonnne eo onenesonneneco 2 1 2 What is ActiveDAQ ccssscccsssssccssssscccsssscccsssscecessccecess 2 1 3 Installimig ActiveDAQ sivesccccssssnsssenssescevssassenctsvocssvetssosessavessece 3 1 3 1 System Requirements eennnnne 3 1 3 2 Installing the ActiveDAQ files and DLL Drivers 3 1 3 3 Running the Device Installation Utility 12 viii 1 3 4 Uninstalling the ActiveDAQ Controls and DLL Drivers15 ActiveDAQ User s Manual Chapter 2 Building ActiveDAQ Applications With Various Languages 17 2 1 Using Various Development Environments 18 2 2 Developing Visual Basic Applications o ooomommmso 18 2 2 1 Loading ActiveDAQ Controls into the VB Toolbox 18 2 2 2 Configuring Controls with Property Sheets 19 2 2 3 Using ActiveDAQ Controls Methods 20 2 2 5 Using the Object Browser 21 2 2 4 ActiveDAQ Controls Event Routines 21 2 3 Developing Delphi Applications sscsssccssscsssecsssees 22 2 3 1 Loading Activ
76. nitoring for analog input example Figure 4 13 Configuring the properties of the DAQAlarm1 control Figure 4 14 Running the alarm monitoring for analog input example xvi ActiveDAQ User s Manual Tables Table A 1 DAQDevice Control Property List 94 Table A 2 DAQDevice Control Methods eeeeeseeeeseeeeeseeeeeeeeseeeeseeeeaeeaeeaeereneeeees 95 Table A 3a DAQAI Analog Input Control Properties 96 Table A 3b DAQAI Analog Input Control Properties 2 97 Table A 4 DAQAI Analog Input Control Methods 98 Table A 5 DAQAI Analog Input Control Events 99 Table A 6 DAQAO Analog Output Control Properties 100 Table A 7 DAQAO Analog Output Control Methods 101 Table A 8 DAQAO Analog Output Control Events 102 Table A 9 DAQDI Digital Input Control Properties 103 Table A 10 DAQDI Digital Input Control Methods Table A 11 DAQDI Digital Input Control Events 00 ce eeeceeseeceeeeeeeseeeeeeereneeeeeneeneeaees 105 Table A 12 DAQDO Digital Output Control Properties 0 eee eceeeeeeeteeeeeeeeeeeeeeeeees 106 Table A 13 DAQDI Digital Output Control Methods 107 Table A 14 DAQCounter Counter Control Properties 108 Table A 15 DAQCounter Counter Control Methods oooococoncnocnnnncccocnnanannnannrccnncnnon 109 Table A 16 DAQPulse Pulse Output Control Properties
77. nnnnnanccnnocnannos 43 3 3 4 Step 4 Configure AI Control in the Object Inspector 44 3 3 5 Step 5 Writing Code for the ActiveDAQ Controls 44 3 3 6 Step 6 Test Your Program e 45 3 4 ActiveDAQ Tutorial for Visual C Applications 47 3 4 1 Step 1 Add Demo Board With DEVINST EXE 47 3 4 2 Step 2 Load Controls into the VC Toolbar 47 3 4 3 Step 3 Design the form ocoonocnnccnocococononnnoncnonnnnnccnnocnnacnos 54 3 4 4 Step 4 Configure the AI Control s Properties 55 3 4 5 Step 5 Writing Code for the ActiveDAQ Controls 55 3 4 6 Step 6 Testing Your Program 60 x ActiveDAQ User s Manual Chapter 4 Using ActiveDAQ Controls 63 4 1 Using ActiveDAQ Controls cccsccsssscsssssssssssssscssceseees 64 4 1 1 ActiveDAQ Controls and their Operations 64 4 2 Common Properties and Methods sssssssssssssssssees 64 4 2 1 DeviceNumber and DeviceName Properties 64 4 2 2 OpenDevice and CloseDevice Methods 66 4 2 3 ErrorCode and ErrorMessage Properties 66 4 3 Analog Input Control ccccsssscssscssssccsssssssscessessssesceses 67 4 3 1 Single Data Reading ooonconnncnnccconcconncnnnonnnonnnonnccnnocnannos 67 4 3 2 Waveform Data Reading 67 4 3 3 Temperature Measurement ne
78. od to start the operations of pulse output as follows DAOPulsel EnablePulse0ut TRUE When the operations are complete you have to stop and reset it as follows DAOPulsel EnablePulse0ut FALSE DAQPulsel ResetPulse Chapter 4 Using ActiveDAQ Controls 85 4 9 Alarm Control The Alarm Control DAQAlarm performs alarm monitoring for the analog input channel When the input falls outside of the alarm limits 1t will fire events to inform you to handle the alarm The Channel property specifies the channel for alarm monitoring and the ScanTime property sets the rate of alarm checking The HiLimit and LoLimit properties specify the high limit and low limit of the alarm threshold There are two alarm mode options Momentary and Latched 1f the alarm is in Latched mode the alarm will stay on even when the input value returns within limits Setting the RetriggerAlarm property to TRUE can turn OFF an alarm in Latched mode When the alarm is in Momentary mode the alarm will be turned ON when the input value 1s outside of alarm limits and OFF while the input value remains within alarm limits The AlarmMode property specifies the alarm mode After configuring the properties you call the EnableAlarm method with TRUE input to start the alarm monitoring The Value property returns the input value When the input of the monitoring channel gets outside of the alarm limits it will fire events The OnHiAlarm event is triggered when the input get
79. oolean Outputs one bit value to the digital line Data specified by the Port and Bit properties Returns FALSE if successful BitReadBack None Boolean Reads one bit value back from the digital line specified by the Port and Bit properties Returns the value Table A 13 DAQDI Digital Output Control Methods Appendix A Properties Methods and Events Reference 107 A 6 Counter Control DAQCounter A 6 1 Property List Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation Utility DEVINST EXE DeviceName String The device name for the DeviceNumber property ErrorCode Long Used for storing the result of calling any methods If it is completed normally it is equal to zero otherwise nonzero See Appendix B for error code listing ErrorMessage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing Channel Short Specifies the channel to perform event counting or frequency measurement Direction Short Determines whether the counter counts up 0 or down 1 It depends on the hardware PresetValue Long Sets the value of the counter at starting counting CounterValue Long Stores the current value of the counter FrequencyValue Float Stores the current measurement for frequency GateMode Short Specifies t
80. operty sheet of ActiveDAQ s Analog Input Control is in the figure below Figure 2 6 ActiveDAQ Analog Input Control property sheet in Delphi In addition you also can read and set the properties of ActiveDAQ controls at runtime programmatically For example you can set the gain code of a device by setting the property of the ActiveDAQ s analog input control Adainl OverallInputRange 1 2 3 3 Using ActiveDAQ Controls Methods To call a method of an ActiveDAQ control add the name of the method after the name of the control For example you can call the RawInput method of ActiveDAQ s analog input control Reading Adainl RawInput channel Chapter 2 Building ActiveDAQ Applications with Various Languages 23 2 3 4 Developing ActiveDAQ Controls Event Routines The ActiveDAQ controls generate the events in response to some occurrence in the controls To develop the event routine code select Object Inspector from the View menu then select the Event tab It is shown below Object Inspector I Dagan Toana o ooo m Figure 2 7 The Object Inspector s View Tab In the Event tab select the desired event and double click on the empty field next to the event name Delphi generates the event handler routine in the code window that allows you write code for it The following example is the event routine generated for Ac tiveDAQ s Analog Input Control CA Variables Constants A Uses Data OleVariant b
81. orm Enter chkHigh chkNormal and chkNormal in the Name fields Then enter High Normal and Low in the Caption fields Your form should look similar to the one shown below Figure 4 12 Form design for the alarm monitoring for analog input example Chapter 4 Using ActiveDAQ Controls 87 Step 2 Configuring the properties of the DAQAlarm1 control 1 Set the ScanTime property of the DAQAlarm1 control to 500 2 Set the Text property of txtLoLimit control to 4 0 3 Set the Text property of txtHiLimit control to 4 0 Pr es DAQAlarm1 DAQAlarm DAQAlarn z Figure 4 13 Configuring the properties of the DAQAlarm1 control Step 3 Writing the code 1 For the Select Device button write the following code Private Sub cmdSelectDevice Click DAODevicel SelectDevice txtDeviceName Text DAODevicel DeviceName End Sub 88 ActiveDAQ Users Manual 2 For the Start button write the following code Private Sub cmdStart Click chkNormal Value Checked chkHigh Value Unchecked chkLow Value Unchecked DAQAlarml DeviceNumber DAODevicel DeviceNumber DAQAlarml OpenDevice DACAlarml HiLimit Val txtHiLimit Text DAQAlarml LoLimit Val txtLoLimit Text DAQAlarml EnableAlarm True Timerl Enabled True End Sub 3 For the Stop button write the following code Private Sub cmdStop Click Timerl Enabled False DACAlarml EnableAlarm False DACAlarml ResetAlarm DACAlarml Close
82. pplication you must add them to the Component Palette Follow the procedure below to add them 1 Select Import ActiveX Control from the Component menu 2 Scroll down to the ActiveDAQ controls which you can find in the Import ActiveX Controls list 3 Select the controls you want to use in your project and click Install If ActiveDAQ controls are not in the list press the Add button to select the desired controls from the WINDOWS SYSTEM 32 directory The Import ActiveX Control list dialog box is as below antech eDAG Al Cc Version 1 0 Advantech ActiveDAQ Alarm Control Version 1 0 Advantech ActiveDAQ AO Control Version 1 0 Advantech ActiveDAQ Counter Control Version 1 0 Advantech ActiveDAQ Device Control Version 1 0 Advantech ActiveDAQ DI Control Version 1 0 ActiveX C Program Files Borland Delphi4 Imports El DELPHI Lib D ELPHI Bin DELPHI Imports c Figure 2 5 Delphi s Import ActiveX Control dialog box showing ActiveDAQ controls 4 Click the Install button to add the controls into your program 22 ActiveDAQ Users Manual 2 3 2 Using the Object Inspector After you add the ActiveDAQ controls to the Delphi Component Palette select the corresponding icon in the Component Palette and place it on a Delphi form You can then edit or configure its properties in the Delphi Object Inspector To access it select a control and select Properties Window from the View menu For example the pr
83. rite code for it The following example is the event routine generated for ActiveDAQ Analog Input Control lel ES MA Project Form1 Code DAQAM v onTerminated Pr ivate Sub DAQAI1_OnTerminated Figure 2 3 Event routine generated by ActiveDAQ Analog Input Control 2 2 5 Using the Object Browser The VB Object Browser assists you to create Visual Basic code It can display a simple description for the available properties methods and events of ActiveDAQ controls To open the Object Browser select Object Browser from the View menu The result is in the figure below s Object Browser ME E forcan gt El el el classes Members of DAQAI AboutBox O AcquireStart AcquireStatus eP INPUTRANGE MODE AcquireStop E TRAN MODE 9 CloseDevice ES Cyclic Mod eS DataType eS DaughterChannel eS DaughterName eS DeviceName eS DeviceNumber eS ErrorCode eS ErrorMessage eS EventEnabled eS ExtTrigger eS FIFOEnabled eS FIFOSize O GetBufferData z GetinpuiRange eS Index z CyclicMode As Boolean s Member of DAQAILib DAQAI Specified the cyclic mode for transferring ll Mode Figure 2 4 ActiveDAQ in the Visual Basic Object Browser Chapter 2 Building ActiveDAQ Applications with Various Languages 21 2 3 Developing Delphi Applications To use ActiveDAQ controls complete the following procedure 2 3 1 Loading ActiveDAQ into the Component Palette Before using ActiveDAQ controls to build an a
84. rols You simply have to install the DLL driver shipped with the hardware 1t should be higher than DLL Driver version 1 11 Hardware not supported in Advantech ActiveDAQ version 1 0 are e PCL 833 quadratic counter e PCL 1800 watchdog functions e PCI 1760 PWM DI with event extension functions e PCL 1800 for Windows 95 e PCL 816 for Windows 95 Notice About System Performance Software performance may not be able to match the stated level of hardware performance and is affected by the performance of the computer that is being used to run the application In our testing on a computer with an Intel Pentium processor running at 233 MHz with 64 MB RAM memory using the PCL 1800 analog input function with DMA transfer supports a scan rate of up to 60 kHz ActiveDAQ User s Manual Index A ActiveX controls 2 control containers 2 C copyright notice ii customer services iii D DAQAI analog input control 2 events 99 example 69 methods 98 properties 96 property sheet 20 single data reading 67 temperature measurement 69 tutorial 30 waveform data reading 67 DAQAlarm alarm control 2 86 events 113 example 87 methods 113 properties 112 DAQAO analog output control 2 73 events 102 methods 101 properties 100 single point analog output 73 example 74 waveform analog output 73 DAQCounter event counting control 2 81 event counting 81 frequency measurement 82 methods 109 properties 108 DAQDevice dialog box
85. ror code listing ErrorMessage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing Port Short Specifies the digital input port It s 8 bits Refers to the MaxPortNumber property Bit Short Specifies the digital input line or bit MaxPortNumber Short Returns number of the available ports for the specified device ScanTime Double Specifies the scan time for digital input in milliseconds EventTrigCount Long Specifies the count for triggering events Table A 9 DAQDI Digital Input Control Properties Appendix A Properties Methods and Events Reference 103 A 4 2 Methods Name Arguments Returned Description type OpenDevice None Boolean Initializes the device previously specified with the DeviceName property This method must be called before any other methods that perform I O operations CloseDevice None Boolean Resets the device previously used by OpenDevice This method must be called when all I O operations are complete BitInput None Boolean Reads single line data on the digital line specified in the Port and Bit properties Bytelnput None Short Reads eight line data starting from the digital line specified in the Port and Bit properties EnableByteScan IN Boolean Enabled Boolean Enable TRUE or disable FALSE digital waveform scan for byte data EnableBitScan IN Boole
86. s in Momentary mode the alarm will be turned ON when the input value is outside of alarm limits and OFF while the input value remains within alarm limits HiLimit Float Specifies the high limit of the alarm threshold LoLimit Float Specifies the low limit of the alarm threshold Value Float Returns current input value GainCode Short Specifies the gain code RetriggerAlarm Boolean Re trigger the alarm monitoring after the alarm is latched Refers to the AlarmMode property ExtTrigger Boolean Specifies external trigger TRUE or pacer trigger FALSE 112 Table A 18 DAQAlarm Alarm Control Properties ActiveDAQ User s Manual A 8 2 Methods Name Arguments Returned Description type OpenDevice None Boolean Initializes the device previously specified with the DeviceName property This method must be called before any other methods that perform I O operations CloseDevice None Boolean Resets the device previously used by OpenDevice This method must be called when all I O operations are complete EnableAlarm IN Boolean Enabled Boolean Enables TRUE or disables FALSE alarm operation ResetAlarm None Boolean Resets alarm GetlnputRange OUT Short Count Boolean Gets the list of the input range for OUT Variant InputRanges the specified device and returns FALSE if successful A 8 3 Events Table A 19 DAQAlarm Alarm Control Methods Name Arg
87. s higher than the high limit The OnLow Alarm event is triggered when the input goes lower than the low limit The OnHiToNormal event is triggered when the input gets within the limit from high alarm state to normal state The OnLoToNormal event 1s triggered when the input gets within the limit from low alarm state to normal state After the alarm operations are complete you have to call the En ableAlarm method with FALSE input and ResetAlarm to stop and reset the alarm Note The Alarm control performs the alarm check by software instead of firmware It will thus support any devices with analog input features in addition to ADAM modules 86 ActiveDAQ User s Manual 4 9 1 Example Alarm Monitoring for Analog Input Step 1 Designing the form 1 2 Open a new project and form Load the Advantech ActiveDAQ Device Control and Alarm Control from the Project Components menu Place a DAQDevice a DAQAlarm and a Timer control on the form Use the default names Place four TextBox controls and enter txtValue txtLoLimit txtHiLimit and txtDeviceName as their Name properties Place three CommandButton controls on the form Enter cmdSe lectDevice cmdStart and cmdStop as their Name properties Then enter Select Device Start and Stop in the Caption fields Place four Label controls on the form Enter Device Low limit High limit and Input value in the Caption fields Place three CheckBox controls on the f
88. shortcut if you want Select Program Folder Eg Setup will add program icons to the Program Folder listed below You may type a new folder name or select one from the existing Folders list Click Next to continue Program Folders Internet Explorer MFC Samples on CDROM Microsoft ActiveX Control Pad x TARTE E Figure 1 7 Making Shortcuts on Windows Start Menu 8 The ActiveDAQ setup program will now copy the required files to your computer s hard disk drive A progress bar will display the files being copied to your computer The DLL drivers and ActiveDAQ controls that enable communication with your Advantech board will be copied to either the C windows system directory for Windows 95 98 or C winnt system32 directory for Windows NT 4 0 8 ActiveDAQ Users Manual Advantech ActiveDAO Controls Version 1 0 Figure 1 8 Copying Files to Hard Disk Drive 9 When the installation program finishes copying all the program files to your hard disk drive the Setup Complete window will be displayed Click the Finish button to close the installation program Setup Complete Figure 1 9 Installation Program Setup Complete Window Chapter 1 Introduction to ActiveDAQ Controls 9 10 The installation of the ActiveDAQ controls is now finished and the program will close You will notice that the Advantech ActiveDAQ program shortcuts have been copied to your Windows Start menu so that you can easily laun
89. t Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation Utility DEVINST EXE DeviceName String The device name for the DeviceNumber property ErrorCode Long Used for storing the result of calling any methods If it is completed normally it is equal to zero otherwise nonzero See Appendix B for error code listing ErrorMessage String The error message for the ErrorCode property It is OK if successful See Appendix B for error message listing Channel Short Specifies the channel to perform pulse output GateMode Short Specifies the gating mode no gating 0 high level gating 1 low level gating 2 rising edge 3 and falling edge 4 If the mode is with gating the pulse output may be started by separate external hardware input PulsePeriod Float Specifies total period in seconds for AMD Am9513A chip PulseUpCycle Float Specifies the first 1 2 cycle length in seconds for AMD Am9513A Table A 16 DAQPulse Pulse Output Control Properties 110 ActiveDAQ User s Manual A 7 2 Methods Name Arguments Returned Description Type OpenDevice None Boolean Initializes the device previously specified with the DeviceName property This method must be called before any other methods that perform I O operations CloseDevice None Boolean Resets the device previously used by Open
90. t in the EventTrigCount property Then call the EnableEvent method to start the operation When the count reaches the EventTrigCount property the control will fire an event named OnEvent Digital Output Control Use the digital output control DAQDO to perform the digital output operations The digital output lines bits on each data acquisition device are grouped into logical units called ports Each port has eight bits or lines The Port and Bit properties specify the digital output line or lines For example if Port 1 and Bit 3 then the digital input line starts from the eleventh one After you configure the Port and Bit properties then call the BitOutput or ByteOutput methods to perform the digital output operation For the ByteOutput method the Mask property is used to mask some of the digital lines when performing digital output The masked digital lines will not change the states at output The Mask property is bit wise For example if you want to mask bit 3 and bit 5 then set the property to 00101000 which is equal to 40 In addition the Digital Output Control provides the BitReadBack and ByteReadBack methods to read back current states of the digital output lines 4 6 1 Example Waveform Digital Input Digital Output Step 1 Designing the form 1 Open a new project and form 2 Load the Advantech ActiveDAQ Device Control DI Control and DO Control from the Project Components menu 3 Place a DAQDevice a DAQDI a
91. t set the InputRangeList property which is an array type to appropriate values Then set the input range mode InputRangeMode for different input ranges 4 3 1 Single Data Reading The Analog Input Control provides two methods to perform single channel reading Rawlnput and Reallnput The Rawlnput method returns binary values and ReadInput returns voltage data Both of them need a channel parameter to specify the input channel The syntax in Visual Basic is as below Voltage DAQAT1 RealInput channel 4 3 2 Waveform Data Reading To acquire waveform data the Analog Input Control provides single shot non cyclic and continuous acquisitions cyclic You can set the CyclicMode property of the control to TRUE for continuous acquisi tion You can acquire data with the Analog Input Control with one or more channels through the properties StartChannel and StopChannel Another property is DataType which specifies the returned data type binary value or voltage data The NumberOfSamples property speci fies the number of samples acquired in a single shot acquisition or Chapter 4 Using ActiveDAQ Controls 67 68 continuous acquisition The SampleRate property means the sampling rate in Hz for one data item For example if you want to scan two channels in 1 second then the SampleRate has to be 2 Hz The Analog Input Control provides four kinds of waveform data acquisition They are software triggering interrupt triggering DMA triggerin
92. tains the information you need to get started with the ActiveDAQ software package ActiveDAQ allows you to easily perform versatile I O operations through properties methods and events in programs developed with Microsoft Visual Basic Microsoft Visual C Delphi and other ActiveX control container environ ments This manual contains step by step instructions for building applica tions with ActiveDAQ You can modify these sample applications to suit your needs This manual does not show you how to use every control or solve every possible programming problem Specific questions should be directed to Advantech s application engineers To use this manual you should already be familiar with one of the supported programming environments and Windows 95 or Windows NT Organization of This Manual This user manual is divided into the following sections Chapter 1 Introduction to ActiveDAQ Controls introduces the ActiveDAQ ActiveX controls and how they can be used in your applications to get the most out of Advantech s Data Acquisition and Control cards It also explains how ActiveDAQ works with the Device Installation Utility Complete installation instructions for the ActiveDAQ controls and the Device Installation Utility are also included In addition Chapter 1 explains how to use the Device Installation Utility to enable your computer to use Advantech s DA amp C hardware This must be completed before you can write programs using Ac
93. the DAODevice control to select a device and assigns the result to the DAQAI control for analog input operation Private Sub cmdSelectDevice Click DAODevicel SelectDevice txtDeviceNum Text DAODevicel DeviceNumber txtDeviceName Text DAODevicel DeviceName DAQAT1 DeviceNumber DAQDevicel DeviceNumber DAQAT1 DeviceName DAODevicel DeviceName End Sub The dialog box created by the DAQDevice control is as follows Chapter 4 Using ActiveDAQ Controls 65 66 000 Advantech DEMO VO 1H E 001 COM2 E 000 lt ADAM 4011 Address 1 Dec gt 001 lt ADAM 4014D Address 2 Dec gt 002 lt ADAM 4050 Address 3 Dec gt E 003 ADAM 4021 Address 4 Dec gt io 004 lt ADAM 5017 Address 5 Dec Slot 0 gt i 002 PCL 818L O 300H Figure 4 2 Dialog box created by the DAQDevice control A device may contain sub devices If you want to view the sub devices in the dialog box you have to set the GetModuleList property of the DAQDevice control to TRUE In the above dialog box it displays the ADAM modules sub devices for a serial port device with GetModuleList equal to TRUE 4 2 2 OpenDevice and CloseDevice Methods OpenDevice is a common method that initializes the device previously specified by the DeviceNumber property This method must be called before any other methods that perform I O operations CloseDevice is the counterpart method of the OpenDevice method to close the device Note T
94. tiveDAQ Control Event Handler Routine 2 5 Compatibility With Visual Basic Delphi and Visual C 28 The ActiveDAQ controls version 1 0 is compatible with the following languages e Microsoft Visual Basic for Windows 95 98 NT versions 5 0 and 6 0 e Inprise Delphi for Windows 95 98 NT version 4 0 with Service Pack 3 e Microsoft Visual C for Windows 95 98 NT version 5 0 and 6 0 If you are not using one of these development tools consult your development tool reference manual for details on creating applications with ActiveX controls ActiveDAQ Users Manual Co HaldVHOD Tutorial 3 1 ActiveDAQ Introductory Tutorial 3 2 This chapter provides an example to demonstrate how to build an application using ActiveDAQ controls from scratch The example makes use of the Analog Input Control to scan the values from a specified channel Visual Basic Delphi and Visual C are used to build the application and demonstrate the step by step procedure For information about using other controls or other developer tools please refer to Chapter 2 Building ActiveDAQ Controls Applications with Various Languages and Appendix A Properties Methods and Events Reference The sample reads an analog input channel from a virtual device and displays the result on the screen The Advantech DLL driver supports the virtual device named demo board whose first channel generates a simulated sine wave By following this examp
95. tiveDAQ to access your hardware Chapter 2 Building ActiveDAQ Applications with Various Languages briefly explains how to use ActiveDAQ controls in three popular development environments ActiveDAQ User s Manual Chapter 3 Tutorial gives the new user a walk through in creating a simple application in Visual Basic 5 0 that uses ActiveDAQ controls Users of other development tools will also find this section informative in understanding how ActiveDAQ controls can simplify many programming tasks Chapter 4 Using ActiveDAQ Controls gives step by step instruc tions for creating sample applications using the Analog Input Control Analog Output Control Digital Input Control Digital Output Control Counter Control Pulse Output Control and the Alarm Control A comprehensive introduction to the controls properties methods and events is included Appendix A Properties Methonds and Events Reference is a listing of all the properties methods and events that are supported by the ActiveDAQ controls Appendix B Error Messages is a listing of all the error and warning messages that you might see when using or programming the ActiveDAQ controls Appendix C Hardware Support Listing shows the ActiveDAQ methods that are supported by each of Advantech s products Preface vii Contents Copyright Noticia Aa li Acknowledgements senilna etnia ae aa 11 Advantech Customer Services ccccccccccnonincnnnnnnnnananancnnnnnnnononos iii Tech
96. trol on the form Use the default names 4 Place two TextBox on the form and enter txtValue and txtDevice Name as their Name properties 5 Place two CommandButton controls on the form Enter cmdSelect Device and cmdWrite as their Name properties Then enter Select Device and Write as their Caption properties 6 Place two Label controls and enter Device and Output values as their Caption properties 74 ActiveDAQ User s Manual Your form should look similar to the one shown below Figure 4 6 Designing the form for the single analog output example Step 2 Configuring the properties 1 Enter 1 0 in the Text field of the txtValue control in the Properties window Step 3 Developing the code 1 For the Select Device button enter the following code Private Sub cmdSelectDevice_Click DAODevicel SelectDevice txtDeviceName Text DAODevicel DeviceName End Sub 2 For the Write button enter the following code Private Sub cmdWrite Click DAOAO1 DeviceNumber DAODevicel DeviceNumber DAQAO1 OpenDevice DAQAO1 RealOutput Val txtValue DAQAO1 CloseDevice End Sub Chapter 4 Using ActiveDAQ Controls 75 4 5 Step 4 Testing your program 1 Press the Select Device button and choose the device that supports analog output 2 Enter 2 0 in the Output value field 3 Press the Write button to output the value We provide additional examples for the Analog Output Control in the Examples path of the insta
97. tware triggering adSoftTrig or 0 Interrupt adINTTrig or 1 DMA adDMATrig or 2 Dual DMA adDDMATrig or 3 Table A 3a DAQAI Analog Input Control Properties 96 ActiveDAQ User s Manual Name Type Description FIFOEnabled Boolean Enable TRUE or disable FALSE the hardware FIFO interrupt It depends on I O hardware EventEnabled Boolean Enable TRUE or disable FALSE to fire events ExtTrigger Boolean Specifies external trigger TRUE or pacer trigger FALSE DaughterName String The name of the daughter board which is attached on the channel of the card specified by the ThermoDasChannel DaughterChannel Short Specifies the scanned channel on the daughter board ThermoDasChannel Short Specifies the scanned channel on the card ThemoDasGain Short Specifies the gain code of the scanned channel on the card ThermoType Short Specifies the thermocouple type J 0 K 1 S 2 T 3 B 4 R 5 E 6 ThermoScale Short Specifies the temperature unit Celsius 0 Fahrenheit 1 Rankine 2 Kelvin 3 MaxSingleEndedChannel Short Returns number of available analog input channels for single ended mode The available channels of the device depend on the configuration whether singled ended or differential mode It is configured by the Device Installation Utility DEVINST EXE MaxDifferentialChannel Short Returns the number of available analog input channels for dif
98. two TextBox controls on the form Enter txtCounter and txtDeviceName as their Name properties Place three CommandButton controls on the form And enter cmdSelectDevice cmdStart and cmdStop as their Name proper ties Then enter Select Device Start and Stop in their Caption fields Place two Label controls on the form Enter Device and Count in the Caption fields 82 ActiveDAQ User s Manual Your form should look similar to the one shown below Figure 4 10 Form design in the event counting example Step 2 Configuring the properties None Step 3 Developing the code 1 For the Select Device button write the following code Private Sub cmdSelectDevice_Click DAQDevicel SelectDevic 7 txtDeviceName Text DAQDevicel DeviceName End Sub Chapter 4 Using ActiveDAQ Controls 83 2 For the Start button write the following code Private Sub cmdStart_Click DAOCounterl DeviceNumber DAQDevicel DeviceNumber DAQCounterl OpenDevic DAOCounterl EnableCounter Tru Timerl Interval 100 Timerl Enabled True cmdStart Enabled False cmdStop Enabled True End Sub 3 For the Stop button write the following code Private Sub cmdStop Click Timerl Enabled False DAOCounterl EnableCounter False DAOCounterl ResetCounter DAOCounterl CloseDevice cmdStart Enabled True nabled False LJ cmaStop End Sub 4 Write the code of the Timer event to displa
99. ty DeviceGetNumOfList None Short Returns the number of installed devices in the NumOfDevices property DeviceGetFirstList None Boolean Returns the device number device name and number of sub devices for the first device of the installed device list in the DeviceNumber DeviceName NumOfSubDevices properties DeviceGetNextList None Boolean Returns the device number name and number of sub devices for the next device of the installed device list from last retrieving in the DeviceNumber DeviceName NumOfSubDevices properties DeviceGetFirstSubList None Boolean Retrieves the first device number and name of the sub device list for current selected device specified in the DeviceNumber property Puts the results in the SubDeviceNumber and SubDeviceName properties DeviceGetNextSubList None None Retrieves the next device number and name of the sub device list from last retrieving for current selected device specified in the DeviceNumber property and puts the results in the SubDeviceNumber and SubDeviceName properties Table A 2 DAQDevice Control Methods Appendix A Properties Methods and Events Reference 95 A 2 Analog Input Control DAQAI A 2 1 Property List Name Type Description DeviceNumber Long Specifies the Device Number previously defined through configuration using the Device Installation
100. uments Description OnHiAlarm None Triggered when the input gets higher than the high limit OnLoAlarm None Triggered when the input gets lower than the low limit OnHiToNormal None Triggered when the input gets within the limit from high alarm state to normal state OnLoToNormal None Triggered when the input gets within the limit from low alarm state to normal state Table A 20 DAQAlarm Alarm Control Events Appendix A Properties Methods and Events Reference 113 114 ActiveDAQ User s Manual Error Messages APPENDIX B 1 Driver Error Messages This section lists the error codes and error messages returned by these controls Each control contains the properties ErrorCode and ErrorMessage that indicate whether the control s method was performed successfully When ErrorCode is not zero it means that the method performed failed ActiveDAQ will return the correspond ing error message in the property ErrorMessage automatically The error messages can be classified into two categories one is generated from DLL drivers the other one is from ActiveDAQ controls The errors from DLL drivers are listed below The ErrorCode is 32 bit Its format is described in Table B 1 ErrorCode 32 bit Bit 31 28 Bit 27 16 Bit 15 0 serial port used base address occupied Code Table B 1 ErrorCode Format 116 ActiveDAQ User s Manual A summary of the ErrorCode is listed in the following three tables Descr
101. ut the Analog Input Control s advanced features ActiveDAQ Users Manual 4 4 Analog Output Control Use the Analog Output control DAQAO to perform single point analog output or waveform output The Channel property specifies which channel is used to perform the operation 4 4 1 Single Point Analog Output The Analog Output Control provides two methods to perform single point analog output RawOutput and RealOutput The RawOutput method outputs a binary value to the channel specified by the Channel property and RealOutput outputs a voltage data 4 4 2 Waveform Analog Output To perform waveform generation the Analog Output Control pro vides finite non cyclic and continuous mode cyclic generation You can set the CyclicMode property of the control to TRUE for continuous mode The DataType property specifies the output data type binary value or real data The NumberOfOutputs property specifies the number of data for output The OutputRate property means the output rate in Hz The Analog Output Control provides three kinds of waveform generation software triggering interrupt triggering and DMA triggering The TransferMode property specifies the triggering mode Software triggering means to output data based on the software timer Interrupt and DMA triggering use the on board pacer to trigger the output operation and acknowledge the driver through hardware interrupt Note For DMA triggering the NumberOfOutputs property
102. veDAQ controls and or the DLL drivers 2 Using the Device Installation Utility to install and configure the drivers for the hardware that is attached to your computer 1 3 1 System Requirements To use the ActiveDAQ ActiveX controls you must have the follow ing Microsoft Windows 95 98 or Windows NT operating system Personal computer using at least a 33 MHz 80486 or higher microprocessor 66 MHz 80486 or higher microprocessor recom mended VGA resolution or higher video adapter ActiveX control container such as Visual Basic 32 bit version Visual C or Delphi 32 bit version Minimum of 16 MB of memory Minimum of 15 MB of free hard disk space Microsoft compatible mouse 1 3 2 Installing the ActiveDAQ files and DLL Drivers 1 Insert the ActiveDAQ installation CD ROM disc into your computer 2 The installation program should start automatically If auto run is not enabled on your computer use your Windows Explorer or the Windows Run command to execute setup exe on the ActiveDAQ installation CD ROM disc assume qd is the letter of your CD ROM disc drive d setup exe for both Windows 98 95 and NT Chapter 1 Introduction to ActiveDAQ Controls 3 Figure 1 1 Run setup exe from the installation CD ROM disc Follow the instructions in the installation wizard 3 The ActiveDAQ installation program loads HTML Edition Figure 1 2 Loading the ActiveDAQ Setup Program 4 ActiveDAQ Users Manual
103. y data Private Sub Timerl Timer txtCounter Text DAOCounterl CounterValue End Sub Step 4 Testing your program 1 Press the Select Device button and choose the device that supports event counting 2 Press the Start button You will then view the data in the Counter field as follows 84 ActiveDAQ User s Manual 4 8 003001 lt ADAM 4080D Address 4 Dec gt Figure 4 11 Running the event counting example We provide examples for the Counter Control and Pulse Output Control in the Examples path of the installation directory Please refer them for more information about the controls advanced fea tures Pulse Output Control Use the Pulse Output control DAQPulse to perform pulse output operations The Channel property specifies the pulse output channel The programming method depends on the counter timer chip on the board There are two kinds of chips Intel 8254 and AMD Am9513A For the AMD Am9513A chip all counter channels from 0 to 9 can perform the pulse generation with an arbitrary duty cycle The PulsePeriod and PulseUpCycle properties specify the total period and first 1 2 duty cycle The Intel 8254 chip always generates a square wave Hence it does not use the PulseUpCycle property For the GateMode property you can configure it with gating mode Then the pulse output operation is started by separate external hardware input After configuring the properties you call the EnablePulseOut meth

Download Pdf Manuals

image

Related Search

Related Contents

BPNONF  Guide d`application du PowerRouter Informations  3 - 2 積雪に対する仕様について  Guia do Usuário  GOD80E取扱説明書  Brodit ProClip 512529  HP Laserjet Pro 200 Color MFP User Guide - PTWW  NEC N8406-022 User's Manual  Italian CMS part 1 - Linfo  User Manual - Schulz Electronic GmbH  

Copyright © All rights reserved.
Failed to retrieve file