Home

PCI-1202/1602/180x Software Manual

image

Contents

1. PCI 1602 Configuration Code Table Analog Input ui Configuration Bipol i n 10V i Bu ee Bipolar 1 25V 3 US 1 4 Priority Thread s Priority Setting Table Setting Define 2 THREAD_PRIORITY_LOWEST 1 THREAD_PRIORITY_BELOW_ NORMAL 0 Defual THREAD_PRIORITY_NORMAL 1 THREAD_PRIORITY_ABOVE_NORMAL 2 THREAD_PRIORITY_HIGHEST 15 THREAD_PRIORITY_TIME_CRITICAL Others THREAD_PRIORITY_NORMAL Version 2 05 Date Jan 8 2007 Page 10 PCI 1202 Software Manual 2 Description of Functions The following list divides functions in the PCI 1202 DLL into 9 categories Testing function Plag amp Play function DIO function DA function AD funciton MagicScan function M_Function Continuous Capture function Batch Capture function In Section 1 1 the functions in each category are already listed in a table This section will explain functions more detail about function syntax parameters error code and the related DEMO Version 2 05 Date Jan 8 2007 Page 11 PCI 1202 Software Manual 2 1 The Testing Functions 2 1 0 P1202 FloatSub2 Calculate C A B in float format float 4 bytes floating point number This function is provided for testing DLL linkage e Syntax float P1202_FloatSub2 float fA float fB e Parameters Input 4 bytes floating point value Input 4 bytes floating point value e Return Return fA fB e Demo DEMO1 C 2 1 1 P1202 ShortSub2 Calculate C A B in SHORT format SHO
2. gt High alarm 2 Low alarm Buff lt Low alarm 3 In alarm Low lt Buff lt High 4 Out alarm Out range Example P1202 AddToScan 0 0 1 0 O 0 wAdChannel 0 gt Add channel 0 to scan wConfig 0 gt Set AD range is 5V 5V wAverage 1 gt No Average wLowAlarm 0 gt No LowAlarm wHighAlarm 0 gt No HighAlarm wAlarmType 0 gt Close Alarm e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO11 C Version 2 05 Date Jan 8 2007 Page 32 PCI 1202 Software Manual 2 6 8 P1202 SaveScan This subroutine specifies the starting address of AD data buffer for MagicScan it should be set before MagicScan start e Syntax Void P1202_SaveScan WORD wAdChannel WORD wBuf e Parameters Input Scan number in the scan queue Note not the A D channel number Example The first scan channel may be any channel But the wAdChannel must be 0 in this subroutine because the wAdChannel number is according to the scanning order wBut Output Starting address of AD data buffer for channel specified in wAdChannel Example WORD wVO0 100000 AD ch 0 buffer WORD wV2 100000 AD ch 2 buffer wRetVal P1202 ClearScan i For PCI 1202 wRetVal P1202_AddToScan 0 0 1 0 0 0 add CH 0 to scan wRetVal P1202_SaveScan 0 wV0 CHO is the first join channel for scan so the scanning order is 0 Save the data of scanning channel that order is O to wVO wRetVal P1202_AddToScan 4
3. O No Error Others Please refer to section 1 2 e Demo DEMO20 C Version 2 05 Date Jan 8 2007 Page 49 PCI 1202 Software Manual 2 10 The Continuous Capture 2 10 0 Introduction Continuous Capture Flow Diagram PCI 1202 P1202 Card0_StartScan Start MagicScan P1202_Card1_StartScan P1202 _Card0_ReadStatus Get state and data P1202 _Card1_ReadStatus P1202 _Card0_Stop P1202_Card1_Stop Controller Version 2 05 Date Jan 8 2007 User s Buffer wBuf wBuf2 Page 50 PCI 1202 Software Manual 2 10 1 P1202 Card0O StartScan This subroutine will start the channel scan and continuous capture function on the first board It is recommended to get ADs for long time and low sampling rate Otherwise the chance of FIFO overflow could be increased The sampling rate under 40KHz is recommended Please refer to PCI 1202 1602 180x Hardware User Manual for more information e Syntax WORD P1202_Card0_StartScan WORD wSampleRateDiv WORD wChannelStatus WORD wChanelConfig WORD wCycles e Parameters WSampleRateDiV Input AD sampling rate 8M wSampleRatediv Ex wSampleRateDiv 800 sampling rate 8M 800 10K Inout O no scan 1 scan for each channel Example1 wChannelStatus 0 1 gt Scan Channel 0 wChannelStatus 0 0 gt No scan Channel 0 wChannelStatus 2 1 gt Scan Channel 2 WchannelContigl Input configuration code for each channel Example
4. PCI 1202 Software Manual 2 11 The Other Functions 2 11 0 P1202 DelayUs This is a machine independent timer This function is used to delay a settling time or used as a general purposed machine independent timer This function will refer to the current active PCI 1202 board Use the P1202 _ActiveBoard to select the active board e Syntax WORD P1202_DelayUs WORD wDelayUs e Parameter number of us to delay 8191 Max 1 gt delay 1 us 1000 gt delay 1000 us 1 ms 8191 gt delay 8191 us 8 191 ms maximum delay 8192 gt invalidate delay will return error e Return O No Error Others Please refer to section 1 2 e Demo DEMO1 C e Long Time Delay WORD DelayMs WORD wDelayMs maximum delay 4294967 295 sec WORD wDelay wRetVal wRetVal 0 for wDelay 0 wDelay lt wDelayMs wDelay wRetVal P1202_DelayUs 1000 return WRetVal Version 2 05 Date Jan 8 2007 Page 57 PCI 1202 Software Manual 3 Appendix xX Notei MagicScan controller This is a mechanism of hardware channel scan The scan channel sequence and config need be preset When the scan start the MagicScan Controller will switch channel and config according to the channel sequence automatically and get data into FIFO At the same time the driver will translate data in FIFO to the Buffer The only thing that user need to do is using function to get data from Buffer The advantage of this mechanism is improvi
5. e Parameter IBO Output how many A D data has been acquired e Return O No Error Others Please refer section 1 2 e Demo DEMO21 C Version 2 05 Date Jan 8 2007 Page 46 PCI 1202 Software Manual 2 9 Multi board Batch Capture two boards operating simultaneously 2 9 0 P1202 FunA_Start When there are two boards installed on a PC using this subroutine to start the batch capture from the two boards simultaneously and store data into memory Please refer to section 2 9 0 for more information e Syntax WORD P1202_FunA_Start WORD wClockDiv0 WORD wChannelOj WORD wConfigO WORD Buffer0 DWORD dwMaxCount0 WORD wClockDiv1 WORD wChannel1 WORD wConfig1 WORD Buffer1 DWORD dwMaxCount1 Short nPriority e Parameters WCIGERDIVG Input AD sampling rate devisor for the first board The sampling rate is 8M wClockDivO WChannel0 Input O no scan 1 scan For each channel of the first board Example1 wChannel0 0 1 gt Scan Channel 0 for the first board wChannel0 0 0 gt No scan Channel 0 for the first board wChannel0 2 1 gt Scan Channel 2 for the first board WGGRIGON Input configuration code for each channel of the first board Please refer to section 1 3 BuferO Output Buffer to store the A D data of the first board dwMaxCount0 Input To specify the data length of the first board Input The AD sampling rate devisor for the 2nd board The sampling rate is 8M wClockDiv1 WChannelM
6. 8 0 InTOdUCION iia riali sani A E E 43 2 8 1 P1202 EMB e A es 44 2 8 2 P1202 IFunB Rea dStalUS clic Ble ee hl Be 45 2 8 3 P1202 FunB Stopias inza ii ii te aaron 46 2 8 4 2 71011 3 a gt RO Pa re aT meen ae 46 2 9 MULTI BOARD BATCHCAPTURE 47 2 9 0 P1202 RUNA Stats ico Ad 47 2 9 1 P1202 FunA ReadStalUs iii iaia 48 2 9 2 P1202FUNA SODA A A AAA AA 48 A A rione dii cirie deli era erede ae 49 2 10 THE CONTINUOUS CAPTURE neee 50 2 10 0 Introduetioni t ricoratoia teli aaa ee ela 50 2 01 P 1202 Gard0 StartScan riali aaa ilada 51 2 10 2 P1202 Card0 ReadStatus iii 52 2037 PALO CAOS Una in 53 2 10 4 P 1202 Gardi StartScani robi aden vecebaavetlesselvthebeiyctest va vigebasseidesieeveces ats 54 2 10 5 P1202 Cardi ReadStatus i 55 Pio POC e ai 56 2 11 THE OTHER PUNCTION Secs tirreno Tae 57 ZLO P202 DelayUS arista ida 57 3 APPENDIX Osio Version 2 05 Date Jan 8 2007 Page 3 PCI 1202 Software Manual 1 Introduction PCI 1202 1602 180x Development Toolkit provides DLL Dynamic Link Library and simple DEMOs Those DEMOs will show you how easy to use DLL to complete the I O process without facing complex hardware This document introduces PCI 1202 PCI 1602 and PCI 180x series functions in the DLL It is intended to be a companion to know functions using the special functions Continuous Capture MagicScan programming and error code information
7. Controller keeps getting data after this function called When the external trigger arrives the Magic Controller will stop getting data and return the last wNumCycles data The user can use P1202 ReadScanStatus to check status and use P1202_StopMagicScan to force MagicScan to terminate Syntax Start End t WORD P1202_StartScanPreTrg WORD wSampleRateDiv WORD wNumCycles SHORT nPriority e Parameters WSampleRateDiV Input AD sampling rate 8M wSampleRateDiv wSampleRateDiv 80 3 sampling rate 8M 80 100K Input number of A D data for each scan channel Total data number wNumCycles number of scan channel Input Set thread s priority Please refer to section 1 4 e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO24 C Version 2 05 Date Jan 8 2007 Page 27 PCI 1202 Software Manual 2 6 5 P1202_StartScanMiddleTrg The Magic Controller keeps getting data When the external trigger arrives the Magic Controller still gets N2 data and return the last wNum N2 data that before external trigger and N2 data that after the trigger So the total AD data returned is wNum data per channel The user can use P1202 ReadScanStatus to check status and use P1202_StopMagicScan to force MagicScan to terminate External migaer signal CHa x A DO dwNum O Start End e Syntax WORD P1202_StartScanMiddleTrg WORD wSampleRateDiv WORD wNum WORD wN2 SHORT nPriority
8. P1202_ActiveBoard to set the active board e Syntax WORD P1202_SetChannelConfig WORD wChannel WORD wConfig e Parameters Input AD channel number Input Configuration code Refer to Section 1 3 Configuration Table e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO1 C 2 5 2 P1202 AdPolling This function will perform a single A D conversion by software polling The P1202 SetChannelConfig function is used to change the active channel and configuration code that the P1202_AdPolling function using This function will refer to the current active PCI 1202 board Use the P1202 ActiveBoard to set the active board e Syntax WORD P1202_AdPolling float fAdVal e Parameter MAGIA Output address of fAdVal which store the AD data this data is automatically computed from hexadecimal to float based on the setting of P1202 _SetChannelConfig e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO1 C Version 2 05 Date Jan 8 2007 Page 20 PCI 1202 Software Manual 2 5 3 P1202 AdsPolling This subroutine will perform multiple AD conversions by polling The P1202 SetChannelConfig subroutine can be used to change channel or configuration code and the P1202_AdsPolling will refer to that setting in later operation This function will refer to the current active PCI 1202 board Use the P1202 ActiveBoard to select the active board e Syntax WOR
9. SaveScan WORD wAdChannel WORD wBuf Void P1202_WaitMagicScanFinish WORD wStatus DWORD dwLowAlarm DWORD dwHighAlarm WORD P1202_StopMagicScan WORD P1202_M_FUN_1 WORD wDaNumber WORD wDaWave float fDaAmplitude WORD wAdSampleRateDiv WORD wAdNumber WORD wAdConfig float fAdBuf float fLowAlarm float HighAlarm WORD P1202_M_FUN_2 WORD wDaNumber WORD wDaWave WORD wDaBuf WORD wAdSampleRateDiv WORD wAdNumber WORD wAdConfig WORD wAdBuf WORD P1202 M_FUN_3 WORD wDaNumber WORD wDaWave float fDaAmplitude WORD wAdSampleRateDiv WORD wAdNumber WORD wChannelStatus WORD wAdConfig float fAdBuf float fLowAlarm float fHighAlarm WORD P1202 M_ FUN 4 WORD wType WORD wDaNumber WORD wDaWave float fDaAmplitude WORD wAdSampleRateDiv WORD wAdNumber WORD wChannelStatus WORD wAdConfig float fAdBuf float fLowAlarm float fHighAlarm Version 2 05 Date Jan 8 2007 Page 6 PCI 1202 Software Manual Category Functions Define WORD P1202 Cardo StartScan WORD wSampleRate WORD wChannelStatus WORD wChannelConfig WORD wCount WORD P1202_Card0_ReadStatus WORD wBuf WORD wBuf2 DWORD dwP1 DWORD dwP2 WORD wStatus Void P1202_Card0_Stop Void Continuous WORD P1202_Card1_StartScan WORD wSampleRate Captu re WORD wChannelStatus WORD wChannelConfig WORD wCount WORD P1202_Card1_ReadStatus WORD wBuf WORD wBuf2 DWORD dwP1 DWORD dwP2 WORD wStatus Void P
10. e Parameters WSampleRateDiV Input AD sampling rate 8M wSampleRateDiv wSampleRateDiv 80 gt sampling rate 8M 80 100K Input Total data per channel Input Number of data after external trigger arrives per channel Input Set Thread s Priority gt Please refer to section 1 4 e Return O No Error Others Please refer to section 1 2 e Demo DEMO25 C Version 2 05 Date Jan 8 2007 Page 28 PCI 1202 Software Manual 2 6 6 P1202 ReadScanStatus This subroutine will read the status of the MagicScan Pre trigger Post trigger and Mid trigger operation The status should be checked continually to make sure the scan is complete If getting a status 0x80 the scan is complete and the data in buffer are ready This function will refer to the current active PCI 1202 board Use the P1202 ActiveBoard to select the active board e Syntax Void P1202_ReadScanStatus WORD wStatus DWORD dwLowAlarm DWORD dwHighAlarm e Parameters Output address of wStatus which store status Table 2 8 6 1 wStatus Value Table wStatus Value HEX Status Description 0x00 initial MagicScan Initial Status Idle 0x01 start MagicScan Running 0x02 time outi MagicScan stage 1 controller TimeOut 0x04 time out2 MagicScan stage 2 controller TimeOut 0x08 overflow MagicScan FIFO overflow 0x80 OK MagicScan Complete Please refer to Note 2 in section 3 Output address of wLowAlarm which store the MagicScan alarm statu
11. setto 14 2 2 0 P 1202 Driverinit rn daranno ia 14 2 2 1 P1202 DriverGlosesa tara liacle abile 14 2 2 2 P1202_GetConfigAddressSpace i 15 2 2 3 P 1 202 WhichBoardActive vii lai a 15 2 2 4 P1202 ACtIVEBOaMd ti o e foso tones Gee ae 16 23 TRE DIO FUNCTIONS pnt tina rn tres 17 2 3 0 AIR aan lea 17 2 3 1 PI 202 IDO iis reni ad 17 24 AE DA FUNCTIONS erat alc 18 2 4 0 PILLO DA araldici ai einer a i i 18 257 FPHEAD FUNCTIONS esna ia ataa e V apei 19 2 5 0 MroducHOn sereins dada lie ea ili 19 2 5 1 P1202 SetChannelConfig ioniene enn aiaa in ea 20 2 5 2 PI202 AQP Ol OT esi e e 20 2 5 3 P1202 AdsPolliig nor ela E 21 2 5 4 P1202 AdsPacer ismael 22 2 6 THE MAGIOSCAN asa asi 23 2 6 0 Introducir dida 23 2 6 1 P1202 CO ASC Li ieee ik ue 24 2 6 2 P1202 StartScan afauii lella lalla 25 2 6 3 P1202_StartScanPostTrg i 26 2 6 4 P 1202 StartScanPreTrgi o cela nia Lia 27 Version 2 05 Date Jan 8 2007 Page 2 PCI 1202 Software Manual 2 6 5 P1202_StartScanMiddleTrg i 28 2 6 6 P1202 ReadScanStatUs iii 29 2 6 7 P1202 AddTosScani i ri lisci iaia tai 31 2 6 8 P1202 SAVE aida 33 2 6 9 P1202_WaitMagicScanFinish nan conc cnn rra rr 34 2 6 10 P1202 StopMagicScan iii 36 2 7 THEM FUNCTION Savater as oca 37 2 7 0 INTOdUCIO Notas 37 2 7 1 O A O air 38 NN A a A eae bt 40 ST O E ire ele 41 2 8 THE SINGLE BOARD BATCH CAPTURE 43 2
12. 0 1 0 0 0 Join CH4 to the scan queue wRetVal P1202_SaveScan 1 wV2 Note The 1 means the scanning order is second not physical channel Il CH4 is the second channel added into scan queue so the scanning order is 1 Save the data of scanning channel that order is 1 to wV2 wSampleRateDiv 80 Sampling rate 8M 80 100k P1202_StartScan wSampleRateDiv DATALENGTH nPriority Start scan e Return O No Error Others Please refer to section 1 2 e Demo DEMO11 C Version 2 05 Date Jan 8 2007 Page 33 PCI 1202 Software Manual 2 6 9 P1202 WaitMagicScanFinish This subroutine will wait until the MagicScan operation is finished This function will refer to the current active PCI 1202 board Use the P1202 ActiveBoard to select the active board e Syntax Void P1202 _WaitMagicScanFinish WORD wStatus DWORD dwLowAlarm DWORD dwHighAlarm e Parameters wStatus Output address of wStatus which store the MagicScan status Table 2 8 6 1 wStatus Status Table wStatus Value HEX Status Describe 0x00 initial MagicScan Initial Status Idle 0x01 start MagicScan Running 0x02 time out MagicScan stage 1 controller TimeOur 0x04 time out2 MagicScan stage 2 controller TimeOut 0x08 overflow MagicScan FIFO overflow PS 0x80 OK MagicScan Complete Note Please refer to Note 2 in Section 3 Output address of wLowAlarm which store the MagicScan alarm status Output address of wHighAlarm which st
13. 1202_Card1_Stop Void WORD P1202_FunA_Start WORD wClock0Div WORD wChannel0 WORD wConfigO WORD Buffer0 DWORD dwMaxCount0 WORD wClock1Div WORD wChannel1 WORD wConfig1 WORD Buffer1 DWORD dwMaxCount1 SHORT nPriority WORD P1202 FunA_ReadStatus Void WORD P1202 FunA_Stop Void WORD P1202_FunA_Get DWORD PO DWORD P1 Batch WORD P1202 FunB_Start WORD wClockODiv WORD wChannel0 Capture WORD wConfigo WORD Buffer0 DWORD dwMaxCount0 SHORT nPriority WORD P1202 FunB_ReadStatus Void WORD P1202 FunB_Stop Void WORD P1202 FunB_Get DWORD PO Version 2 05 Date Jan 8 2007 Page 7 PCI 1202 Software Manual 1 2 Error Code Define Error Code Define Table Return Value 0 1 25 Define NoError DriverHandleError DriverCallError AdControllerError M_FunExecError ConfigCodeError HighAlarm LowAlarm AdPollingTimeOut AlarmTypeError FindBoardError AdChannelError DaChannelError InvalidateDelay DelayTimeOut InvalidateData FifoOverflow TimeOut ExceedBoardNumber NotFoundBoard FindT woBoardError ThreadCreateError StopError AllocateMemoryError Describe No error Invalid VxD SYS handle Note 1 Call VxD SYS error Note 1 A D controller error May be hardware error please contact agent M_Functions Error A D config error fAdBuf gt fHighAlarm fAdBuf lt fLowAlarm AdPolling TimeOut Note1 Alarm type error Found board error Invalid A D channel Invalid D A chan
14. D P1202_AdsPolling float fAdVal WORD wNum e Parameters Output starting address of AD data buffer these data will be automatically computed from hexadecimal to float based on the setting of P1202_SetChannelConfig Input number of AD conversions will be performed e Return O No Error Others Please refer to section 1 2 e Demo DEMO1 C Version 2 05 Date Jan 8 2007 Page 21 PCI 1202 Software Manual 2 5 4 P1202 AdsPacer This subroutine will perform multiple AD conversions by pacer trigger The P1202 SetChannelConfig subroutine can be used to change channel or configuration code and the P1202_AdsPacer will refer to that condition in later operation The hardware pacer 8254 Timer will generate trigger signals to AD converter periodically So these AD data can be used to reconstruct the waveform of analog input P1202 AdsPolling get ADs by pure software so the AD conversion operation may be interrupted by system OS It is recommended to use P1202_AdsPacer if the input wave form reconstruction is needed This function will refer to the current active PCI 1202 board Use the P1202 ActiveBoard to select the active board e Syntax WORD P1202_AdsPacer float fAdVal WORD wNum WORD wSampleDiv e Parameters RAVEN Output starting address of AD data buffer 16 bits these data will be automatically computed based on the setting of P1602_SetChannelConfig Input number of AD conversions will be pe
15. P1202 Cardo Stop This subroutine will stop the continuous capture function on first board e Syntax Void P1202 _Card0_Stop Void e Parameter Void e Return O No Error Others Please refer to section 1 2 e Demo DEMO13 C Version 2 05 Date Jan 8 2007 Page 53 PCI 1202 Software Manual 2 10 4 P1202 Card1 StartScan This subroutine will start the channel scan and continuous capture function on the second board It is recommended using for long time and low sampling rate ADs Otherwise the chance of FIFO overflow could be increased The sampling rate less than 40KHz is recommended Please refer to PCI 1202 1602 180x Hardware User Manual for more information e Syntax WORD P1202_Card1_StartScan WORD wSampleRateDiv WORD wChannelStatus WORD wChanelConfig WORD wCount e Parameters Input AD sampling rate 8M wSampleRateDiv Ex wSampleRate 800 3 sampling rate 8M 800 10K Input 0 no scan 1 scan for each channel Example1 wChannelStatus 0 1 gt Scan Channel 0 wChannelStatus 0 0 gt No scan Channel 0 wChannelStatus 2 1 gt Scan Channel 2 WwchannelContigl Input configuration code for each channel Ex wChannelConfig 1 0 Set 0 as the configuration of channel WCYEIES nput number of A D data for each scan channel Total data number wCycles number of scan channel e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO14 C V
16. PCI 1202 Software Manual PCI 1202 1602 180x Software Manual for Windows 98 NT 2K XP Warranty All products manufactured by ICP DAS are warranted against defective materials for a period of one year from the date of delivery to the original purchaser Warning ICP DAS assumes no liability for damage consequent to the use of this product ICP DAS reserves the right to change this manual at any time without notice The information furnished by ICP DAS is believed to be accurate and reliable However no responsibility is assumed by ICP DAS for its use nor for any infringements of patents or other rights of third parties resulting from its use Copyright Copyright 1998 by ICP DAS All rights are reserved Trademark The names used for identification only may be registered trademarks of their respective companies Version 2 05 Date Jan 8 2007 Page 1 PCI 1202 Software Manual Table of Contents 1 INTRODUCTION M norreno nananana nani nane 4 deli FUNCTION DEFINE dicon iaia niico sirene 5 2 ERROR GODE DEFINE spiare aeeoe i sei 8 1 3 SCONFIGURATIONICODE ille liana 9 4 PRIORITY lcd 10 2 DESCRIPTION OF FUNCTIONS 11 2 1 THE TESTING FUNCTIONS stiro e aes use 12 2 1 0 P1202 FloatSUb2 iorala erariale ian 12 2 1 1 P 1202 gt ShonSUb2 liti ana air de 12 2 1 2 P1202 GetDilVersioni 0 cari A A hs es SLAG 13 2 1 3 P1202 GetDriverVersiOne cesta A elie ti ee Been 13 2 2 THEDRNVERFUNCHONS
17. RT 16 bits signed number This function is provided for testing DLL linkage e Syntax short P1202_ShortSub2 Short nA Short nB e Parameters Input 16 bits value Input 16 bits value e Return Return nA nB e Demo DEMO1 C Version 2 05 Date Jan 8 2007 Page 12 PCI 1202 Software Manual 2 1 2 P1202 GetDllVersion Read the DLL version number of P1202 DLL e Syntax WORD P1202_GetDlIVersion Void e Parameter Void e Return Return DLL version number Ex return 0x200 the DLL version is 2 0 e Demo DEMO1 C 2 1 3 P1202 GetDriverVersion This subroutine will read the driver version number of Nappci VxD in Windows 95 98 or Napwnt SYS in Windows NT e Syntax WORD P1202_GetDriverVersion WORD wDriverVersion e Parameter output wDriverVersion address of wDriverVersion Ex wDriverVersion 0x200 the driver version is 2 0 e Return O No Error Others Please refer to sec 1 2 e Demo DEMO1 C Version 2 05 Date Jan 8 2007 Page 13 PCI 1202 Software Manual 2 2 The Driver Functions 2 2 0 P1202 Driverlnit Allocate resources needed from system and return the total board number in the system This function must be called once before using the I O functions e Syntax WORD P1202_Driverlnit WORD wTotalBoard e Parameter Output wTotalBoard address of wTotalBoard wTotalBoard 1 gt one PCI 1202 card in the system wTotalBoard n gt n PCI 1202 cards in the system e Retur
18. These DLL can perform a variety of data acquisition operation as follows Testing function Plag amp Play function DIO function DA function AD funciton MagicScan function M_Function Continuous Capture function Batch Capture function OMONDAOAR WD Section 1 1 Functions categories and define Section 1 2 Error code define Section 1 3 The list of Configuration code that can control amplifier signal Section 1 4 The list of thread priority setting With the priority setting you can get higher thread priority in the OS Version 2 05 Date Jan 8 2007 Page 4 PCI 1202 Software Manual 1 1 Function Define When you read the function manual please notice the KeyWORD for variables KeyWORD Set otare call Set after call functions and return functions value Input Yes Na Output No vis The functions in the PCI 1202 DLL are divided into 9 categories The red WORD P1202 of functions name could be replaced with P1602 or P180x to use the functions which have the same purpose defined in P1602 or P180x DLL Example P1202 ClearScan Void 3 P1602 ClearScan Void or P180x_ClearScan Void Category Test Driver Digital I O D A A D Version 2 05 Functions Define float short WORD WORD WORD Void WORD WORD WORD WORD WORD WORD WORD WORD WORD WORD P1202_FloatSub2 float fA float fB P1202 ShortSub2 short nA sho
19. an 8 2007 Page 39 PCI 1202 Software Manual 2 7 2 P1202 M FUN 2 The P1202_M_FUN_ 2 usage like P1202 _M_FUN_ 1 but it will not compute the waveform image automatically Users must set each DA value of the output wave form lt can output the user defined waveform from DA channel 0 and get data from AD Channel 0 at the same time Please refer to PCI 1202 1602 1800 1802 Hardware manual for more information e Syntax WORD P1202 M_FUN 2 WORD wDaNumber WORD wDaWave WORD wDaBuf WORD wAdSampleRateDiv WORD wAdNumber WORD wAdConfig WORD wAdBuf e Parameters Input number of D A samples in one waveform Please refer to Example 1 in the P1202 M_FUN_1 wDaWave Input Number of DA waveform to be output Please refer to Example 2 in the P1202_M_FUN_1 Output The array stores the D A waveform image Input AD sampling rate 8000000 wAdSampleRateDiv samples sec Input Number of AD data to be read Input A D input range configuration code Please refer to section 1 3 wAdBu Output the starting address of fAdBuf which store the A D data e Return O No Error Others Please refer to section 1 2 e Demo DEMO7 C Version 2 05 Date Jan 8 2007 Page 40 PCI 1202 Software Manual 2 7 3 P1202 M FUN 3 This subroutine output sine wave from DA channel 0 according to the parameters wDaNumber and fDaAmplitude By the wDaWave the number of DA waveform output is programmable It can o
20. ctiveBoard This function sets one of the PCI 1202 boards active This function must be called once before the D I O A D D A functions e Syntax WORD P1202_ActiveBoard WORD wBoardNo e Parameter wBoardNo Input board number Start from 0 e Return 0 No Error Others Please refer to sec 1 2 e Demo All DEMO programs e Reference The P1202_ActiveBoard will take effect on all functions except the following P1202_FloatSub2 P1202 ShortSub2 P1202 GetDriverVersion P1202 Drivelnit P1202 DriveClose P1202 GetConfigAddressSpace P1202 Card0_StartScan P1202 Card0 ReadData P1202 _Card0_ Stop P1202 Card1_StartScan P1202 Cardi ReadData P1202 _Cardi_ Stop Version 2 05 Date Jan 8 2007 Page 16 PCI 1202 Software Manual 2 3 The DIO Functions 2 3 0 P1202 Di This subroutine will read the 16 bits data from DI port This function will refer to the current active PCI 1202 Use the P1202 ActiveBoard to set the active board e Syntax WORD P1202_Di WORD wDi e Parameter Output address of wDi which store the 16 bits DI data e Return O No Error Others Please refer to sec 1 2 e Demo DEMO1 C 2 3 1 P1202 Do This subroutine will send the 16 bits data to DO port This function will refer to the current active PCI 1202 board Use the P1202_ActiveBoard to set the active board e Syntax WORD P1202_Do WORD wDo e Parameter Input the 16 bits data sent to DO port e Re
21. ersion 2 05 Date Jan 8 2007 Page 54 PCI 1202 Software Manual 2 10 5 P1202 Card1 ReadStatus This subroutine will read the status of the Continuous Capture on the second board It only checks the status of continuous capture without stops the operation When the data ready the return value will be 0 Users can continue capturing data in a loop until stop the capturing process This function will refer to the current active PCI 1202 board Use the P1202_ActiveBoard to select the active board e Syntax P1202 Card1_ReadStatus WORD wBuf WORD wBuf2 DWORD dwP1 DWORD dwP2 WORD wStatus e Parameters WBU Output store data by scan order 012 N012 N 012 N The data sequence in the wBuf is as follows EBA Output store data by channel sequence 00000 11111 22222 NNNNN The data sequence in the wBuf2 is as follows Input Output reserved Input Output reserved Output 1 thread start 2 TimeOut 8 FIFO overflow 0x80 thread finish 5 buffer full Return Ready No data FIFO overflow Thread time out Buffer Full emo DEMO14 C of ono Version 2 05 Date Jan 8 2007 Page 55 PCI 1202 Software Manual 2 10 6 P1202 Cardi Stop This subroutine will stop the continuous capture function of the 2nd board e Syntax Void P1202_Card1_Stop Void e Parameter Void e Return Void e Demo DEMO14 C Version 2 05 Date Jan 8 2007 Page 56
22. l Input 0 no scan 1 scan For each channel of the 2nd board Example wChannel1 0 1 gt Scan Channel 0 for the 2nd board wChannel1 0 0 gt No scan Channel 0 for the 2nd board wChannel1 2 1 gt Scan Channel 2 for the 2nd board WGS Configuration code for each channel of the 2nd board Please refer to section 1 3 Version 2 05 Date Jan 8 2007 Page 47 PCI 1202 Software Manual Output Buffer to store the A D data of the 2nd board Input To specify the data length of the 2nd board Input To set the thread s priority Please refer to section 1 4 e Return O No Error Others Please refer to section 1 2 e Demo Program DEMO20 C 2 9 1 P1202 FunA ReadStatus This subroutine will read the status of Fun_A batch capture e Syntax WORD P1202_FunA_ReadStatus Void e Parameter Void e Return 0 data is ready 1 data not ready e Demo DEMO20 C 2 9 2 P1202 FunA_Stop This subroutine will stop the batch capture function e Syntax WORD P1202_FunA_Stop Void e Parameter Void e Return Void e Demo DEMO20 C Version 2 05 Date Jan 8 2007 Page 48 PCI 1202 Software Manual 2 9 3 P1202 FunA Get This function will retrieve the number A D samples acquired e Syntax WORD P1202_FunA_Get DWORD P0 DWORD P1 e Parameters P0 Output how many A D data has been acquired for the first board P1 Output how many A D data has been acquired for the 2nd board e Return
23. l Input Configuration code for each channel Refer to Section 3 1 Configuration Table Output Buffer to store the A D data Input the data length to get in each getting data process If the getting data thread gets dwMaxCount0 data the status that P1202_FunB_ReadStatus returned is 0 at this time users can copy data from BufferO then start the next getting process nPriority Input To set the thread s priority Please refer to section 1 4 e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO21 C Version 2 05 Date Jan 8 2007 Page 44 PCI 1202 Software Manual 2 8 2 P1202 FunB ReadStatus This function returns the status of Fun_B batch capture If the getting data thread gets dwMaxCount0 data the status is 0 at this time users can copy data from Buffer0 to another memory then start the next getting process e Syntax WORD P1202_FunB_ReadStatus Void e Parameter Void e Return 0 data is ready 1 data not ready e Demo DEMO21 C Version 2 05 Date Jan 8 2007 Page 45 PCI 1202 Software Manual 2 8 3 P1202 FunB Stop This subroutine will stop the batch capture function e Syntax WORD P1202_FunB Stop Void e Parameter Void e Return O No Error Others Please refer to section 1 2 e Demo DEMO21 C 2 8 4 P1202 FunB_Get This function will retrieve the number of A D samples that have been acquired e Syntax WORD P1202 _FunB_Get DWORD P0
24. l for more information e Syntax WORD P1202 M FUN 1 WORD wDaNumber WORD wDaWave float fDaAmplitude WORD wAdSampleRateDiv WORD wAdNumber WORD wAdConfig float fAdBuf float fLowAlarm float fHighAlarm e Parameters Input The element number of one sine wave When the number increased the wave will be more smoothly but the speed of output a sine wave will be decreased Examplel This picture set wDaNumber 5 it will output a sine wave that make up by 5 of automatically generated DA value And the output speed depends upon computer performance WDAWAVE Input Number of DA waveform to be output Example2 When wDaWave is 2 it will output the sine wave defined by wDANumber twice RAVER Version 2 05 Date Jan 8 2007 Page 38 PCI 1202 Software Manual fDaAmplitude Input Amplitude of DA output fDaAmplitude range is 10 10 NOTE the hardware J1 must be set on 10V wAdSampleRateDiv Input AD sampling rate 8000000 wAdSampleRateDiv samples sec Input Number of AD data to be read Input A D input range configuration code Please refer to section 1 3 Output the starting address of fAdBuf which store the A D data Input low alarm limit if fAdBuf lt fLowAlarm gt LowAlarm on Input high alarm limit if fAdBuf gt fHighAlarm gt HighAlarm on e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO5 C Version 2 05 Date J
25. n O No Error Others Please refer to sec 1 2 e Demo All demo programs 2 2 1 P1202 DriverClose This function will return the resources allocated from system It must be called once at the end of program e Syntax Void P1202_DriverClose Void e Parameter Void e Return Void e Demo All demo programs Version 2 05 Date Jan 8 2007 Page 14 PCI 1202 Software Manual 2 2 2 P1202 GetConfigAddressSpace Get the I O address of PCI 1202 board n This function is for debug It is not necessary to call this function in an application e Syntax WORD P1202_GetConfigAddressSpace WORD wBoardNo WORD wAddrTimer WORD wAddrCtrl WORD wAddrDio WORD wAddrAdda e Parameters Input PCI 1202 board number Start from 0 Output Get 8254 Timer I O address map Output Get Controller I O address map Output Get Digital I O Port I O address map Output Get A D and D A I O address map Please refer to PCI 1202 1602 1800 1802 Hardware manual Chapter 3 for more information e Return O No Error Others Please refer to sec 1 2 e Demo DEMO1 C 2 2 3 P1202 WhichBoardActive Return the active board number e Syntax WORD P1202_WhichBoardActive Void e Parameter Void e Return Board number of the active board Start from 0 First card gt 0 Second card gt 1 e Demo DEMO1 C Version 2 05 Date Jan 8 2007 Page 15 PCI 1202 Software Manual 2 2 4 P1202 A
26. nel D A channel must be 0 or 1 dwDelayUs gt 8191 Delay TimeOut Invalid data FIFO overflow TimeOut Invalid board number First board number is 0 Can t detect board Note1 Can t detect second board Create thread error Stop error Allocate memory error Note 1 Please update driver and restart PC To get more information about the last release driver please refer to http www icpdas com download pci index htm Version 2 05 Date Jan 8 2007 Page 8 PCI 1202 Software Manual 13 Configuration Code PCI 1002L 1800L 1802L Configuration Code Table Analog Input Configuration ling Ti Bipolar Unipolar Sig Sel Renae Bande Settling Time Sue Bipolar bw 5V i Bus US oxoo ooo Bipolar 2 5v E amt Bipolar 1 25V a lus oo Bipolar 0 625V e bus o3 Bipolar 10v Bipolar 5v us x05 Bipolar 2 5v 2 pus ooo Bipolar 1 25V a lus or Unipolar ov 10v 1 fus wos Unipolar ov 5v Unipolar ov 2 5v a sus ooa ue o le face os 2 PCI 1202H 1800H 1802H Configuration Code Table Analog Input Configuration ling Ti Bipolar Unipolar Sig ii SA Settling Time Se Bipolar EE A 4 aus us oo 0 Bipolar oos hioo hao us pata Bipolar v 5 28us xs Bipolar fw 0 01V 500 lisoous 0x17 Unipolar 0 1v 100 isous foxtA Unipolar ov 0 01V 1000 1300 us Version 2 05 Date Jan 8 2007 Page 9 PCI 1202 Software Manual
27. nel_0 1 2 are on others are OK e Return Void e Demo DEMO11 C Version 2 05 Date Jan 8 2007 Page 35 PCI 1202 Software Manual 2 6 10 P1202 StopMagicScan Stop MagicScan e Syntax Void P1202_StopMagicScan Void e Parameter Void e Return Void e Demo DEMO14 C Version 2 05 Date Jan 8 2007 Page 36 PCI 1202 Software Manual 2 7 TheM Functions 2 7 0 Introduction M_Function Process Flow Chart Function Name M_FUN_1 M FUN 2 M_FUN_3 M_FUN_4 Version 2 05 Controller MagicScan Control Please refer to Note 1 in the Section 3 Table 2 9 0 1 M_Function Feature Table D A Analog Output 0 Output sine wave Analog Output 0 Output arbitrary wave form Analog Output 0 Output sine wave Analog Output 0 Output square wave semi square wave or sine wave Date Jan 8 2007 AID Analog Input 0 10V 10V Analog Input 0 10V 10V channel gain programmable 32 channels max channel gain programmable 32 channels max Page 37 PCI 1202 Software Manual 2 7 1 P1202 M FUN1 This subroutine output sine wave from DA channel 0 according to the parameter wDaNumber and fDaAmplitude By the wDaWave the number of DA waveform to be output is programmable lt can output sine wave from DA channel 0 and get data from AD Channel 0 at the same time Users also need to set sampling rate and data number of AD Please refer to PCI 1202 1602 1800 1802 Hardware manua
28. ng channel scan performance effectively x Note2 FIFO Overflow When the FIFO full the last data will cover the first data it causes data lose and called FIFO Overflow To prevent FIFO Overflow it is recommended to suspend another program like IE anti virus or select other card that have bigger FIFO like 8K series card Version 2 05 Date Jan 8 2007 Page 58 PCI 1202 Software Manual 4 DEMO There are more than 20 demo programs provided as the following list demo1 demo2 demo3 demo4 demo5 demo6 demo7 demo8 demo9 demo10 two board same as demo9 demo11 one board MagicScan demo demo12 two board same as demo11 demo13 one board continuous capture demo demo14 two board continuous capture demo Windows 95 NT only demo15 all installed board D I O test for board number identification demo16 one board performance evaluation demo demo17 one board MagicScan demo scan sequence 43335 demo18 one board MagicScan demo scan 32 channel show channel one board D I O test D A test A D polling amp pacer trigger test general test two board same as demo1 one board all 32 channels of A D by software trigger by polling two board same as demo3 one board M_function_1 demo two board same as demo5 one board M_function_2 demo two board same as demo7 one board M_function_3 demo 0 1 15 16 17 demo19 one board A D calibration demo20 two board P1202_FUNA continuous ca
29. on others are OK e Return Void e Demo DEMO11 C Version 2 05 Date Jan 8 2007 Page 30 PCI 1202 Software Manual 2 6 7 P1202 AddToScan This subroutine will add one channel into the MagicScan circular queue The maximum channels could be added into MagicScan circular queue is 48 The scan sequence is the order of adding channel into scan queue Example P1202 AddToScan 1 0 1 0 O 0 P1202 AddToScan 1 0 1 0 O 0 P1202_AddToScan 0 0 1 0 O 0 Scan order is chi gt chi gt ch0 gt chi gt ch1 gt ch0 gt chi gt This function will refer to the current active PCI 1202 board Use the P1202 ActiveBoard to select the active board e Syntax WORD P1202_AddToScan WORD wAdChannel WORD wConfig WORD wAverage WORD wLowAlarm WORD wHighAlarm WORD wAlarmType e Patermeters Input AD channel number Input the configuration code Refer to Section 1 3 Configuration Table Input the factor of digital average filter Average wAverage data to one and the smallest value is 1 The factor of digital average filter When the wAverage is 5 it will average 5 data to 1 The sampling rate will become one fifth Input 12 bits low alarm data Input 12 bits high alarm data Input Alarm type Version 2 05 Date Jan 8 2007 Page 31 PCI 1202 Software Manual Table 2 8 7 1 Alarm Type Define Table AlarmType Value Alarm Type Comment 0 No alarm Close 1 High alarm Buff
30. ore the MagicScan alarm status dwLowAlarm bit 0 15 Bt F E D GijBI A S 8 7z 6 5 4 38 2 1 channel 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 dwLowAlarm bit 16 31 Bit 1F 1E 1D 1C 1B 1A 19 18 17 16 15 14 13 12 11 channel 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 wLowAlarm 32 bits corresponding to 32 channels Version 2 05 Date Jan 8 2007 Page 34 PCI 1202 Software Manual Ch 0 gt No low alarm Ch 1 gt Low alarm on Example dwLowAlarm 0 gt all channels OK no low alarm dwLowAlarm 1 gt low alarm of channel_0 is on others are OK dwLowAlarm 3 gt low alarm of channel_0 and channel_1 are on others are OK dwHighAlarm bit 0 15 Bt F E D C B A 9 8 7 6 5 4 3 2 110 channel 15 14 13 12 11 10 9 8 7 6 5 4 3 2 11 0 dwHighAlarm bit 16 31 Bit 1TF 1E 1D 1C 1B 1A 19 18 17 16 15 14 13 12 11 10 channel 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 dwHighAlarm 32 bits corresponding to 32 channels Ch 0 gt No high alarm occurs Ch 1 gt High alarm on Example dwHighAlarm 0 gt all channels OK no high alarm dwHighAlarm 4 gt high alarm of channel_2 is on others are OK dwHighAlarm 7 high alarm of chan
31. pture demo demo21 single board P1202_FUNB continuous capture demo demo23 single board post trigger demo demo24 single board pre trigger demo demo25 single board middle trigger demo Refer to the company floppy disk for details Version 2 05 Date Jan 8 2007 Page 59
32. put the starting address of fAdBuf which store the A D data Input low alarm limit if fAdBuf lt fLowAlarm gt LowAlarm on Input high alarm limit if fAdBuf gt fHighAlarm gt HighAlarm on e Return O No Error Others Please refer to section 1 2 e Demo DEMO9 C Version 2 05 Date Jan 8 2007 Page 42 PCI 1202 Software Manual 2 8 The Single Board Batch Capture 2 8 0 Introduction FunB Batch Cap ture Procedures P1202 ActiveBoard Active board P1202_FunB_ Start Start Scan P1202_FunB_ReadStatus Get state P1202 _FunB_Get Get data P1202_FunB_Stop Stop scan Architecture Controller Version 2 05 Date Jan 8 2007 Page 43 PCI 1202 Software Manual 2 8 1 P1202 FunB_ Start This subroutine starts the batch capture and stores data into a specified memory This function works on only one PCI 1202 board system Please refer to section 2 9 0 for more information e Syntax WORD P1202_FunB Start WORD wClockDiv0 WORD wChannel0 WORD wConfig0 WORD Buffer0 DWORD dwMaxCount0 SHORT nPriority e Parameters WGISERDIVO INput The AD sampling rate devisor The sampling rate is 8M wClockDivO Wwchannel0 Input 0 disable scan channel index 1 enable scan channel index Example1 wChannel0 0 1 gt set scan channel 0 enable wChannel0 0 0 gt set scan channel 0 disable wChannel0 2 1 gt set scan channel 2 enable WOontigo
33. rformed Input AD sampling rate 8M wSampleDiv Example wSampleDiv 80 gt Sampling rate 8M 80 100K e Return O No Error Others Please refer to section 1 2 e Demo DEMO1 C P1202_SetChannelConfig P1202_AdPolling P1202 AdsPollng lt Fix channel AD conversion mode P1202_AdsPacer Version 2 05 Date Jan 8 2007 Page 22 PCI 1202 Software Manual 2 6 The MagicScan Functions 2 6 0 Introduction MagicScan Process Step1 Set channel scan order and config Step2 Start MagicScan Step3 Get MagicScan status Step4 Get data MagicScan Process Flow Diagram PCI 1202 Version 2 05 Date Jan 8 2007 Page 23 PCI 1202 Software Manual 2 6 1 P1202 ClearScan This subroutine will initialize the MagicScan controller This function will refer to the current active PCI 1202 board Use the P1202 ActiveBoard to select the active board Please refer to Note 1 in section 3 e Syntax WORD P1202_ClearScan e Parameter Void e Return O No Error Others Please refer to section 1 2 e Demo DEMO11 C Version 2 05 Date Jan 8 2007 Page 24 PCI 1202 Software Manual 2 6 2 P1202 StartScan This subroutine will start the MagicScan operation This subroutine will return to the caller before the MagicScan operation finish The user can use P1202 _WaitMagicScanFinish or P1202 ReadScanStatus to check the status of MagicScan operation This function will refer to the c
34. rt nB P1202 _GetDllVersion Void P1202 _GetDriverVersion WORD wVxdVersion P1202_Driverlnit WORD wTotalBoards P1202_DriverClose Void P1202_GetConfigAddressSpace WORD wBoardNo WORD wAddrTimer WORD wAddrCtrl WORD wAddrDio WORD wAddrAdda P1202_ActiveBoard WORD wBoardNo P1202_WhichBoardActive Void P1202_Di WORD wDi P1202_Do WORD wDo P1202_Da WORD wDaChannel WORD wDaVal P1202_SetChannelConfig WORD wAdChannel WORD wConfig P1202_AdPolling float fAdVal P1202_AdsPolling float fAdVal WORD wNum P1202_AdsPacer float fAdVal WORD wNum WORD wSampleDiv Date Jan 8 2007 Page 5 PCI 1202 Software Manual Category Magic M_Function Functions Define WORD P1202 ClearScan Void WORD P1202 StartScan WORD wSampleRateDiv DWORD dwNum SHORT nPriority WORD P1202 StartScanPostTrg WORD wSampleRateDiv DWORD dwNum SHORT nPriority WORD P1202_StartScanPreTrg WORD wSampleRateDiv DWORD dwNum SHORT nPriority WORD P1202 StartScanMiddleTrg WORD wSampleRateDiv DWORD dwNum DWORD dwN2 SHORT nPriority WORD P1202_StartScanPreTrgVerC WORD wSampleRateDiv DWORD dwNum SHORT nPriority WORD P1202_StartScanMiddleTrgVerC WORD wSampleRateDiv DWORD dwNum DWORD dwN2 SHORT nPriority Void P1202_ReadScanStatus WORD wStatus DWORD dwLowAlarm DWORD dwHighAlarm WORD P1202 AddToScan WORD wAdChannel WORD wConfig WORD wAverage WORD wLowAlarm WORD wHighAlarm WORD wAlarmType WORD P1202
35. s Output address of wHighAlarm which store the MagicScan alarm status dwLowAlarm bit 0 15 Bit F E D C B A 9 8 7 6 5 4 3 2 1 channel 15 14 13 12 11 10 9 8 7 6 5 4 3 2 14 dwLowAlarm bit 16 31 Bit 1F 1E 1D 1C 1B 14 19 18 17 16 15 14 13 12 11 channel 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 dwLowAlarm 32 bits corresponding to 32 channels Version 2 05 Date Jan 8 2007 Page 29 PCI 1202 Software Manual Ch 0 no low alarm Ch 1 gt low alarm on Example dwLowAlarm 0 gt all channels OK no low alarm dwLowAlarm 1 gt channel_0 is low alarm others are OK dwLowAlarm 3 channel_0 and channel_1 are low alarm others are OK dwHighAlarm bit 0 15 Bt F E D C B A 9 8 7 6 5 4 3 2 110 channel 15 14 13 12 11 10 9 8 7 6 5 4 3 2 11 0 dwHighAlarm bit 16 31 Bit 1F 1E 1D 1C 1B 1A 19 18 17 16 15 14 13 12 11 10 channel 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 dwHighAlarm32 bits corresponding to 32 channels Ch 0 gt no high alarm Ch 1 gt high alarm on Example dwHighAlarm 0 all channels OK no high alarm dwHighAlarm 4 gt high alarm of channel_2 is on others are OK dwHighAlarm 7 gt high alarm of channel_0 1 2 are
36. turn O No Error Others Please refer to sec 1 2 e Demo DEMO1 C When CNI connect with CN2 P1202_Do 0x10 Output 0x10 P1202_Di wDi wDi 0x 10 Input Version 2 05 Date Jan 8 2007 Page 17 PCI 1202 Software Manual 2 4 The DA Functions 2 4 0 P1202 Da This subroutine will send the 12 bits data to DA port This function will refer to the current active PCI 1202 board Use the P1202_ActiveBoard to set the active board e Syntax WORD P1202_Da WORD wChannel WORD wDaVal e Parameters Input Analog output channel wChannel 0 analog output Channel 0 wChannel 1 analog output Channel 1 Input 12 bits data sent to DA port O minimum and 4095 maximum The DA output can be 5V or 10V depending on the setting of hardware JP1 The software can t detect the state of JP1 So the maximum wDaVal 4095 may be 5V or 10V e Return O No Error Others Please refer to sec 1 2 e Demo DEMO1 C Version 2 05 Date Jan 8 2007 Page 18 PCI 1202 Software Manual 2 5 The AD Functions 2 5 0 Introduction AD DA Polling Function process Version 2 05 Date Jan 8 2007 Page 19 PCI 1202 Software Manual 2 5 1 P1202 SetChannelConfig This subroutine is used to set the AD channel configuration code Refer to section 1 3 It also sets the active AD channel for P1202_AdPolling P1202_AdsPolling and P1202_AdsPacer This function will refer to the current active PCI 1202 board Use the
37. urrent active PCI 1202 board Use the P1202 ActiveBoard to select the active board e Syntax WORD P1202_StartScan WORD wSampleRateDiv WORD wNumCycles SHORT nPriority e Parameters Input AD sampling rate 8M wSampleRateDiv Ex wSampleRateDiv 80 gt sampling rate 8M 80 100K Input Number of MagicScan cycle to perform Input Set Thread s Priority Please refer to section 1 4 e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO11 C Version 2 05 Date Jan 8 2007 Page 25 PCI 1202 Software Manual 2 6 3 P1202 StartScanPostTrg To get a number of AD data from one or multi channel after the external trigger arrives The user can use P1202 ReadScanStatus to check status and use P1202 _StopMagicScan to force the MagicScan to terminate Start End Please refer to Note 1 in the section 3 e Syntax WORD P1202_StartScanPostTrg WORD wSampleRateDiv WORD wNumCycles SHORT nPriority e Parameters WSampleRateDiv Input AD sampling rate 8M wSampleRateDiv Ex wSampleRateDiv 80 sampling rate 8M 80 100K Input number of A D data for each scan channel Total data number wNumCycles number of scan channel Input Set thread s priority Please refer to section 1 4 e Return 0 No Error Others Please refer to section 1 2 e Demo DEMO23 C Version 2 05 Date Jan 8 2007 Page 26 PCI 1202 Software Manual 2 6 4 P1202_StartScanPreTrg The Magic
38. utput sine wave from DA channel 0 and get data from channel scan at the same time wAdNumber and wAdSampleRateDiv are used to set AD data number and sampling rate Please refer to PCI 1202 1602 1800 1802 Hardware manual for more information e Syntax WORD P1202 M_FUN_3 WORD wDaNumber WORD wDaWave float fDaAmplitude WORD wAdSampleRateDiv WORD wAdNumber WORD wChannelStatus WORD wAdConfig float fAdBuf float fLowAlarm float fHighAlarm e Parameters wDaNumber Input The element number of one sine wave When the number increased the wave will be more smoothly but the speed of output a sine wave will be decreased Please refer to Example 1 in the P1202 M_FUN_1 wDaWave Input Number of DA waveform to be output Please refer to Example 2 in the P1202 M_FUN_1 fDaAmplitude Input Amplitude of DA output fDaAmplitude value range 10 10 NOTE the hardware J1 must be set on 10V Input AD sampling rate 8000000 wAdSampleRateDiv samples sec Version 2 05 Date Jan 8 2007 Page 41 PCI 1202 Software Manual Input Number of AD data to be read Input 1 scan channel index enable 0 scan channel index disable Example3 wAdChannel 0 1 gt Set scan channel 0 enable wAdChannel 0 0 gt Set scan channel 0 disable wAdChannel 2 1 gt Set scan channel 2 enable WAGGSRTGII Input A D input range configuration code Please refer to section 1 3 Out
39. wChannelConfig 1 0 set the configuration of channel is 0 Input number of A D data for each scan channel Total data number wCycles number of scan channel e Return O No Error Others Please refer to section 1 2 e Demo DEMO13 C Version 2 05 Date Jan 8 2007 Page 51 PCI 1202 Software Manual 2 10 2 P1202 Card0 ReadStatus This subroutine will read the status of the Continuous Capture on first board It only checks the status of capture process without stops operation When the data ready the return value will be 0 Users can continue capturing data in a loop until stop the capturing process This function will refer to the current active PCI 1202 board Use the P1202_ActiveBoard to select the active board e Syntax P1202 _Card0 _ReadStatus WORD wBuf WORD wBuf2 DWORD dwP1 DWORD dwP2 WORD wStatus e Parameters WB Output store data by scan order 012 N012 N 012 N The data sequence in the wBuf is as follows ABUA Output in channel sequence order 00000 11111 22222 NNNNN The data sequence in the wBuf2 is as follows Input Output reserved Input Output reserved Output 1 thread start 2 TimeOut 8 FIFO overflow 0x80 thread finish 5 buffer full e Return Ready No data FIFO overflow Thread time out Buffer Full emo DEMO13 C U gt onN 0 Version 2 05 Date Jan 8 2007 Page 52 PCI 1202 Software Manual 2 10 3

Download Pdf Manuals

image

Related Search

Related Contents

n50ok - CRES Ile de la Réunion    カタログ(PDF:5855KB)  Pegasus 710 – User Guide  ISTRUZIONI PER L`USO  

Copyright © All rights reserved.
Failed to retrieve file