Home
National Instruments 320682C User's Manual
Contents
1. Remarks When locating a real number in a string Scan accepts either floating point notation or scientific notation s T23 n Scan s Ss gt f x result x 12 3 n 1 so Up m Scan s Ss gt f amp x result x n 0 LabWindows CVI Standard Libraries 2 60 National Instruments Corporation Chapter 2 Formatting and I O Library When locating a real number in a string Scan skips over white space characters If a non numeric character other than a white space character or is found before the first numeric character the Scan call fails Thus Scan fails on the pin p12 3 it leaves the value in x unmodified and returns zero indicating that no target specifiers were satisfied s 12 3m n Scan S Ss gt f amp x result x 12 3 n 1 sr M1234 n Scan s Ss gt E 8 x result x 12 3 n 1 s 1 23e n Scan s s gt x result x n 0 Scan considers the occurrence of a non numeric character such as the m in 12 3m to mark the end of the real number A second decimal point also marks the end of the number However Scan fails on 1 23e because the value of the exponent is missing S n M2345 7 Scan s Ss gt Sf w4 amp x result x 1 23 n 1 The w4 modifier specifies that only the first 4 bytes of the string are scanned String to Integer and Real char s ot ay ny do
2. e VAL_APPEND do not truncate file all write operations append to end of file e VAL_OPEN_AS_1IS do not truncate file positions the file pointer at the beginning of the file National Instruments Corporation 2 21 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 fileType specifies whether to treat file as ASCII or binary When performing I O on a file in binary mode no special treatment is given to carriage returns CR and line feeds LF When you open the file in ASCII mode CR LF combination translates to LF when reading and LF translates to CR LF when writing fileType values are as follows e VAL_BINARY binary e VAL_ASCII ASCII ReadFile int n ReadFile int fileHandle char buffer int count Purpose Reads up to count bytes of data from a file or STDIN into buffer Reading starts at the current position of the file pointer When the function completes the file pointer points to the next unread character in the file Parameters Input fileHandle integer File handle count integer Number of bytes to read Return Value Return Codes Error possibly bad handle Tried to read past end of file Parameter Discussion fileHandle is the file handle returned by the OpenFile function fileHandle points to the file from which you want to read If fileHandle 0 input is read from STDIN and no prior OpenFile call is needed buffer is the buffer
3. Purpose Multiplies two 1D arrays The function obtains the ith element of the output array by using the following formula op APY The function performs the operation in place that is outputArray can be the same array as either arrayX or arrayY Parameters arrayX double precision Input array array arrayY double precision Input array array numberofElements integer Number of elements to be multiplied array LabWindows CVI Standard Libraries 3 26 National Instruments Corporation Chapter 3 Analysis Library Return Value status integer Refer to error codes in Table 3 2 Mul2D int status Mul2D void arrayX void arrayY int numberofRows int numberofColumns void outputArray Purpose Multiplies two 2D arrays The function obtains the ith jth element of the output array by using the following formula x Zij Xij Vij The function performs the operation in place that is outputArray can be the same array as either arrayX or arrayY Parameters arrayX double precision 2D Input array array array Y double precision 2D Input array array numberofRows integer Number of elements in first dimension numberofColumns integer Number of elements in second dimension array Return Value status integer Refer to error codes in Table 3 2 National Instruments Corporation 3 27 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Neg1D int status
4. Under UNIX you can allow more time by sending the SIGKILL message to the process The SIGKILL message cannot be blocked caught or ignored and therefore should always succeed Parameters executableHandle integer The executable handle acquired from LaunchExecutableEx Return Value Return Codes Handle is invalid Handle is invalid LabWindows CVI Standard Libraries 8 82 National Instruments Corporation Chapter 8 Utility Library Timer double t Timer void Purpose Returns the number of seconds that have elapsed since the first call to Timer Delay or SyncWait or the first operation on a timer control The value is never reset to zero except when you restart your program The resolution on Windows is normally 1 millisecond However if the following line appears in the CVI section of your WIN INT file the resolution is 55 milliseconds useDefaultTimer True The resolution on Sun Solaris is 1 millisecond Parameters None Return Value double precision Number of seconds since first call to Timer TimeStr char s TimeStr void Purpose Returns an 8 character string in the form HH MM SS where HH is the hour MM is in minutes and SS is in seconds Parameters None Return Value National Instruments Corporation 8 83 LabWindows CVI Standard Libraries Utility Library Chapter 8 TruncateRealNumber double y TruncateRealNumber double inputR
5. e outputMatrix must be FofRowsInX by FofColumnsInY O National Instruments Corporation 3 23 LabWindows CVI Standard Libraries Analysis Library Chapter 3 MaxMin1D int status MaxMin1D double inputArray int numberofElements double maximumValue int maximumIndex double minimumValue int minimumIndex Purpose Finds the maximum and minimum values in the input array as well as the respective indices of the first occurrence of the maximum and minimum values Parameters inputArray double precision array Input array Number of elements numberofElements integer maximum Value maximumIndex minimum Value minimumIndex double precision integer double precision integer Maximum value Index of maximum Value in inputArray Minimum value Index of minimum Value in inputArray Return Value status integer Refer to error codes in Table 3 2 MaxMin2D int status MaxMin2D void inputArray int numberofRows int numberofColumns double maximumValue int maximumRowIndex int maximumColumnIndex double minimumValue int minimumRowIndex int minimumColumnIndex Purpose Finds the maximum and the minimum values in the 2D input array as well as the respective indices of the first occurrence of the maximum and minimum values The inputArray is scanned by rows LabWindows CVI Standard Libraries 3 24 National Instruments Corporation Chapter 3 Para
6. National Instruments Corporation Chapter 8 Utility Library Return Value loaded integer Indicates whether the LabWindows CVI low level support driver was loaded at startup Return Codes Low level support driver was loaded at startup O Low level support driver was not loaded at startup DateStr char s DateStr void Purpose Returns a 10 character string in the form MM DD YYYY where MM is the month DD is the day and YYYY is the year Parameters None Return Value 10 character string The date in MM DD YY Y Y format Delay void Delay double numberofSeconds Purpose Waits the number of seconds indicated by numberofSeconds The resolution on Windows is normally 1 millisecond However if the following line appears in the CVI section of your WIN INI file the resolution is 55 milliseconds useDefaultTimer True The resolution on Sun Solaris is 1 millisecond National Instruments Corporation 8 9 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameter Input double precision Number of seconds to wait Return Value None DeleteDir int result DeleteDir char directoryName Purpose Deletes an existing directory Parameters Input directoryName String Return Value Return Codes Success Directory not found General I O error occurred Insufficient memory to complete operation Access denied or directory not empty Path is a fil
7. Return Value oldState Previous state of the break on protection errors feature Return Codes Was previously enabled Was previously disabled or debugging is disabled Example int oldValue oldValue SetBreakOnProtectionErrors 0 the statement that erroneously reports an error SetBreakOnProtectionErrors oldValue National Instruments Corporation 8 65 LabWindows CVI Standard Libraries Utility Library Chapter 8 SetDir int result SetDir char directoryName Purpose Sets the current working directory to the specified directory Under Windows 3 1 this function can change the current working directory on any drive however it does not change the default drive To change the default drive use the SetDrive function Parameters directoryName New current working directory Return Value Return Codes Success Specified directory not found or out of memory Parameter Discussion Under Windows 3 1 directoryName must not contain a drive letter SetDrive int result SetDrive int driveNumber Note This function is available only on the Windows versions of LabWindows CVI Purpose Sets the current default drive Parameters LabWindows CVI Standard Libraries 8 66 National Instruments Corporation Chapter 8 Utility Library Return Value Return Codes Success Invalid drive number Using This Function The mapping between the drive number an
8. group H handshaking YO ID IEEE in Instrument Library The factor by which a signal is amplified sometimes expressed in decibels Refers to cable connector types A male connector is one with protruding pins like a lamp plug A female connector has holes like an outlet A small device that can be attached to serial cable connectors or PC sockets among others to convert a female connector into a male or a male connector into a female General Purpose Interface Bus is the common name for the communications interface system defined in ANSI IEEE Standards 488 1 1987 and 488 2 1992 A collection of digital ports combined to form a larger entity for digital input and or output Prevents overflow of the input queue that occurs when the receiver is unable to empty its input queue as quickly as the sender is able to fill it The RS 232 Library has two types of handshaking software handshaking and hardware handshaking You should enable one or the other if you want to ensure that your application program synchronizes its data transfers with other serial devices that perform handshaking Hertz Input output Identification Institute of Electrical and Electronics Engineers Inches A LabWindows CVI library that contains instrument drivers interrupt A computer signal indicating that the CPU should suspend its current task to service a designated activity LabWindows CVI Standard Libraries G 4 National Instrum
9. Disconnects your client program from a server application Parameters conversationHandle unsigned integer Uniquely identifies the conversation Return Value Note This function terminates a connection identified by the conversation handle passed There can be more than one conversation between a client and a server See Also Connect ToTCPServer RegisterTCPServer DisconnectTCPClient int status DisconnectTCPClient unsigned int conversationHandle Purpose Called by a TCP server to terminate a connection with a client Be aware that there can be more than one conversation between a server and a client Parameters conversationHandle unsigned integer Uniquely identifies the connection Return Value National Instruments Corporation 7 7 LabWindows CVI Standard Libraries TCP Library Chapter 7 See Also RegisterTCPServer GetTCPErrorString char message GetTCPErrorString int errorNum Purpose Converts the error number returned by a TCP Library function into a meaningful error message Parameters Return Value RegisterT CPServer int status RegisterTCPServer unsigned int portNumber tcpFuncPtr serverCallbackFunction void callbackData Purpose Registers your program as a valid TCP server and allows other applications to connect to it for network communication Parameters portNumber unsigned integer Uniquely identifies a server on a single machine serverCallbackF
10. Error reading file Did not receive the initial negative acknowledgment character Did not receive acknowledgment after the end of transmission character was sent Error while writing to file Did not receive either a start of data or end of transmission character when expected Transfer was canceled because the CAN character was received Invalid start delay Invalid maximum number of retries Invalid wait period Invalid packet size Unable to read CRC CRC error The value of rs232err is zero if the most recently called RS 232 function completed successfully Errors above 200 occur only on XModem function calls Errors 261 through 265 are recorded when the maximum number of retries has been exhausted in trying to receive an XModem function packet O National Instruments Corporation 5 37 LabWindows CVI Standard Libraries Chapter 6 DDE Library This chapter describes the functions in the LabWindows CVI DDE Dynamic Data Exchange Library The DDE Library Function Overview section contains general information about the DDE Library functions and panels The DDE Library Function Reference section contains an alphabetical list of function descriptions This library is available for LabWindows CVI for Microsoft Windows only DDE Library Function Overview The DDE Library includes functions specifically for Microsoft Windows DDE support This section contains general information about the DDE Library functions and panel
11. LabWindows CVI makes no distinction between warm links and hot links In both cases your client application receives the data through the client callback function when the data value changes If a warm link is in effect LabWindows CVI requests and receives the data from the server before the callback function is called The Set UpDDEWarmLink and Set UpDDEHot Link functions are provided because some DDE server applications offer only one type of link LabWindows CVI Standard Libraries 6 4 National Instruments Corporation Chapter 6 DDE Library A DDE Library Example Using Microsoft Excel and LabWindows CVI LabWindows CVI includes a sample program called ddedemo pr j that uses DDE to send data to Microsoft Excel The example program can be found in the samples ddetcp directory The following discussion outlines the process required to open an Excel worksheet file send data over DDE and setup a DDE link with one of the cells in the worksheet from a LabWindows CVI program Start Excel and load the worksheet file called LWCVI XLS The sample program performs the following operations 1 Connects to the Microsoft Excel worksheet as a client The function Connect ToDDEServer with excel as the server name and LWCVI XLS as the topic name establishes a connection with the worksheet The Callback Function Pointer CLientCallback identifies the function which will process the DDE transactions generated from this pa
12. Neg1D double inputArray int numberofElements double outputArray Purpose Negates the elements of the input array The function performs the operation in place that is inputArray and outputArray can be the same array Parameters Input inputArray double precision Input array array numberofElements integer Number of elements outputArray double precision Negated values of the inputArray array Return Value Set1D int status Set1D double array int numberofElements double setValue Purpose Sets the elements of the input array to a constant value Parameters Input numberofElements integer Number of elements in array setValue double precision Constant value Output array double precision Result array set to the value array of set Value Return Value LabWindows CVI Standard Libraries 3 28 National Instruments Corporation Chapter 3 Analysis Library Sort int status Sort double inputArray int numberofElements int direction double outputArray Purpose Sorts the input array in ascending or descending order The function performs the operation in place that is inputArray and outputArray can be the same array Parameters inputArray double precision Input array array numberofElements integer Number of elements to be sorted direction integer 0 ascending Non zero descending array Return Value status integer Refer to error co
13. O National Instruments Corporation 10 7 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Easy VO for DAQ Function Reference This section describes each function in the Easy I O for DAQ Library The function descriptions are arranged alphabetically AlAcquireTriggered Waveforms short error AlAcquireTriggered Waveforms short device char channelString long numberOfScans double scansPerSecond double highLimitVolts double lowLimitVolts double actualScanRate unsigned short triggerType unsigned short edgeSlope double triggerLevelV char triggerSource long pretriggerScans double timeLimitsec short fillMode double waveforms Purpose This function performs a timed acquisition of voltage data from the analog channels specified in the channelString The acquisition does not start until the trigger conditions are satisfied If you have an E Series DAQ device you can select Equivalent Time Sampling for the Trigger Type to sample repetitive waveforms at up to 20 MHz See the help for the Trigger Type parameter for details LabWindows CVI Standard Libraries 10 8 National Instruments Corporation Chapter 10 Parameters device channelString numberOfScans scansPerSecond highLimitVolts lowLimit Volts triggerType edgeSlope triggerLevelV triggerSource pretriggerScans timeLimitsec fillMode actualScanRate waveforms Return Value shor
14. amp hidden archive if read_only FmtOut WAVEFORM DAT is a read only file GetFileDate int result GetFileDate char fileName int month int day int year Purpose Gets the date of a file Parameters Output month Month 1 to 12 day Day of month 1 to 31 year Year 1980 2099 Return Value LabWindows CVI Standard Libraries 8 24 National Instruments Corporation Chapter 8 Utility Library Return Codes Success File not found or directory in path not found General I O error occurred Insufficient memory to complete operation Invalid path for example c filename in Windows Access denied Parameter Discussion fileName may be the empty string in which case the date of the file found by the most recent call to GetFirstFileor GetNextF ile is returned Windows only Example get the date of WAVEFORM DAT int month day year GetFileDate waveform dat amp month day amp year GetFileSize int result GetFileSize char fileName long fileSize Purpose Returns the size of a file Parameters Return Value National Instruments Corporation 8 25 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Codes Success File not found or directory in path not found General I O error occurred Insufficient memory to complete operation Invalid path for example c filename in Windows Access denied P
15. array Y Real double precision Real part of y array array Y Imaginary double precision Imaginary part of y array numberofElements integer Number of elements outputArrayReal double precision Real part of z array outputArrayImaginary double precision Imaginary part of z array Return Value status integer Refer to error codes in Table 3 2 CxRecip int status CxRecip double xReal double xImaginary double outputReal double outputImaginary Purpose Finds the reciprocal of a complex number The function obtains the resulting complex number by using the following formulas yr xr xr2 xi yi xi xr2 xi2 National Instruments Corporation 3 13 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Parameters Input xReal double precision Real part of x xImaginary double precision Imaginary part of x Output outputReal double precision Real part of y outputImaginary double precision Imaginary part of y Return Value CxSub int status CxSub double xReal double xImaginary double yReal double yImaginary double outputReal double outputImaginary Purpose Subtracts two complex numbers The function obtains the resulting complex number by using the following formulas ZV Xr yr zi xi yi Parameters xReal double precision Real part of x xImaginary double precision Imaginary part of x yReal double precision Real part of y yImaginary double pr
16. arrayX double precision 2D Input array array Y double precision 2D Input array numberofRows Number of elements in first dimension numberofColumns Number of elements in second dimension array O National Instruments Corporation 3 17 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Return Value status integer Refer to error codes in Table 3 2 DotProduct int status DotProduct double vectorX double vectorY int numberofElements double dotProduct Purpose Computes the dot product of the vectorX and vectorY input arrays The function obtains the dot product by using the following formula n l dotproduct x e y Y xs y i 0 Parameters vectorX double precision Input vector array vector Y double precision Input vector array numberofElements integer Number of elements Return Value status integer Refer to error codes in Table 3 2 LabWindows CVI Standard Libraries 3 18 O National Instruments Corporation Chapter 3 Analysis Library GetAnalysisErrorString char message GetAnalysisErrorString int errorNum Purpose Converts the error number returned by an Analysis Library function into a meaningful error message Parameters Input errorNum integer Status returned by an Analysis function Return Value message Explanation of error Histogram int status Histogram double inputArray int numberofElements double base double top int histo
17. directoryName must be at least MAX_PATHNAME_LEN bytes long Parameter Discussion Using This Function This function is useful when a project and its related files are distributed to multiple users who may place them in a different directory on each machine If your program needs to access a file that is in the same directory as the project you can use Get ProjectDir and MakePathname to construct the full pathname Example char fileName char projectDir MAX_PATHNAME_ LEN char fullPath MAX_PATHNAME_ LEN fileName myfile if GetProjectDir projectDir lt 0 FmtOut Project is untitled n else MakePathname projectDir fileName fullPath LabWindows CVI Standard Libraries 8 34 National Instruments Corporation Chapter 8 Utility Library GetStdioPort void GetStdioPort int stdioPort Purpose Gets a value indicating the current destination for data written to the standard output and the source of data read from the standard input The Standard I O port can be either the CVI Standard Input Output window or the standard Input Output of the host system This function is valid only on the UNIX version Parameters Output stdioPort integer 0 the CVI Standard Input Output window 1 the host system s standard output GetStdioWindowOptions void GetStdioWindowOptions int maxNumLines int bringToFrontWhenModified int showLineNumbers Purpose Gets the
18. unsigned int timeout Purpose Sets up a hot link advisory loop between the client and the server The function returns zero for success and a negative error code for failure Parameters Input conversationHandle unsigned integer Uniquely identifies the conversation itemName string Uniquely identifies the output item for example system dataFormat unsigned integer Valid data format for example CE TEXT timeout unsigned integer Timeout in ms LabWindows CVI Standard Libraries 6 20 National Instruments Corporation Chapter 6 DDE Library Return Value Parameter Discussion The itemName represents the information in the server application where the DDE link is established For example the item name could represent an Excel range of cells by using the range description R1C1 R10C10 Note To the client LabWindows CVI does not distinguish between a hot link and a warm link For both types of links the clientCallbackFunction is called with a transaction type Of DDE_DATAREADY when the data item is changed at the server site and the new data is available in the dataPtr parameter of the callback function LabWindows CVI has two different functions for setting up a warm link or hot link in case some applications only accept one or the other kind of link See Also RegisterDDEServer SetUpDDEWarmLink SetUpDDEWarmLink int status SetUpDDEWarmLink unsigned int conversationHa
19. 123 456 78 90 associated with it In addition each server specifies its own unique port number These two pieces of information identify different servers either on the same machine or on different machines Before any client program can connect to a server it has to know the host name and server port number If your program is to act as a TCP server you must call the RegisterTCPServer function in your program The RegisterTCPServer function establishes your program as the server associated with a port number on the local host Client applications can connect to your program by using either the host name where the server application is currently running or the IP address and the port number associated with the server application The callback function is invoked whenever the conversation partner requests communication This is discussed in the following section The TCP Callback Function Callback functions provide the mechanism for receiving notification of connection connection termination and data availability Similar to the method in which callback function responds to user interface events from your User Interface Library object files a TCP callback function responds to incoming TCP messages and information As shown in Table 7 2 a callback function can respond to three types of TCP messages TCP_CONNECT TCP_DISCONNECT and TCP_DATAREADY TCP callback functions used in a program acting as a TCP server can be trig
20. End Or Identify signal simultaneously with transmission of the last data byte By design the Listener stops reading when it detects a data message accompanied by EOI regardless of the value of the byte End of string EOS character The Talker uses a special character at the end of its data string By prior arrangement the Listener stops receiving data when it detects that character You can use either a 7 bit ASCII character or a full 8 bit binary byte You can use these methods individually or in combination However the Listener must be properly configured to unambiguously detect the end of a transmission Using the configuration program you can accommodate all permissible forms of read and write termination You cannot force the handler to ignore END on read operations The default configuration settings for read and write termination can also be changed at run time using the ibeos and ibeot functions Timeouts A timeout mechanism regulates the GPIB routines that transfer command sequences or data messages A default timeout period of 10 sec is preconfigured in the handler thus all I O must complete within that period to avoid a timeout error The default timeout value can be changed with the IBCONF utility In addition you can use the NI 488 board function call ibtmo to programmatically alter the timeout period Regardless of the I O and Wait timeout period a much shorter timeout is enforced for responses to serial polls T
21. InvalidPropTypeXErr TooManyConnectionsXErr CannotConnectXErr DupPropertyXErr O National Instruments Corporation The function was successful The value passed to one or more of the parameters was invalid Refer to each function description for specific information The display argument is not a valid display The value for this argument must either be the value returned by Connect ToXDisplay or be the predefined value CVIXDisplay The window argument is not a valid window InstallXPropertyCallback One or more of the windows in the windowList argument are not valid The property argument is not a valid property handle This argument must be the value returned by CreateXProperty InstallXPropertyCallback One or more of the property handles in the propertyList argument are not valid The propertyType argument is not a valid property type This value must either be one of the predefined property types or be a value returned by CreateXPropType The program has already made the maximum number of connections as defined by the constant MAX_X_ DISPLAYS Use DisconnectFromXDisplay to allow more connections The connection could not be made to the X server This happens for a number of reasons including an invalid display name a network problem or a security problem A property with the same propertyName but with different propertyType already exists continues 9
22. LoadExternalModule except that on Windows 95 and NT external references in object and library modules loaded from a DLL can be resolved using DLL symbols that are not exported On platforms other than Windows 95 and NT LoadExternalModuleEx works exactly like LoadExternalModule LabWindows CVI Standard Libraries 8 52 National Instruments Corporation Chapter 8 Parameters pathName Utility Library string Relative or absolute pathname of the module to be loaded callingModuleHandle void Usually the module handle of the calling DLL pointer Youcanuse__CVIUserHInst Zero indicates the project or executable Return Value moduleld ID of the loaded module Return Codes Same as the return codes for LoadExternalModule Using this Function Refer to the function help for LoadExternalModule for detailed information on that function When you call LoadExternalModule on an object or library module external references need to be resolved They are resolved using symbols defined in the project or in object library or DLL import library modules that have already been loaded using LoadExternalModule or LoadExternalModuleEx This is true even if you call LoadExternalModule from a DLL You may want to load an object or library module from a DLL and have the module link back to symbols that you defined in but did not export from the DLL You can do this using LoadExternal calling
23. MaxMin 1D 3 24 MaxMin2D 3 24 to 3 25 Mul1D 3 26 to 3 27 Mul2D 3 27 Neg 1D 3 28 Sub1D 3 30 to 3 31 Sub2D 3 31 Subset1D 3 32 array utility functions Clear1D 3 6 to 3 7 Copy1D 3 7 Set1D 3 28 ArrayToFile function 2 4 to 2 6 asterisks in format specifiers formatting functions 2 39 scanning functions 2 48 asynchronous acquisition functions AICheckAcquisition 10 15 AIClearAcquisition 10 15 AlReadAcquisition 10 16 to 10 17 AlStartAcquisition 10 19 PlotLastAIWaveformsPopup 10 47 asynchronous callbacks notification of SRQ and other GPIB events 4 12 restrictions with ibNotify function 4 20 automatic serial polling compatibility 4 8 hardware interrupts 4 8 to 4 9 purpose and use 4 7 to 4 8 RQS events ibInstallCallback function 4 17 ibNotify function 4 19 SRQI events ibInstallCallback function 4 17 ibNotify function 4 19 National Instruments Corporation B Beep function 8 5 board control functions GPIB 4 7 board control functions GPIB Library 4 3 break on library error functions DisableBreakOnLibraryErrors 8 11 to 8 12 EnableBreakOnLibraryErrors 8 15 GetBreakOnLibraryErrors 8 17 GetBreakOnProtectionErrors 8 18 SetBreakOnLibraryErrors 8 63 to 8 64 SetBreakOnProtectionErrors 8 64 to 8 65 Breakpoint function 8 6 BroadcastDDEDataReady function 6 8 to 6 9 bus control functions GPIB Library 4 3 byte count variable ibcntl 4 6 C C locale 1 2 to 1 5 information values table
24. Parameters Error Code returned by GetLastFmtIOErr Return Value National Instruments Corporation 2 19 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 NumFmtdBytes int n NumFmtdBytes void Purpose Returns the number of bytes formatted or scanned by the previous formatting or scanning call Parameters None Return Value integer Number of bytes formatted or scanned Using This Function If the previous call was a formatting call NumFmt dBytes returns the number of bytes placed into the target If the previous call was a scanning call NumFmt dBytes returns the number of bytes scanned from the source The return value is undefined if there have been no preceding formatting or scanning calls Certain operations using the Fmt File and ScanFile routines can result in more than 64 KB being formatted or scanned Because NumFmt dBytes returns an integer its value will not be accurate in these cases The value returned rolls over when formatting or scanning more than 65 535 bytes Example double f leans Scan 3 1416 Ss gt Sf amp f n NumFmtdBytes n will have the value 6 indicating that six bytes were scanned from the source string OpenFile int handle OpenFile char fileName int read writeMode int action int fileType Purpose Opens a file for input and or output LabWindows CVI Standard Libraries 2 20 National Instruments Corporation Chapter 2 For
25. Purpose Loads a file containing one or more object modules Parameter Input pathName string Relative or absolute pathname of the module to be loaded Return Value Return Codes Out of memory File not found Invalid file format Invalid path name Unknown file extension Cannot open file PTH file open error PTH file read error PTH file invalid contents DLL header file contains a static function prototype DLL function has an unsupported argument type DLL has a variable argument function DLL header contains a function without a proper prototype DLL function has an unsupported return type A DLL function s argument or return type is a function pointer A function in the DLL header file was not found in the DLL continues National Instruments Corporation 8 49 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Codes Continued Could not load the DLL Could not find the DLL header file Could not load the DLL header file out of memory or the file is corrupted Syntax error in the DLL header file DLL initialization function failed Module already loaded with different calling module handle See LoadExternalModuleEx Invalid calling module handle See LoadExternalModuleEx Module loaded in Borland mode in the LabWindows CVI development environment contains uninitialized global variables that are also defined in other modules Paramet
26. Since the left side of the lt symbol must be a single format specifier literal characters if present must be on the right side of the symbol Literals on the left side or more than one format specifier on the left side result in a 1 error indicating a faulty format string You then can use the function Get Fmt ErrNdx to determine exactly where the error lies in the format string The characters lt and gt have special meaning in the format strings To specify that these characters be taken literally they should be preceded by Scanning Functions The following information is a brief description of the three scanning functions e n Scan source formatstring targetptrl targetptrn The Scan function inspects the source argument and applies transformations to it according to descriptions in the format string argument The results of the transformations are placed into the targetptrl targetptrn arguments n ScanFile handle formatstring targetptrl targetptrn The ScanF ile function reads data from the file corresponding to the handle argument and applies transformations to it according to descriptions in the format string argument The results of the transformations are placed into the targetptr1 targetptrn arguments e n ScaniIn formatstring targetptrl targetptrn The ScanIn function reads data from standard input and applies transformations to it according to descriptions in the f
27. You pass taskID to CounterStart CounterRead and CountersStop Return Value short integer Refer to error codes in Table 10 5 LabWindows CVI Standard Libraries 10 48 O National Instruments Corporation Chapter 10 Easy I O for DAQ Library Parameter Discussion typeOf Measurement identifies the type of pulse width or period measurement to make This parameter accepts the following attributes e MEASURE_HIGH_PULSE_WIDTH measure high pulse width from rising to falling edge e MEASURE_LOW_PULSE_WIDTH measure low pulse width from falling to rising edge e MEASURE_PERIOD_BTW_RISING_EDGES measure period between adjacent rising edges e MEASURE_PERIOD_BTW_FALLING_EDGES measure period between adjacent falling edges sourceTimebase determines whether the counter uses its SOURCE pin or an internal timebase as its signal source Pass USE_COUNTER_SOURCE to count TTL edges at counter s SOURCE pin or pass a valid internal timebase frequency to count the TTL edges of an internal clock Valid internal timebase frequencies are 1000000 Am9513 100000 Am9513 10000 Am9513 1000 Am9513 100 Am9513 20000000 DAQ STC 100000 DAQ STC ReadFromDigitalLine short error ReadFromDigitalLine short device char portNumber short line short portWidth 1ong configure unsigned long lineState Purpose Reads the logical state of a digital line on a p
28. beginning at the first occurrence of an ASCII NUL in the target string Specify String Size When modifying a source format specifier the w string modifier specifies the maximum number of bytes to be consumed from the string argument You can enter any non negative value here the default being zero which indicates that the entire string should be consumed When modifying a target format specifier the w string modifier specifies the exact number of bytes to store in the string excluding the terminating ASCII NUL If nis zero or omitted as many bytes are stored as are called for by the sources When n is greater than the number of bytes available from the source the remaining bytes are filled with ASCII NULs if the q modifier is used or blanks if the q modifier is not present When the w string modifier is used in conjunction with the a string modifier n indicates the number of bytes to append to the string excluding the terminating ASCII NUL If wn modifies a target string and n is larger than the number of bytes in the target argument the target string is overwritten in compiled C Append NULs When applied to a target string in conjunction with the w string modifier the q string modifier specifies that unfilled bytes at the end of the target string be set to ASCII NULs instead of blanks LabWindows CVI Standard Libraries 2 38 National Instruments Corporation Chapter 2 Formatting and I O Library tn Terminate on Character W
29. cc cnascessqeasscsaseenseeessosavisieevsuneavanagavebessaveghedasheseunteeepadzevess xvii Conventions Used in This Manual s ssseseesseeesssessseesseesserssesssseessseesseesseesseessseesssees X X The LabWindows CVI Documentation Set ooooccnnncccnnocccnoncccnoncnonnnanononanonnncncnnnnccnnnnnnnns XX Related Documentation sea XX Customer Communication syesjscccs spaced es depdaanesdacee suendoavasseavaceidapedeca iria KX Chapter 1 PINS TSG EMD ANY claudia 1 1 Low Level VO FUNCIONS asii aras 1 2 Standard La guase AOS A A AAA ees 1 2 Character Proceso atole c 1 5 String Process 1 5 Input Output Facilities inde 1 6 errno Set by File UO Ponce 1 6 Mathematical Funciona ds 1 6 Tim and Date PUncons ista dali aei e OEE ESE ESSEEN 1 6 Control Functions iesse n n i e Ea a ardid 1 7 ANST C Library Function Reference tampa ii o 1 9 doc 1 9 Chapter 2 Formatting and VO Library oooccoccicidicicicionononnnonnnonononononononononoronononorororororonorononoso 2 1 Formatting and I O Library Function Overview ooooocooccconocccoonnncnoncnononcncnnnnnnnncccnanncnnns 2 1 The Formatting and I O Library Function Panels ooooonnnncccnnocccnonnccnoncninnnnnnnno 2 1 The String Manipulation Functions ceesceeesececeeeeeceeceeceeeeeceneeeeseeeeenteeeees 2 3 The Special Nature of the Formatting and Scanning Functions 000 2 3 Formatting and I O Library Function Reference ooooococnoncccnonccononcnononncnnonaconnnccnnnnn
30. mpu tormatString targetptr1 targetptrn Types must match formatString contents Return Value integer Number of target format specifiers satisfied Return Codes Format string error VO error Using This Function No argument is required for the source item in the case of the ScanIn function The return value indicates how many target format specifiers were satisfied 1 1f the format string is in error or 2 if there was an I O error A complete discussion of this function is in the Using the Formatting and Scanning Functions section later in this chapter SetFilePtr long position SetFilePtr int fileHandle 1ong offset int origin Purpose Moves the file pointer for the file specified by fileHandle to a location that is offset bytes from origin Returns the offset of the new file pointer position from the beginning of the file Parameters fileHandle integer File handle returned by OpenFile offset long integer Number of bytes from origin to position of file pointer origin integer Position in file from which to base offset LabWindows CVI Standard Libraries 2 26 National Instruments Corporation Chapter 2 Formatting and I O Library Return Value position long integer Offset of the new file pointer position from the beginning of the file Return Code Error due to an invalid file handle an invalid origin value or an offset value that is before the beginning of the fil
31. or the configuration function ibconfig If you enable Autopolling the handler automatically conducts serial polls when SRQ is asserted As part of the Autopoll procedure the handler stores each positive serial poll response in a queue associated with each device A positive response has the RQS or hex 40 bit set in the device status byte Queues are necessary because some devices can send multiple positive status bytes back to back When a positive response from a device is received the RQS bit of its status word ibsta is set The polling continues until SRQ is unasserted or an error condition is detected If the handler cannot locate the device requesting service no known device responds positively to the poll or if SRQ becomes stuck on because of a faulty instrument or cable a GPIB system error exists that will interfere with the proper evaluation of the RQS bit in the status words of devices The error ESRQ is reported to you when you issue an ibwait call with the RQS bit National Instruments Corporation 4 7 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 included in the wait mask Aside from the difficulty caused by ESRQ in waiting for RQS the error will have no detrimental effects on other GPIB operations If you call the serial poll function ibrsp and have received one or more responses previously via the automatic serial poll feature the ibrsp function returns the first queued response Other respons
32. short AOUpdateChamnels short device char channelString double voltageArray Purpose This function applies specified voltages to the analog output channel specified in the channelString Parameters device short integer Assigned by configuration utility channelString string The analog output channels to which the voltages are applied voltageArray double array The voltages that are applied to the specified analog output channels Return Value short integer Refer to error codes in Table 10 5 O National Instruments Corporation 10 23 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Parameter Discussion channelString is the analog output channels to which the voltages are applied Refer to the Channel String for Analog Output Functions subsection of the Easy I O for DAO Library Function Overview section of this chapter for the syntax of this string voltageArray is the voltages that are applied to the specified analog output channels This array should contain the voltages to be applied to the analog output channels in the order that is specified in the channelString For example if the channelString contains 0 1 3 then voltage 0 LD 1 2 volts applied to channel 0 voltage 1 2 4 2 4 volts applied to channel 1 voltage 2 3 6 3 6 volts applied to channel 3 ContinuousPulseGenConfig short error ContinuousPulseGenConfig short device char c
33. 1 2 external module utility functions GetExternalModuleAddr 8 21 to 8 22 LoadExternalModule 8 49 to 8 52 LoadExternalModuleEx 8 52 to 8 54 ReleaseExternalModule 8 59 RunExternalModule 8 62 to 8 63 UnloadExternalModule 8 84 to 8 85 O National Instruments Corporation 1 7 Index F fax technical support Appendix 1 fdopen function ANSI C Library 1 9 to 1 10 file I O functions CloseFile 2 7 errno global variable 1 6 GetFileInfo 2 17 OpenFile 2 20 to 2 22 ReadFile 2 22 to 2 23 SetFilePtr 2 26 to 2 28 WriteFile 2 29 to 2 30 file utility functions CopyFile 8 7 to 8 8 DeleteFile 8 10 to 8 11 GetFileAttrs 8 23 to 8 24 GetFileDate 8 24 to 8 25 GetFileSize 8 25 to 8 26 GetFileTime 8 26 to 8 27 GetFirstFile 8 27 to 8 29 GetNextFile 8 33 RenameFile 8 60 to 8 61 SetFileAttrs 8 67 to 8 68 SetFileDate 8 68 to 8 69 SetFileTime 8 70 SplitPath 8 77 to 8 78 FileToArray function 2 11 to 2 12 FillBytes function 2 13 FindPattern function 2 13 to 2 14 floating point modifiers f formatting functions 2 37 to 2 38 scanning functions 2 45 to 2 46 FlushInQ function 5 18 FlushOutQ function 5 19 Fmt FmtFile and FmtOut functions See formatting function programming examples formatting functions format codes formatting functions 2 34 to 2 35 scanning functions 2 42 to 2 43 format string formatting functions 2 33 to 2 35 examples 2 33 to 2 34 form of 2 34 format codes 2 34 to 2 35 LabWindows CVI Sta
34. 10 1 Channel String analog input functions 10 4 to 10 5 analog output functions 10 7 classes 10 3 command strings 10 6 device numbers 10 4 error conditions table 10 57 to 10 66 function reference AlAcquireTriggeredWaveforms 10 8 to 10 13 AlAcquireWaveforms 10 33 to 10 34 AICheckAcquisition 10 15 AIClearAcquisition 10 15 AlReadAcquisition 10 16 to 10 17 AlSampleChannel 10 17 to 10 18 AlSampleChannels 10 18 AlStartAcquisition 10 19 AOClearWaveforms 10 20 AOGenerate Waveforms 10 21 to 10 22 AOUpdateChannel 10 22 to 10 23 AOUpdateChannels 10 23 to 10 24 ContinuousPulseGenConfig 10 24 to 10 26 LabWindows CVI Standard Libraries I 6 CounterEventOrTimeConfig 10 26 to 10 29 CounterMeasureFrequency 10 29 to 10 32 CounterRead 10 32 to 10 33 CounterStart 10 33 CounterStop 10 34 DelayedPulseGenConfig 10 34 to 10 36 FrequencyDividerConfig 10 37 to 10 39 GetAILimitsOfChannel 10 40 to 10 41 GetChannellIndices 10 41 to 10 42 GetChannelNameFromIndex 10 42 to 10 43 GetDAQErrorString 10 43 to 10 44 GetNumChannels 10 44 GroupByChannel 10 44 to 10 45 ICounterControl 10 45 to 10 47 PlotLastAlWaveformsPopup 10 47 Pulse WidthOrPeriodMeasConftig 10 48 to 10 49 ReadFromDigitalLine 10 49 to 10 51 ReadFromDigitalPort 10 51 to 10 52 SetEasyIOMultitaskingMode 10 53 WriteToDigitalLine 10 53 to 10 55 WriteToDigitalPort 10 55 to 10 56 function tree 10 2 to 10 3 limitations 10 2 overview 10 1 valid cou
35. 1985 DST begins at 2 00 a m on the last Sunday in March and ends at 2 00 a m on the last Sunday in October You can change the way LabWindows CVI determines DST by changing this string in the cvimsgs txt file The countmsg exe program must be executed after changing the text file You should execute the following line countmsg cvimsgs txt Control Functions The assert macro defined by LabWindows CVI does not print diagnostics to the standard error stream when the debugging level is anything other than None Instead when the value of its argument evaluates to zero LabWindows CVI will display a dialog box with a message containing the file name line number and expression that caused the assert to fail Under UNIX system passes the specified command to the Bourne shell sh as input as if the current process was performing a wait 2V system call and was waiting until the shell terminated Callbacks are not called while the command is executing Under Windows the executable can be either an MS DOS or Microsoft Windows executable including exe com bat and pif files The function does not return until the command terminates and user keyboard and mouse events are ignored until the command exits Callbacks for asynchronous events such as idle events Windows messages and VXI interrupts PostDeferredCall calls and DAQ events are called while the command is executing If you need to execute a command built into command com suc
36. 1995 e Nye Adrian Xlib Programming Manual Sebastopol California O Reilly amp Associates 1994 ISBN 0 937175 27 7 e Gettys James and Robert W Scheifler Xlib C Language X Interface MIT X Consortium Standard Cambridge Massachussetts X Consortium 1994 ISBN none Customer Communication National Instruments wants to receive your comments on our products and manuals We are interested in the applications you develop with our products and we want to help if you have problems with them To make it easy for you to contact us this manual contains comment and technical support forms for you to complete These forms are in the appendix Customer Communication at the end of this manual LabWindows CVI Standard Libraries XX National Instruments Corporation Chapter 1 ANSI C Library This chapter describes the ANSI C Standard Library as implemented in LabWindows CVI Note When you link your executable or DLL with an external compiler you are using the ANSI C library of the external compiler Table 1 1 ANSI C Standard Library Classes Header File Character Handling lt ctype h gt Character Testing Character Case Mapping Date and Time lt time h gt Time Operations Time Conversion Time Formatting Localization lt locale h gt Mathematics lt math h gt Trigonometric Functions Hyperbolic Functions Exp and Log Functions Power Functions Nonlocal Jumping lt setjmp h gt Signal Handling lt signal h gt Input
37. 2 64 String to Real After Finding a Substring in the String 2 64 String with Comma Separated ASCII Numbers to Real Array 2 65 Scanning Strings That Are Not NUL Terminated coooconnccnnnninoninonnninns 2 65 Integer Array to ROA dolida 2 66 Integer Array to Real Array with Byte Swapping oococoncccnnocccinnncnnnnoss 2 66 Integer Array Containing 1 Byte Integers to Real Array 2 66 String Containing Binary Integers to Integer Array eee 2 67 String Containing an IEEE Format Real Number ta Real Maa Ie 2 67 ASCII File to Two Integers with Error Checking ooonoccnnncnnoninoncconnos 2 68 ASCII File with Comma Separated Numbers to Real Array with Number of Elements at Beginning of File ooooococnnococioncccnonnnonns 2 68 Binary File to Integer Array Assuming a Fixed Number Of Elements id A eden 2 69 Binary File to Real Array Assuming a Fixed Number of Elements 2 69 Binary File to Real Array Assuming a Variable Number Of Elements cri tits 2 69 Reading an Integer from the Standard Input oooooonnccnnncnnonanoconaccnonnnnnos 2 70 Reading a String from the Standard Input eee eee esseceteeeeeeeenees 2 70 Reading a Line from the Standard Input eee eeeeceeeeeeeeeeeeeeeeeeeees 2 71 National Instruments Corporation vil LabWindows CVI Standard Libraries Contents Chapter 3 Analysis Lib a do da a le Dd 3 1 Analysis Library Function OYE IE Wi 3 1 The Analysis Library Function Panels oooo
38. 2 Compatibility driver Native 32 Bit Driver The native 32 bit driver is a 32 bit device driver written specifically for Windows 95 It is supported on the following boards e AT GPIB TNT e AT GPIB TNT e AT GPIB TNT PnP e PCI GPIB e PCMCIA GPIB e PCMCIA GPIB LabWindows CVI Standard Libraries 4 10 National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library If you want to use GPIB under Windows 95 and you have an older board it is recommended that you upgrade to one of the boards in this list Compatibility Driver The compatibility driver is a 32 to 16 bit thunking DLL that you can use with the Windows 3 1 GPIB driver under Windows 95 All GPIB boards are supported by the compatibility driver The compatibility driver has several limitations In particular it does not support multithreading and transfers are limited to 64k bytes Windows NT The GPIB driver for Windows NT is a native 32 bit driver written specifically for Windows NT Version 1 0 supports the following boards e AT GPIB e AT GPIB TNT Version 1 2 due to be released in the second half of 1996 will add support for the PCI GPIB and PCMCIA GPIB Limitations on Transfer Size There are no limitations on transfer size except for the compatibility driver under Windows 95 The compatibility driver is limited to 64 KB transfers Multithreading If you are using multithreading in an external compiler you can call GPIB functions from more
39. 2L n round 0 5 result OL RunExternalModule int result RunExternalModule int moduleID char buffer Purpose Calls the pre defined entry point function in an external module see LoadExternalModule Parameters moduleID integer ID of loaded module buffer string Parameter buffer Return Value Indicates the result of the operation Return Codes Success Out of memory Entry point is undefined Invalid file format Undefined references Cannot open file Invalid module ID LabWindows CVI Standard Libraries 8 62 National Instruments Corporation Chapter 8 Utility Library Parameter Discussion modulelD is the value LoadExternalModule returns buffer is a character array in which you can pass information to and from the module RunExternalModule requires that the module define the following function void _xxx_entry_ point char where xxx 1s the base name of the file in lowercase For example if the pathname of the file is as follows C LW PROGRAMS TESTO1 OBJ then the name of the entry point must be _test01_entry_point Example int module_id int status char pathname pathname EXTMOD OBJ module_id LoadExternalModule pathname if module_id lt 0 FmtOut Unable to load s n pathname else RunExternalModule module_id UnloadExternalModule module_id SetBreakOnLibraryErrors int oldState SetBreak
40. 6 hardware handshaking 5 7 to 5 8 hardware interrupts and autopolling 4 8 to 4 9 help starting See SystemHelp function hidden window for providing X window IDs 9 3 to 9 4 Histogram function 3 19 to 3 20 I VO functions See also Easy I O for DAQ Library Formatting and I O Library functions Standard Input Output window functions GPIB Library 4 2 low level GPIB GPIB 488 2 I O functions 4 4 LabWindows CVI Standard Libraries I 10 port I O utility functions inp 8 42 inpw 8 42 to 8 43 outp 8 56 outpw 8 56 RS 232 Library ComFromFile 5 3 5 9 to 5 10 ComRd 5 11 ComRdByte 5 12 ComRdTerm 5 12 to 5 13 ComToFile 5 3 5 15 to 5 16 ComWrt 5 16 to 5 17 ComWrtByte 5 17 to 5 18 IBCONF utility 4 6 ibdev function 4 6 ibfind function 4 6 ibInstallCallback function 4 14 to 4 17 callback function 4 17 driver version requirements 4 12 purpose and use 4 14 to 4 17 SRQI RQS and auto serial polling 4 16 synchronous callbacks 4 12 ibNotify function 4 17 to 4 20 asynchronous callbacks 4 12 callback function 4 19 to 4 20 driver version requirements 4 12 purpose and use 4 17 to 4 20 rearming error warning 4 19 restrictions in asynchronous callbacks 4 20 SRQI RQS and auto serial polling 4 19 ICounterControl function 10 45 to 10 47 InitCVIRTE function 8 40 to 8 42 inp function 8 42 input output facilities ANSI C 1 6 inpw function 8 42 to 8 43 InstallComCallback function 5 22 to 5 25 InstallXPro
41. 6 15 RESIDES aa 6 16 A O 6 19 SetUpDDEH Ot Link iii eden ini 6 20 SECU PLD EW aries ii lie alinea 6 21 Terminate DDE Gini innr E E E EET 6 22 UnregisterDDESeryer it a i A RE EEE ANRE ASS 6 23 Error Conditions os Sc 6 23 Chapter 7 TCP Library ereas I et o a e ta 7 1 TCP Library Function OVER 7 1 The TCP Library Function Panels ccscs sssccsasascesascevecsasscactessdeneveavesaaenavnncsans 7 1 TCP Clh ntsand Servers e 7 2 The TCP Callback uncon Aa 7 2 TCP Library Function Reference resina ica ode ia 7 3 CHET CP REAG aa A bic 7 3 ChentTEPWTTE soni ost 7 4 C nnectTorCPSErVEr e a a E die 7 5 DiscomnecttromTOPSCIVET tonic 7 7 Disconnect TCP Client inusitado arranco atenta iada indias banda cated tone 7 7 Gel PC PEROES ne ti ia 7 8 IG SISter PEP SER A O AI 7 8 Server PO PREAG eciivehsativgshaaande iia 7 10 Server A A A a ea E easi 7 11 A AA O E AREA 7 11 a A A ee ON ee Re 7 12 National Instruments Corporation xi LabWindows CVI Standard Libraries Contents Chapter 8 Pity D Dra ts tt a alc e dd a 8 1 The Utility Library Function Panel ds 8 1 Utility Library Function Reference ssssesseessesseeessseesseessresseesseresseersseessresseesseeesseee 8 5 BOO 8 5 TO 8 6 Close CVIRTE SN anton dan testa naam antes 8 6 ia 8 7 CopyFile ai indias 8 7 CNV iILowLevelSupportDriverLoaded ini 8 8 Whe got ann RPGR RST EE CER rr 9 Reson SAE Ret RTE oan heen oP MeO Ti ane Arenal eee 8 9 Delay died 8 9 SA NOS 8 10 O 8 10 DisableBreakO
42. 8 35 to 8 36 GetStdioWindowPosition 8 36 to 8 37 GetStdioWindowSize 8 37 GetStdioWindow Visibility 8 37 to 8 38 SetStdioPort 8 71 to 8 72 SetStdioWindowOptions 8 72 to 8 74 SetStdioWindowPosition 8 74 to 8 75 SetStdioWindowSize 8 75 SetStdioWindow Visibility 8 76 standard language additions ANSI C 1 2 to 1 5 National Instruments Corporation I 15 Index statistics functions Histogram 3 19 to 3 20 Mean 3 25 to 3 26 Sort 3 29 StdDev 3 29 to 3 30 Status control GPIB 4 6 status functions See also error related functions Formatting and I O Library functions GetFmtErrNdx 2 18 GetFmtIOError 2 18 to 2 19 GetFmtlOErrorString 2 19 NumFmtdBytes 2 20 RS 232 library GetComStat 5 19 to 5 20 GetInQLen 5 20 to 5 21 GetOutQLen 5 4 5 21 GetRS232ErrorString 5 22 ReturnRS232Err 5 28 thread specific GPIB Library ThreadIbent 4 22 ThreadIbentl function 4 22 to 4 23 ThreadIberr 4 23 to 4 25 ThreadIbsta 4 25 to 4 26 Status Word ibsta global variable 4 6 4 10 StdDev function 3 29 to 3 30 string manipulation functions CompareBytes 2 7 to 2 8 CompareStrings 2 8 to 2 9 CopyBytes 2 9 to 2 10 CopyString 2 10 definition 2 3 FillBytes 2 13 FindPattern 2 13 to 2 14 ReadLine 2 23 to 2 24 StringLength 2 28 StringLowerCase 2 28 to 2 29 StringUpperCase 2 29 WriteLine 2 30 to 2 31 string modifiers s formatting functions 2 38 to 2 39 scanning functions 2 46 to 2 48 string proce
43. 8 78 SyncWait 8 79 SystemHelp 8 79 to 8 81 TerminateExecutable 8 82 Timer 8 83 TimeStr 8 83 LabWindows CVI Standard Libraries Index TruncateRealNumber 8 84 UnloadExternalModule 8 84 to 8 85 WriteToPhysicalMemory 8 85 to 8 86 WriteToPhysicalMemoryEx 8 86 to 8 87 Vv va_arg macro l 2 variable argument functions LabWindows CVI support of 1 2 vector and matrix algebra functions Determinant 3 16 DotProduct 3 18 InvMatrix 3 20 to 3 21 MatrixMul 3 23 Transpose 3 36 void HandlePropertyNotifyEvent function 9 7 void_InitXPropertyLib function 9 7 W wait utility functions See timer wait utility functions window functions standard input output See Standard Input Output window functions window properties accessing GetXWindowPropertyItem 9 20 to 9 22 GetXWindowPropertyV alue 9 22 to 9 25 PutXWindowPropertyItem 9 27 to 9 28 PutX WindowProperty Value 9 29 to 9 31 RemoveX WindowProperty 9 31 to 9 32 Windows 95 GPIB support 4 10 to 4 11 compatibility driver 4 11 native 32 bit driver 4 10 Windows NT and GPIB driver 4 11 limitations on transfer size 4 11 multithreading 4 11 LabWindows CVI Standard Libraries I 18 notification of SRQ and other GPIB events 4 12 asynchronous callbacks 4 12 driver version requirements 4 12 synchronous callbacks 4 12 write termination GPIB 4 9 WriteFile function 2 29 to 2 30 WriteLine function 2 30 to 2 31 WriteToDigitalLine function 10 53 to 10 5
44. A Abs1D function 3 4 to 3 5 accessing physical memory See physical memory access functions accessing window properties See window properties accessing Add1D function 3 5 Add2D function 3 5 to 3 6 AdviseDDEDataReady function 6 6 to 6 8 AlAcquireTriggeredWaveforms function 10 8 to 10 13 AlAcquireWaveforms function 10 13 to 10 14 AICheckAcquisition function 10 15 AlClearAcquisition function 10 15 AlReadAcquisition function 10 16 to 10 17 AISampleChannel function 10 17 to 10 18 AlISampleChannels function 10 18 AlStartAcquisition function 10 19 analog input functions See also Easy I O for DAQ Library AlAcquireTriggeredWaveforms 10 8 to 10 13 AlAcquireWaveforms 10 33 to 10 34 AlSampleChannel 10 17 to 10 18 AlSampleChannels 10 18 Channel String 10 4 to 10 5 O National Instruments Corporation El analog output functions See also Easy I O for DAQ Library AOClearWaveforms 10 20 AOGenerate Waveforms 10 21 to 10 22 AOUpdateChannel 10 22 to 10 23 AOUpdateChannels 10 23 to 10 24 Channel String 10 7 Analysis Library functions error conditions 3 37 function panels classes and subclasses 3 3 function tree table 3 1 to 3 2 hints for using 3 3 to 3 4 function reference Abs1D 3 4 to 3 5 Add1D 3 5 Add2D 3 5 to 3 6 Clear1D 3 6 to 3 7 Copy1D 3 7 CxAdd 3 7 to 3 8 CxAdd1D 3 8 to 3 9 CxDiv 3 9 CxDiv1D 3 10 CxLinEv1D 3 11 CxMul 3 12 CxMul1D 3 12 to 3 13 CxRecip 3 13 to 3 14 CxSub 3 14 CxSub1
45. CVI would use the German names of months and days For the LC_COLLATE locale e strcoll maps to the Windows function 1st rcmp Because LabWindows CVI does not support extended character sets that require more than a byte per character a multibyte character in LabWindows CVI is actually a single byte character Likewise a multibyte sequence is a sequence of single byte characters Because a multibyte character is the same as a wide character the conversion functions described in these sections do little more than return their inputs as outputs Character Processing LabWindows CVI implements all the ANSI C character processing facilities as both macros and functions The macros are disabled when the LabWindows CVI debugging level is set to Standard or Extended so that user protection is available for the arguments to the functions String Processing Under UNIX the strco11 function is equivalent to st rcmp and its behavior is not affected by the LC_COLLATE locale Under Windows strcol1 is equivalent to the Windows function 1st rcmp For both platforms the function st rxf rm performs a string copy using strncpy and returns the length of its second argument O National Instruments Corporation 1 5 LabWindows CVI Standard Libraries ANSI C Library Chapter 1 Input Output Facilities The function rename fails if the target file already exists Under Microsoft Windows rename fails if the source and target files are on different disk driv
46. Chapter 10 Easy I O for DAQ Library Parameters device short Assigned by configuration utility integer counter string The counter to be used for the counting operation counterSize unsigned Determines the size of the counter used to short perform the operation integer sourceTimebase double USE_ COUNTER_SOURCE count TTL edges at counter s SOURCE pin or supply a valid internal timebase frequency to count the TTL edges of an internal clock countLimitAction unsigned The action to take when the counter reaches short terminal count integer sourceEdge short The edge of the counter source or timebase signal integer on which it increments gateMode unsigned Specifies how the signal on the counter s GATE short pin is used integer taskID unsigned The reference number assigned for the counter long reserved for this operation You pass taskID to integer CounterStart CounterRead and CounterStop Return Value error short Refer to error codes in Table 10 5 integer Parameter Discussion counter is the counter to be used for the counting operation The valid counters are shown in Table 10 2 which is found in the Valid Counters for the Counter Timer Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter counterSize determines the size of the counter used to perform the operation e Fora device with DAQ STC counters counterSize must be ONE_COUNTER 24 bit e
47. Chapter 4 Only one callback function can apply for each board or device Each call to this function for the same board or device supersedes the previous call To disable callbacks for a board or device pass 0 for the eventMask parameter Parameters boardOrDevice integer A board index or a board or device descriptor returned by OpenDev ibfind or ibdev eventMask integer Specifies the events upon which the callback function is called Pass 0 to disable callbacks See discussion below callbackFunction GpibNotifyCallback_t The name of the user function that is called when the specified events occur See discussion below callbackData void pointer A pointer to a user defined four byte value that is passed to the callback function Return Value status integer The same value as the ibsta status variable Refer to your NI 488 2M user manual for a description of the values of ibsta status variable eventMask The conditions upon which to invoke the callback function are specified as bits in the eventMask parameter The bits corresponds to the bits of the ibsta status word This value reflects a sum of one or more events If any one of the conditions occur the callback is called If when you install the callback one of the bits you have set in the mask is already TRUE the callback is called immediately For example if you pass CMPL as the eventMask and the ibwait function would currently return a status word wit
48. DAQ library are located in the cvi samples easyio directory These sample programs are discussed in the EASYIO section of cvi samples doc Note It is recommended that you do not mix calls to the Data Acquisition Library with similar types of calls to the Easy I O for DAQ Library in the same application For example do not mix analog input calls to the Data Acquisition Library with analog input calls to the Easy I O for DAQ Library in the same program Advantages of Using the Easy I O for DAQ Library If you want to scan multiple analog input channels on an MIO board using the Data Acquisition Library you have to programmatically build a channel list and a gain list before calling SCAN_Op The Easy I O for DAQ functions accept a channel string and upper and lower input limit parameters so that you can easily perform a scan in one step In the Data Acquisition Library you may have to use Lab_ISCAN_Op or SCAN_Op or MDAO_ Start depending on which DAQ device you are using Also if you are using SCXI there are a number of SCXI specific functions that must be called prior to actually acquiring data National Instruments Corporation 10 1 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 The Easy I O for DAQ functions are device independent which means that you can use the same function on a Lab series board an MIO board an EISA A2000 or SCXI module Limitations of Using the Easy I O for DAQ Library The Eas
49. Library Chapter 10 Table 10 5 Easy I O for DAQ Error Codes Continued 10340 noConnectErr No RTSI signal line is connected or the specified signal and the specified line are not connected badConnectErr The RTSI signal line cannot be connected as specified L0342 multConnectErr The specified RTSI signal is already being driven by a RTSI line or the specified RTSI line is already being driven by a RTSI signal 10343 SCXIConfigErr The specified SCXI configuration parameters are invalid or the function cannot be executed given the current SCXI configuration 10360 DSPInitErr The DSP driver was unable to load the kernel for its operating system 10370 badScanListErr The scan list is invalid This error can result if for example you mix AMUX 64T channels and onboard channels or if you scan multiplexed SCXI channels out of order 10400 userOwnedRsrcErr The specified resource is owned by the user and cannot be accessed or modified by the driver 10401 unknownDeviceErr The specified device is not a National Instruments product or the driver does not work with the device for example the driver was released before the features of the device existed iea deviceNotFoundErr No device is located in the specified slot or at the specified address 3 deviceSupportErr The requested action does not work with specified device the driver recognizes the device but the action is inappropriate for the device 1
50. Module Get External Module Address Unload External Module Release External Module Port I O Input Byte From Port Input Word From Port Output Byte To Port Output Word To Port LabWindows CVI Standard Libraries 8 2 Delete File RenameFile CopyFile GetFileSize GetFileDate SetFileDate GetFileTime SetFileTime GetFileAttrs SetFileAttrs GetFirstFile GetNextFile MakePathname SplitPath GetDir GetProjectDir GetModuleDir GetFullPathFromProject SetDir MakeDir DeleteDir GetDrive SetDrive LoadExternalModule LoadExternalModuleEx RunExternalModule GetExternalModuleAddr UnloadExternalModule ReleaseExternalModule inp inpw outp outpw continues National Instruments Corporation Chapter 8 Utility Library Table 8 1 The Utility Library Function Tree Continued Standard Input Output Window Clear Screen Get Stdio Window Options Set Stdio Window Options Get Stdio Window Position Set Stdio Window Position Get Stdio Window Size Set Stdio Window Size Get Stdio Window Visibility Set Stdio Window Visibility Get Stdio Port Set Stdio Port Run Time Error Reporting Set Break On Library Errors Get Break On Library Errors Set Break On Protection Errors Get Break On Protection Errors Old Style Functions Enable Break On Library Errors Disable Break On Library Errors Interrupts Disable Interrupts Enable Interrupts Get Interrupt State Physical Memory Access Read From Physical Memory Read From Physical Memor
51. National Instruments Corporation 1 9 LabWindows CVI Standard Libraries ANSI C Library Chapter 1 Parameter Discussion mode is the same as the mode parameter to fopen You should use a mode value that is consistent with the mode in which you originally opened the file If you use write capabilities that were not enabled when the file handle was originally opened the call to dopen succeeds but any attempt to write fails For instance if you originally opened the file for reading only you can pass rw to dopen but any call to fwrite fails LabWindows CVI Standard Libraries 1 10 O National Instruments Corporation Chapter 2 Formatting and I O Library This chapter describes the functions in the LabWindows CVI Formatting and I O Library and contains many examples of how to use them The Formatting and I O Library contains functions that input and output data to files and manipulate the format of data in a program The Formatting and I O Library Function Overview section contains general information about the Formatting and I O Library functions and panels Because the Formatting and I O Library differs in many respects from the other LabWindows CVI libraries it is very important to read the overview before reading the other sections of this chapter The Formatting and I O Library Function Reference section contains an alphabetical list of function descriptions This section is helpful for determining the syntax of the file I O and stri
52. O Library The LabWindows CVI Formatting and I O Library functions are arranged alphabetically ArrayToFile int status ArrayToFile char fileName void array int dataType int numberOfElements int numberOfGroups int arrayDataOrder int fileLayout int colSepStyle t fieldWidth int fileType int fileAction int Purpose Saves an array to a file using various formatting options The function handles creating opening writing and closing the file The file can later be read back into an array using the FileToArray function Parameters fileName string File pathname array void Numeric array dataType integer Array element data type numberOfElements integer Number of elements in array numberOfGroups integer Number of groups in array arrayDataOrder integer How groups are ordered in file fileLayout integer Direction to write groups in file colSepStyle integer How data on one line are separated fieldWidth integer Constant width between columns fileType integer ASCII binary mode fileAction integer File pointer reposition location LabWindows CVI Standard Libraries 2 4 National Instruments Corporation Chapter 2 Formatting and I O Library Return Value Return Codes Success Error attempting to open file Error attempting to close file An I O error occurred Invalid dataType parameter Invalid numberOfElements parameter Invalid numberOfGroups parameter Invalid arr
53. O for DAQ Library Chapter 10 Parameters device short integer Assigned by configuration utility channelString string The analog channel string channelSubString string A sub string of the channelString channelType short integer Specifies whether the channelString is ANALOG_INPUT or ANALOG_OUTPUT Output channelIndices long integer Returns the indices of the channels in the array channelSubString Return Value short integer Refer to error codes in Table 10 5 Parameter Discussion channelString is the analog channels that are to be sampled Refer to the Channel String for Analog Input Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter for the syntax of this string channelSubString is a sub string of the channelString For example if the channelString is 0 3 5 the sub string could be 2 or Ml Ou GetChannelNameFromIndex short error GetChannelNameFromIndex short device char channelString long index short channelType char channelName_ Purpose Determines the name of the particular channel in the channelString indicated by index LabWindows CVI Standard Libraries 10 42 National Instruments Corporation Chapter 10 Parameters device short integer channelString string index long integer channelType short integer Easy I O for DAQ Library Assigned by configuration utility Analog input channels that are to be sampled The
54. O for DAQ Library Chapter 10 Return Value error short Refer to error codes in Table 10 5 integer Parameter Discussion counter is the counter to be used for the counting operation The valid counters are shown in Table 10 2 which is found in the Valid Counters for the Counter Timer Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter counterSize determines the size of the counter used to perform the operation e Fora device with DAQ STC counters counterSize must be ONE_COUNTER 24 bit e Fora device with Am9513 counters counterSize can be ONE_COUNTER 16 bit or TWO_COUNTERS 32 bit e If you use TWO_COUNTERS counter 1 is cascaded with the specified counter counter 1 is defined as shown in Table 10 3 in the function description for CounterEventOrTimeConfig counterMinus1GateMode is the gate mode for counter 1 The possible values are UNGATED_SOFTWARE_START e COUNT_WHILE_GATE_HIGH e COUNT _WHILE GATE LOW e START_COUNTING_ON_RISING_EDGE counter 1 is used to gate counter so that rising edges are counted over a precise sample time For a specified counter counter 1 is defined as shown in Table 10 4 CounterRead short error CounterRead unsigned long taskID short overflow long count Purpose Reads the counter identified by taskID LabWindows CVI Standard Libraries 10 32 National Instruments Corporation C
55. Output lt stdio h gt Open Close Read Write Flush Line Input Output Character Input Output Formatted Input Output Buffer Control File Positioning File System Operations Error Handling continues National Instruments Corporation 1 1 LabWindows CVI Standard Libraries ANSI C Library Chapter 1 Table 1 1 ANSI C Standard Library Classes Continued General Utilities lt stdlib h gt String to Arithmetic Expression Random Number Generation Memory Management Searching and Sorting Integer Arithmetic Multibyte Character Sets Program Termination Environment String Handling lt string h gt Byte Operations String Operations String Searching Collation Functions Miscellaneous Low Level I O Functions Under UNIX you can use the low level I O functions such as open sopen read and write from the system library by including system header files in your program Under Windows you can use these functions by including cvi include ansi lowlvlio hin your program No function panels are provided for these functions Standard Language Additions LabWindows CVI does not support extended character sets that require more than 8 bits per character As a result the wide character type wchar_t is identical to the single byte char type LabWindows CVI accepts wide character constants specified with the L prefix as in L ab but only the first character is significant Furthermore library functions that use the
56. STOP TRIG input stops the acquisition e If you choose Scan Clock Gating an external signal gates the scan clock on and off If the scan clock gate becomes FALSE the current scan completes and the scan clock ceases operation When the scan clock gate becomes TRUE the scan clock immediately begins operation again e If you choose Equivalent Time Sampling This is a mode in which the Equivalent Time Sampling technique is used on an E Series DAQ device to achieve an effective acquisition rate of up to 20 MHz The signal that is being measured must be a periodic waveform The trigger conditions must be satisfied or this function times out Equivalent Time Sampling is the process of taking A D conversions from a periodic waveform at special points in time such that when the A D conversions are placed side by side they represent the original waveform as if it had been sampled at a high frequency LabWindows CVI Standard Libraries 10 10 National Instruments Corporation Chapter 10 Easy I O for DAQ Library For example if the A D conversions represented by x s on the waveform shown below are placed side by side they represent one cycle of the waveform Equivalent Time Sampling is accomplished in this function as follows l Set a hardware analog trigger condition for measuring your waveform using the Edge Slope Trigger Level and Trigger Source parameters of this function Whenever a hardware analog trigger
57. The Fmt File call writes the ASCII representation of a real array element to the file followed by a comma The w modifier specifies that the number be right justified in a 15 character field The WriteFile call writes a linefeed to the file after every fifth call to FmtFile Because the file is opened in ASCII mode the linefeed is automatically written as a linefeed carriage return combination Note If the format string is Ss w15 lt f the number and the comma are left justified together in a 15 character field Integer Array to Binary File Assuming a Fixed Number of Elements int readings 100 int file handle nbytes file handle OpenFile FILE DAT 2 0 0 FmtFile file handle 100i lt 100i readings nbytes NumFmtdBytes CloseFile file_handle Remarks The Fmt File call writes all 100 elements of the integer array readings to a file in binary form If the Fmt File call is successful noytes 200 100 integers 2 bytes per integer Real Array to Binary File Assuming a Fixed Number of Elements double waveform 100 int file_handle nbytes file handle OpenFile FILE DAT 2 0 0 FmtFile file_handle 100f lt 100f waveform nbytes NumFmtdBytes CloseFile file_handle Remarks The Fmt File call writes all 100 elements of the real array waveform to a file in binary form If the Fmt File call is successful noytes 800 100 integers 8 bytes per real number L
58. an empty string for deviceName the library uses the following device names depending on the COM port number you have specified Port Number deviceName on Windows deviceName on UNIX COM1 COM2 COM3 COM4 and so on National Instruments Corporation dev ttya dev ttyb dev ttys1 dev ttys2 5 27 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Under UNIX the inputQueueSize and outputQueueSize parameters are ignored The serial driver determines the queue size Under Windows if you specify 0 for inputQueueSize or outputQueueSize 512 is used If you specify a value between 0 and 30 30 is used On Windows 95 and NT there is no maximum limitation on the queue size On Windows 3 1 the maximum queue size is 65535 However some serial drivers have a maximum of 32767 and give undefined behavior when you use a larger queue size It is recommended that you use a queue size no greater than 32767 Under Windows 3 1 the baudRate value may be from 0 to Oxf fff Values below 0xff00 are interpreted by the comm driver literally Values from Oxf f00 to Oxf ff f are codes defined by the particular comm driver to represent rates higher than Oxfeff Under Windows 95 and NT all baudRate values are interpreted literally by the comm driver Using This Function The function disables XON XOFF mode and CTS hardware handshaking The default time out for I O operations is 5 second
59. are to pass the array to a graph you should acquire the data grouped by channel e Ifyou are to pass the array to a strip chart you should acquire the data grouped by scan e You can also acquire the data grouped by scan and later reorder it to be grouped by channel using the GroupByChannel function LabWindows CVI Standard Libraries 10 12 O National Instruments Corporation Chapter 10 Easy I O for DAQ Library waveforms is an array containing the voltages acquired on the channels specified in the channelString The acquired voltages are placed into the array in the order specified by fillMode This array must be declared as large as number of channels numberOfScans You can determine the number of channels using the Get NumChannel1s function AlAcquireWaveforms short error AIAcquireWaveforms short device char channelString long numberOfScans double scansPerSecond double highLimitVolts double lowLimitVolts double actualScanRate short fillMode double waveforms Purpose This function performs a timed acquisition of voltage data from the analog channels specified in the channelString Parameters device short Assigned by configuration utility integer channelString string Analog input channels that are to be sampled numberOfScans long Number of scans to be acquired One scan involves integer sampling every channel in the channelString once scansPerSecond double Number of scans performed
60. be terminated upon occurrence of a numeric expression Using Ss gt s t Sd with the source string ab567 ab is placed in the first target and the integer 567 is placed in the second target National Instruments Corporation 2 47 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 xX Discard Terminator When applied to a target string the x modifier specifies that the terminating character be discarded before the next target is filled in Using S gt s xt59 s xt59 with the source string abc XYZ abc is placed in the first target and XYZ is placed in the second target d Discard Data When applied to a target specifier the d modifier indicates that there is no target argument to correspond to the target specifier The data that otherwise is placed in the target argument is discarded instead The count returned by the Scan ScanFile ScanIn functions will include the target specifier even if the d modifier is used Scan ScanFile ScanIn Asterisks Instead of Constants in Format Specifiers Often a format specifier requires one or more integer values The format specifier for an integer array for example requires the number of elements rep You can use constants for these integer values in format specifiers Alternatively you can specify an integer value using an argument in the argument list When you use this method substitute an asterisk for the constant in the format specifier Use the a
61. board and FTP services and for BBS automated information call 512 795 6990 You can access these services at e United States 512 794 5422 or 800 327 3077 Up to 14 400 baud 8 data bits 1 stop bit no parity e United Kingdom 01635 551422 Up to 9 600 baud 8 data bits 1 stop bit no parity e France 1 48 65 15 59 Up to 9 600 baud 8 data bits 1 stop bit no parity FaxBack Support FaxBack is a 24 hour information retrieval system containing a library of documents on a wide range of technical information You can access FaxBack from a touch tone telephone at the following number 512 418 1111 National Instruments Corporation A 1 LabWindows CVI Standard Libraries Customer Communication FTP Support To access our FTP site log on to our Internet host ftp natinst com as anonymous and use your Internet address such as joesmith anywhere com as your password The support files and documents are located in the support directories Appendix A E Mail Support currently U S only You can submit technical support questions to the appropriate applications engineering team through e mail at the Internet addresses listed below Remember to include your name address and phone number so we can contact you with solutions and suggestions GPIB gpib support natinst com DAQ daq support natinst com VXI vxi support natinst com LabVIEW lv support natinst com LabWindows lw support natinst com HiQ hiq support natins
62. change these defaults OpenComConfig int result OpenComConfig int COMPort char deviceName long baudRate int parity int dataBits int stopBits int inputQueueSize int outputQueueSize Purpose Opens a com port and sets port parameters as specified If inputQueueSize or outputQueueSize is between 1 and 29 it is forced to 30 LabWindows CVI Standard Libraries 5 26 National Instruments Corporation Chapter 5 Parameters COMPort integer deviceName string baudRate long integer dataBits integer stopBits integer inputQueueSize integer outputQueueSize integer Return Value RS 232 Library Range 1 through 32 Name of the COM port Either 110 150 300 600 1200 2400 4800 9600 14400 19200 28800 38400 56000 57600 115200 128000 or 256000 SPARCstations do not support 14400 28800 56000 57600 115200 128000 and 256000 PCs do not support 150 Some PC serial drivers do not support 115200 128000 and 256000 O no parity 1 odd parity 2 even parity 3 mark parity 4 space parity Either 5 6 7 or 8 Either 1 or 2 0 selects 512 See discussion below 0 selects 512 See discussion below Parameter Discussion deviceName is the name of the com port in the ASCII string For example COM1 for com port 1 on Microsoft Windows using COMM DRV and dev ttya for com port 1 on UNIX using the Zilog 8530 SCC serial comm driver If you pass a NULL pointer or
63. dialog box options to a final action The sequence File Page Setup Options Substitute Fonts directs you to pull down the File menu select the Page Setup item select Options and finally select the Substitute Fonts option from the last dialog box Paths in this manual are denoted using backslashes to separate drive names directories and files as in drivename dirilname dir2name myfile TEEE 488 IEEE 488 and IEEE 488 2 refer to the ANSI IEEE Standard 488 1 1987 IEEE 488 2 and the ANSIVIEEE Standard 488 2 1992 respectively which define the GPIB Abbreviations acronyms metric prefixes mnemonics symbols and terms are listed in the Glossary National Instruments Corporation xix LabWindows CVI Standard Libraries About This Manual The LabWindows CVI Documentation Set For a detailed discussion of the best way to use the LabWindows CVI documentation set see the section Using the LabWindows CVI Documentation Set in Chapter 1 Introduction to LabWindows CVI of Getting Started with LabWindows CVI Related Documentation The following documents contain information that you may find helpful as you read this manual ANSI IEEE Standard 488 1 1987 IEEE Standard Digital Interface for Programmable Instrumentation e ANSVIEEE Standard 488 2 1992 IEEE Standard Codes Formats Protocols and Common Commands e Harbison Samuel P and Guy L Steele Jr C A Reference Manual Englewood Cliffs NJ Prentice Hall Inc
64. enabled while your program is running at the user as opposed to the kernel level Return Value interrupt state integer Interrupt bit of 80x86 CPU status flag GetKey int k GetKey void Purpose Waits for the user to press a key and returns the key code as an integer value Note This function only detects keystrokes in the Standard I O window It does not detect keystrokes in windows created with the User Interface Library or in the console window in a Windows Console Application LabWindows CVI Standard Libraries 8 30 O National Instruments Corporation Chapter 8 Utility Library Parameters None Return Value Using This Function The values returned are the same as the key values used in the User Interface Library See userint h Keystroke Return Value lt Ctrl b gt VAL _MENUKEY_MODIFIER B lt Shift F4 gt Note This function returns 1 if you are running on UNIX and have done one of the following HIFT_MODIFIER VAL_F4_VKEY Selected Use hosts system s standard Input Output in the dialog box brought up by selecting Options Environment in the Project window or Called SetStdioPort to set the port to HOST_SYSTEM_STDIO Example Give the user a chance to quit the program int k FmtOut Enter q to quit any other key to continue k GetKey if k 0x0051 k 0x0071 LES OLOR exit 0 GetModuleDir int res
65. error codes in Table 10 5 Parameter Discussion portNumber specifies the digital port this function configures A portNumber value of 0 signifies port 0 a portNumber of 1 signifies port 1 and so on If you use an SCXI 1160 SCXI 1161 SCXI 1162 or SCXI 1163 module use the SCx MDy 0 syntax where x is the chassis ID and y is the module device number to specify the port on a module portWidth is the total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port on an MIO non E Series board by setting portWidth to 8 e When portWidth is greater than the physical port width of a digital port the following restrictions apply The portWidth must be an integral multiple of the physical port width and the port numbers in the combined port must begin with the port named by portNumber and must increase consecutively For example if portNumber is 3 and portWidth is 24 bits LabWindows CVI uses ports 3 4 and 5 e The portWidth for the 8255 based digital I O ports including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 should be at least 8 configure specifies whether to configure the digital port before writing e When this function is called in a loop it can be optimized by only configuring the digital port on the first iteration e When you configure a digital I O port that is part of an 8255 PPI
66. following attributes e POSITIVE_POLARITY the delay phase 1 is a low TTL level and the pulse phase 2 is a high level e NEGATIVE_POLARITY the delay phase 1 is a high TTL level and the pulse phase 2 is a low level LabWindows CVI Standard Libraries 10 36 National Instruments Corporation Chapter 10 Easy I O for DAQ Library FrequencyDividerConfig short error FrequencyDividerConfig short device char counter double sourceTimebase double timebaseDivisor unsigned short gateMode unsigned short outputBehavior short sourceEdge unsigned long taskID Purpose This function configures the specified counter to count the number of signal transitions on its SOURCE pin or on an internal timebase signal and to strobe or toggle the signal on 1ts OUT pin To divide an external TTL signal connect it to counter s SOURCE pin and set the sourceTimebase parameter to USE_COUNTER_SOURCE To divide an internal timebase signal set the sourceTimebase parameter to a desired valid frequency Set the timebaseDivisor to the desired value For a value of N and a pulsed output an output pulse equal to the period of the source or timebase signal appears on counter s OUT pin once each N cycles of that signal For a toggled output the output toggles after each N cycles The toggled output frequency is thus half that of the pulsed output in other words pulsedFrequency sourceFrequency N and toggl
67. for example 80 have been transferred Any remaining characters at the end of the line are discarded The linefeed is never transferred to the buffer ReadLine returns the number of bytes read including the number discarded but excluding the linefeed National Instruments Corporation 2 71 LabWindows CVI Standard Libraries Chapter 3 Analysis Library This chapter describes the functions in the LabWindows CVI Analysis Library The Analysis Library Function Overview section contains general information about the Analysis Library functions and panels The Analysis Library Function Reference section contains an alphabetical list of the function descriptions Analysis Library Function Overview The Analysis Library includes functions for one dimensional 1D and two dimensional 2D array manipulation complex operations matrix operations and statistics This section contains general information about the Analysis Library functions and panels The Analysis Library Function Panels The Analysis Library function panels are grouped in a tree structure according to the types of operations performed The Analysis Library function tree is shown in Table 3 1 The first and second level bold headings in the tree are the names of function classes and subclasses Function classes and subclasses are groups of related function panels The third level headings in plain text are the names of individual function panels Each analysis function panel
68. function 4 17 to 4 20 OpenDev 4 6 4 21 ThreadIbent 4 22 ThreadIbentl 4 22 to 4 23 ThreadIberr 4 23 to 4 25 ThreadIbsta 4 25 to 4 26 writing instrument modules note 4 7 device numbers Easy I O for DAQ Library 10 4 digital input output functions ReadFromDigitalLine 10 49 to 10 51 ReadFromDigitalPort 10 51 to 10 52 WriteToDigitalLine 10 53 to 10 55 WriteToDigitalPort 10 55 to 10 56 directory utility functions DeleteDir 8 10 GetDir 8 20 GetDrive 8 20 to 8 21 GetFullPathFromProject 8 29 to 8 30 GetModuleDir 8 31 to 8 32 GetProjectDir 8 34 MakeDir 8 54 to 8 55 MakePathname 8 55 SetDir 8 66 SetDrive 8 66 to 8 67 SplitPath 8 77 to 8 78 DisableBreakOnLibraryErrors function 8 11 to 8 12 DisableInterrupts function 8 12 DisableTaskSwitching function 8 12 to 8 15 DisconnectFromDDEServer function 6 15 DisconnectFromTCPServer function 7 7 to 7 8 DisConnectFromXDisplay function 9 14 to 9 15 LabWindows CVI Standard Libraries Index DisconnectTCPClient function 7 7 Div1D function 3 16 to 3 17 Div2D function 3 17 to 3 18 documentation conventions used in manual xix LabWindows CVI documentation set xx organization of manual xvii xviii related documentation xx DotProduct function 3 18 DTE device 5 5 Dynamic Data Exchange DDE See DDE Library functions dynamic link library GPIB 4 5 to 4 6 E Easy I O for DAQ Library advantages 10 1 to 10 2 calls to Data Acquisition Library note
69. i Os Od n gas 4 13 CLOSE DEV ii iran aA 4 13 Close lis CDSS A AS 4 14 ibl stallC ll backs e codi aos 4 14 SRQI RQS and Auto Serial Polling ooonnocccnnocccnnoccnonncnnonnnccnnncnonnnos 4 16 ACallbaGk Pune OW cun aia 4 17 A ces wes densi code Sivguna tateecnacty ems E toate sect aeeeee aE 4 17 SV CO Mask A a nel E A EN 4 18 SRQI RQS and Auto Serial Polling ooonoocccnnoccconocaconaccnonaccnnnncnnnnnos 4 19 Callback Pumectl A cadescsvenscdacsseesdatwtacdaces a a 4 19 Restrictions on Operations in Asynchronous Callbacks 4 20 O1 aT DLA E E EE re et EE te ett eaten nae oO rr een re eae or 4 21 Thread tai iii 4 22 ds A a a a a 4 22 National Instruments Corporation ix LabWindows CVI Standard Libraries Contents A Dorr ter OMT ereT RTT a vre On Cr nr he Merre mre reper eam 4 23 E PE E 4 25 Chapter 5 RS a a 5 1 RS 232 Library Function ONCE Wo 5 1 The RS 232 Library Function PanelSiciiian aiii 5 1 Usine So a aaa 5 3 Reporting RS 232 A desdaarasuanaetone 5 3 XModem File Transfer Functions ua 5 3 A A A ce i 5 3 R5S 232 Cable Information unit iii 5 4 Hands e ahaa 5 6 Software Handshaking 2 5 05 6y osc ia read 5 6 Hardware Handshaking nd ld 5 7 R5 232 Library Function Reference iii ti 5 8 CSC reais vases Waele cee R T A AR E 5 8 COMBINA 5 9 Combrombie concilio ic 5 9 COR do 5 11 COMRAB eu oil 5 12 COMO Terni esoo a A E E 5 12 COTS CUES CABS ias 5 14 Eoia Ko l E da 5 15 ComWitacisciina ainda an
70. ibdev function Instrument modules must use the OpenDev function When you open a device an integer value representing a device descriptor is returned All subsequent operations that involve a particular device require that you specify this device descriptor If OpenDev is used the CloseDev function should be used to close the device at the end of the program e Each GPIB Library function panel has three global controls labeled Status Error and Count These controls show the values of the GPIB status ibsta error iberr and byte count ibcnt1 variables The Status control displays in hexadecimal format The help information for Status explains the meaning of each bit in the status word If the most significant bit is set a GPIB error has occurred When an error occurs the Error control displays an error number The help information for Error describes the type of error associated with each error number Count displays the number of bytes transferred over the GPIB during the most recent bus transfer LabWindows CVI Standard Libraries 4 6 O National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library Note When writing instrument modules you must use the Device Manager functions OpenDev and CloseDev instead of ibfind or ibdev You must also use the Device Manager functions in application programs that make calls to instrument modules The Device Manager functions allow instrument modules to open dev
71. in the asynchronous callback and call PostDeferredCal1 to schedule a synchronous callback 2 In the synchronous callback perform the other operations See Also ibInstallCallback LabWindows CVI Standard Libraries 4 20 National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library OpenDev int bd OpenDev char deviceName char instrumentPrefix Purpose Opens a GPIB device Parameters deviceName string Must be null terminated instrumentPrefix string Must be null terminated Return Value integer Result of the open device operation Return Codes Device table is full or no more devices available Parameter Discussion deviceName is a string specifying a device name that appears in the IBCONF device table If deviceName is not OpenDev acts identically to ibfind If deviceName is OpenDev acts identically to ibdev OpenDev uses the first available unopened device instrumentPrefix is a string that specifies the instrument prefix associated with the instrument module The instrument prefix must be identical to the prefix entered when creating the function tree for the instrument module If the instrument module has no prefix or if OpenDev is not being used in an instrument module pass the string for instrumentPrefix Using This Function This function attempts to find an unused device in the GPIB handler s device table and open it If successful OpenDev returns a devic
72. including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 the 8255 PPI goes through a configuration phase where all the ports within the same PPI chip get reset to logic low regardless of the data direction The data directions on other ports however are maintained LabWindows CVI Standard Libraries 10 56 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Error Conditions All of the functions in the Easy I O for DAQ Library return an error code A negative number indicates that an error occurred If the return value is positive it has the same description as if it were negative but 1t is considered a warning Table 10 5 Easy I O for DAQ Error Codes Success 10001 syntaxErr An error was detected in the input string the arrangement or ordering of the characters in the string is not consistent with the expected ordering semanticsErr An error was detected in the input string the syntax of the string is correct but certain values specified in the string are inconsistent with other values specified in the string invalid ValueErr The value of a numeric parameter is invalid 0 4 valueConflictErr The value of a numeric parameter is inconsistent with another parameter and the combination is therefore invalid 10 100 badDeviceErr The device parameter is invalid 10006 badLineErr The line parameter
73. index of a particular channel in the channelString Specifies whether the channelString is ANALOG_INPUT or ANALOG_OUTPUT Returns the name of the particular channel in the Return Value channelString indicated by index Parameter Discussion channelString is the analog channels that are to be sampled Refer to the Channel String for Analog Input Functions or Channel String for Analog Output Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter for the syntax of this string channelName returns the name of the particular channel in the channelString indicated by index This string should be declared to have MAX_CHANNEL_NAME_LENGTH bytes GetDAQErrorString char errorString GetDAQErrorString short errorNumber Purpose This function returns a string containing the description for the numeric error code Parameters Input errorNumber short The error number that was returned from an integer Easy I O for DAQ function Return Value errorString string The string containing the description for the numeric error code National Instruments Corporation 10 43 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 GetNumChannels short error GetNumChannels short device char channelString short channelType unsigned long numberOfChannels Purpose Determines the number of channels contained in the channelString You need to know the number
74. int index n s HEADER R5 D6 DATA 3 71E 2 index FindPattern s 0 1 DATA n Scan s s i gt Sf index amp x result 3141 50 1 0 0 4 x n Remarks This example is similar to the previous one except that portion of the string to be skipped is terminated by a substring 1 DATA rather than by a single character The Formatting and I O Library function FindPattern is used to find the index where added to the index so that it points to the first byte after Scan and matched with the asterisk in the format string DATA begins in s Four is DATA The index is then passed to In this example FindPattern returns 15 and index is 19 When index is matched to the asterisk in the format string in the Scan call the format string is interpreted as Ss i19 gt f The i19 indicates that the first 19 bytes of s should be ignored Scan then extracts the real number from the remaining string 3 71E 2 and assigns it to x that one target specifier is satisfied LabWindows CVI Standard Libraries Scan returns 1 indicating National Instruments Corporation Chapter 2 Formatting and I O Library String with Comma Separated ASCII Numbers to Real Array char s int ns double a 5 5 8 byte real numbers 12 23 AD 645 1 38 2 4 n Scan s SS gt S5f x a result a 0 12 3 alil 45 0 a 2 6 5 JK a 3 0 013 a 4 4 0
75. is TTL low after CounterStart is called e START_COUNTING_ON_RISING_EDGE start counting on the rising edge of the TTL gate signal after CounterStart is called e START_COUNTING_ON_FALLING_EDGE start counting on the falling edge of the TTL gate signal after CounterStart is called pulsePolarity is the polarity of phase 2 of each cycle The options are e POSITIVE_POLARITY the delay phase 1 is a low TTL level and the pulse phase 2 is a high level e NEGATIVE_POLARITY the delay phase 1 is a high TTL level and the pulse phase 2 is a low level CounterEventOrTimeConfig short error CounterEventOrTimeConfig short device char counter unsigned short counterSize double sourceTimebase unsigned short countLimitAction short sourceEdge unsigned short gateMode unsigned long taskID Purpose Configures one or two counters to count edges in the signal on the specified counter s SOURCE pin or the number of cycles of a specified internal timebase signal When you use this function with the internal timebase and in conjunction with CounterStart and CounterRead your program can make more precise timing measurements than with the Timer function You can also call the CounterStart function to gate or trigger the operation with a signal on the counter s GATE pin LabWindows CVI Standard Libraries 10 26 National Instruments Corporation
76. is copied directly to or from the string Formatting Modifiers modifiers are optional codes used to describe the nature of the source or target data If you use them you must enclose the modifiers in square brackets and place them immediately after the format code they modify If one format specifier requires more than one modifier enclose all modifiers in the same set of brackets There is a different set of modifiers for each possible format specifier Formatting Integer Modifiers i d x 0 c bn Specify Length The b integer modifier specifies the length of the integer argument or the length of an individual integer array element in bytes The default length is 4 B therefore simple 4 B integers do not need this modifier The modifier b2 represents short integers The modifier b1 represents single byte integers in Specify Array Offset The i integer modifier specifies an offset within an integer array argument It indicates the location within the array where processing begins n is the zero based index of the first element to process Thus 10d i2 applied to a source integer array reads the 10 integer values from the third through the twelfth elements of the array The i modifier is valid only if rep is present If you use the i modifier with the z modifier then n is in terms of bytes Z Treat String as Integer Array The z integer modifier indicates that the data type of the corresponding argument is a string Never
77. limits These parameters can be thought of as the left most high low limit command The following Channel String cmd interChannelRate 1000 0 0 3 specifies that channels O through 3 should be sampled at 1000 0 Hz in other words there should be 1 1000 0 1ms of delay between each channel If you do not set an interchannel sample rate the channels are sampled as fast as possible for your hardware to achieve pseudo simultaneous scanning The syntax for the command string can be described using the following guide e items enclosed in are optional e lt number gt is an integer or real number e lt LF gt is a line feed character e lt LF gt means you may use either or lt LF gt to separate command strings from channel strings e may be used as an optional command separator e spaces are optional The syntax for the initial command string that appears before any channels are specified is cmd interChannelRate lt number gt hi lt number gt low lt number gt lt LF gt The syntax for command strings that appear after any channels are specified 1s lt LF gt cmd hi lt number gt low lt number gt lt LF gt LabWindows CVI Standard Libraries 10 6 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Channel String for Analog Output Functions The second parameter to most of the analog output functions is the channel string containing the analog output channels that
78. module in slot y of the chassis with ID x OB1 SCx MDy DTEMP The temperature sensor configured in DTEMP mode on the parallel module in slot y of the chassis with ID x OBO SCx MDy CALGND SCXI 1100 and SCXI 1122 only The grounded amplifier of the module in slot y of the chassis with ID x OBO SCx MDy SHUNTO SCXI 1121 SCXI 1122 and SCXI 1321 only Channel O of the module in slot y of the chassis with ID x with the shunt resistor applied OBO SCx MDy SHUNTO 3 SCXI 1121 SCXI 1122 and SCXI 1321 only Channel 0 through 3 of the module in slot y of the chassis with ID x with the shunt resistors applied at each channel National Instruments Corporation 10 5 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Command Strings You can use command strings within the Channel String to set per channel limits and an interchannel sample rate For example cmd hi 10 0 low 10 0 7 4 cmd hi 5 0 low 5 0 3 0 specifies that channels 7 through 4 should be scanned with limits of 10 0 volts and channels 3 through 0 should be scanned with limits of 5 0 volts As you view the Channel String from left to right when a high low limit command is encountered those limits are assigned to the following channels until the next high low limit command is encountered The High Limit and Low Limit parameters to AISampleChannel s are the initial high low
79. necessary to give the formatting and scanning functions versatility For instance a single Scan function call performs disparate operations such as the following e Find the two numeric values in the string header 45 1 03e 2 and place the first value in an integer variable and the second in a real variable e Take the elements from an integer array swap the high and low bytes in each element and place the resulting values in a real array To perform these operations each formatting and scanning function takes a format string as one of its parameters In effect a format string is a mini program that instructs the formatting and scanning functions on how to transform the input arguments to the output arguments For conciseness format strings are constructed using single character codes These codes are National Instruments Corporation 2 3 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 described in detail in the Using the Formatting and Scanning Functions section later in this chapter You may find the formatting and scanning functions more difficult to learn than other LabWindows CVI functions To help you in this learning process read the discussions in the Formatting and I O Library Programming Examples section at the end of this chapter Formatting and I O Library Function Reference This section gives a brief description of each of the functions available in the LabWindows CVI Formatting and I
80. occurred with calculations involving the property item sizes and the number of items specified InsuffMemXErr There is insufficient memory to perform the operation Genera lxXErr An Xlib function failed for some unknown reason BrokenConnectionXErr The connection to the X server was broken This occurs if the remote server terminated Parameter Discussion display must either be the predefined value CVIXDi splay or be the value returned by ConnectToXDisplay Use CVIXDisplay if the window is on the same display used by LabWindows CVI For the window parameter use CVI XRoot Window to access the default root window of the display used by LabWindows CVI Use CVIXHiddenWindow to access the hidden window associated with your application LabWindows CVI Standard Libraries 9 30 National Instruments Corporation Chapter 9 X Property Library The following values are valid for the mode parameter ReplaceXPropMode Replace the existing property value with the new value PrependXP ropMode Add the new property value to the beginning of the existing value AppendXP ropMode Add the new property value to the end of the existing value See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XChangeProperty function RemoveX WindowProperty PropLibXErrType status RemoveX WindowProperty DisplayPtrx display WindowX window Pr
81. occurs the internal ATCOUT signal is strobed The ATCOUT signal is internally routed to the gate of GPCTRO which is configured to generate a pulse each time it receives a rising edge at it s gate input The output of GPCTRO is internally routed to the data acquisition sample clock to control the A D conversion rate The very high effective scan rate is achieved through a pre pulse delay that is programmed into GPCTRO This delay automatically increments before each GPCTRO pulse so that the A D conversions occur at slightly larger intervals from the trigger condition as trigger conditions occur over time Because the waveform being measured is periodic A D conversions that are at particular intervals from trigger conditions over time can look the same as A D conversions at particular intervals from one unique trigger point in time In the following figure tn dn X gt the nth trigger condition gt delay between the nth trigger and the nth conversion gt an A D conversion gt the trigger level x x a eae ES ESA ESA ANS x Anto Alo Az No Nao Az x t0 yl t2 t3 t4 t5 t6 I I leat sss WSS yess I I do dl d2 d3 d4 d5 d6 National Instruments Corporation 10 11 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 When the A D conversions are placed side by side they represent the original waveform as if it had been sampled at a high frequency
82. of channels in the channelString so that you can interpret for analog input or build for analog output waveform arrays correctly Parameters device short Assigned by configuration utility integer channelString string The analog channel string channelType short Specifies whether the channelString is integer ANALOG_INPUT or ANALOG_OUTPUT Output numberOfChannels unsigned Returns the number of channels contained in long integer the channelString Return Value error short Refer to error codes in Table 10 5 integer Parameter Discussion channelString is the analog channels that are to be sampled Refer to the Channel String for Analog Input Functions or Channel String for Analog Output Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter for the syntax of this string GroupByChannel short error GroupByChannel float array long numberOfScans unsigned long numberOfChannels Purpose This function can be used to reorder an array of data from grouped by scan mode into grouped by channel mode LabWindows CVI Standard Libraries 10 44 National Instruments Corporation Chapter 10 Easy I O for DAQ Library If you acquire data in grouped by scan mode you need to reorder the array into grouped by channel mode before it can be passed to graph plotting functions analysis functions and others See the description of the fillMode parameter of ATAcquireWa
83. per second Any particular channel is scanned at this rate highLimitVolts double Maximum voltage to be measured lowLimit Volts double Minimum voltage to be measured fillMode short Specifies one of the following modes for the integer waveforms array GROUP_BY_CHANNEL or GROUP_BY_SCAN Output actualScanRate double The actual scan rate may differ slightly from the scan rate you specified given the limitations of your particular DAQ device waveforms double Array containing the voltages acquired on the array channels specified in the channelString National Instruments Corporation 10 13 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Return Value error short Refer to error codes in Table 10 5 integer Parameter Discussion channelString is the analog input channels that are to be sampled Refer to the Channel String for Analog Input Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter for the syntax of this string fillMode specifies whether the waveforms array is grouped by channels or grouped by scans Consider the following examples e If you scan channels A through C and Number of Scans is 5 then the possible fill modes are GROUP_BY_CHANNEL Al A2 A3 A4 A5 B1 B2 B3 B4 B5 C1 C2 C3 C4 C5 LN PooN or GROUP_BY_SCAN Al B1 Cl A2 B2 C2 A3 B3 C3 A4 B4 C4 A5 B5 C5 he SX Poo A LN e Jf you are to pass the array to a graph
84. perform byte swapping where needed Note The LabWindows CVI X Property Library specifies units in the number of BYTES as opposed to BITS Thus the format values of 8 16 and 32 used by Xlib functions correspond to units of 1 2 and 4 respectively in the functions of the LabWindows CVI X Property Library See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XInternAt om function DestroyXProperty PropLibXErrType status DestroyXProperty PropertyHandleX property Purpose Destroys X property information You can use this function when you no longer need to access a property This function frees memory allocated by CreateXPropert y The property handle cannot be used after this function is called All property information is destroyed when the program terminates Note It is not possible to destroy properties for which callbacks are installed LabWindows CVI Standard Libraries 9 12 O National Instruments Corporation Chapter 9 X Property Library Parameter Input property PropertyHandleX Handle to the property information to be destroyed This value must either be one of the predefined property types or be a value returned by CreateXPropType Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr O Th
85. predefined value CVIXDisplay or be the value returned by ConnectToXDisplay Use CVIXDisplay if the window is on the same display used by LabWindows CVI For the window parameter use CVI XRoot Window to access the default root window of the display used by LabWindows CVI Use CVIXHiddenWindow to access the hidden window associated with your application See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XChangeProperty function LabWindows CVI Standard Libraries 9 28 National Instruments Corporation Chapter 9 X Property Library PutX WindowProperty Value PropLibXErrType status PutX WindowPropertyValue DisplayPtrx display WindowX window PropertyHandleX property unsigned int numberoflItems int mode void property Value Purpose This function stores the supplied value with the property on the window To store a single property item you can use the function Put XWindowPropertylItem Parameters Input display DisplayPtrX A pointer to the display of the X server to which the window belongs window WindowX The window on which the property value is to be stored property Handle of the property to be stored This Property HandleX value must have been obtained with CreateXProperty numberofTtems unsigned integer Number of property items to store on the window mode integer Mode in which property valu
86. read only file can match regardless of its other attributes This holds true for the system hidden directory and archive attributes If you use more than one attribute the effect is additive For example if you use the read only and directory attributes all read only files and all directories can match If you use the normal and read only attributes all normal files and all read only files can match Parameters searchPath string Path to search normal integer Normal attribute read only integer Read only attribute system integer System attribute hidden integer Hidden attribute archive integer Archive attribute directory integer Directory attribute Return Value Return Codes Success No files found that match criteria General I O error occurred Insufficient memory to complete operation Invalid path for example c filename in Windows Access denied LabWindows CVI Standard Libraries 8 28 O National Instruments Corporation Chapter 8 Utility Library Parameter Discussion searchPath may contain the wildcard characters and Each attribute parameter can have one of the following values 0 do not search for files with the attribute 1 search for files with the attribute fileName contains the basename and extension of the first matching file and must be at least MAX_FILENAME_LEN characters in length GetFullPathFromProject int result GetFullPathFromProject char fileName c
87. real array to binary file assuming fixed number of elements 2 54 assuming variable number of elements 2 55 real to string in floating point notation 2 51 to 2 52 in scientific notation 2 52 two integers to ASCII file with error checking 2 53 variable portion of real array to binary file 2 55 writing line containing integer with literals to standard output 2 58 writing to standard output without linefeed carriage return 2 58 formatting functions See also scanning functions string manipulation functions asterisks instead of constants in format specifiers 2 39 Fmt description 2 14 to 2 15 examples 2 32 FmtFile description 2 15 to 2 16 examples 2 32 FmtOut description 2 16 to 2 17 examples 2 32 format string 2 33 to 2 35 introductory examples 2 31 to 2 32 literals in format string 2 40 purpose and use 2 31 special nature of 2 3 to 2 4 formatting modifiers 2 35 to 2 39 See also scanning modifiers floating point modifiers f 2 37 to 2 38 National Instruments Corporation integer modifiers i Yd x 0 c 2 35 to 2 37 string modifiers s 2 38 to 2 39 FrequencyDividerConfig function 10 37 to 10 39 G gender changer 5 6 GetAILimitsOfChannel function 10 40 to 10 41 GetAnalysisErrorString function 3 19 GetBreakOnLibraryErrors function 8 17 GetBreakOnProtectionErrors function 8 18 GetChannelIndices function 10 41 to 10 42 GetChannelNameFromIndex function 10 42 to 10 43 Ge
88. result CloseInstrDevs char instrumentPrefix Purpose Closes instrument devices Parameter instrumentPrefix Must be null terminated Return Value integer Result of the close instrument devices operation Return Codes Using This Function Closes all devices associated with the instrument module whose prefix is specified instrumentPrefix is a string that specifies the prefix of the instrument module being closed CloseInstrDevs always returns zero CloseInstrDevs should be used only in conjunction with OpenDev ibInstall Callback int status ibInstallCallback int boardOrDevice int eventMask GPIBCallbackPtr callbackFunction void callbackData Note This function is available only on Microsoft Windows On UNIX use the ibsgnl function On Windows 3 1 the data type of the return value and the first two parameters is short rather than int Purpose This function allows you to install a synchronous callback function for a specified board or device If you want to install an asynchronous callback use the ibnotify function instead LabWindows CVI Standard Libraries 4 14 National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library The callback function is called when any of the GPIB events specified in the Event Mask parameter have occurred on the board or device but only while you allow the system to process events The system can process events when you call ProcessSystemEvents or GetU
89. specified transfer direction S masters Th clock configuration forthe cock masieris valid saver The clock configuration forthe clock slave is invalid 7 make No source signal bas been assigned to the clock resource o o Oo Orv Or Oo Ov 0619 multClkSrcErr A source signal has already been assigned to the clock resource 0620 noTrigErr No trigger signal has been assigned to the trigger resource 0621 badTrigErr The specified trigger signal cannot be assigned to the trigger resource 0622 preTrigErr The pretrigger mode is not supported or is not available in the current configuration or no pretrigger source has been assigned current configuration or no delay source has been assigned ejeje 0627 noTrigDrvErr No signal has been assigned to the trigger resource 0628 multTrigDrvErr A signal has already been assigned to the trigger resource 0629 invalidOpModeErr The specified operating mode is invalid or the resources have not been configured for the specified operating mode L0630 invalidReadErr An attempt was made to read 0 bytes from the transfer buffer or an attempt was made to read past the end of the transfer buffer 0631 noInfiniteModeErr Continuous input or output transfers are invalid in the current operating mode 0632 someInputsIgnoredErr Certain inputs were ignored because they are not relevant in the current operating mode 0633 invalid
90. specifier Ss 18 instructs Scan to ignore the first 8 bytes of s This method works only if the location of the number within s is always the same In the third call the format string contains the non numeric characters literally This method works only if the non numeric characters in s are always the same O National Instruments Corporation 2 63 LabWindows CVI Standard Libraries Formatting and I O Library String to Real After Finding a Semicolon in the String char s double x int n s TIME 12 45 00 7 34 n Scan s SS gt SS xdt59 f amp x result x 7 34 n 2 Remarks Chapter 2 Some strings returned by programmable instruments contain headers that consist of numeric as well as non numeric data and are terminated by a particular character such as a semicolon This example shows how such a header can be skipped The format string contains two target specifiers In the first specifier Ss xdt the t modifier instructs Scan to read bytes from s until a number is en countered The d modifier indicates that the bytes must be discarded because there is no argument corresponding to the specifier The x modifier indicates that the semicolon should also be discarded When the Scan call succeeds it returns 2 indicating that two target specifiers were satisfied even though there is only one target argument String to Real After Finding a Substring in the String char s double x
91. targetString make sure that you allow room for the ASCII NUL For example if maximum Bytes is 40 the destination buffer should contain at least 41 bytes If you do not want to specify a maximum number of bytes to copy use 1 for maximum Bytes You can use this function even when sourceString and targetString overlap Note The value of maximum Bytes must not exceed one less than the number of bytes in the target variable LabWindows CVI Standard Libraries 2 10 National Instruments Corporation Chapter 2 FileToArray Formatting and I O Library int status FileToArray char fileName void array int dataType int numberOfElements int numberOfGroups int arrayDataOrder int fileLayout int fileType Purpose Reads data from a file into an array Can be used with files created using the ArrayToFile function The function handles creating opening reading and closing the file Parameters fileName string dataType integer numberOfElements integer numberOfGroups integer arrayDataOrder integer fileLayout integer fileType integer File pathname Array element data type Number of elements in array Number of Groups in array How groups are ordered in file Direction to write groups in file ASCH binary mode Return Value status Indicates success or failure Return Code Success Error attempting to open file Error attempting to close file An I O error occurred Invalid arrayDataType p
92. than one thread at the same time under Windows NT or under Windows 95 with the native 32 bit driver In order to be truly multithreaded safe you must use on of the following versions of the GPIB driver e For Windows 95 Version 1 1 or later e For Windows NT Version 1 2 or later Although previous versions of the drivers support multithreading they do not support the ThreadIbsta ThreadIberr ThreadIbcnt or ThreadiIbcnt1 functions You need these functions to obtain thread specific status values when calling GPIB functions from more than one thread The global status variables ibsta iberr ibcnt and ibcnt1 are not reliable in this case because they are maintained on a per process basis National Instruments Corporation 4 11 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 Notification of SRQ and Other GPIB Events Synchronous Callbacks Under Windows 3 1 you can use ibInstallCallback to specify a function to be called when an SRQ is asserted on the GPIB or when an asynchronous I O operation has completed It is a board level function only The same functionality exists on Windows 95 when you are using the compatibility driver If you are using Windows NT or the native 32 bit driver for Windows 95 you can use ibInstallCallback to specify functions to be invoked on the occurrence of any board level or device level condition on which you can wait using the ibwait function Cal
93. the decimal point in a string representation of the floating point number Significant digits may be lost in attempting to conform to the precision specification National Instruments Corporation 2 45 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 If the pn modifier is omitted a default of p6 is used The p modifier is valid for sources only Specify as Scientific Notation The e floating point modifier indicates that the string representation of the floating point value is in scientific notation If omitted non scientific notation is used n is optional and specifies the number of digits to use in the exponent For example f e2 causes 10 0 to be formatted as 1 0e 01 If nis omitted a default of three is used The e modifier is valid for sources only Specify as Floating Point The f floating point modifier indicates that the string representation of the floating point value is in non scientific notation This is the default even when the modifier is not present Discard Terminator The x floating point modifier causes the character that terminated the numeric data to be discarded In this way terminator characters can be skipped when reading lists of numeric input Thus 3f x reads three floating point numbers disregarding the terminator character which appears after each one this specifier could then be used to scan the string 3 5 7 6 32 4 Discard Data When applied to a target specifier the
94. the transfer buffers originally written to can be updated If DMA is active and a single transfer buffer contains interleaved channel data all output channels currently using the DMA channel will require new data 10605 end WriteErr No data was written to the transfer buffer because the final data block has already been loaded 10606 notArmedErr The specified resource is not armed armedErr The specified resource is already armed 10608 noTransferInProgErr No transfer is in progress for the specified resource 10609 transferInProgErr A transfer is already in progress for the specified resource 0 transferPauseErr A single output channel in a group cannot be paused if the output data for the group is interleaved 1 0 64 10611 badDirOnSomeLinesErr Some of the lines in the specified channel are not configured for the transfer direction specified For a write transfer some lines were configured for input For a read transfer some lines were configured for output badLineDirErr The specified line does not support the specified transfer direction 10613 badChanDirErr The specified channel does not support the specified transfer direction continues LabWindows CVI Standard Libraries 10 62 O National Instruments Corporation Chapter 10 Easy I O for DAQ Library Table 10 5 Easy I O for DAQ Error Codes Continued OY 4 badGroupDirErr The specified group does not support the
95. value must have been obtained with CreateXProperty propertyItem Property item obtained from window LabWindows CVI Standard Libraries 9 20 National Instruments Corporation Chapter 9 X Property Library Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to one or more parameters InvalidDisplayXErr The display argument is not a valid display This argument must either be the predefined value CVIXDisplay or be the value returned by Connect ToxDisplay lidWindowXErr The window argument is not a valid window lidPropertyXErr The property argument is not a valid property handle This argument must be the value returned by CreateXProperty TypeMismat ch The actual X type of the property value on the window does not match the type specified for property UnitMismatch The actual X format of the property value on the window does not match the unit specified for property SizeMismatchXErr The number of bytes in the property value is not a multiple of the size specified for property MissingPropertyXErr The property does not exist on the window Insuff MemXErr There is insufficient memory to perform the operation GeneralXErr An Xlib function failed for some unknown reason Broke
96. values are indicated by b4 8 and 4 are the only valid values for n Specify Array Offset You can use the i floating point modifier to specify an offset within a floating point array argument It indicates the location within the array where processing is to begin n is the zero based index of the first element to process Thus 10f 12 applied to a source floating point array reads the 10 floating point values from the third through the twelfth elements of the array The i modifier is valid only if rep is present If you use the i modifier with the z modifier then n is in terms of bytes Treat String as Floating Point The z floating point modifier indicates that the data type of the corresponding argument is a string Nevertheless the data in the string is treated as a floating point array The z modifier is valid only if rep is present Specify String Size The w floating point modifier specifies the exact number of bytes occupied by a string representation of the floating point argument in the event that the value is converted from a string format You can enter any non negative value here If nis less than the number of digits required to represent the floating point number an asterisk will be inserted into the string to signify an overflow The default for n is zero which indicates that the value can occupy whatever space is necessary Specify Precision The p floating point modifier specifies the number of digits to the right of
97. wordWritten The word that was written LabWindows CVI Standard Libraries 8 56 National Instruments Corporation Chapter 8 Utility Library ReadFromPhysicalMemory int status ReadFromPhysicalMemory unsigned int physicalAddress void destinationBuffer unsigned int numberOfBytes Note This function is available only on the Windows versions of LabWindows CVI Purpose Copies the contents of a region of physical memory into destinationBuffer The function does not check whether the memory actually exists If the memory does not exist the success value is returned but no data is read Note For you to be able to use this function under Windows 95 or NT the LabWindows CVI low level support driver must be loaded Parameters physicalAddress unsigned integer The physical address to be read from There are no restrictions on the address it can be below or above 1 MB destinationBuffer void pointer The buffer into which the physical memory will be copied numberOfB ytes unsigned integer The number of bytes to copy from physical memory Return Value status integer Indicates whether the function succeeded Return Codes Success Failure reported by the operating system or low level support driver not loaded O National Instruments Corporation 8 57 LabWindows CVI Standard Libraries Utility Library Chapter 8 ReadFromPhysicalMemoryEx int status ReadFromPhysicalMemoryEx unsigned int physicalAddress
98. you should acquire the data grouped by channel e If you are to pass the array to a strip chart you should acquire the data grouped by scan e You can also acquire the data grouped by scan and later reorder it to be grouped by channel using the GroupByChannel function waveforms is an array containing the voltages acquired on the channels specified in the channelString The acquired voltages is placed into the array in the order specified by fillMode This array must be declared as large as number of channels numberOfScans You can determine number of channels using the function Get NumChannels LabWindows CVI Standard Libraries 10 14 National Instruments Corporation Chapter 10 Easy I O for DAQ Library AICheckA cquisition short error AICheckAcquisition unsigned long taskID unsigned long scanBacklog Purpose This function can be used to determine the backlog of scans that have been acquired into the circular buffer but have not been read using AIReadAcquisition IfATReadAcquisition is called with read mode set to LATEST_MODE scanBacklog is reset to zero Parameters Input taskID unsigned The task ID that was returned from long integer AIStartAcquisition Output scanBacklog unsigned Returns the backlog of scans that have been acquired long integer into the circular buffer but have not been read using ATReadAcquisition Return Value short integer Refer to error codes in Table 10
99. 1 3 LC_COLLATE 1 5 LC_CTYPE 1 4 to 1 5 LC_MONETARY 1 4 LC_NUMERIC 1 4 LC_TIME 1 5 cables See RS 232 cables callback functions DDE Library functions 6 2 to 6 4 DDE transaction types table 6 4 example using Excel 6 5 to 6 6 parameter prototypes table 6 3 GPIB GPIB 488 2 Libraries function tree 4 3 ibInstallCallback 4 12 4 14 to 4 17 ibNotify 4 12 4 17 to 4 20 Windows NT and Windows 95 asynchronous callbacks 4 12 driver version requirements 4 12 ibInstallCallback 4 14 to 4 17 ibNotify function 4 17 to 4 20 synchronous callbacks 4 12 O National Instruments Corporation I 3 Index RS 232 Library function tree 5 2 InstallComCallback 5 22 to 5 25 TCP Library functions overview 7 2 to 7 3 TCP transaction types table 7 3 X Property Library functions InstallXPropertyCallback 9 4 9 25 to 9 27 overview 9 4 UninstallXPropertyCallback 9 4 9 33 character processing ANSI C 1 5 classes ANSI C Library 1 1 to 1 2 clear functions GPIB 488 2 Library 4 3 Clear1D function 3 6 to 3 7 ClientDDEExecute function 6 10 ClientDDERead function 6 10 to 6 11 ClientDDEWrite function 6 12 to 6 13 clients and servers DDE Library functions 6 2 TCP Library functions 7 2 ClientTCPRead function 7 3 to 7 4 ClientTCPWrite function 7 4 to 7 5 close functions GPIB and GPIB 488 2 Libraries 4 2 RS 232 Library 5 1 CloseCom function 5 8 to 5 9 CloseCVIRTE function 8 6 CloseDev function 4 6 to 4 7 4 13 CloseFile
100. 16 ComWrt 5 16 to 5 17 ComWrtByte 5 17 to 5 18 FlushInQ 5 18 FlushOutQ 5 19 GetComStat 5 19 to 5 20 GetInQLen 5 20 to 5 21 GetOutQLen 5 4 5 21 GetRS232ErrorString 5 22 InstallComCallback 5 22 to 5 25 OpenCom 5 4 5 25 to 5 26 OpenComConfig 5 4 5 26 to 5 28 ReturnRS232Err 5 28 SetComTime 5 29 SetCTSMode 5 7 5 30 SetX Mode 5 31 XModemConfig 5 4 5 31 to 5 33 XModemReceive 5 3 5 4 5 33 to 5 34 XModemSend 5 34 to 5 35 handshaking 5 6 to 5 8 reporting errors 5 3 RS 232 cables 5 4 to 5 6 troubleshooting 5 3 to 5 4 XModem file transfer functions 5 3 rs232err global variable 5 3 RS 485 AT Serial board 5 3 RunExternalModule function 8 62 to 8 63 LabWindows CVI Standard Libraries Index S scanning function programming examples ASCII file to two integers with error checking 2 68 ASCII file with comma separated numbers to real array with number of elements at beginning of file 2 68 to 2 69 binary file to integer array assuming fixed number of elements 2 69 binary file to real array assuming fixed number of elements 2 69 assuming variable number of elements 2 69 to 2 70 integer array containing 1 byte integers to real array 2 66 to 2 67 integer array to real array 2 66 with byte swapping 2 66 list of examples 2 49 to 2 50 reading integer from standard input 2 70 reading line from standard input 2 71 reading string from standard input 2 70 to 2 71 scanning strings that are not NUL te
101. 39 SetSystemDate 8 76 SetSystemTime 8 77 TimeStr 8 83 DCE device 5 5 DDE Library functions callback function 6 2 to 6 4 functions capable of trigger callback function table 6 4 parameter prototypes table 6 3 clients and servers 6 2 connecting to DDE server 6 2 DDE data links 6 4 error conditions 6 23 to 6 24 function reference AdviseDDEDataReady 6 6 to 6 8 BroadcastDDEDataReady 6 8 to 6 9 ClientDDEExecute 6 10 ClientDDERead 6 10 to 6 11 ClientDDE Write 6 12 to 6 13 ConnectToDDEServer 6 2 6 13 to 6 15 DisconnectFromDDEServer 6 15 GetDDEErrorString 6 15 to 6 16 RegisterDDEServer 6 2 6 16 to 6 18 ServerDDE Write 6 19 to 6 20 SetUpDDEHotLink 6 2 6 4 6 20 to 6 21 SetUpDDEWarmLink 6 2 6 4 6 21 to 6 22 TerminateDDELink 6 22 UnregisterDDEServer 6 23 function tree table 6 1 Microsoft Excel example 6 5 to 6 6 DDE transaction types table 6 4 Delay function 8 9 to 8 10 DelayedPulseGenConfig function 10 34 to 10 36 DeleteDir function 8 10 DeleteFile function 8 10 to 8 11 DestroyXProperty function 9 12 to 9 13 DestroyXPropType function 9 13 to 9 14 Determinant function 3 16 O National Instruments Corporation ES Index device control functions GPIB Library 4 2 4 7 device drivers GPIB 4 5 to 4 7 device I O functions GPIB 488 2 Library 4 3 Device Manager functions GPIB CloseDev 4 6 to 4 7 4 13 CloseInstrDevs 4 14 ibInstallCallback 4 12 4 14 to 4 17 ibNotify 4 12 ibNotify
102. 5 AIClearAcquisition short error AIClearAcquisition unsigned long taskID Purpose This function clears the current asynchronous acquisition that was started by ATStartAcquisition Parameters Input taskID unsigned The task ID that was returned from long integer AIStartAcquisition Return Value O National Instruments Corporation 10 15 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 AlIReadAcquisition short error AIReadAcquisition unsigned long taskID long scanstoRead unsigned short readMode unsigned long scanBacklog short fillMode double waveforms Purpose This function reads the specified number of scans from the internal circular buffer established by ATStartAcquisition If the specified number of scans is not available in the buffer the function waits until the scans are available You can call ALCheckAcquisition before calling AI ReadAcquisition to determine how many scans are available Parameters taskID unsigned long The task ID that was returned from integer AIStartAcquisition scanstoRead long integer The number of scans that are read from the internal circular buffer readMode unsigned Specifies whether scans are read from the circular short integer buffer in CONSECUTIVE_MODE or LATEST_MODE fillMode short integer Specifies one of the following modes for the waveforms array GROUP_BY_CHANNEL or GROUP_BY_SCAN scanB
103. 5 WriteToDigitalPort function 10 55 to 10 56 WriteToPhysicalMemory function 8 85 to 8 86 WriteToPhysicalMemoryEx function 8 86 to 8 87 X X Property Library functions callback functions 9 4 communicating with local applications 9 3 ConnectToXDisplay function 9 3 error codes 9 4 to 9 6 function panels 9 1 function reference ConnectToXDisplay 9 7 to 9 9 CreateXProperty 9 3 9 9 to 9 10 CreateXPropType 9 3 9 10 to 9 12 DestroyXProperty 9 12 to 9 13 DestroyXPropType 9 13 to 9 14 DisConnectFromXDisplay 9 14 to 9 15 GetXPropErrorString 9 15 GetXPropertyName 9 15 to 9 16 GetXPropertyType 9 16 to 9 17 GetXPropTypeName 9 17 to 9 18 GetXPropTypeSize 9 18 GetXPropTypeUnit 9 19 GetX WindowPropertyltem 9 20 to 9 22 GetX WindowProperty Value 9 22 to 9 25 InstallXPropertyCallback 9 4 9 25 to 9 27 PutXWindowPropertyItem 9 27 to 9 28 National Instruments Corporation Index PutX WindowProperty Value 9 29 to 9 31 RemoveX WindowProperty 9 31 to 9 32 UninstallXPropertyCallback 9 4 9 33 void HandlePropertyNotifyEvent 9 7 void_InitXPropertyLib 9 7 function tree table 9 2 hidden window 9 3 overview 9 1 property handles and types 9 3 to 9 4 predefined property types table 9 3 using outside of LabWindows CVI 9 7 X interclient communication 9 2 to 9 3 XModem file transfer functions purpose and use 5 3 XModemConfig 5 4 5 31 to 5 33 XModemReceive 5 3 5 4 5 33 to 5 34 XModemSend 5 3 5 34 to
104. 5 35 National Instruments Corporation I 19 LabWindows CVI Standard Libraries
105. 5 LabWindows CVI Standard Libraries X Property Library Chapter 9 Table 9 3 X Property Library Error Types and Descriptions Continued DupPropTypeXErr PropertyInUseXErr PropTypelnUseXErr TypeMismatchXErr UnitMismatchXErr InvalidindexXErr SizeMismatchXErr OverflowXErr InvalidCallbackXErr MissingPropertyXErr InsuffMemXErr GeneralXErr BrokenConnectionXErr LabWindows CVI Standard Libraries A property type with the same typeName but with different size or unit already exists A property callback was installed with InstallPropertyCallback for this property It is not possible to destroy properties for which callbacks are installed There is a property created by CreateXPropert y that has this property type It is not possible to destroy property types if there are properties that use them The actual X type of the property value on the window does not match the type specified for property The actual X format of the property value on the window does not match the unit specified for property The index specified is larger than the actual number of property items on the window The number of bytes in the property value is not a multiple of the size specified for property Arithmetic overflow occurred with calculations involving the property item sizes and the number of items specified The function specified is not installed as a callback The property does not
106. 999 outputState short integer HIGH_STATE Output state of the counter is high 1_LOW_STATE Output state of the counter is low Valid when the controlCode 7 I_RESET Output readValue unsigned Returns the value read from the counter when short integer controlCode 6 I_READ Return Value Parameter Discussion controlCode determines the counter s operating mode This parameter accepts the following attributes e 0 I_TOGGLE_ON_TC counter s output becomes low after the mode set operation and the counter decrements from count to 0 while the gate is high The output toggles from low to high once the counter reaches 0 e 1 IT_PROGRAMMABLE_ONE_SHOT counter s output becomes low on the count following the leading edge of the gate input and becomes high on TC e 2 I_RATE_GENERATOR counter s output becomes low for one period of the clock input The count indicates the period between output pulses e 3 I_SQUARE_WAVE_RATE_GENERATOR counter s output stays high for one half of the count clock pulses and stays low for the other half e 4 1_SOFTWARE_TRIGGERED_STROBE counter s output is initially high and the counter begins to count down while the gate input is high On terminal count the output becomes low for on clock pulse then becomes high again LabWindows CVI Standard Libraries 10 46 O National Instruments Corporation Chapter 10 Easy I O for DAQ Li
107. A OS 7 3 Table72 TCP Library Error Codes to 7 12 Table 8 1 The Utility Library Function Tree cooococnnncccnnonccnoncccnoncnnnnnacononcnnonnconnnnnononannnnannnns 8 1 Table 9 1 The X Property Library Function Tree vala A 9 2 Tabl 9 2 RBredetined Property Vy pes iii iia io ido laio 9 3 Table 9 3 X Property Library Error Types and DeScriptions ooooccnocnnonononnnonncnoncnoncnan ccoo ncnnnos 9 5 Table 9 4 Status Values for InstallXPropertyCallback ooooonoocccnnnccnnnoccconccconaccnonccnnanccnnnon ns 9 26 Table 10 1 Easy I O for DAQ Function Tre8 ooooocnnnnncnnoncccnnnnconnnanononacononanononocononocono noci n conos 10 2 Table 10 2 Valid CA os dass pd ea as E de 10 7 Table 10 3 Definition of Am 9513 Counter 1 A Ri 10 28 Table 104 Adjacent Counters eta a R a EEE E A ee 10 30 Table 10 5 Easy I O for DAQ Error Codes cecssssscesssccssssscessscesesnnessnncesssseeenacesenacceeaneees 10 57 LabWindows CVI Standard Libraries xvi National Instruments Corporation About This Manual The LabWindows CVI Standard Libraries Reference Manual contains information about the LabWindows CVI standard libraries the Graphics Library the Analysis Library the Formatting and I O Library the GPIB Library the GPIB 488 2 Library the RS 232 Library the Utility Library and the system libraries The LabWindows CVI Standard Libraries Reference Manual is intended for use by LabWindows CVI users who have already completed the Getting St
108. AQ device while your program is running Parameters multitaskingMode integer When activated DAQ devices are reconfigured to default settings every time an Easy I O for DAQ function invokes such devices Return Value None WriteToDigitalLine short error WriteToDigitalLine short device char portNumber short line short portWidth 1 ong configure unsigned long lineState Purpose Sets the output logic state of a digital line on a digital port National Instruments Corporation 10 53 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Parameters device short integer Assigned by configuration utility portNumber string Specifies the digital port this function configures line short integer Specifies the individual bit or line within the port to be used for I O portWidth short integer The total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port on an MIO non E Series board by setting portWidth to 8 configure long integer 1 Configure the digital port before writing 0 Don t configure the digital port before writing When this function is called in a loop it can be optimized by only configuring the digital port on the first iteration lineState unsigned long Specifies the new state of the digital line 1 logical integer high 0 logical low Return Value short integer Refer to error codes in Table 10 5 Paramet
109. CII NUL If n is zero or omitted as many bytes are stored as are called for by the sources When n is greater LabWindows CVI Standard Libraries 2 46 National Instruments Corporation Chapter 2 tn t Formatting and I O Library than the number of bytes available from the source the remaining bytes are filled with ASCII NULs if the q modifier is used or blanks if the q modifier is not present When the w modifier is used in conjunction with the a modifier n indicates the number of bytes to append to the string excluding the terminating ASCII NUL If wn modifies a target string and n is larger than the number of bytes in the target argument the target argument is overwritten in compiled C Append NULs When applied to a target string in conjunction with the w string modifier the q string modifier specifies that unfilled bytes at the end of the target string be set to ASCII NULs instead of blanks Append with Spacing When the source is a string and the y modifier is applied to a target string format specifier the target string is filled with bytes from the source string without skipping leading spaces or tabs Terminate on Character When applied to a source string the t modifier specifies that the source string is terminated on the first occurrence of the character n where n is the ASCII value of the character Thus s t44 causes reading of the source string to stop on an ASCI comma More than one t modifier can occur in t
110. CII NUL at the end of the transferred bytes After the assignment s is NUL terminated Integer Array to Real Array int ivals 100 double dvals 100 Scan ivals 100i gt 100f dvals Remarks Each integer in ivals is converted to real number and then written into dvals Integer Array to Real Array with Byte Swapping int ivals 100 double dvals 100 Scan ivals 100i 010 gt 100f dvals Remarks Each integer in ivals is byte swapped converted to a real number and written into dvals Byte swapping is useful when a programmable instrument sends back 2 byte integers with the high byte first followed by the low byte When this data is read into an integer array the placement of the bytes is such that the high byte is interpreted as the low byte The o10 modifier specifies that the bytes be interpreted in the opposite order Integer Array Containing 1 Byte Integers to Real Array int ivals 50 100 1 byte integers double dvals 100 100 8 byte real numbers Scan ivals 100i b1 gt 100f dvals Scan ivals 100i blu gt 100f dvals Remarks Sometimes each element in an integer array is used to store two 1 byte integers This example shows how to unpack the 1 byte integers and store them in a real array The b1 indicates that each binary integer is only one byte long LabWindows CVI Standard Libraries 2 66 National Instruments Corporation Chapter 2 Formatting and I O Library T
111. CVI Standard Libraries 2 42 National Instruments Corporation Chapter 2 Formatting and I O Library f real number As a source or target specifier this indicates that the corresponding parameter is a real number or if rep is present a real array As a source specifier in conversions to string formats the floating point value is converted into ASCII form As a target specifier in conversions from string format bytes of the source parameter are consumed as long as they match the pattern of floating point ASCII numbers or until the end of the string is encountered The scanned characters are converted to a floating point value and placed into the corresponding floating point or floating point array target parameter If the format is repeated the operation is repeated the appropriate number of times with successive elements of the array parameter The pattern for floating point ASCII numbers is an optional sign or a series of one or more decimal digits possibly containing a decimal point and an optional exponent consisting of an E or e followed by an optionally signed decimal integer value character As a source specifier this indicates that the source parameter is an integer with one significant byte or if rep is present an array of 1 byte integers As a target specifier this indicates that a byte of the source parameter is to be consumed and the scanned character placed directly into the corresponding target parameter which is a
112. Contents button in Help This call should never be used with HELP_CONTENTS If a Help file has two or more Contents topics the application must assign one as the default To ensure that the correct Contents topic remains set the application should call Syst emHelp with command set to HELP_ SETCONTENTS and the additionalLongData parameter specifying the corresponding context identifier National Instruments Corporation 8 81 LabWindows CVI Standard Libraries Utility Library Chapter 8 TerminateExecutable int status TerminateExecutable int executableHandle Purpose Attempts to terminate an executable if it has not already terminated Under Windows the system terminates an executable by sending close messages to each window in the application If the application does not honor the close messages then the application does not terminate The TerminateExecutable function gives up control for a limited period to give the application an opportunity to process the close messages This period should be sufficient for all applications When you need to allow more time your program can call the ProcessSystemEvents function in a loop as shown in the following example Example define TIME_LIMIT 5 0 number of seconds double startTime startTime Timer TerminateExecutable handle while ExecutableHasTerminated handle amp amp Timer startTime gt TIME LIMIT ProcessSystemEvents
113. Copies the numberofBytes bytes starting at position sourceIndex of sourceBuffer to position targetIndex of targetBuffer Parameters targetIndex integer Starting position in targetBuffer sourceBuffer string Source buffer sourceIndex integer Starting position in sourceBuffer numberofBytes integer Number of bytes to copy targetBuffer Destination buffer Return Value None National Instruments Corporation 2 9 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Parameter Discussion Both sourceIndex and targetIndex are zero based You can use this function even when sourceBuffer and targetBuffer overlap CopyString void CopyString char targetString int targetIndex char sourceString int sourceIndex int maximum Bytes Purpose Copies the string starting at position sourceIndex of sourceString to position targetIndex of targetString until an ASCII NUL is copied or maximum Bytes bytes have been copied Appends an ASCII NUL if no ASCII NUL was copied Parameters targetIndex integer Starting position in targetString sourceString string Source buffer sourceIndex integer Starting position in sourceString maximum Bytes integer Number of bytes to copy excluding the ASCII NUL targetString Destination buffer Return Value None Parameter Discussion Both sourceIndex and targetIndex are zero based If you want to use maximum Bytes to prevent from writing beyond the end of
114. D 3 15 Determinant 3 16 Div1D 3 16 to 3 17 Div2D 3 17 to 3 18 DotProduct 3 18 GetAnalysisErrorString 3 19 Histogram 3 19 to 3 20 InvMatrix 3 20 to 3 21 LinEv1D 3 21 LinEv2D 3 22 MatrixMul 3 23 MaxMin1D 3 24 LabWindows CVI Standard Libraries Index MaxMin2D 3 24 to 3 25 Mean 3 25 to 3 26 Mul1D 3 26 to 3 27 Mul2D 3 27 Neg1D 3 28 Set1D 3 28 Sort 3 29 StdDev 3 29 to 3 30 Sub1D 3 30 to 3 31 Sub2D 3 31 Subset1D 3 32 ToPolar 3 32 to 3 33 ToPolar1D 3 33 to 3 34 ToRect 3 34 to 3 35 ToRect1D 3 35 Transpose 3 36 overview 3 1 reporting analysis errors 3 4 ANSI C Library C locale 1 2 to 1 5 information values table 1 3 LC_COLLATE 1 5 LC_CTYPE 1 4 to 1 5 LC_MONETARY 1 4 LC_NUMERIC 1 4 LC_TIME 1 5 character processing 1 5 classes table 1 1 to 1 2 control functions 1 7 to 1 9 errno set by file I O functions 1 6 fdopen function 1 9 to 1 10 input output facilities 1 6 low level I O functions 1 2 mathematical functions 1 6 standard language additions 1 2 to 1 5 string processing 1 5 time and date functions 1 6 to 1 7 ANSI C macros 1 2 AOClearWaveforms function 10 20 AOGenerateWaveforms function 10 21 to 10 22 AOUpdateChannel function 10 22 to 10 23 AOUpdateChannels function 10 23 to 10 24 array operation functions Abs1D 3 4 to 3 5 LabWindows CVI Standard Libraries I 2 Add 1D 3 5 Add2D 3 5 to 3 6 Div1D 3 16 to 3 17 Div2D 3 17 to 3 18 LinEv1D 3 21 LinEv2D 3 22
115. D Two dimensional A A Analog input A D Analog to digital AC Alternating current ADC A D An electronic device often an integrated circuit that converts an analog converter voltage to a digital number ADC resolution The resolution of the ADC which is measured in bits An ADC with 16 bits has a higher resolution and thus a higher degree of accuracy than a 12 bit ADC analog trigger A trigger that occurs at a user selected point on an incoming analog signal Triggering can be set to occur at a specific level on either an increasing or a decreasing signal positive or negative slope Analog triggering can be implemented either in software or in hardware When implemented in software all data is collected transferred into system memory and analyzed for the trigger condition When analog triggering is implemented O National Instruments Corporation G 1 LabWindows CVI Standard Libraries Glossary ANSI AO asynchronous automatic serial B B background acquisition bipolar block mode C CodeBuilder cold junction compensation conversion time in hardware no data is transferred to system memory until the trigger condition has occurred American National Standards Institute Analog output 1 Hardware A property of an event that occurs at an arbitrary time without synchronization to a reference clock 2 Software A property of a function that begins an operation and returns prior to the comple
116. DDELink unsigned int conversationHandle char itemName unsigned int dataFormat unsigned int timeout Purpose Lets your program acting as a DDE client terminate an advisory link previously set up with the server either through SetUpDDEWarmLink or SetUpDDEHotLink This function returns zero for success or a negative error code for failure Parameters Input conversationHandle unsigned integer Uniquely identifies the conversation itemName string Uniquely identifies the output item for example system dataFormat unsigned integer Valid data format for example CF_TEXT timeout unsigned integer Timeout in ms Return Value Refer to error codes in Table 6 3 LabWindows CVI Standard Libraries 6 22 National Instruments Corporation Chapter 6 DDE Library UnregisterDDEServer int status UnregisterDDEServer char serverName Purpose Unregisters your application program as a DDE server Parameters Return Value integer Refer to error codes in Table 6 3 See Also RegisterDDEServer Error Conditions If an error condition occurs during a call to any of the functions in the LabWindows CVI DDE Library the status return value contains the error code This code is a non zero value that specifies the type of error that occurred Error code return values are negative numbers The currently defined error codes and their associated meanings are shown in Table 6 3 O N
117. DelayBeforeGateSec double counterMinus1GateMode unsigned short integer actualGateWidthSec double overflow short integer short integer timeout short integer frequency double National Instruments Corporation 10 31 Easy I O for DAQ Library Assigned by configuration utility The counter to be used for the counting operation Determines the size of the counter used to perform the operation ONE_COUNTER or TWO_COUNTERS The desired length of the pulse used to gate the signal The lower the signal frequency the longer the Gate Width must be The maximum expected delay between the time the function is called and the start of the gating pulse If the gate signal does not start in this time a timeout occurs The gate mode for counter 1 The length in seconds of the gating pulse that is used 1 counter rolled past terminal count 0 counter did not roll past terminal count If overflow is 1 the value of frequency is inaccurate Set to 1 if the measurement completes without a counter overflow A timeout and a valid measurement may occur at the same time A timeout does not produce an error Set to 1 if the time limit expires during the function call A timeout and a valid measurement may occur at the same time A timeout does not produce an error The frequency of the signal It is computed as the number of rising edges actualGateWidthSec LabWindows CVI Standard Libraries Easy I
118. E_DISCONNECT When conversation partner quits DDE_DATAREADY When conversation partner sends data DDE_REQUESTDATA When client requests data DDE_ADVISELOOP When client requests advisory loop DDE_ADVISESTOP When client terminates request for advisory loop DDE_EXECUTE When client requests execution of a command Refer to the description for RegisterDDEServer and Connect ToDDEServer for more information about the DDE callback function DDE Links Whenever a client program needs to be informed of changes to the value of a particular data item in the server application a DDE data link is required You can establish a DDE data link in LabWindows CVI by calling the SetUpDDEWarmLink or SetUpDDEHotLink functions Whenever the data value changes the client callback function is triggered and the data is available in the dataPtr parameter Within one client server connection there can be multiple data links each applying to a different data item For example you can establish a link between your LabWindows CVI program and a particular cell in Excel The data item to which the link applies is specified in the itemName parameter in the call to Set UpPDDEWarmLink or Set UpDDEHot Link functions As defined in Windows warm and hot links differ in that under a warm link the client is merely alerted when the data value changes whereas under a hot link the data is actually sent
119. Failure refer to LaunchExecutable Parameter Discussion The following values are valid for windowState LE_HIDE application window is hidden LE_SHOWNORMAL application window is shown normally and is activated LE_SHOWMINIMIZED application window is displayed as an icon and is activated LE_SHOWMAXIMIZED application window is displayed as a maximized window and is activated LE_SHOWNA application window is shown normally but is not activated LE_SHOWMINNOACTIVE application window is shown as an icon but is not activated National Instruments Corporation 8 47 LabWindows CVI Standard Libraries Utility Library Chapter 8 A handle can be passed to ExecutableHasTerminated and TerminateExecutable When you no longer need the handle you should call RetireExecutableHandle When you do not want to obtain a handle you can pass NULL When you launch several processes with LaunchExecutableEx but do not call RetireExecutableHandle on them you might reach the limit for the maximum number of processes the system imposes This happens even when the processes have already terminated the program does not recognize that the processes have terminated until you call RetireExecutableHandle Checking Termination of CVI Executables Under Windows 3 1 If you launch another LabWindows CVI executable under Windows 3 1 the launched executable process will terminate itself after launching the new copy of the CVI Run
120. FindPattern lab2ab3ab4 3 1 AB 0 1 Fmt int n Fmt void target char formatString sourcel sourcen Purpose Formats the sourcel sourcen arguments according to descriptions in the formatString argument LabWindows CVI Standard Libraries 2 14 National Instruments Corporation Chapter 2 Formatting and I O Library Parameters formatString sourcel sourcen Types must match formatString contents Output Type must match formatString contents Return Value integer Number of source format specifiers satisfied Return Code Using This Function This function places the result of the formatting into the target argument which you must pass by reference The return value indicates how many source format specifiers were satisfied or 1 if the format string is in error A complete discussion of this function is in the Using the Formatting and Scanning Functions section later in this chapter FmtFile int n FmtFile int fileHandle char formatString sourcel sourcen Purpose Formats the source sourcen arguments according to descriptions in the formatString argument The result of the formatting is written into the file corresponding to the fileHandle argument which was obtained by a call to the LabWindows CVI function OpenFile Parameters fileHandle integer File handle formatString string sourcel sourcen types must match formatString contents National Instrument
121. Fora device with Am9513 counters counterSize can be ONE_COUNTER 16 bit or TWO_COUNTERS 32 bit National Instruments Corporation 10 27 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 e If you use TWO_COUNTERS counter 1 is cascaded with the specified counter Counter 1 is defined as shown in Table 10 3 Table 10 3 Definition of Am 9513 Counter 1 counter counter 1 VD 0 JJ e uu A N 1 2 3 4 5 6 T 8 9 D Re sourceTimebase determines whether the counter uses its SOURCE pin or an internal timebase as its signal source Pass USE_COUNTER_SOURCE to count TTL edges at counter s SOURCE pin or pass a valid internal timebase frequency to count the TTL edges of an internal clock Valid internal timebase frequencies are 1000000 Am9513 100000 Am9513 10000 Am9513 1000 Am9513 100 Am9513 20000000 DAQ STC 100000 DAQ STC countLimitAction is the action to take when the counter reaches terminal count The parameter accepts the following attributes e COUNT_UNTIL_TC count until terminal count and set the overflow status when it is reached This mode is not available on the DAQ STC e COUNT_CONTINUOUSLY count continuously The Am9513 does not set the overflow status at terminal count but the DAQ STC does LabWindows CVI Standard Libraries 10 28 National Instruments Corporation Chapter 10 Easy I O for DAQ Library sourceEdge is the edge of the
122. Hardware Interrupts and Autopolling If you have disabled the interrupts of the GPIB interface board via IBCONF or the ibconfig function the handler detects SRQ only during calls to the handler and Autopolling can occur only at the following events e During a device ibwait for RQS e Immediately after a device function has completed and is about to return to the application program If you have enabled hardware interrupts the handler can respond to SRQI interrupts and perform Autopolling even when the handler is not performing a function However the handler will not conduct an Autopoll if any of the following conditions exist LabWindows CVI Standard Libraries 4 8 National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library e The last GPIB call was a board call Autopolling is re instated after a subsequent device call e GPIB I O is in progress In particular during asynchronous GPIB I O autopolling will not occur until the asynchronous I O has completed e The stuck SRQ condition exists e Autopolling has been disabled by IBCONF or by ibconfig Read and Write Termination The IEEE 488 specification defines two methods of identifying the last byte of device dependent data messages The two methods permit a Talker to send data messages of any length without the Listener s knowing in advance the number of bytes in the transmission The two methods are as follows END message The Talker asserts the EOI
123. I O error occurred Insufficient memory to complete operation Parameter Discussion currentDirectory must be at least MAX_PATHNAME_LEN bytes long GetDrive int result GetDrive int currentDriveNumber int numberofDrives Note This function is available only on the Windows versions of LabWindows CVI Purpose Gets the current default drive number and the total number of logical drives in the system Parameters currentDriveNumber Current default drive number numberofDrives Number of logical drives LabWindows CVI Standard Libraries 8 20 O National Instruments Corporation Chapter 8 Utility Library Return Value Return Codes Success Current directory is on a network drive that is not mapped to a local drive currentDriveNumber is set correctly but namberOfDrives is set to 1 General I O error occurred Insufficient memory to complete operation Access denied Parameter Discussion The mapping between the drive number and the logical drive letter is 0 A 1 B and so on The total number of logical drives includes floppy disk drives hard disk drives RAM disks and networked drives GetExternalModuleA ddr void address GetExternalModuleAddr char name int modulelD int status Purpose Obtains the address of an identifier in a module that was loaded using LoadExternalModule Parameters Input name string Name of identifier moduleID integer ID of loaded module R
124. If the property does not exist on the window this function does NOT report an error Instead the number of items returned is set to 0 LabWindows CVI Standard Libraries 9 22 National Instruments Corporation Chapter 9 Parameters display DisplayPtrX window WindowX property Propert yHandlex unsigned integer numberofTtemsRequested unsigned integer delete integer Output numberofItemsReturned unsigned integer passed by reference numberOflItemsRemaining unsigned integer passed by reference property Value generic pointer National Instruments Corporation 9 23 X Property Library A pointer to the display of the X server to which the window belongs The window from which the property value is to be obtained Handle of the property to be obtained This value must have been obtained with CreateXProperty Index into the property value where reading is to begin Specify the number of property items to skip from the start of the property value Number of property items to obtain from the window Flag indicating whether to delete the property value from the window after it is obtained Specify 1 to delete the portion of the property value that was obtained Specify 0 to leave the property value as it is Number of property items that were obtained from the window Number of property items on the window that were neither skipped nor obtained Pass NULL for this parameter if you do no
125. Install Asynchronous Callback Thread Specific Status Get Ibsta for Thread Get Iberr for Thread Get Ibent for Thread Get Ibentl for Thread GPIB 488 2 Functions Device VO Send Send to Multiple Devices Receive Trigger and Clear Trigger Device Trigger Multile Devices Clear Device Clear Multiple Devices O National Instruments Corporation 4 3 ibsic ibcac ibgts ibsre ibemd ibemda ibrpp iblines ibwait ibevent ibsignal ibloc ibppc ibrsv ibist ibwrtkey ibrdkey ibInstallCallback ibNotify ThreadIbsta ThreadIberr ThreadIbcnt ThreadIbcntl Send SendList Receive Trigger TriggerList DevClear DevClearList continues LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 Table 4 1 The GPIB Functions Library Function Tree Continued SRQ and Serial Polls Test SRQ line Wait for SRQ Find Requesting Device Read Status Byte Serial Poll All Devices Parallel Polls Parallel Poll Parallel Poll Config Parallel Poll Unconfig Remote Local Enable Remote Operation Enable Local Operation Set remote with Lockout Send Local Lockout System Control Reset System Send Interface Clear Conduct Self Tests Find All Listeners Pass Control Low Level I O Send Commands Setup for Sending Send Data Bytes Setup for Receiving Receive Response Message The classes and subclasses in the tree are described here TestSRQ WaitSRQ FindRQS ReadStatusByte AllSpoll PPoll PPollConf
126. Instruments Corporation Chapter 9 X Property Library There are three predefined property types that you do not need to create using this function These types listed below are useful for defining properties to store window IDs integers and strings Property Type WINDOW_X_PROP_TYPE WINDOW sizeof WindowX INTEGER_X_PROP_TYPE INTEGER sizeof int STRING_X_PROP_TYPE STRING sizeof char Note You can create a maximum of 64 different property types Parameters typeName string Name of the property type Each property type name is unique and has one set of attributes which cannot be changed after you create the property type unsigned integer Number of bytes in a single property item unsigned integer Number of bytes in the basic units that make up a property item Output propertyType PropTypeHandlex Property type created Use this value as passed by reference the type parameter to CreateXProperty to create properties Return Values The return value indicates the success or failure status of the function call A negative value indicates an error status values are shown in the following table NoXErr O The function was successful InvalidParamXErr NULL was passed to one or more of the parameters size argument is 0 unit is not 1 2 or 4 or size is not a multiple of unit DupPropTypexErr A property type with the same typeName but with different size or unit alrea
127. LabWindows CVI Standard Libraries Reference Manual July 1996 Edition Part Number 320682C 01 Copyright 1994 1996 National Instruments Corporation All rights reserved Intemet Support GPIB gpib support natinst com DAQ daq support natinst com VXI vxi support natinst com LabVIEW lv support natinst com LabWindows lw support natinst com HiQ hiq support natinst com VISA visa support natinst com Lookout lookout support natinst com FTP Site ftp natinst com Web Address www natinst com Bulletin Board Support BBS United States 512 794 5422 or 800 327 3077 BBS United Kingdom 01635 551422 BBS France 1 48 65 15 59 A FaxBack Support 512 418 1111 Om SO lt gt Telephone Support U S Tel 512 795 8248 Fax 512 794 5678 LC lt gt Intemational Offices Australia 03 9 879 9422 Austria 0662 45 79 90 0 Belgium 02 757 00 20 Canada Ontario 519 622 9310 Canada Qu bec 514 694 8521 Denmark 45 76 26 00 Finland 90 527 2321 France 1 48 14 24 24 Germany 089 741 31 30 Hong Kong 2645 3186 Italy 02 413091 Japan 03 5472 2970 Korea 02 596 7456 Mexico 95 800 010 0793 Netherlands 0348 433466 Norway 32 84 84 00 Singapore 2265886 Spain 91 640 0085 Sweden 08 730 49 70 Switzerland 056 200 51 51 Taiwan 02 377 1200 U K 01635 523545 National Instruments Corporate Headquarters 6504 Bridge Point Parkway Austin TX 78730 5039 Tel 512 794 0100 Warranty The media on which you r
128. LabWindows CVI Standard Libraries Utility Library Parameters Chapter 8 pathName Pan driveName directoryName fileName string Drive name string Full directory path ending with directory separator character Return Value None Parameter Discussion string Simple file name The driveName directoryName and fileName parameters can each be NULL If not NULL they must be buffers of the following size or greater drive name directory name file name MAX _ DRIVENAME LEN MAX_DIRNAME_LEN MAX_FILENAME_LEN On operating systems without drive names such as UNIX driveName will always be filled in with the empty Example char p char d char d char f SplitP Es LabWindows CVI string athName MAX_ PATHNAME riveName MAX_DRIVENAME_LEN 5 irName MAX_DIRNAME EN ileName MAX_FILENAME ath pathName driveName dirName fileName If pathName contains c cvi samples apps update c then driveName contains Gi dirName contains cvi samples apps fileName contains update c If pathName is computer share dirname foo c directory name is computer share dirname then drive name is file name is Standard Libraries TEOG G 8 78 National Instruments Corporation Chapter 8 Utility Library SyncWait void SyncWait double beginTime double interval Purpose Waits until the number
129. LabWindows CVI Standard Libraries 3 2 LinEvID MaxMinID Subset1D Sort Add2D Sub2D Mul2D Div2D LinEv2D MaxMin2D CxAdd CxSub CxMul CxDiv CxRecip ToPolar ToRect CxAddID CxSub1D CxMullD CxDivID CxLinEvID ToPolarID ToRectID Mean StdDev Histogram DotProduct MatrixMul InvMatrix Transpose Determinant Clear1D SetID Copy1D GetAnalysisErrorString National Instruments Corporation Chapter 3 Analysis Library The classes and subclasses in the function tree are described here e The Array Operations function panels perform arithmetic operations on 1D and 2D arrays 1D Operations a subclass of Array Operations contains function panels that perform 1D array arithmetic 2D Operations a subclass of Array Operations contains function panels that perform 2D array arithmetic The Complex Operations function panels perform complex arithmetic operations The Complex Operations function panels can operate on complex scalars or 1D arrays The real and imaginary parts of complex numbers are processed separately Complex Numbers a subclass of Complex Operations contains function panels that perform scalar complex arithmetic 1D Complex Operations a subclass of Complex Operations contains function panels that perform complex arithmetic on 1D complex arrays e The Statistics function panels perform basic statistics functions e The Vector amp Matrix Algebra function panels perform vector
130. Libraries Easy I O for DAQ Library Chapter 10 Pulse WidthOrPeriodMeasConfig short error Pulse WidthOrPeriodMeasConfig short device char counter unsigned short typeOfMeasurement double sourceTimebase unsigned long taskID Purpose Configures the specified counter to measure the pulse width or period of a TTL signal connected to its GATE pin The measurement is done by counting the number of cycles of the specified timebase between the appropriate starting and ending events Connect the signal you want to measure to the counter s GATE pin To measure with an internal timebase set sourceTimebase to the desired frequency To measure with an external timebase connect that signal to counter s SOURCE pin and set the sourceTimebase parameter to USE_COUNTER_SOURCE Call CounterStart to start the measurement Then call CounterRead to read the value A valid count value is greater than 3 without overflow Parameters device short Assigned by configuration utility integer counter string The counter to be used for the counting operation typeOfMeasurement unsigned Identifies the type of pulse width or period short measurement to make integer sourceTimebase double USE_COUNTER_SOURCE count TTL edges at counter s SOURCE pin or supply a valid internal timebase frequency to count the TTL edges of an internal clock taskID unsigned The reference number assigned for the counter long integer reserved for this operation
131. Libraries Formatting and I O Library Chapter 2 Return Value integer Index in buffer where pattern was found Return Code Parameter Discussion The buffer searched is the set of numberofBytes bytes starting at position startingIndex of buffer Exception If numberofBytes is 1 the buffer searched is the set of bytes starting at position startingIndex of buffer up to the first ASCII NUL startingIndex is zero based If caseSensitive is zero alphabetic characters are compared without regard to case If caseSensitive is non zero alphabetic characters are considered equal only if they have the same case If startFromRight is zero the leftmost occurrence of the pattern in the buffer will be found If startFromRight is non zero the rightmost occurrence of the pattern in the buffer will be found If the pattern is found pattern returns the index relative to the beginning of buffer where it found the first byte of the pattern If the pattern is not found pattern returns 1 The following example returns 4 which is the index of the second of the three occurrences of ab in the string lab2ab3ab4 The first occurrence is skipped because startingIndex is 3 Of the two remaining occurrences the leftmost is found because startFromRight is zero ndx FindPattern lab2ab3ab4 3 1 AB 0 0 On the other hand the following line returns 7 which is the index of the last occurrence of ab because startFromRight is non zero ndx
132. MA channel is available for use DMAInUseErr The specified DMA channel is already in use by another device continues O National Instruments Corporation 10 61 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Table 10 5 Easy I O for DAQ Error Codes Continued 10457 badDMAGroupErr DMA cannot be configured for the specified group because it is too small too large or misaligned Consult the user manual for the device in question to determine group ramifications with respect to DMA DLLInterfaceErr The DLL could not be called due to an interface error interfaceInteractionErr You have attempted to mix LabVIEW 2 2 VIs and LabVIEW 3 0 VIs You may run an application consisting only of 2 2 VIs then run the 2 2 Board Reset VI before you can run any 3 0 VIs You may run an application consisting of only 3 0 VIs then run the 3 0 Device Reset VI before you can run any 2 2 VIs invalidDSPhandleErr The DSP handle input to the VI is not a valid handle 10600 noSetupErr No setup operation has been performed for the specified resources 10601 multSetupErr The specified resources have already been configured by a setup operation 10602 noWriteErr No output data has been written into the transfer buffer 210603 group WriteErr The output data associated with a group must be for a single channel or must be for consecutive channels L0604 active WriteErr Once data generation has started only
133. ModuleHandle parameter You can do so by using the LabWindows CVI pre defined variable CVIU LoadExternal references Any remaining unresolved references are resolved by searching the symbols defined in the project or in object library or import library modules that have already been loaded using LoadExt LoadExt ternal serHl Modul IModuleEx You must specify the module handle of the DLL as the nst ModuleEx first searches the global DLL symbols to resolve external ternal Modul e or LoadExternalModuleEx eEx expects the DLL to contain a table of symbols that can be used to resolve references If you create the DLL in LabWindows CVI the table is included automatically If you create the DLL using an external compiler you must arrange for this table to be included in the DLL You can do this by creating an include file that includes all of the symbols that need to be in this table You can then use the External Compiler Support O National Instruments Corporation 8 53 LabWindows CVI Standard Libraries Utility Library Chapter 8 command in the Build menu of the Project Window to create an object file containing the table You must include this object file in the external compiler project you use to create the DLL LoadExternalModuleEx acts identically to LoadExternalModule if either e you pass zero for callingModuleHandle or e you pass__CVIUserHInst for callingMo
134. NTIES EXPRESS OR IMPLIED AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE CUSTOMER S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA PROFITS USE OF PRODUCTS OR INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF ADVISED OF THE POSSIBILITY THEREOF This limitation of the liability of National Instruments will apply regardless of the form of action whether in contract or tort including negligence Any action against National Instruments must be brought within one year after the cause of action accrues National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control The warranty provided herein does not cover damages defects malfunctions or service failures caused by owner s failure to follow the National Instruments installation operation or maintenance instructions owner s modification of the product owner s abuse misuse or negligent acts and power failure or surges fire flood accident actions of third parties or other events outside reasonable control Copyright Under the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval syst
135. OnLibraryErrors int newState Purpose When debugging is enabled and a National Instruments library function reports an error LabWindows CVI can display a runtime error dialog box and suspend execution You can use this function to enable or disable this feature In general it is best to use the Break on library errors checkbox in the Run Options command of the Project window to enable or disable this feature You should use this function only when you want the temporarily disable the Break on library errors feature around a segment of code This function does not affect the state of the Break on library errors checkbox in the Run Options command of the Project window National Instruments Corporation 8 63 LabWindows CVI Standard Libraries Utility Library Chapter 8 If debugging is disabled this function has no effect Run time errors are never reported when debugging is disabled Parameters Pass a nonzero value to enable Pass zero to disable Return Value oldState Previous state of the break on library errors feature Return Codes Was previously enabled Was previously disabled or debugging is disabled Example int oldValue oldValue SetBreakOnLibraryErrors 0 function calls that may legitimately return errors SetBreakOnLibraryErrors oldValue SetBreakOnProtectionErrors int oldState SetBreakOnProtectionErrors int newState Purpose If debugging is enabled LabWindows CVI uses in
136. Purpose Receives packets of information over the com port specified by COMPort and writes the packets to the specified file Parameters COMPort integer Range 1 through 32 fileName string Contains the pathname Return Value result integer Result of the XModem receive operation Failure Success Using This Function This function uses the XModem file transfer protocol The transmitter must also follow this protocol for this function to work properly The Xmodem protocol requires that the sender and receiver agree on the error checking protocol This agreement is negotiated at the beginning of the transfer and can cause a significant delay National Instruments Corporation 5 33 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 XModemReceive tries maximum tofTries 1 2 times to negotiate a CRC error check transfer If there is no response it tries to negotiate a check sum transfer up to maximum ofT ries 1 2 times The file is opened in binary mode and carriage returns and linefeeds are not treated as ASCII characters They are written to the RS 232 line untouched If the size of the file being sent is not an even multiple of the packet size the file received is padded with NUL 0 bytes For example if the file being sent contains only the string HELLO the file written to disk contains the letters HELLO followed by packet size 5 bytes of zero If the packet size is 128 the file co
137. Q 16 SRQ stuck in on position ETAB 20 Device list error during a FindLstn or FindRQS call ELCK 21 Address or board is locked ELNK 200 The GPIB library was not linked Dummy functions were linked instead EDLL 201 Error loading GPIB32 DLL The MS Windows error code is returned by ThreadIbcntl EFNEF 203 Unable to find the function in GPIB32 DLL The MS Windows error code is returned by ThreadIbcntl EGLB 205 Unable to find globals in GPIB32 DLL The MS Windows error code is returned by ThreadIbcntl ENNI 206 Not a National Instruments GPIB32 DLL EMTX 207 Unable to acquire Mutex for loading DLL The MS Windows error code is returned by ThreadIbecntl EMSG 210 Unable to register callback function with MS Windows ECTB 211 The callback table is full LabWindows CVI Standard Libraries 4 24 National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library See Also Threadlbsta Threadlbcnt ThreadIbcntl ThreadIbsta int threadSpecificStatus ThreadIbsta void Note This function is available only under Windows 95 and NT This function returns the value of the thread specific ibsta variable for the current thread The global variables ibsta iberr ibcnt and ibcnt1 are maintained on a process specific rather than thread specific basis If you are calling GPIB functions in more than one thread the values in these global variables may not always be reliable Status variables analogous to ibsta iberr ibcnt and ibcn
138. RegenModeErr This device does not support the specified analog output regeneration mode 0680 badChanGainErr All channels must have an identical setting for this device 0681 badChanRangeErr All channels of this device must have the same range 0682 badChanPolarityErr All channels of this device must have the same polarity 10683 badChanCouplingErr All channels of this device must have the same coupling continues O National Instruments Corporation 10 63 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Table 10 5 Easy I O for DAQ Error Codes Continued 10684 badChanInputModeErr All channels of this device must have the same input range 10685 clkExceedsBrdsMaxConvRate The clock rate selected exceeds the recommended maximum rate for this device 10686 scanListInvalidErr A configuration change has invalidated the scan list bufferInvalidErr A configuration change has invalidated the allocated buffer 10688 noTrigEnabledErr The total number of scans and pretrigger scans implies that a trigger start is intended but no trigger is enabled 10689 digitalTrigBErr Digital trigger B is illegal for the total scans and pretrigger scans specified 10690 digitalTrigAandBErr With this device you cannot enable digital triggers A and B at the same time 10691 extConvRestrictionErr With this device you cannot use an external sample clock with an external scan clock start trigger or s
139. See Also ConnectToDDEServer ClientDDEWrite ClientDDE Write int status ClientDDE Write unsigned int conversationHandle char itemName unsigned int dataFormat void dataPointer unsigned int dataSize unsigned int timeout O National Instruments Corporation 6 11 LabWindows CVI Standard Libraries DDE Library Chapter 6 Purpose Called by client to write data to a DDE server application Parameters conversationHandle unsigned integer Uniquely identifies the conversation itemName string Uniquely identifies the output item for example system dataFormat unsigned integer Valid data format for example CF_TEXT dataPointer void pointer Buffer holding data dataSize unsigned integer Number of bytes to write Limited to 64 KB under Windows 3 1 and Windows 95 timeout unsigned integer Timeout in ms Return Value integer Refer to error codes in Table 6 3 Parameter Discussion dataFormat must be a valid data format recognized by Microsoft Windows The following are the valid data formats supported by Microsoft Windows CF_TEXT CF_PALET CF_BITMAP CF_PENDATA CF_METAFILEPICT CF_RIFF CF_SYLK CF_WAVE CF_DIF CF_OWNERDISPLAY CF_TIFF CF_DSPTEXT CF_OEMTEXT CF_DSPBITMAP CF_DIB CF_DSPMETAFILEPICT Refer to Microsoft programmers documention for Windows 3 x for an in depth discussion of DDE programming and meaning of each data fo
140. Success Using This Function The file is opened in binary mode Carriage returns and linefeeds are not treated as ASCII characters They are sent to the receiver untouched This function uses the XModem file transfer protocol The receiver must also follow this protocol for this function to work properly If the size of the file being sent is not an even multiple of the packet size the last packet is padded with NUL 0 bytes For example if the file being sent contains only the string HELLO and the packet size is 128 the packet of data sent contains the letters HELLO followed by 123 packet size 5 zero bytes The standard XModem protocol only supports 128 and 1024 packet sizes The sender sends an SOH character 0x01 to indicate that the packet size is 128 or an STX character 0x02 to indicate that the packet size is 1024 LabWindows CVI attempts to support any packet size As a sender LabWindows CVI sends an STX character when you specify packet size as 1024 For any other packet size 1t sends an SOH character For transfers with a large packet size and a low baud rate a large delay period is recommended O National Instruments Corporation 5 35 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Error Conditions If an error condition occurs during a call to any of the functions in the LabWindows CVI RS 232 Library the function returns an error code and the global variable rs232err contains that error code This c
141. TEXT CF_PALET CF_BITMAP CF_PENDATA CF_METAFILEPICT CF_RIFF CF_SYLK CF_WAVE CF_DIF CF_OWNERDISPLAY CF_TIFF CF_DSPTEXT CF_OEMTEXT CF_DSPBITMAP CF_DIB CF_DSPMETAFILEPICT O National Instruments Corporation 6 19 LabWindows CVI Standard Libraries DDE Library Chapter 6 Refer to Microsoft programmers documention for Windows 3 x for an in depth discussion of DDE programming and meaning of each data format type Using This Function This function allows your program acting as a DDE server to send data to a client You should call this function only when your serverCallbackFunction receives transaction type xType of DDE_REQUESTDATA If you call the function at any other time the data is stored until the client requests data If you call the function multiple times on the same conversation before the client requests the data each new data set is appended to the buffer containing the stored data If the client has set up a hot or warm link and you need to send data other than in response to a DDE_REQUESTDATA transaction use the AdviseDDEDataReady or BroadcastDDEDataReady function If successful this function returns the number of bytes written Otherwise this function returns a negative error code See Also RegisterDDEServer AdviseDDEDataReady SetUpDDEHotLink int status SetUpDDEHotLink unsigned int conversationHandle itemName unsigned int dataFormat
142. WIRE_2_ECHO Sets the transceiver to Two Wire DTR controlled with echo mode WIRE_2 CTRL Sets the transceiver to Two Wire DTR controlled without echo WIRE_2 AUTO Sets the transceiver to Two Wire auto TXRDY controlled mode ComToFile int nbytes ComToFile int COMPort int fileHandle int count int terminationByte Purpose Reads from input queue of specified com port and write data to file specified by fileHandle Returns number of bytes successfully written to file Bytes are read from input queue until count is satisfied terminationByte is encountered or an error occurs whichever occurs first Parameters COMPort Range through 32 fileHandle File handle returned by OpenFile count If 0 this value is ignored terminationByte If 1 this value is ignored Return Value file Parameter Discussion If count is zero the function ignores it and terminates on terminationByte or error If terminationByte is 1 the function ignores it and terminates on count bytes read or an error If terminationByte is valid the function stops when it encounters terminationByte terminationByte is removed from the input queue and is not written to the file If terminationByte is CR or LF then CR LF and LF CR combinations are treated just as they are National Instruments Corporation 5 15 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 for ComRdTe rm If both count and terminationByte are disabled
143. Width double The achieved pulse width based on the resolution and range of your hardware taskID unsigned long The reference number assigned to this integer operation You pass taskID to CounterStart CounterRead and CounterStop Return Value short integer Refer to error codes in Table 10 5 Parameter Discussion counter is the counter to be used for the counting operation The valid counters are shown in Table 10 2 which is found in the Valid Counters for the Counter Timer Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter pulseDelay is the desired duration of the delay phase 1 before the pulse This parameter accepts the following attributes e The unit is seconds if timebaseSource is USE_INTERNAL_TIMEBASE and cycles if timebaseSource is USE_COUNTER_SOURCE e If pulseDelay 0 0 and timebaseSource is internal the function selects a minimum delay of three cycles of the timebase used National Instruments Corporation 10 35 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 e pulseWidth is the desired duration of the pulse phase 2 after the delay e The unit is seconds if timebaseSource is USE_INTERNAL_TIMEBASE and cycles if timebaseSource is USE_COUNTER_SOURCE e If pulseDelay 0 0 and timebaseSource is internal the function selects a minimum delay of three cycles of the timebase used timebaseSource is the s
144. Windows CVI Standard Libraries 10 52 National Instruments Corporation Chapter 10 Easy I O for DAQ Library SetEasyIOMultitaskingMode void SetEasyIOMultitaskingMode int multitaskingMode Purpose By default if you call the non timed Easy I O for DAQ functions repetitively these functions do not reconfigure the hardware unless you change the parameters to the functions Thus the performance of these functions is improved by only reconfiguring the hardware when necessary However if you run multiple data acquisition programs simultaneously any non timed Easy I O for DAQ functions will not know when the hardware has been reconfigured by another application accessing the same DAQ device and the functions will run incorrectly To get around this problem you can force these functions to always reconfigure the hardware by setting the multitasking mode to MULTITASKING_AWARE You should set the multitasking mode to MULTITASK_AWARE if your program calls the non timed Easy I O for DAQ functions and you expect another data acquisition program to be accessing the same board while your program is running In this mode the Easy I O for DAQ functions always reconfigure the hardware on each invocation which means they will not be adversely affected by other applications but they will not be optimized for speed You should set the multitasking mode to MULTITASK_UNAWARE if you know there will not be another program accessing the same D
145. X property PropTypeHandleX propertyType Purpose Gets the type of a property This function returns a pointer to the type associated with the property handle Parameters Input property PropertyHandlexX Property handle for which the name is to be obtained This value must have been obtained from CreateXProperty Output propertyType PropTypeHandleX The property type Use the functions passed by reference Get xPropTypeName Get XPropTypeSize and GetXPropTypeUnit to get more information about the property type LabWindows CVI Standard Libraries 9 16 O National Instruments Corporation Chapter 9 X Property Library Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to the parameter InvalidPropertyXErr The property argument is not a valid property handle This argument must be the value returned by CreateXProperty GetXPropTypeName PropLibXErrType status GetXPropTypeName PropTypeHandlexX propertyType char typeName Purpose Gets a property type name This function returns the name associated with the property type Parameters Input propertyType PropTypeHandleX Handle to property type for which the name is to be obtained This value must either be one of the predefined property types o
146. XErr NULL was passed to one or more of the parameters InvalidPropTypexErr The propertyType argument is not a valid property type This value must either be one of the predefined property types or be a value returned by CreateXPropType DupPropertyXErr A property with the same propertyName but with different propertyType already exists InsuffMemxXErr There is insufficient memory to store the property information or there are already 256 properties Parameter Discussion propertyType is added with the property the first time you write a property to a window When you access a property on a window on which the property already exists its type must match this value for the access to succeed See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XInternAtom function CreateXPropType PropLibXErrType status CreateXPropType const char typeName unsigned int size unsigned int unit PropTypeHandleX propertyType Purpose Creates X property type You can use this function to define the attributes of the properties that you read and write on X windows You must create property types with this function before you can create properties Each property type has a unique name and set of attributes that cannot be changed except by destroying the property and recreating it LabWindows CVI Standard Libraries 9 10 National
147. Y locale e Currency_symbol maps to the value of sCurrency e mon_decimal_point maps to the value of sDecimal mon_thousands_sep maps to the value of sThousand e frac_digits maps to the value of iCurrDigits e int_frac_digits maps to the value of iCurrDigits e p_cs_precedes and n_cs_precedes are set to 1 if i Currency equals 0 or 2 otherwise they are set to 0 e p_sep_by_space and n_sep_by_space are set to 0 if icurrency equals 0 or 1 otherwise they are set to 0 p_sign_posn and n_sign_posn are determined by the value of iNegCurr as follows Value of Value of iNegCurr p_sign_posn n_sign_posn 0 For the LC_CTYPE locale e isalnum maps to the Windows function isCharAlphaNumeric e isalpha maps to the Windows function isCharAlpha LabWindows CVI Standard Libraries 1 4 National Instruments Corporation Chapter 1 ANSI C Library e islower maps to the Windows function isCharLower e supper maps to the Windows function isCharUpper e tolower maps to the Windows function AnsiLower toupper maps to the Windows function AnsiUpper For the LC_ TIME locale e strftime uses the following items from the WIN INT file for the appropriate format specifiers sTime iTime s1159 s2359 iTLZero sShortDate and sLongDate e The names of the weekdays and the names of the months match the language version of LabWindows CVI That is a German version of LabWindows
148. abWindows CVI Standard Libraries 2 54 National Instruments Corporation Chapter 2 Formatting and I O Library Real Array to Binary File Assuming a Variable Number of Elements void StoreArray double x int count char filename int file handle file handle OpenFil filename 2 0 0 FmtFile file handle S f lt f count count x CloseFile file _ handle Remarks This example shows how a function can be used to write an array of real numbers to a binary file The function s parameters are a real array the number of elements to be written and the filename The Fmt File call writes the first count elements of x to a file in binary form The two asterisks in the format string are matched to count For instance if count is 100 then the format string is equivalent to 100f lt 100f A Variable Portion of a Real Array to a Binary File void StoreSubArray double x int start int count char filename int file handle file handle OpenFil filename 2 0 0 FmtFile file handle f lt f i count count start x CloseFile file handle Remarks This example is an extension of the previous example The function also writes a variable number of elements of a real array to a file Instead of beginning at the first element of the array a starting index is passed to the function The Fmt File call writes count elements of x starting from x start to a file in bi
149. ack function that will be invoked to process client requests The callback function must be of the following form int ddeFuncPtr int handle char topicName char itemName int xType int dataFmt int dataSize void dataPtr void callbackData The xType transaction type parameter specifies the type of request received from the client The following transaction types are supported DDE_CONNECT LabWindows CVI Standard Libraries 6 16 O National Instruments Corporation Chapter 6 DDE Library DE_DISCONNECT DE_DATAREADY DE_REQUEST DE_ADVISELOOP DE_ADVISESTOP DE_EXECUTE DDE_CONNECT This transaction type is received when a client is requesting a connection The topicName parameter specifies the connection topic The set of valid topic names is defined by the server and can be used in different ways For example Excel uses the topic name to specify the file on which the client requests to operate A client can have multiple connections to the same server as long as there is a different topic name for each connection DDE_DISCONNECT Received when a client is requesting the termination of a connection or when Windows terminates the connection due to an internal error DDE_DATAREADY Received when the client has sent data via DDE to the server The topicName itemName dataF mt dataSize and dataPtr parameters contain significant data The itemName can spec
150. acklog unsigned long Returns the backlog of scans that have been acquired integer into the circular buffer but have not been read using ATReadAcquisition waveforms double array Array containing the voltages acquired on the channels specified in the chamnelString Return Value short integer Refer to error codes in Table 10 5 Parameter Discussion readMode specifies whether scans are read from the circular buffer in CONSECUTIVE_MODE or LATEST MODE In CONSECUTIVE_MODE scans are read from the internal circular buffer starting from the last scan that was read Using this mode you are guaranteed that you will not lose data unless an error occurs In LATEST_MODE the most recently acquired n scans are read LabWindows CVI Standard Libraries 10 16 National Instruments Corporation Chapter 10 Easy I O for DAQ Library from the internal circular buffer where n is scanstoRead Calling AIReadAcquisition in this mode resets the scanBacklog to zero scanBacklog returns the backlog of scans that have been acquired into the circular buffer but have not been read using AIReadAcquisition IfATReadAcquisition is called in latest read mode the scan backlog is reset to zero You can also call AICheckAcquisition to determine the scan backlog before calling ALIReadAcquisition waveforms is an array containing the voltages acquired on the channels specified in the channelString The acquired voltages
151. adi dis 8 44 LaunchExecutableEx oocoonoocnnononocononnnonanononocnoncnnnnononononcononnnnn non nac ncoronnanononoss 8 47 LoadExternalModuler iinai ai Tita 8 49 LoadExternalModuleEX ooooooocconnocccocnonnonnnnnonconononnnnnnnnoroorononannonnnrconconcnnnnnnnnnoos 8 52 MaKe Dit rca ias la abs 8 54 MakePathnad mies E N ase Eee ates 8 55 E RETO 8 56 O 8 56 ReadEromPhysicalMemor Ye nicas cia nad andan aida 8 57 ReadbromPhysical Memory E RRA Iii 8 58 ReleaseExternalModule c ccccccccccsssssssecececececeessnsececeeceseeesenseaeeeseceeeeseneaaees 8 59 Ret aMO RIGS ot it A 8 60 RetireExecutableHandle ud ile 8 61 RoundRealToNearestInteger o 8 61 RunExternalModule nsen manahin a n a a R na a 8 62 SetBreakOnLibraryErrors sessseesseeesseeesseesseesseseseeesseeesstessersseesseresseeesseesseesse 8 63 SetBreakOnProtectionElrTOTS ccconoonoonnonncnccnonnnnnnnnnnnnconononnnononononconnnnananonononoos 8 64 SOI al O ad e A e 8 66 SOUL VE AAA 8 66 SetElde Atos bras 8 67 SETHE D de iio nai ind 8 68 Sel FME suit it 8 70 SetPersistentVarlable ocoonconnoononononococnnannnananonocconcnnnnononnnoroonononannnnnncnoonon 8 71 SetstdioP Orilla as 8 71 SetStdioWindoWwOPptio S cedarea Atar 8 72 SetStdioWindowPosition ccconnoononnnnnonnnnononnononononconononan no nonononnononnnnn no nnnnccononnos 8 74 SetStdiOWiNdOWSIZO ooooococcnocccncononononononocnononnnno a a a no nnnonccnons 8 75 SetStdioWindowVisibility ii 8 76 SECS yste
152. ait function for a board other than ERR This includes SROI END CMPL TIMO CIC and others e At the device level you can specify any of the status word bits that can be specified in the waitMask parameter to the ibwait function for a device other than ERR This includes ROS END CMPL and TIMO If you are using a NI 488 2 driver Windows 3 1 or compatibility driver for Windows 95 then the only following mask bits are valid SROI or CMPL but not both SRQL RQS and Auto Serial Polling If you want to install a callback for the SROT board level event Auto Serial Polling must be disabled You can disable Auto Serial Polling with the following function call ibconfig boardIndex IbcAUTOPOLL 0 If you want to install a callback for the ROS device level event Auto Serial Polling must be enabled for the board You can enable Auto Serial Polling with the following function call ibconfig boardIndex IbcAUTOPOLL 1 LabWindows CVI Standard Libraries 4 16 National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library CallbackFunction The callback function must have the following form void CallbackFunctionName int boardOrDevice int mask void callbackData The mask and callbackData parameters are the same values that were passed to ibInstallCallback If invoked because of an SROT or ROS condition the callback function should call the ibrsp function to read the status b
153. al Instruments Corporation 4 19 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 If invoked because an asynchronous I O operation started by ibrda ibwrta or ibcmda completed the callback function should contain the following call ibwait boardOrDevice TIMO CMPL The ibcnt and ibcnt 1 status variables are not updated until this call to ibwait is made Restrictions on Operations in Asynchronous Callbacks Callbacks installed with ibnoti f y can be called at any time while your program is running You do not have to allow the system to process events Because of this you are restricted in what you can do in the callback You can do the following e Call the User Interface Library PostDeferredCal1 function which schedules a different callback function to be called synchronously e Call any GPIB function except ibnotify or ibInstallCallback e Manipulate global variables but only if you know that the callback has not been called at a point when the main part of your program is modifying or interrogating the same global variables e Call ANSI C functions such as strcpy and sprintf which affect only the arguments passed in that is have no side effects You cannot call printf or file I O functions e Call malloc calloc realloc or free If you need to perform operations that fall outside these restrictions do the following Lis In your asynchronous callback perform the time critical operations
154. all bytes have been sent you lose the bytes remaining in the queue To guarantee that all bytes have been removed from the output queue before closing LabWindows CVI Standard Libraries 5 16 National Instruments Corporation Chapter 5 RS 232 Library the port call GetOutQLen GetOutQLen returns the number of bytes remaining in the output queue The function returns an error if the port is not open or parameter values are invalid Example Place the string Hello world in the output queue of COM2 and check if operation was successful if ComWrt 2 Hello World 13 13 Operation was unsuccessful or char buf 100 Fmt buf Ss Hello World if ComWrt 2 buf 13 13 Operation was unsuccessful ComWrtByte int status ComWrtByte int COMPort int byte Purpose Writes a byte to the output queue of the specified port The byte written is the low order byte of the integer Returns a 1 to indicate the operation is successful or a negative error code to indicate the operation has failed Returns immediately without waiting for the byte to be transmitted out through the serial port Parameters COMPort Range through 32 byte Only the low order byte is significant Return Value status integer Result of the write operation lt 0 Error code See Table 5 6 1 One byte placed in the output queue National Instruments Corporation 5 17 LabWindows CVI Standard Librar
155. alue 10 0 seconds maximum ofRetries integer O selects the default value 10 waitPeriod double precision 0 0 selects the default value 10 0 seconds gt 5 0 is recommended packetSize integer 0 selects the default value 128 Return Value result integer Result of the XModem configuration operation Less than zero Error code See Table 5 6 Zero Success Parameter Discussion XModemSend and XModemReceive use the baud rate and the input output queue sizes specified by OpenComConf ig But they ignore the data bits the parity and the stop bits settings of OpenComConfig and always use 8 bits no parity and one stop bit Instead of using the time out value defined by the Set ComTime function XModem functions use a 1 second time out between data bytes A zero input for any parameter except COMPort sets that parameter to its default value startDelay sets the timing for the initial connection between the two communication parties When a LabWindows CVI program assumes the role of receiver startDelay specifies the interval in seconds during which to send the initial negative acknowledgment character to the transmitter That character is sent every startDelay seconds up to maximum ofRetries times When a LabWindows CVI program assumes the role of transmitter startDelay specifies the interval in seconds during which the transmitter waits for the initial negative acknowledgment The transmitter waits up to startDelay m
156. an a 32 buf abc and n 2 Notice there are no spaces in the format string between the two target specifiers In the second call there is a space between 1 and s Consequently Scan expects a space to occur in s immediately after the integer Because there is no space in s Scan fails at that point It leaves buf unmodified and returns 1 indicating that only one target specifier is satisfied Note Do not put spaces between specifiers in Scan ScanFile or ScanlIn format strings String to Real Skipping over Non Numeric Characters in the String char s double x int n s VOLTS 1 2 n Scan s Ss gt s dt amp x fe COSULt 12 nS 2 s VOLTS 1 2 n Scan s S i8 gt Sf amp x f result x 12 n ky s VOLTS 1 2 n Scan s s gt VOLTS f amp x result x 1 2 n 1 Remarks The three different format strings represent different methods for skipping over non numeric characters In the first call the format string contains two target specifiers In the first specifier Ss dt 4 the t modifier instructs Scan to read bytes from s until a number is encountered The d modifier indicates that the bytes must be discarded because there is no argument corresponding to the specifier When the Scan call succeeds it returns 2 indicating that two target specifiers were satisfied even though there is only one target argument In the second call the source
157. and matrix operations Vectors and matrices are represented by 1D and 2D arrays respectively e The Array Utilities function panels copy initialize and clear arrays e Miscellaneous is a class of function panels for miscellaneous Analysis Library functions The online help with each panel contains specific information about operating each function panel Hints for Using Analysis Function Panels With the analysis function panels you can manipulate scalars and arrays of data interactively You will find it helpful to use the Analysis Library function panels in conjunction with the User Interface Library function panels to view the results of analysis routines When using the Analysis Library function panels remember the following things e The processing speed of the analysis functions is affected by the computer on which you are running LabWindows CVI A numeric coprocessor especially increases the speed of floating point computations If you are using an Analysis Library function panel and nothing seems to happen for an inordinate amount of time keep the constraints of your hardware in mind e Many analysis routines for arrays run in place That is the input and output data can be stored in the same array This is very important to keep in mind when you are processing National Instruments Corporation 3 3 LabWindows CVI Standard Libraries Analysis Library Chapter 3 large amounts of data Large double precision arrays consume a
158. andshaking The SetCTSMode function enables hardware handshaking For hardware handshaking to work two conditions must exist First the serial devices must follow the same or similar hardware handshake protocols they must use the same lines for the handshake and assign the same meanings to those lines Second the serial cable connecting the two devices must include the lines required to support the protocol Because no single well defined hardware handshake protocol exists resolve any differences between the LabWindows CVI hardware handshake protocol and the one your device uses Most serial devices primarily rely on the CTS and RTS lines to perform hardware handshaking and the DTR line is used to signal its online presence to the other device Some serial devices also may use the DTR line for hardware handshaking similarly to the CTS line The Set CTSMode function has two different modes to handle either case This Set CTSMode function employs the following line behaviors for each mode Note Under UNIX changes to the DTR line have no effect on the communication port LWRS_HWHANDSHAKE_ OFF e The RTS and DTR lines are raised when opening the port and lowered when closing the port Data is sent out the port regardless of the status of CTS Note Under Windows the SetComEscape function can be used to change the value of the RTS and DTR lines LWRS_HWHANDSHAKE_CTS_RTS e When the PC is the receiver If the port is opened th
159. arWaveforms unsigned long taskID Purpose This function clears the waveforms generated by AOGenerat eWaveforms when you passed 0 for its Iterations parameter Parameters Input taskID unsigned The task ID that was returned from long integer AOGenerateWaveforms Return Value LabWindows CVI Standard Libraries 10 20 National Instruments Corporation Chapter 10 Easy I O for DAQ Library AOGenerateWaveforms short error AOGenerateWaveforms short device char channelString double updatesPerSecond int updatesPerChannel int iterations double waveforms unsigned long taskID Purpose This function generates a timed waveform of voltage data on the analog output channels specified in the channelString Parameters device short integer Assigned by configuration utility channelString string The analog output channels to which the voltages are applied updatesPerSecond double The number of updates that are performed per second Any particular channel is updated at this rate updatesPerChannel integer The number of D A conversions that compose a waveform for a particular channel iterations integer The number of waveform iterations that are performed before the operation is complete 0 continuous waveforms double array The voltages to be applied to the channels specified in the channelString taskID unsigned Returns an identifier for the waveform long integer generation If you
160. arameter Invalid numberOfElements parameter Invalid numberOfGroups parameter Invalid arrayDataOrder parameter Invalid fileLayout parameter Invalid fileType parameter National Instruments Corporation LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Parameter Discussion FileName may be an absolute pathname or a relative file name If you use a relative file name the file is located relative to the current working directory DataType must be one of the following e VAL_CHAR e VAL_SHORT_INTEGER e VAL_INTEGER e VAL_FLOAT e VAL_DOUBLE e VAL_UNSIGNED_SHORT_INTEGER e VAL_UNSIGNED_INTEGER e VAL_UNSIGNED_CHAR NumberOfGroups specifies the number of groups into which the data in the file is divided Groups can be in the form of either columns or rows If there are no groups use 1 This parameter only applies if the file type is ASCII If the data is divided into groups arrayDataOrder specifies the order in which the data is to be stored in the array The two choices are as follows e VAL_GROUPS_TOGETHER all points from one data group are stored together followed by all points from the next data group e VAL_DATA_MULTIPLEXED the first points from each data group are stored consecutively followed by the second points from each group etc If the file is in ASCII format fileLayout specifies how the data ap
161. arameter Discussion fileName may be the empty string in which case the size of the file found by the most recent call to GetFirstFileor GetNextF ile is returned Windows only Example long size if GetFileSize waveform dat amp size 0 FmtOut The size of WAVEFORM DAT is i b4 size GetFileTime int result GetFileTime char fileName int hours int minutes int seconds Purpose Gets the time of a file Parameters hours Hours 0 to 23 minutes Minutes 0 to 59 seconds Number of 2 second increments 0 29 Return Value LabWindows CVI Standard Libraries 8 26 O National Instruments Corporation Chapter 8 Utility Library Return Codes Success File not found or directory in path not found General I O error occurred Insufficient memory to complete operation Invalid path for example c filename in Windows Access denied Parameter Discussion fileName may be the empty string in which case the time of the file found by the most recent call to GetFirstFileor GetNextF ile is returned Windows only Example get the time of WAVEFORM DAT int hours minutes seconds GetFileTime waveform dat amp hours minutes amp seconds GetFirstFile int result GetFirstFile char searchPath int normal int read only int system int hidden int archive int directory char fileName Purpose Starts a search for files with specified attrib
162. are calling GPIB functions in more than one thread the values in these global variables may not always be reliable Status variables analogous to ibsta iberr ibcnt and ibcnt1 are maintained for each thread This function returns the value of the thread specific iberr variable If you are not using multiple threads the value returned by this function is identical to the value of the iberr global variable Parameters none Return Value threadSpecificError integer The most recent GPIB error code for the current thread of execution The value is meaningful only when ThreadIbsta returns a value with the ERR bit set National Instruments Corporation 4 23 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 Return Codes Defined Constant Value Description EDVR 0 Operating system error The system specific error code is returned by ThreadIbcntl ECIC 1 Function requires GPIB PC to be CIC ENOL 2 No listener on write function EADR 3 GPIB PC addressed incorrectly EARG 4 Invalid function call argument ESAC 5 GPIB PC not System Controller as required EABO 6 T O operation aborted ENEB 7 Non existent GPIB PC board EDMA 8 Virtual DMA device error EOIP 10 T O started before previous operation completed ECAP 11 Unsupported feature EFSO 12 File system error EBUS 14 Command error during device call ESTB 15 Serial Poll status byte lost ESRO
163. are placed into the array in the order specified by fillMode This array must be declared as large as number of channels scanstoRead You can determine the number of channels by using the function GetNumChannels AISampleChanmnel short error AISampleChannel short device char singleChannel double highLimitVolts double lowLimitVolts double voltage Purpose This function acquires a single voltage from a single analog input channel Parameters device short integer Assigned by configuration utility singleChannel string The analog input channel that is to be sampled highLimitVolts double Maximum voltage to be measured lowLimit Volts double Minimum voltage to be measured voltage double Returns the measured voltage passed by reference Return Value short integer Refer to error codes in Table 10 5 O National Instruments Corporation 10 17 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Parameter Discussion singleChannel is the analog input channel that is to be sampled See the Channel String for Analog Input Functions subsection of the Easy I O for DAO Library Function Overview section in this chapter for the syntax of this string AISampleChanmnels short error AISampleChannels short device char channelString double highLimitVolts double lowLimitVolts double voltageArray Purpose This function performs a single scan on a set of analog inpu
164. are to be driven Refer to the chapter specific to your DAQ device in the DAQ Hardware Overview Guide to determine what channels are valid for your hardware The document is an Adobe Acrobat file daghwov pdf that you can view on screen and also print daqhwov pdf is part of a set of pdf files that come with every DAQ device sold by National Instruments The syntax for the Channel String is as follows e If you are using a DAQ device without SCXI list the channels to be driven as in the following example 0 2 5 drives channels 0 2 and 5 sO drives channels 0 through 3 inclusive e If you are using SCXI you can address SCXI channels when you attach one or more SCXI chassis to a plug in data acquisition board The SCXI channel syntax is as follows SCx MDy a channel a on the module in slot y of the chassis with ID x SCx MDy a b channels a through b inclusive on the module in slot y of the chassis with ID x SCXI channel ranges cannot cross module boundaries SCXI channel ranges must always increase in channel number Valid Counters for the Counter Timer Functions The second parameter to most of the counter timer functions is the counter used for the operation The valid counters you can use depends on your hardware as shown in Table 10 2 Table 10 2 Valid Counters Device Type Valid Counters DAQ STC Devices O and 1 Am9513 MIO boards 1 2 and 5 PC TIO 10 1 through 10 EISA A2000 2
165. arted with LabWindows CVI tutorial and are familiar with the LabWindows CVI User Manual To use this manual effectively you should be familiar with LabWindows CVI and DOS fundamentals Organization of This Manual The LabWindows CVI Standard Libraries Reference Manual is organized as follows Chapter 1 ANSI C Library describes the ANSI C Standard Library as implemented in LabWindows CVI Chapter 2 Formatting and I O Library describes the functions in the LabWindows CVI Formatting and I O Library and contains many examples of how to use them The Formatting and I O Library contains functions that input and output data to files and manipulate the format of data in a program Chapter 3 Analysis Library describes the functions in the LabWindows CVI Analysis Library The Analysis Library Function Overview section contains general information about the Analysis Library functions and panels The Analysis Library Function Reference section contains an alphabetical list of the function descriptions Chapter 4 GPIB GPIB 488 2 Library describes the NI 488 and NI 488 2 functions in the LabWindows CVI GPIB Library as well as the Device Manager functions in LabWindows CVI The GPIB Library Function Overview section contains general information about the GPIB Library functions and panels the GPIB DLL and guidelines and restrictions you should know when using the GPIB Library Detailed descriptions of the NI 488 and NI 488 2 functions can be found
166. ary function panel generates an X Property Library function call The name of the function is in bold italics to the right of the function panel name National Instruments Corporation 9 1 LabWindows CVI Standard Libraries X Property Library Chapter 9 Table 9 1 The X Property Library Function Tree Accessing Remote Hosts Connect To X Server Disconnect From X Server Managing Property Types Create New Property Type Get Property Type Name Get Property Type Size Get Property Type Unit Destroy Property Type Managing Property Information Create New Property Get Property Name Get Property Type Destroy Property Accessing Window Properties Get Single Window Property Item Put Single Window Property Item Get Window Property Value Put Window Property Value Remove Window Property Handling Property Events Install Property Callback Uninstall Property Callback Get Error String ConnectToXDisplay DisconnectFromXDisplay CreateXPropType GetXPropTypeName GetXPropTypeSize GetXPropTypeUnit DestroyXPropType CreateXProperty GetXPropertyName GetXPropertyType DestroyXProperty GetX WindowPropertyItem PutXWindowPropertylItem GetX WindowProperty Value PutX WindowProperty Value Remove X WindowProperty InstallXPropertyCallback UninstallXPropertyCallback GetXPropErrorString X Interclient Communication X applications often use X properties to communicate with each other Properties are essentially tagged data associated with a wi
167. ary reference functions to access properties on the root window of the remote X server Return Values The return value indicates the success or failure status of the function call A negative value indicates an error status values are shown in the following table NoXErr The function was successful InvalidParamXErr NULL was passed to one or more of the parameters TooManyConnectionsXErr The program has already made the maximum number of connections as defined by the constant MAX_X_ DISPLAYS Use DisconnectFromXDisplay to allow more connections CannotConnectXErr The connection could not be made to the X server This happens for a number of reasons including an invalid display name a network problem or a security problem Parameter Discussion Valid values for displayName include any valid arguments to the Xlib function XOpenDisplay The format is hostname server or hostname server screen where e hostname specifies the name of the host computer on which the display is physically connected e server specifies the number of the server on its host computer usually 0 e screen specifies the number of the default screen on the server usually 0 LabWindows CVI Standard Libraries 9 8 O National Instruments Corporation Chapter 9 X Property Library See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XOpe
168. asses in the function tree are described here LaunchExecutable LaunchExecutableEx ExecutableHas Terminated TerminateExecutable RetireExecutableHandle SystemHelp GetCVIVersion GetCurrentPlatform InStandaloneExecutable InitCVIRTE CloseCVIRTE CVILowLevelSupportDriverLoaded Beep Breakpoint RoundRealToNearestInteger TruncateRealNumber GetWindow Display Setting e Timer Wait functions use the system timer including functions that wait on a timed basis e Date Time functions return the date or time in ASCII or integer formats and set the date or time e Keyboard functions provide access to user keystrokes e File Utilities functions manipulate files e Directory Utilities functions manipulate directories and disk drives External Modules functions load execute and unload files that contain compiled C object modules e Port I O functions read and write data from I O ports Supported only under Microsoft Windows LabWindows CVI Standard Libraries National Instruments Corporation Chapter 8 Utility Library e Standard Input Output Window functions control various attributes of the Standard Input Output Window Run Time Error Reporting functions enable and disable the feature which breaks execution when a LabWindows CVI library function returns an error code e Interrupts functions disable and enable the occurrence of interrupts e Physical Memory Access functions read and write data from and to
169. ating Point Array The z floating point modifier indicates that the data type of the corresponding argument is a string Nevertheless the data in the string is treated as a floating point array The z modifier is valid only if rep is present wn Specify String Size The w floating point modifier specifies the exact number of bytes in which to store a string representation of the floating point argument in the event that the value is converted to a string format Any non negative value can be entered here If n is less than the number of digits required to represent the floating point number an asterisk will be inserted into the string to signify an overflow The default for n is zero which indicates that the value can occupy whatever space is necessary pn Specify Precision The p floating point modifier specifies the number of digits to the right of the decimal point in a string representation of the floating point number You can lose significant digits by attempting to conform to the precision specification If the pn modifier is omitted the default value is p6 en Specify as Scientific Notation The e floating point modifier specifies that a value be converted to string format in scientific notation If omitted floating point notation is used nis optional and specifies the number of digits in the exponent For example f e2 formats 10 0 as 1 0e 01 If nis omitted a default of three is used f Specify as Floating Point Notation Th
170. ation Chapter 8 Utility Library GetFileAttrs int result GetFileAttrs char fileName int read only int system int hidden int archive Note Only available on the Windows version of LabWindows CVI Purpose Gets the following attributes of a file e Read Only e System e Hidden e Archive The read only attribute makes it impossible to write to the file or create a file with the same name The system attribute and hidden attribute both prevent the file from appearing in a directory list and exclude it from normal searches The archive attribute is set whenever you modify the file and cleared by the DOS BACKUP command Parameters File to get attributes read only Read only attribute system System attribute hidden Hidden attribute archive Archive attribute Return Value Return Codes Success Specified file is a directory File not found National Instruments Corporation 8 23 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameter Discussion Each attribute parameter will contain one of the following values O attribute is not set 1 attribute is set fileName may be the empty string in which case the attributes of the file found by the most recent call to Get FirstFile or GetNextFile are returned Example get the attributes of WAVEFORM DAT int read_only system hidden archive GetFileAttrs waveform dat amp read_only amp system
171. ational Instruments Corporation Chapter 10 Easy I O for DAQ Library initial High Limit Volts specifies the maximum voltage that is measured for all channels in the channel string listed before a command string that specifies a new high limit For the following channel string 0 1 cmd hi 10 0 low 10 0 2 3 If initialHighLimitVolts is 5 0 channels 0 and 1 have a high limit of 5 0 and channels 2 and 3 have a high limit of 10 0 initial LowLimit Volts is the minimum voltage that is measured for all channels in the channel string listed before a command string that specifies a new low limit For the following channel string O dy ema Ni 1040 Low 1 020 2 354 If the initialLowLimit Volts is 5 0 channels 0 and 1 have a low limit of 5 0 and channels 2 and 3 have a low limit of 10 0 GetChannelIndices short error GetChamnellndices short device char channelString char channelSubString short channelType long channelIndices Purpose Determines the indices of the channels in the channelSubString For example if the channelString is 7 61 and the channelSubString is dE A the channelIndices array would be filled as follows channelIndices 0 0 channelIndices 1 2 channelIndices 2 5 This function is useful if you want to verify that a particular channel is part of the channelString National Instruments Corporation 10 41 LabWindows CVI Standard Libraries Easy I
172. ational Instruments Corporation 6 23 LabWindows CVI Standard Libraries DDE Library Chapter 6 Table 6 3 DDE Library Error Codes a DE _FailedToConnect DDE_NoError DDE_UnableToRegisterServic DE_ExistingServer DE_ServerNotRegistered DE_TooManyConversations DE_ReadFailed DE _WriteFailed DE_ExecutionFailed DE_InvalidParameter DE_OutOfMemory DE_TimeOutErr DE_NoConnectionEstablished DE_FailedToSetUpHotLink DE_FailedToSetUpWarmLink DE_GenerallOErr DE_AdvAckTimeOut DE_Busy DE_DataAckTimeOut DE_D11NotInitialized DE_DllUsage DE_ExecAckTimeOut DE_DataMismatch DE_LowMemory DE_MemoryError DE_NotProcessed DE_NoConvEstablished DE_PokeAckTimeOut DE_PostMsgFailed DE_Reentrancy DE_ServerDied DE_SysError DE_UnadvAckTimeOut Ki k k kl k kl kl Ki kl kl kl kl kl kl kl Ki kl kl k kl k k kl k k kl kl kl kl kl k Ki Ki DE_UnfoundQueueld Note Error codes from 16 to 33 are native DDEML errors which correspond to Windows DDE error codes starting from 0x4000 LabWindows CVI Standard Libraries 6 24 O National Instruments Corporation Chapter 7 TCP Library This chapter describes the functions in the LabWindows CVI TCP Transmission Control Protocol Library The TCP Library Function Overview section contains general information about the TCP Library functions and panels The TCP Library Function Reference section c
173. atus RetireExecutableHandle int executableHandle Purpose Informs the Utility Library that you no longer intend to use the handle acquired from LaunchExecutableEx When you call this function the Utility Library can reuse the memory allocated to keep track of the state of the executable Under UNIX if the process has terminated the system removes the process from the list of processes This keeps the system from reaching the limit on the total number of processes under execution by a single user which the system imposes Parameters executableHandle integer The executable handle acquired from LaunchExecutableEx 1 handle is invalid 0 success Return Value RoundRealToNearestInteger long n RoundRealToNearestInteger double inputRealNumber Purpose Rounds its floating point argument and returns the result as a long integer A value with a fractional part of exactly 0 5 is rounded to the nearest even number This function is encountered in translations Parameter inputRealNumber Double precision National Instruments Corporation 8 61 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Value Example long n n round 1 2 result 1L xf n round 1 8 result 2L n round 1 5 result 2L n round 0 5 result xy n round 1 2 result 1L xf n round 1 8 result 2L n round 1 5 result
174. aximum ofRetries seconds The default value of startDelay is 10 0 maximum ofRetries sets the maximum number of times the transmitter retries sending a packet to the receiver on the occurrence of an error condition The default value of maximum ofRetries is 10 waitPeriod sets the period of time between the transfers of two packets When a LabWindows CVI program assumes the role of transmitter it waits for up to waitPeriod seconds LabWindows CVI Standard Libraries 5 32 National Instruments Corporation Chapter 5 RS 232 Library for an acknowledgment before it re sends the current packet When LabWindows CVI plays the role of receiver it waits for up to waitPeriod seconds for the next packet after it sends out an acknowledgment for the current packet If it does not receive the next packet within delayPeriod seconds it re sends the acknowledgment and waits again up to maximum ofRetries times The default value of waitPeriod is 10 0 packetSize sets the packet size in bytes Its value must be less than or equal to the input and queue sizes The standard XModem protocol defines packet sizes to be 128 or 1024 If you are using any other size make sure the two communication parties understand each other The default value of packetSize is 128 Using This Function For transfers with a large packet size and a low baud rate a large delay period is recommended XModemReceive int result XModemReceive int COMPort char fileName
175. ayDataOrder parameter Invalid fileLayout parameter Invalid fileType parameter Invalid separationStyle parameter Invalid fieldWidth parameter Invalid fileAction parameter Parameter Discussion FileName may be an absolute pathname or a relative file name If you use a relative file name the file is created relative to the current working directory DataType must be one of the following VAL_CHAR VAL_SHORT_INTEGER VAL_INTEGER VAL_FLOAT VAL_DOUBLE VAL_UNSIGNED_SHORT_INTEGER VAL_UNSIGNED_INTEGER VAL_UNSIGNED_CHAR If you save the array data in ASCII format you may divide the array data into groups Groups can be written as either columns or rows NumberOfGroups specifies the number of groups into which to divide the array data If you do not want to divide your data into groups use 1 If you divide your array data into groups arrayDataOrder specifies how the data is ordered in the array The two choices are as follows National Instruments Corporation 2 5 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 e VAL_GROUPS_TOGETHER all points of each data group are assumed to be stored consecutively in the data array e VAL_ DATA _MULTIPLEXED 1t is assumed that the first point from each data group is stored together followed by the second point from each group and so on If you save the array data in ASCII fo
176. bles to determine exactly what channels are valid for your hardware The syntax for the Channel String is as follows e If you are using an MIO board NEC AI 16E 4 or NEC AI 16XE 50 list the channels in the order in which they are to be read as in the following example 0 2 5 reads channels 0 2 and 5 in that order O23 reads channels 0 through 3 inclusive Ef e If you are using AMUX 64T boards You can address AMUX 64T channels when you attach one two or four AMUX 64T boards to a plug in data acquisition board Refer to Chapter 2 Hardware Overview in your NI DAO User Manual for PC Compatibles to determine how AMUX 64T channels are multiplexed onto onboard channels The onboard channel to which each block of four eight or 16 AMUX 64T channels are multiplexed and the scanning order of the AMUX 64T channels are fixed To specify a range of AMUX 64T channels therefore you enter in the channel list the onboard channel into which the range is multiplexed For example if you have one AMUX 64T 0 reads channels 0 through 3 on each AMUX 64T board in that order To sample a single AMUX 64T channel you must also specify the number of the AMUX 64T board as in the following example AM1 3 samples channel 3 on AMUX 64T board 1 AM4 8 samples channel 8 on AMUX 64T board 4 LabWindows CVI Standard Libraries 10 4 O National Instruments Corporation Chapter 10 Easy I O for DAQ Library I
177. brary e 5 1_HARDWARE_TRIGGERED_STROBE similar to mode 4 except that a rising edge at the gate input triggers the count to start e 6 I_READ read the counter and return the value in the read Value parameter e 7 I_RESET tesets the counter and sets its output to outputState count is the period between output pulses This parameter accepts the following attributes e If controlCode is 0 1 4 or 5 count can be 0 through 65 535 in binary counter operation and 0 through 9 999 in binary coded decimal BCD counter operation e If controlCode is 2 or 3 count can be 2 through 65 535 in binary counter operation and 2 through 9 999 in BCD counter operation Note 0 is equivalent to 65 535 in binary counter operation and 10 000 in BCD counter operation PlotLastAIWaveformsPopup short error PlotLastAIWaveformsPopup short device double waveformsBuffer Purpose This function plots the last AI waveform that was acquired It is intended for demonstration purposes Data must be grouped by channel before it is passed to this function Either use the GROUP_BY_CHANNEL as the fillMode parameter when acquiring the data or call GroupByChannel before calling this function Parameters device short integer Assigned by configuration utility waveformsBuffer double array Array containing the last AI waveform acquired Return Value National Instruments Corporation 10 47 LabWindows CVI Standard
178. brary A 4 1 GPIB Library Function OvervieW sssesssesssseeesseesseessersseesseessseessressersseesseessseesseest 4 1 GPIB Functions Library Function Panels ooonnococnoucccnonccononccononaconnnaconnncnnnnos 4 1 GPIB ADAC Sa 4 5 GPIB Libraries and the GPIB Dynamic Link Library Device Driver 4 5 Guidelines and Restrictions for Using the GPIB Libraries ee eeeeeees 4 6 Device and Board Functions a aes oe S 4 7 Automocion 4 7 Autopolling Compatibility ooonnocccnnoccnonnanononanononaconnnannonanononanononos 4 8 Hardware Interrupts and AutopolliN8 ooonncccnnnccconoccconancconncnonnnnnnnnncconnncconnncnnn 4 8 Read and Write Termination meeer o 4 9 JEt aE AEE A E T EN T AEE 4 9 Global Variables for the GPIB Library ooooonnoccnonccccnoncnononaconnncnnnnnccnnnncconnncnon 4 10 Different Levels of Functionality Depending on Platform and GPIB Board 4 10 WIndows 9252 ate catrnarecut a a N 4 10 Native 32 Bit DIN 4 10 Compatibility DED VEL 3s 3055 05 Sees tis ias an 4 11 Windows NT cccsiiascostavesscantasesaanengsdaavisedcnts nected ence ssdedpantecavieesdanna sasha ous 4 11 Etmitatons on Transfer SIZE fas calc n E RE 4 11 Mi read A a E Be 4 11 Notification of SRQ and Other GPIB EventS ooooooononcnncccnonnnononanononcononnnnanononos 4 12 Synchronous Callbacks iia din olas dean nia ins 4 12 Asynchronous Callbacks on id cn 4 12 Driver Version Requirements A ae Soave 4 12 GPIB Function Relerente erie
179. callback function should return TRUE if the request is successful Otherwise the function should return FALSE Note Server callback should be short and should return as soon as possible callbackData is a four byte value that will be passed to the callback function each time it is called for this server O National Instruments Corporation 7 9 LabWindows CVI Standard Libraries TCP Library Chapter 7 It is up to you to define the meaning of the callback data The following are examples of how the callback data can be used e You can register your program as a TCP server multiple times under different port numbers You could use the same callback function for all of the server instances by using the callback data to differentiate between them e You can use the callback data to point to a data object that you need to access in the callback function In this way you would not need to declare the data object as a global variable If you do not want to use the callback data you can pass zero See Also Connect ToTCPServer UnregisterTCPServer ServerTCPRead conversationHandle void dataBuffer dataSize unsigned int timeout int status ServerTCPRead unsigned ini unsigned ini CT CT Purpose Reads data from a TCP client application Parameters conversationHandle unsigned integer Uniquely identifies the conversation dataBuffer void pointer Buffer in which to receive data dataSize unsigned integer Number of byte
180. callbackFunction Purpose Install a property callback function The specified function is called whenever one of the specified properties on one of the specified windows changes in any way If more than one function is installed for the same property the functions are called in the reverse order in which they were installed If the function is already installed as a callback function the list of windows and properties that are associated with that function are replaced with those specified by the new installation Parameters display DisplayPtrX A pointer to the display of the X server to which the window belongs windowList const WindowX An array of windows on which the properties may exist numberofWindows unsigned integer Number of windows in the Window List This value must be greater than 0 propertyList const An array of handles to PropertyCallbackTypeX properties for which the callback is called continues National Instruments Corporation 9 25 LabWindows CVI Standard Libraries X Property Library Chapter 9 Parameters Continued numberofProperties unsigned integer Number of properties in the Property List callbackData generic pointer Pointer to data to be passed to the callback function This value is passed to the callback function as the userData parameter callbackFunction PropertyCallbackTypex Pointer to the function to be called when the properties change Ret
181. cards all matching files are copied If targetFileName has wildcards it will be matched to sourceFileName If the target file is a directory the existing file or group of files will be copied into the directory sourceFileName may also be the empty string in which case the file found by the most recent call to Get FirstFileor GetNextFile is copied CVILowLevelSupportDriverLoaded int loaded CVILowLevelSupportDriverLoaded void Note This function is available only in the Windows 95 and NT version of LabWindows CVI Purpose This function returns an indication of whether the LabWindows CVI low level support driver was loaded at startup The following Utility Library functions require the LabWindows CVI low level driver to be loaded at startup oe Function support driver is needed inp Windows NT inpw Windows NT outp Windows NT outpw Windows NT ReadFromPhysicalMemory Windows 95 and NT ReadFromPhysicalMemoryEx Windows 95 and NT WriteToPhysicalMemory Windows 95 and NT WriteToPhysicalMemoryEx Windows 95 and NT Disablelnterrupts Windows 95 Enablelnterrupts Windows 95 DisableTaskSwitching Windows 95 Most of these functions do not return an error if the low level support driver is not loaded To make sure your calls to these functions can execute correctly call CVILowLevelSupportDriverLoaded at the beginning of your program LabWindows CVI Standard Libraries 8 8
182. case 1 break LabWindows CVI Standard Libraries Fmt buf s lt SQUARE 2 56 NumFmtdBytes returns National Instruments Corporation Chapter 2 case 2 Fmt buf s lt TRIANGLE break switch signal_output case 0 Fmt buf Ss a lt OUTPUT OFF break case 1 Fmt buf Ss a lt OUTPUT ON break nbytes StringLength buf Remarks i os Formatting and I O Library This example shows how to append characters to a string without writing over the existing contents of the string The first switch construct writes one of three strings into buf The second switch construct appends one of two strings to the string already in buf After the call buf contains SQUARE OUTPUT OFF Notice that the a modifier applies to the target specifier S S only the number of bytes appended Creating an Array of File Names char fname_array 4 int 217 fname_array 0 fname_array 1 fname_array 2 fname_array 3 for i 0 1 lt 4 i Fmt fname_arrayli Remarks Ss lt FILI We r We r We r We r ESi w4p0 DAT 13 13 13 L3 spaces spaces spaces spaces 1 xy tringLength returns the number of bytes in the resulting string In this case tringLength is used instead of NumFmt dBytes because NumFmt dBytes would return To allocate the space for each filename in the array a separate constant s
183. ce The size is the number of bytes in a single property item Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to the size parameter InvalidPropTypexErr The propertyType argument is not a valid property type This value must either be one of the predefined property types or be a value returned by CreateXPropType See Also CreateXPropType LabWindows CVI Standard Libraries 9 18 O National Instruments Corporation Chapter 9 X Property Library GetXPropTypeUnit PropLibXErrType status GetXPropTypeUnit PropTypeHandleX propertyType unsigned int unit Purpose Get a property type unit This function returns the unit associated with the property type The unit is the number of bytes 1 2 or 4 in the basic objects that make up a property item Parameters Input propertyType PropTypeHandlex Handle to property type for which the unit is to be obtained This value must either be one of the predefined property types or be a value returned by CreateXPropType Output unit unsigned integer The unit associated with the property type passed by The unit is the number of bytes 1 2 or 4 in reference the basic objects that make up a property item Return Values The return value indicates the success or fa
184. cify the port on a module portWidth is the total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port on an MIO non E Series board by setting portWidth to 8 e When portWidth is greater than the physical port width of a digital port the following restrictions apply The portWidth must be an integral multiple of the physical port width and the port numbers in the combined port must begin with the port named by portNumber and must increase consecutively For example if portNumber is 3 and portWidth is 24 bits LabWindows CVI uses ports 3 4 and 5 e The portWidth for the 8255 based digital I O ports including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 should be at least 8 configure specifies whether to configure the digital port before reading e When this function is called in a loop it can be optimized by only configuring the digital port on the first iteration e When you configure a digital I O port that is part of an 8255 PPI including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 the 8255 PPI goes through a configuration phase where all the ports within the same PPI chip get reset to logic low regardless of the data direction The data directions on other ports however are maintained Lab
185. contains the same value that was used to set up the advisory loop DDE_EXECUTE Received when the client requests the execution of acommand The itemName parameter contains the command string The set of valid command strings is defined by the server For example Excel uses Save to save a file Using This Function National Instruments Corporation 6 17 LabWindows CVI Standard Libraries DDE Library Chapter 6 This function registers your program as a DDE server with the specified name Clients attempting to connect to your program must use the specified name Thereafter all requests by the client will be routed through the specified serverCallbackFunction You can register your program as a DDE server multiple times as long as you specify different server names Note The callback function should return TRUE if the request is successful else return FALSE The callback function should be short and should return as soon as possible callbackData is a four byte value that will be passed to the callback function each time it is called for this server You can define the meaning of the callback data The following are examples of how the callback data can be used 1 You can register your program as a DDE server multiple times under different names For instance you can use the same callback function for all of the server instances by using the callback data to differentiate between them 2 You can use the callback data t
186. counter source or timebase signal on which it increments and this parameter accepts the following attributes e COUNT_ON_RISING_EDGE e COUNT_ON_FALLING_EDGE gateMode specifies how the signal on the counter s GATE pin is used The options are e UNGATED_SOFTWARE_START ignore the gate signal and start when CounterStart is called e COUNT_WHILE_GATE_HIGH count while the gate signal is TTL high after CounterStart is called e COUNT_WHILE_GATE_LOW count while the gate signal is TTL low after CounterStart is called e START_COUNTING_ON_RISING_EDGE start counting on the rising edge of the TTL gate signal after CounterStart is called e START_COUNTING_ON_FALLING_EDGE start counting on the falling edge of the TTL gate signal after CounterStart is called CounterMeasureFrequency short error CounterMeasureFrequency short device char counter J unsigned short counterSize double gate WidthSampleTimeinSec double maxDelayBeforeGateSec unsigned short counterMinus1GateMode double actualGateWidthSec short overflow short valid short timeout double frequency Purpose Measures the frequency of a TTL signal on the specified counter s SOURCE pin by counting rising edges of the signal during a specified period of time In addition to this connection you must also wire the counter s GATE pin to t
187. ction int handle char topicName char itemName int xType int dataFmt int dataSize void dataPtr void callbackData Parameters handle The conversation handle which uniquely identifies the client server connection topicName The server application triggering the callback itemName The data item within the server application that triggers the callback Exception When xType is DDE_EXECUTE itemName represents the command string from the client program xtype The transaction type see Table 6 2 dataFmt The format of the data being transmitted dataSize The number of bytes in the data May actually be greater than the number of bytes transmitted It is recommended that you encode size information in your data dataPtr Points to the transmitted data callbackData A user defined data value Note The value of the dataSize parameter is greater than or equal to the actual size of the data It is recommended that you encode size information in your data Return Value The callback function should return 1 to indicate success or 0 to indicate failure or rejection of the requested action Transaction Types All of the DDE transaction types xType that can trigger a callback function are listed in Table 6 2 National Instruments Corporation 6 3 LabWindows CVI Standard Libraries DDE Library Chapter 6 Table 6 2 DDE Transaction Types xType DDE_CONNECT When a new client requests a connection DD
188. ction with a pre defined name and prototype The function serves as the entry point to the module See RunExternalModule for more information LoadExternalModule can also be used on a source file c that is part of the current project or a source file that has been loaded as the program for an instrument module This allows you to develop your module in source code form and test it using the LabWindows CVI debugging capabilities After you have finished testing your module and compiled it into an external object or library file you need to make no modifications to your application source code other than to change the pathname in the call to LoadExternalModule Avoid calling LoadExternalModule on a file in the project when you plan to link your program in an external compiler The LabWindows CVI Utility library does not know the locations of symbols in executables or DLEs linked in external compilers You can provide this information by using the Other Symbols section of the External Compiler Support dialog box in the Build menu of the LabWindows CVI Project window to create an object module containing a table of symbols you want to find using GetExternalModuleAdar If you use this method you should pass the empty string to LoadExternalModule for the module pathname If successful LoadExternalModule returns an integer module ID which can later be passed to RunExternalModule GetExternalModuleAddr and UnloadExternalModule If u
189. current value of the following Standard Input Output window options Maximum Number of Lines Bring To Front When Modified Show Line Numbers O National Instruments Corporation 8 35 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameters maxNumLines The maximum number of lines that can be stored in the Standard Input Output window If this amount is exceeded lines are discarded from the top bringToFrontWhenModified integer Indicates whether the Standard Input Output window is brought to the front each time a string or character is added to it 1 Yes 0 No showLineNumbers Indicates whether line numbers are shown in the Standard Input Output window 1 Yes 0 No Parameter Discussion If you do not want to obtain any of these values you can pass NULL GetStdioWindowPosition void GetStdioWindowPosition int top int left Purpose Gets the current position in pixels of the client area of the Standard Input Output window relative to the upper left corner of the screen The client area begins under the title bar and to the right of the frame LabWindows CVI Standard Libraries 8 36 O National Instruments Corporation Chapter 8 Utility Library Parameters The current distance in pixels from the top of client area of the Standard Input Output window to the top of the screen integer The current distance in pixels from the leftmost edge of client area of the Standard Input Outp
190. d I O Library The Data Formatting function panels perform intricate formatting operations with a single function call Formatting Functions a subclass of Data Formatting contains function panels that combine and format one or more source items into a single target item Scanning Functions a subclass of Data Formatting contains function panels that transform a single source item into several target items Status Functions a subclass of Data formatting contains function panels that return information about the success or failure of a formatting or scanning call The online help with each panel contains specific information about operating each function panel The String Manipulation Functions The functions in the String Manipulation class perform common operations such as copying one string to another comparing two strings or finding the occurrence of a string in a character buffer These functions are similar in purpose to the standard C string functions The Special Nature of the Formatting and Scanning Functions The formatting and scanning functions are different in nature from the other functions in the LabWindows CVI libraries With few exceptions each LabWindows CVI library function has a fixed number of parameters and each parameter has a definite data type Each formatting and scanning function however takes a variable number of parameters and the parameters can be of various data types This difference is
191. d modifier indicates there is no target argument to correspond to the target specifier The data that otherwise is placed in the target argument is discarded instead The count returned by the Scan ScanFile ScanIn functions will include the target specifier even if the d modifier is used Scanning String Modifiers 3s in wn Specify Array Offset The i string modifier specifies an offset within a string It indicates the location within the string where processing is to begin n is the zero based index of the first byte to process Thus s 12 applied to a target string begins placing data in the third byte of the string Append When applied to a target format specifier the a string modifier specifies that all formatted data be appended to the target string beginning at the first occurrence of an ASCII NUL in the target string Specify String Size When modifying a source format specifier the w string modifier specifies the maximum number of bytes from the source string to be used for filling the target arguments You can enter any non negative value here the default being zero which indicates that the entire string can be used For ScanFile and ScanTIn the entire source string is consumed even if the w modifier restricts the number of bytes used to fill in the target arguments When modifying a target format specifier the w modifier specifies the exact number of bytes to store in the string excluding the terminating AS
192. d the logical drive letter is 0 A 1 B and so on SetFileAttrs int result SetFileAttrs char fileName int read only int system int hidden int archive Note This function is available only on the Windows versions of LabWindows CVI Purpose Sets the read only system hidden and archive attributes of a file The read only attribute protects a file from being overwritten and prevents the creation of a file with the same name The system attribute and hidden attribute both prevent the file from appearing in a directory list and exclude it from normal searches The archive attribute is set whenever the file is modified and cleared by the DOS BACKUP command Parameters fileName string File to set attributes read only integer Read only attribute system integer System attribute hidden integer Hidden attribute archive integer Archive attribute National Instruments Corporation 8 67 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Value Return Codes Success One of the following errors occurred e File not found e Attribute cannot be changed Parameter Discussion Each attribute parameter can have one of the following values 0 clears the attribute 1 sets the attribute 1 leaves the attribute unchanged fileName may be the empty string in which case the attributes of the file found by the most recent call to Get FirstFileor GetNextFile are set SetFileDa
193. dadas 5 16 Con WEB VG ias 5 17 USE O26 ots ON Ne BEN PAIL SEN bMS PADS PALES a BI 5 18 PUSH UO pesna enana sehen ides a Heed dead veh at EAR 5 19 CAOS Etna 5 19 Gc O91 Bohs a e e a e a o 5 20 CTFEQUO ii A A AAA EA AAA 5 21 GEtRS 2S 2 rrr SUM O id ii Inde 5 22 InstallComC all Gack a ion 5 22 OD ENC ON suerte iia asada ns ov ess 5 25 PENG COMIC ONG 55 2 nena Se tescadedanasch ds a a a R as 5 26 Retin RS 232E unid is 5 28 SetCom TIME ai ais 5 29 SLOT VEO cas a na 5 30 SetXMod dla a 5 31 XModemC onfi S ii 5 31 XModemkR eco Sii ii idas 5 33 DONIGUEMIS eds Ali li 5 34 EMOL CORONA loan ea a ela 5 36 LabWindows CVI Standard Libraries x National Instruments Corporation Contents Chapter 6 DDE Library a ta Lo do a e cia e bs ada 0 6 1 DDE Library Function OVervi GW irene 6 1 The DDE Library Function Panels eee ceescccesncecesececeeececeeeeecseececseeeeeseeeeees 6 1 DDE Cents ANG SV sta 6 2 The DDE Callback Pune on j s is3 sense succes haya ccdacauqies Sa ueacana teed auesdodagogeas 6 2 PE Oe iodo eateries 6 4 A DDE Library Example Using Microsoft Excel and LabWindows CVI 6 5 DDE Library Function Reference susi iii sde enn 6 6 AdviseDDEDataR ead y ich teres den ana iad ota eee 6 6 Broadcast DDE DaAtaR cone onae e a taaan 6 8 ChentDDEExecuUte sion veterans E E NE aE NAER E e A 6 10 ATS Ti DER dt e e a ds e o la A 6 10 A 6 12 ComeetioD DES E E E E E 6 13 DisconneethrombD DE Serv ii aaa 6 15 GetD DEEIMOrS Wing iria
194. des in Table 3 2 StdDev int status StdDev double inputArray int numberofElements double mean double standardDeviation Purpose Computes the standard deviation and the mean average values of the input array The formulas used to find the mean and the standard deviation are as follows n 1 meanval DBE n i 0 n 1 sDev x ave n i 0 National Instruments Corporation 3 29 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Parameters inputArray double precision Input array array numberofElements integer Number of elements in inputArray Output mean double precision Mean value standardDeviation double precision Standard deviation Return Value status integer Refer to error codes in Table 3 2 Sub1D int status Sub1D double arrayX double arrayY int numberofElements double outputArray Purpose Subtracts two 1D arrays The function obtains the ith element of the output array by using the following formula Gj X Y The operation can be performed in place that is outputArray can be in place of either arrayX or arrayY Parameters arrayX double precision Input array array array Y double precision Input array array numberofElements integer Number of elements to be subtracted array LabWindows CVI Standard Libraries 3 30 National Instruments Corporation Chapter 3 Analysis Library Return Value status integer Ref
195. dified option in the dialog box brought up by the Environment command in the Options menu of the Project window The value that you set using this function is reflected the next time you bring up the Environment dialog box National Instruments Corporation 8 73 LabWindows CVI Standard Libraries Utility Library Chapter 8 showLineNumbers In an executable the default value is 0 do not show line numbers In the CVI Development System the default value is the current state of the Line Numbers option in the View menu of the Standard Input Output Window The value that you set using this function is reflected the next time you bring up the View menu SetStdioWindowPosition int status SetStdioWindowPosition int top int left Purpose Sets the current position in pixels of the client area of the Standard Input Output window relative to the upper left corner of the screen The client area begins under the title bar and to the right of the frame Parameters integer The distance in pixels of the top of client area of the Standard Input Output window relative to the top of the screen Valid Range VAL_AUTO_CENTER 16000 to 16000 integer The distance in pixels of the leftmost edge of client area of the Standard Input Output window relative to the leftmost edge of the screen Valid Range VAL_AUTO_CENTER 16000 to 16000 Return Value a Return Codes Success top is not within the valid range left is not wit
196. duleHandle but you are calling the function from a file that is in the project or your executable rather than in a DLL or e you are not running in Windows 95 or NT You cannot load the same external module using two different calling module handles The function reports an error if you attempt to load the an external module when it is already loaded under a different module handle MakeDir int result MakeDir char directoryName Purpose Creates a new directory based on the specified directory name Note You can create only one directory at a time Parameters Return Value Return Codes Success One of the path components not found General I O error occurred Insufficient memory to complete operation Invalid path for example c filename in Windows Access denied Disk is full Directory or file already exists with same pathname LabWindows CVI Standard Libraries 8 54 National Instruments Corporation Chapter 8 Utility Library Example make a new directory named DATA WAVEFORM on drive C assuming that C DATA does not exist E MakeDir C DATA MakeDir C DATA WAVEFORM MakePathname void MakePathname char directoryName char fileName char pathName Purpose Constructs a path name from a directory path and a filename The subroutine ensures that the directory path and the filename are separated by a backslash Parameters directoryName string D
197. dy exists InsuffMemXErr There is insufficient memory to store the property information or there are already 64 property types National Instruments Corporation 9 1 LabWindows CVI Standard Libraries X Property Library Chapter 9 Parameter Discussion Usually you can use the expression sizeof TYPE for the size parameter where TYPE is the C data type char int and others used to store the property value This value must be a multiple of the unit argument unit specifies how the X server should view the property item as an array of 1 byte 2 byte or 4 byte objects and is necessary to perform simple byte swapping between different types of computers See the notes near the end of this function description If the property item consists of a single object such as an integer or a character the unit should be just the size of the object An exception is the double type for which the default unit should be 4 bytes If the property item is a structure or array containing a number of smaller objects then the unit should be the number of bytes in the smaller objects Note If you are communicating with a remote X server on a computer that has different byte ordering than your application the unit specified is used to perform the byte swapping However byte swapping cannot be properly performed for structures containing different size members or for double type For these special cases use a unit of 1 and then explicitly
198. e Parameter Discussion The valid values of origin are as follows e 0 beginning of file e 1 current position of file pointer e 2 end of file Using This Function This function can also be used to obtain the file size by setting offset to O and origin to 2 In this case the return value indicates the file size and the pointer will be at the end of the file It is possible to position the file pointer beyond the end of the file Intermediate bytes bytes between the old end of file and the new end of file contain indeterminate values An attempt to position the file pointer before the beginning of the file causes the function to return an error If the file is a device that does not support random access such as the standard input the function returns an indeterminate value Example Open or create the file c TEST DAT move 10 bytes into the file and write a string to the file Note Use in pathname in C instead of int handle result long position handle OpenFile c TEST DAT 0 2 1 if handle 1 FmtOut error opening file exit 1 position SetFilePtr handle 10L 0 if position 10 National Instruments Corporation 2 27 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 result WriteFile handle Hello World 13 if result 1 FmtOut error writing to file else FmtOut error position
199. e X window ID of the root window of the display that LabWindows CVI uses The Hidden Window Before you can read or write property data you need the X window IDs of the windows that will have the properties associated with them One option is to always use the root window ID for attaching properties You could get the root window ID for the local display from the variable CVIXRootWindow To get the root window ID for a remote display you could use the value returned by Connect ToXDisplay This approach has disadvantages First if your program adds a property to the root window and does National Instruments Corporation 9 3 LabWindows CVI Standard Libraries X Property Library Chapter 9 not delete it the property remains there indefinitely Second because there is only one root window there may be conflicts when multiple applications attempt to access the same properties To overcome those disadvantages LabWindows CVI provides a hidden window Before it runs your program LabWindows CVI creates a window that never displays The X window ID for this window is available in the X Property Library from the global variable CVIXHiddenWindow This window ID is always available to your program for reading and writing properties When your program terminates LabWindows CVI removes the window and all of its properties Property Callback Functions You can use the X Property Library to instruct LabWindows CVI to notify yo
200. e magnitude double phaseRadians Purpose Converts the rectangular coordinates xReal yImaginary to polar coordinates magnitude phaseRadians The formulas used to obtain the polar coordinates are as follows mag x y phase arctan y x The phaseRadians value is in the range of T to 7 LabWindows CVI Standard Libraries 3 32 O National Instruments Corporation Chapter 3 Analysis Library Parameters Input xReal double precision X coordinate yImaginary double precision X coordinate Output magnitude double precision Magnitude phaseRadians double precision Phase in radians Return Value status integer Refer to error codes in Table 3 2 ToPolar1D int status ToPolar1D double arrayXReal double arrayYImaginary int numberofElements double magnitude double phaseRadians Purpose Converts the set of rectangular coordinate points arrayXReal array Y Imaginary to a set of polar coordinate points magnitude phaseRadians The function obtains the ith element of the polar coordinate set by using the following formulas mag x y phase arctan y x The phaseRadians value is in the range of n to 7 The function performs the operations in place that is arrayXReal and magnitude and array Y Imaginary and phaseRadians can be the same arrays respectively O National Instruments Corporation 3 33 LabWindows CVI Standard Libraries Analysis Library Param
201. e not a directory DeleteFile int result DeleteFile char fileName Purpose Deletes an existing file from disk LabWindows CVI Standard Libraries 8 10 National Instruments Corporation Chapter 8 Utility Library Parameter Return Value Return Codes Success File not found or directory in path not found General I O error occurred Insufficient memory to complete operation Invalid path for example c filename in Windows Access denied Specified path is a directory not a file Parameter Discussion fileName may contain wildcard characters and in which case all matching files are deleted fileName may also be the empty string in which case the file found by the most recent call to GetFirstFile or GetNextFile is deleted DisableBreakOnLibraryErrors void DisableBreakOnLibraryErrors void Purpose If debugging is enabled if the debugging level in the Run Options dialog box of the Options menu in the Project window is set to Standard or Extended this function directs LabWindows CVI not to display a run time error dialog box when a National Instruments library function reports an error If debugging is disabled this function has no effect National Instruments Corporation 8 11 LabWindows CVI Standard Libraries Utility Library Chapter 8 You can use this function in conjunction with EnableBreakOnLibraryErrors to temporarily suppress the Break on Library Errors feat
202. e descriptor Otherwise it returns a negative number National Instruments Corporation 4 21 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 ThreadIbcnt int threadSpecificCount ThreadIbent void Note This function is available only under Windows 95 and NT This function returns the value of the thread specific ibcnt variable for the current thread The global variables ibsta iberr ibcnt and ibcnt1 are maintained on a process specific rather than thread specific basis If you are calling GPIB functions in more than one thread the values in these global variables may not always be reliable Status variables analogous to ibsta iberr ibcnt and ibcnt1 are maintained for each thread This function returns the value of the thread specific ilbcnt variable If you are not using multiple threads the value returned by this function is identical to the value of the ibcnt global variable Parameters none Return Value threadSpecificCount integer The number of bytes actually transferred by the most recent GPIB read write or command operation for the current thread of execution If an error occurred loading the GPIB DLL this 1s the error code returned by the MS Windows LoadLibrary function See Also Threadlbsta Threadlberr ThreadIbcntl ThreadIbentl long threadSpecificCount ThreadIbentl void Note This function is available only under Windows 95 and NT This function returns t
203. e f floating point modifier specifies the value to be converted to string format in floating point notation This is the default National Instruments Corporation 2 37 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Truncate The t floating point modifier indicates that in floating point to integer transformations the floating point value is truncated instead of rounded This is the default Round The r floating point modifier indicates that in floating point to integer transformations the floating point value is rounded instead of truncated The default method is truncation Note The value can be represented in scientific notation even when the e modifier is absent This occurs when the absolute value of the argument is greater than 1 0e40 or less than 1 0e 40 or when the absolute value of the argument is greater than 1 0e20 or less than 1 0e 4 and neither the p modifier nor the w modifier is present Formatting String Modifiers s in wn Specify Array Offset The i string modifier specifies an offset within a string It indicates the location within the string where processing is to begin n is the zero based index of the first byte to process Thus s 12 applied to a target string begins placing data in the third byte of the string Append When applied to a target format specifier the a string modifier specifies that all formatted data be appended to the target string The data is appended
204. e file is not a directory The number of bytes used by the new process image s argument list and environment list is greater than ARG_MAX bytes see man page for sysconf 2V The new process image file has the appropriate access permission but is not in the proper format National Instruments Corporation 8 45 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Codes under Microsoft Windows Command was successfully started System was out of memory executable file was corrupt or relocations were invalid File was not found Path was not found Attempt was made to dynamically link to a task or there was a sharing or network protection error Library required separate data segments for each task There was insufficient memory to start the application Windows version was incorrect Executable file was invalid Either it was not a Windows application or there was an error in the EXE image Application was designed for a different operating system Application was designed for MS DOS 4 0 Type of executable file was unknown Attempt was made to load a real mode application developed for an earlier version of Windows Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read only Attempt was made to load a compressed executable file The file must be decompressed before it can be loaded Dynamic link library DLL file
205. e function was successful InvalidPropertyXErr 4 The property argument is not a valid property This argument must be the value returned by CreateXProperty PropertyInUsexErr 10 A property callback was installed with InstallPropertyCallback for this property DestroyXPropType PropLibXErrType status DestroyXPropType PropTypeHandlexX propertyType Purpose Destroys X property type You can use this function when you no longer need a property type This function frees memory that was allocated by CreateXPropType The property type cannot be used after this function is called All property types are destroyed when the program terminates Note It is not possible to destroy property types if there are properties that use them Parameter Input propertyType PropertyHandleX Handle of the property type to be destroyed This value must either be one of the predefined property types or be a value returned by CreateXPropType O National Instruments Corporation 9 13 LabWindows CVI Standard Libraries X Property Library Chapter 9 Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr O The function was successful InvalidPropTypexErr 5 The propertyType argument is not a valid property type This value must either be one of the predefined property types or be a val
206. e functions provide a mechanism for communication among X clients This library provides capabilities similar to those available in the TCP library but differs from the TCP library in the following significant ways e It conforms to a conventional method for X interclient communication e It works between any X clients that are connected to the same display and does not require any particular underlying communication protocol such as TCP e It provides a method for sharing data among X clients without explicit point to point connections between them The X Property Library Overview section contains general information about the X Property Library The X Property Library Function Reference section alphabetically lists function names with descriptions X Property Library Overview The X Property Library is available only in the UNIX versions of LabWindows CVI This section contains general information about the X Property Library functions and panels The X Property Library Function Panels The X Property Library function panels are grouped in a tree structure according to the types of operations performed The X Property Library Function tree appears in Table 9 1 The first and second level bold headings in the tree are the names of function classes and subclasses Function classes and subclasses are groups of related function panels The third level headings in plain text are the names of individual function panels Each X Property Libr
207. e is stored propertyValue generic pointer Property value to be stored on the window This parameter must be an array of size N by M bytes where N is the size of a property item and M is the number of items to be written National Instruments Corporation 9 29 LabWindows CVI Standard Libraries X Property Library Chapter 9 Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamxErr NULL was passed to one or more parameters mode is not ReplaceXPropMode PrependXPropMode or AppendXP ropMode InvalidDisplayXErr The display argument is not a valid display This argument must either be the predefined value CVIXDisplay or be the value returned by ConnectToXDisplay lidWindowXErr The window argument is not a valid window lidPropertyARrr The property argument is not a valid property handle This argument must be the value returned by CreateXProperty TypeMismatchXErr The actual X type of the property value on the window does not match the type specified for property This can only occur if you set mode to append or prepend UnitMismatchXErr The actual X format of the property value on the window does not match the unit specified for property This can only occur if you set mode to append or prepend OverflowXErr Arithmetic overflow
208. e library raises RTS and DTR If the input queue of the port is nearly full the library lowers RTS Ifthe input queue of the port is nearly empty the library raises RTS Ifthe port is closed the library lowers RTS and DTR When the PC is the sender The RS 232 library must detect that its CTS line is high before sending data out the port LWRS_HWHANDSHAKE_CTS_RTS_DTR e When the PC is the receiver Ifthe port is opened the library raises RTS and DTR O National Instruments Corporation 5 7 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Ifthe input queue of the port is nearly full the library lowers RTS and DTR If the input queue of the port is nearly empty the library raises RTS and DTR Ifthe port is closed the library lowers RTS and DTR When the PC is the sender The RS 232 library must detect that its CTS line is high before sending data out the port Note The only difference between LWRS_HWHANDSHAKE_CTS_RTS and LWRS_HWHANDSHAKE_CTS_RTS_DTRis the behavior of the DTR line If the handshaking mechanism used by your device uses the CTS and RTS lines use a serial cable as shown in Table 5 3 if your device is a DCE or Table 5 4 if your device is a DTE Optionally your cable can omit the connection between pins 6 and 20 if your device does not monitor DSR when sending data Notice that the RTS pin of the receiver translates to the CTS pin of the sender and
209. e to Integer Array Assuming a Fixed Number of Elements Binary File to Real Array Assuming a Fixed Number of Elements Binary File to Real Array with Number of Elements at Beginning of File Reading an Integer from the Standard Input Reading a String from the Standard Input Reading a Line from the Standard Input Fmt FmtFile FmtOut Examples in C This section contains examples of program code that use the Fmt Fmt File and Fmt Out functions from the Formatting and I O Library To eliminate redundancy error checking on I O operations has been omitted from all of the examples in this section except the Two Integers to ASCII File with Error Checking example Integer to String char buf 10 int a a 16 Fmt buf s lt 2i a result 16 a 16 Fmt buf s lt 2x a result 10 a 16 Fmt buf s lt 0 a result 20 a l Fmt buf 3s lt i a result 1 a l Fmt buf Ss lt if u a result 4294967295 a 1234 Fmt buf s lt 2i w6 a result 1234 a 1234 LabWindows CVI Standard Libraries 2 50 National Instruments Corporation Chapter 2 Fmt buf s lt i w6p0 a a 1234 Fmt buf s lt i w2 a Remarks resul resul Formatting and I O Library t 001234 t x4 The results shown are the contents of buf after each call to Fmt The last call demonstrates what occurs when the width specif
210. eCVIRTE void CloseCVIRTE void Purpose This function releases memory in the LabWindows CVI Run Time Engine that was allocated by InitCVIRTE for a particular DLL If you call Init CVIRTE from D11Main you also should call CloseCVIRTE from D11Main You should call it in response to the DLL_PROCESS_DETACH message after your other detach code Parameters None Return Value None LabWindows CVI Standard Libraries 8 6 National Instruments Corporation Chapter 8 Utility Library Cls void Cls void Purpose In the LabWindows CVI environment this function clears the Standard I O window Parameters None Return Value None CopyFile int result CopyFile char sourceFileName char targetFileName Purpose Copies the contents of an existing file to another file Parameters Input sourceFileName string File to copy targetFileName string Copy of original file Return Value Return Codes Success File not found or directory in path not found General I O error occurred Insufficient memory to complete operation Invalid path for either of the file names Access denied Specified path is a directory not a file Disk is full National Instruments Corporation 8 7 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameter Discussion sourceFileName and targetFileName may contain wildcard characters and If sourceFileName has wild
211. ead 100 bytes from input queue of COM1 into buf int n char buf 100 n ComRd 1 buf 100 if n 100 Time out or error occurred before read completed O National Instruments Corporation 5 11 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 ComRdByte int byte ComRdByte int COMPort Purpose Reads a byte from the input queue of the specified port Returns an integer whose low order byte contains the byte read Returns either on time out when the byte is read or when an error occurs If an error or a time out occurs ComRdByte returns a negative error code See Table 5 6 This is the only case in which the high order byte of the return value is non zero Parameter Return Value integer Low order byte contains the byte read Error Using This Function This function times out if the input queue remains empty in the specified time out period This may occur when no data has been received within the time out period The function returns an error code if the port is not open COMPort is invalid or a time out occurs ComRdTerm int nbytes ComRdTerm int COMPort char buffer int count int terminationByte Purpose Reads from input queue until terminationByte occurs in buffer count is met or a time out occurs Returns integer value indicating number of bytes read from queue LabWindows CVI Standard Libraries 5 12 National Instruments Corporation Chapter 5 RS 232 Librar
212. eading an Integer from the Standard Input int n num_readings n 0 while n 1 FmtOut Enter number of readings do n ScanIn S1 gt i amp num_readings Remarks This example shows how to get user input from the keyboard The Fmt Out call writes the prompt string to the screen without a linefeed or carriage return The ScanIn call attempts to read an integer value from the keyboard and place it in num_readings If ScanIn succeeds it returns 1 and the loop is exited Otherwise the prompt string is repeated The format string in the ScanIn call contains a source specifier of 1 This has two consequences First ScanIn returns whenever the user presses ENTER even if the input line is empty This allows the prompt string to be repeated at the beginning of each line until the user enters an integer value Second any characters entered after the integer value are discarded Reading a String from the Standard Input char filename 41 ant ny n 0 while n 1 FmtOut Enter file name my n Scanln 1 gt s w40q filename Remarks This example is similar to the previous example except that the item being read from the keyboard is a string instead of an integer The w modifier is used to prevent ScanIn from LabWindows CVI Standard Libraries 2 70 National Instruments Corporation Chapter 2 Formatting and I O Library writing beyond the end of filename Notice that the width sp
213. ealNumber Purpose Truncates the fractional part of inputRealNumber and returns the result as a real number Parameters Input inputRealNumber double precision Return Value double precision Value of inputRealNumber without its fractional part UnloadExternalModule int status_id UnloadExternalModule int moduleID Purpose Unloads an external module file loaded via LoadExternalModule Parameter Output moduleID integer ID of loaded module Return Value status_id integer Indicates the result of the operation Return Codes Success Failure due to invalid module_id Parameter Discussion modulelD is the value returned by LoadExternalModule or 1 If 1 is used all external modules are unloaded LabWindows CVI Standard Libraries 8 84 National Instruments Corporation Chapter 8 Utility Library Example int module_id int status char pathname pathname PROG OBJ module_id LoadExternalModule pathname if module_id lt 0 FmtOut Unable to load s n pathname else RunExternalModule module_id UnloadExternalModule module_id WriteToPhysicalMemory int status WriteToPhysicalMemory unsigned int physicalAddress void sourceBuffer unsigned int numberOfBytes Note This function is available only on the Windows versions of LabWindows CVI Purpose Copies the contents of destinationBuffer into a region of physical memory The fu
214. eceive National Instruments software are warranted not to fail to execute programming instructions due to defects in materials and workmanship for a period of 90 days from date of shipment as evidenced by receipts or other documentation National Instruments will at its option repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period National Instruments does not warrant that the operation of the software shall be uninterrupted or error free A Return Material Authorization RMA number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty National Instruments believes that the information in this manual is accurate The document has been carefully reviewed for technical accuracy In the event that technical or typographical errors exist National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition The reader should consult National Instruments if errors are suspected In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it EXCEPT AS SPECIFIED HEREIN NATIONAL INSTRUMENTS MAKES NO WARRA
215. ecified is one less than the size of filename This allows room for the ASCII NUL that ScanIn appends at the end of filename The q modifier causes Scantn to fill any unused bytes at the end of filename with ASCII NULs Without the q modifier all unused bytes are filled with spaces except for the ASCII NUL at the end The call to ScanIn in this example skips over leading spaces and tabs and terminates the string on an embedded space For other options see the String to String example earlier in this section Reading a Line from the Standard Input char buf 81 nbytes ReadLin 0 buf 80 Remarks The previous two examples show how to read single items from the keyboard When you are prompted to enter several items on one line it is often easier to read the entire line into a buffer before parsing it This can be done via the Formatting and I O Library function ReadLine The first parameter to ReadLine is a file handle In this case the file handle is zero which is the handle reserved for the Standard Input The other two parameters are a buffer and the maximum number of bytes to place in the buffer ReadLine always appends an ASCII NUL at the end of the bytes read Thus the maximum number of bytes passed to ReadLine must be at least one less than the size of the buffer ReadLine transfers every character from the input line to the buffer including leading embedded and trailing spaces until the maximum number of bytes
216. ecision Imaginary part of y Output outputReal double precision Real part of z outputImaginary double precision Imaginary part of z Return Value status integer Refer to error codes in Table 3 2 LabWindows CVI Standard Libraries 3 14 National Instruments Corporation Chapter 3 Analysis Library CxSub1D int status CxSub1D double arrayXReal double arrayXImaginary double arrayYReal double arrayYImaginary J int numberofElements double outputArrayReal double outputArrayImaginary Purpose Subtracts two 1D complex arrays The function obtains the ith element of the resulting complex array by using the following formulas 21 XI Yr 1 zi XI yl The function performs the operations in place that is the input and output complex arrays can be the same Parameters arrayXReal double precision Real part of x array arrayXImaginary double precision Imaginary part of x array array Y Real double precision Real part of y array array Y Imaginary double precision Imaginary part of y array numberofElements integer Number of elements outputArrayReal double precision Real part of z array outputArrayImaginary double precision Imaginary part of z array Return Value status integer Refer to error codes in Table 3 2 O National Instruments Corporation 3 15 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Determinant int status Dete
217. ect1D 3 35 open functions GPIB Library 4 2 RS 232 Library 5 1 OpenCom function 5 4 5 25 to 5 26 OpenComConfig function 5 4 5 26 to 5 28 OpenDev function 4 6 4 20 OpenFile function 2 20 to 2 22 outp function 8 56 outpw function 8 56 P parallel poll functions GPIB 488 2 Library 4 4 persistent variable functions GetPersistentVariable 8 33 to 8 34 SetPersistentVariable 8 71 LabWindows CVI Standard Libraries I 12 physical memory access functions ReadFromPhysicalMemory 8 57 ReadFromPhysicalMemoryEx 8 58 WriteToPhysicalMemory 8 85 to 8 86 WriteToPhysicalMemoryEx 8 86 to 8 87 PlotLastAlWaveformsPopup function 10 47 port 1 O utility functions inp 8 42 inpw 8 42 to 8 43 outp 8 56 outpw 8 56 properties See also X Property Library functions definition 9 2 handles and types 9 3 property events handling GetXPropErrorString 9 15 InstallXPropertyCallback 9 4 9 25 to 9 27 UninstallXPropertyCallback 9 4 9 33 property information managing CreateXProperty 9 3 9 9 to 9 10 DestroyXProperty 9 12 to 9 13 GetXPropertyName 9 15 to 9 16 GetXPropertyType 9 16 to 9 17 property types managing CreateXPropType 9 3 9 10 to 9 12 DestroyXPropType 9 13 to 9 14 GetXPropTypeName 9 17 to 9 18 GetXPropTypeSize 9 18 GetXPropTypeUnit 9 19 Pulse WidthOrPeriodMeasConfig function 10 48 to 10 49 PutX WindowPropertyItem function 9 27 to 9 28 PutX WindowProperty Value function 9 29 to 9 31 National In
218. ed LWRS_RXCHAR 0x0002 Received certain character LWRS_RXF LAG 0x0004 Transmit Queue empty LWRS_TXEMPTY 0x0008 CTS changed state LWRS_CTS 0x0010 DSR changed state LWRS_DSR 0x0020 RLSD changed state LWRS_RLSD 0x0040 BREAK received LWRS_BREAK 0x0080 Line status error occurred LWRS_ERR 0x0100 Ring signal detected LWRS_RING 0x8000 notify Count bytes in inqueue LWRS_RECEI 0 1 2 3 4 5 6 7 8 Nn LabWindows CVI Standard Libraries 5 24 National Instruments Corporation Chapter 5 RS 232 Library The following table further describes the events Event Constant Name Description LWRS_RXCHAR Set when any character is received and placed in the receiving queue LWRS_RXFLAG Set when the event character is received and placed in the receiving queue The event character is specified in the eventCharacter parameter of this function LWRS_TXEMPTY Set when the last character in the transmission queue is sent LWRS_CTS Set when the CTS clear to send line changes state LWRS_DSR Set when the DSR data set ready line changes state LWRS_RLS Set when the RLSD receive line signal detect line changes state LWRS_BREAK Set when a break is detected on input LWRS_ERR Set when a line status error occurs Line status errors are CE_FRAME CE_OVERRUN and CE_RXPARITY LWRS_RING Set to indicate that a ring indicator was detected LWRS_RECEI Set to detect when at least notify Count byt
219. ed long This value parameter depends integer on the command parameter as described in the Parameter Discussion additionalStringData string This value parameter depends on the command parameter as described in the Parameter Discussion Return Value status integer Non zero on success zero on failure Parameter Discussion helpFile contains a filename that may be followed by an angle bracket lt and the name of a secondary window if the topic is to be displayed in a secondary window rather than in the primary window The name of the secondary window must have been defined in the WINDOWS section of the Help Project HP J file command can be one of the following values HELP_COMMAND Execute a Help Macro In this case additionalStringData is the Help macro to be executed HELP_CONTENTS Displays the Help contents topic as defined by the Contents option in the OPTIONS section of the HPd file HELP_CONTEXT Display Help for a particular topic identified by a context number that has been defined in the MAP section of the HPJ file In this case additionalLongData is the context number of the topic HELP_CONTEXTNOFOCUS Display Help for a particular topic identified by a context number that has been defined in the MAP section of the HPJ file Help does not change the focus to the window displaying the topic LabWindows CVI Standard Libraries 8 80 O National Instruments Corporatio
220. ed project National Instruments Corporation 8 51 LabWindows CVI Standard Libraries Utility Library Chapter 8 3 If the file has not been found and its extension is d11 LoadExternalModule searches for the file in the directories specified in the Windows LoadLibrary call If it is a relative pathname with one or more directory paths such as dir module ob LoadExternalModule creates an absolute pathname by appending the relative pathname to the directory that contains the currently loaded project If the pathname is for a DLL import library LoadExternalModule finds the DLL using the DLL name embedded in the import library and the standard Windows DLL search algorithm Example void funcPtr char buf double dval int ival nt module_id nt status har buf 100 ouble dval t ival a e Qo Q H H n har pathname char funcname pathname EXTMOD OBJ funcname my_function module_id LoadExternalModule pathname if module_id lt 0 FmtOut Unable to load s n pathname else funcPtr GetExternalModuleAddr module_id funcname amp status if funcPtr NULL FmtOut Could not get address of s n funcname else funcPtr buf dval ival LoadExternalModuleEx int moduleld LoadExternalModuleEx char pathName void callingModuleHandle Purpose LoadExternalModuleEx loads a file containing one or more object modules It is similar to
221. edFrequency sourceFrequency 2 N thus if N 3 the OUT pin would generate pulses as follows source al 1 1 121 1 1 11 121 1 1 1 1 1 1 1 1 1 1 LI pulsed toggled _ If gateMode is not UNGATED_SOFTWARE_START connect your gate signal to counter s GATE pin National Instruments Corporation 10 37 LabWindows CVI Standard Libraries Easy I O for DAQ Library Parameters device counter source Timebase timebaseDivisor gateMode outputBehavior sourceEdge taskID Return Value short integer string double double unsigned short integer unsigned short integer short integer unsigned long integer Chapter 10 Assigned by configuration utility The counter to be used for the counting Operation USE_ COUNTER_SOURCE count TTL edges at counter s SOURCE pin or supply a valid internal timebase frequency to count the T TL edges of an internal clock The source frequency divisor Specifies how the signal on the counter s GATE pin is used The behavior of the output signal when counter reaches terminal count The edge of the counter source or timebase signal on which it decrements COUNT_ON_RISING_EDGE or COUNT_ON_FALLING_EDGE The reference number assigned to this operation You pass taskID to CounterStart CounterRead and CounterStop Parameter Discussion counter is the counter to be used for the counting opera
222. edgeSlope specifies whether the trigger occurs when the trigger signal voltage is leading POSITIVE_SLOPE or trailing NEGATIVE_SLOPE triggerLevelV the voltage at which the trigger is to occur triggerLevelV is valid only when the Trigger Type is hardware or software analog trigger triggerSource specifies which channel is the trigger source triggerSource must be one of the channels listed in the channelString Or if you pass or NUL the first channel in the channelString is used as the triggerSource triggerSource is valid only when the Trigger Type is hardware or software analog trigger timeLimitsec is the maximum length of time in seconds to wait for the data If the time you set expires the function returns a timeout error t imeOutErr 10800 Other Values 2 O disables the time limit Warning This setting leaves your computer in a suspended state until the trigger condition occurs 1 O default lets the function calculate the timeout based on the acquisition rate and number of scans requested fillMode specifies whether the waveforms array is grouped by channels or grouped by scans Consider the following examples e If you scan channels A through C and Number of Scans is 5 then the possible fill modes are GROUP_BY_CHANNEL Al A2 A3 A4 A5 B1 B2 B3 B4 B5 C1 C2 C3 C4 C5 fp A ON or GROUP_BY_SCAN Al B1 C1 A2 B2 C2 A3 B3 C3 A4 B4 C4 A5 B5 C5 LA LN HOON LN e If you
223. em or translating in whole or in part without the prior written consent of National Instruments Corporation Trademarks NI DAQ NI 488 2 and NI 488 2M are trademarks of National Instruments Corporation Product and company names listed are trademarks or trade names of their respective companies WARNING REGARDING MEDICAL AND CLINICAL USE OF NATIONAL INSTRUMENTS PRODUCTS National Instruments products are not designed with components and testing intended to ensure a level of reliability suitable for use in treatment and diagnosis of humans Applications of National Instruments products involving medical or clinical treatment can create a potential for accidental injury caused by product failure or by errors on the part of the user or application designer Any use or application of National Instruments products for or involving medical or clinical treatment must be performed by properly trained and qualified medical personnel and all traditional medical safeguards equipment and procedures that are appropriate in the particular situation to prevent serious injury or death should always continue to be used when National Instruments products are being used National Instruments products are NOT intended to be a substitute for any form of established process procedure or equipment used to monitor or safeguard human health and safety in medical or clinical treatment Contents ADOUE This Mani al sai xvii Organization Of This M anual
224. ents Corporation K KB kS ksamples L LSB M manual scaling MB MIO mux N NI 488 functions NI 488 2 routines port postriggering National Instruments Corporation G 5 Glossary Kilobytes of memory 1 000 samples 1 000 samples Least significant bit Where SetAxRange is called to explicitly set the maximum and minimum X and Y values Megabytes of memory Multifunction I O Milliseconds Multiplexer a switching device with multiple inputs that sequentially connects each of its inputs to its output typically at high speeds in order to measure several signals with a single analog input channel National Instruments functions you use to communicate with GPIB devices built according to the ANSI IEEE Standards 488 1 1987 and 488 2 1992 National Instruments routines you use to communicate with GPIB devices built according to the ANSI IEEE Standard 488 2 1992 A digital port consisting of four or eight lines of digital input and or output The technique used on a DAQ board to acquire a programmed number of samples after trigger conditions are met LabWindows CVI Standard Libraries Glossary pretriggering pts R resolution RTD S s S s Sample and Hold S H SCXI self calibrating Single Ended SE Inputs software trigger standard libraries STC System synchronous LabWindows CVI Standard Libraries The technique used on a DAQ board to keep a cont
225. er Get Error String GetTCPErrorString National Instruments Corporation 7 1 LabWindows CVI Standard Libraries TCP Library Chapter 7 TCP Clients and Servers Network communication using the TCP library involves a client and a server in each connection A TCP server can send and receive information to and from a client application through a network A TCP client can send and request data to and from a server application Once registered a server waits for clients to request connection to it A client however can only request connection to a pre existing server With the LabWindows CVI TCP Library you can write programs to act as a TCP client or server Under Windows you cannot run both a server and a client on the same computer The procedure for writing a program using TCP is similar to the procedure followed for using DDE Refer to the sample program discussion in Chapter 6 DDE Library Two additional sample programs TCPSERV PRJ and TCPCLNT PRU provide some guidelines on structuring your TCP programs as a server or client These programs are provided as templates only and will require modification for operation on your machine To connect to a TCP server from a LabWindows CVI program you must have some information about the application to which you would like to connect All TCP server applications must run on a specified host which either has a known host name for example aaa bbb ccc ora known IP address for example
226. er Discussion This function loads an external object module file The file need not be listed in your project nor loaded as an instrument module Under Windows 3 1 the file may be an object file obj a library file 1ib ora dynamically linked library d11 Object and library modules must be compiled with the Watcom C compiler for Windows or the LabWindows CVI compiler Under Windows 95 and NT the file may be an object file obj a library file 1ib ora DLL import library 1ib You cannot load a DLL directly Object and library modules can be compiled in LabWindows CVI or an external compiler In UNIX the file may be an object file o or a statically linked library a All files must conform to the rules for loadable compiled modules in the LabWindows CVI Programmer Reference Manual By loading external object modules you can execute code that is not in your project and not in a loaded instrument module You can load the external modules only when needed and unload them when they are no longer needed After a module has been loaded you can execute its code in one of two ways e You can obtain pointers to functions in the module by calling GetExternalModuleAddr You can then call the module s functions through the function pointers LabWindows CVI Standard Libraries 8 50 O National Instruments Corporation Chapter 8 Utility Library e Youcan call RunExternalModule This requires that the module contain a fun
227. er Discussion portNumber specifies the digital port this function configures A portNumber value of 0 signifies port 0 a portNumber of 1 signifies port 1 and so on If you use an SCXI 1160 SCXI 1161 SCXI 1162 or SCXI 1163 module use the SCx MDy 0 syntax where x is the chassis ID and y is the module device number to specify the port on a module portWidth is the total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port on an MIO non E Series board by setting portWidth to 8 e When portWidth is greater than the physical port width of a digital port the following restrictions apply The portWidth must be an integral multiple of the physical port width and the port numbers in the combined port must begin with the port named by portNumber and must increase consecutively For example if portNumber is 3 and portWidth is 24 bits LabWindows CVI uses ports 3 4 and 5 LabWindows CVI Standard Libraries 10 54 National Instruments Corporation Chapter 10 Easy I O for DAQ Library e The portWidth for the 8255 based digital I O ports including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 should be at least 8 configure specifies whether to configure the digital port before writing e When this function is called in a loop it can be optimized by only configuring the digital port on the first ite
228. er returned by an X Property Library function into a meaningful error message Parameters Input errorNum PropLibXErrType Status returned by an X Property function Return Value message Explanation of error GetXPropertyName PropLibXErrType status GetXPropertyName PropertyHandlexX property char propertyName Purpose Gets a property name This function returns a pointer to the name associated with the property handle Parameters Input property PropertyHandlexX Property handle for which the name is to be obtained This value must have been obtained from CreateXProperty Output propertyName_ character pointer Pointer to the property name passed by reference National Instruments Corporation 9 15 LabWindows CVI Standard Libraries X Property Library Chapter 9 Warning The propertyName pointer points to memory allocated by CreateXProperty You must not attempt to free this pointer or to change its contents Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to the name parameter InvalidPropertyXErr The property argument is not a valid property handle This argument must be the value returned by CreateXProperty GetXPropertyType PropLibXErrType status GetXPropertyType PropertyHandle
229. er to error codes in Table 3 2 Sub2D int status Sub2D void arrayX void arrayY int numberofRows int numberofColumns void outputArray Purpose Subtracts two 2D arrays The function obtains the ith jth element of the output array by using the formula Sif Xij T bd The function performs the operation in place that is outputArray can be in place of either arrayX or arrayY Parameters arrayX double precision 2D Input array arrayY double precision 2D Input array numberofRows Number of elements in first dimension numberofColumns Number of elements in second dimension array Return Value status integer Refer to error codes in Table 3 2 National Instruments Corporation 3 31 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Subset1D int status Subset1D double inputArray int numberofElements int index int length double outputArray Purpose Extracts a subset of the inputArray input array containing the number of elements specified by the length and starting at the index element Parameters inputArray double precision Input array array numberofElements integer Number of elements in inputArray index integer Initial index for the subset length integer Number of elements copied to the subset array Return Value status integer Refer to error codes in Table 3 2 ToPolar int status ToPolar double xReal double yImaginary doubl
230. erms of bytes Treat String as Integer Array The z integer modifier indicates that the data type of the corresponding argument is a string Nevertheless the data in the string is treated as an integer array The z modifier is valid only if rep is present O National Instruments Corporation 2 43 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 rn wn onnnn Specify Radix The r integer modifier specifies the radix of the integer argument which is important if the integer is converted from a string format Legal radixes are 8 octal 10 decimal the default 16 hexadecimal and 256 a special radix representing single 8 bit ASCII characters Specify String Size The w integer modifier specifies the exact number of bytes occupied by a string representation of the integer argument in the event that the integer is converted from a string format You can enter any non negative value here If n is less than the number of digits required to represent the integer an asterisk will be inserted into the string to signify an overflow The default for n is zero which indicates that the integer can occupy whatever room is necessary Specify as Two s Complement The s integer modifier indicates that the integer argument is to be considered a signed two s complement number This is the default interpretation of integers so the s modifier is not required Specify as Non negative The u integer modifier indicates t
231. ersationHandle unsigned int portNumber char serverHostName tcpFuncPtr clientCallbackFunction void callbackData unsigned int timeout Purpose Establishes a conversation between your program and a pre existing server Your program becomes a client Parameters portNumber unsigned integer Uniquely identifies a server on a single machine serverHostName character array Can either be the host name or IP address string For example aaa bbb ccc or 123 456 78 90 clientCallbackFunction TCP function Pointer to the user callback pointer function callbackData void pointer User defined data timeout unsigned integer Timeout in ms Output conversationHandle unsigned integer Uniquely identifies the conversation National Instruments Corporation 7 5 LabWindows CVI Standard Libraries TCP Library Chapter 7 Return Value status integer Refer to error codes in Table 7 3 Parameter Discussion clientCallbackFunction is the name of the function called to process messages to your program as a TCP client The callback function must be of the following form int tcpFuncPtr int handle int xType int errCode void callbackData The xType transaction type parameter specifies the type of message received from the server The client callback function can receive the following transaction types TCP_DISCONNECT TCP_DATAREADY The errCode parameter is used only when the transaction
232. erty item is to be stored property PropertyHandleX Handle of the property to be stored This value must have been obtained with CreateXProperty propertyltem generic pointer Property item to be stored on the window This parameter must point to an object of the same size as a property item You can get the property item size by calling the function GetXPropertySize O National Instruments Corporation 9 27 LabWindows CVI Standard Libraries X Property Library Chapter 9 Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to one or more parameters InvalidDisplayXErr The display argument is not a valid display This argument must either be the predefined value CVIXDisplay or be the value returned by ConnectToXDisplay l1idWindowXErr The window argument is not a valid window lidPropertyXErr The property argument is not a valid property handle This argument must be the value returned by CreateXProperty InsuffMemXErr There is insufficient memory to perform the operation GeneralXErr An Xlib function failed for some unknown reason BrokenConnectionXErr The connection to the X server was broken This occurs if the remote server terminated Parameter Discussion display must either be the
233. ertyltem 34 ou ceca asics saxdneedsccy ave sane dasedacastuasacddunedaase aebdanphensdedaeane 9 20 Get Window PEOPEDLY Y aleta nO noaa daea ii ara aes iR 9 22 Install X Property Callback ii di it tt E A As 9 25 PutXWindowProperty MEM ic ic cc0s cece cadena oia tedio lancia avevaapbensdeeasane 9 27 PUEXCW indow Property V ale s cccccisccceisassavcdsesscacsaneavsssisegaadeasascedeseesensnayeveeauans 9 29 REMOVE WINDOW POPE E A ee aos 9 31 Uninstall Property Callback tio 9 33 Chapter 10 Easy VO for DAQ Library oooccocicooionococcococicococoooonononononononononononononorororororororonononononoos 10 1 Easy I O for DAQ Library Function OvervieW cooococconccconocccnoncnononcncnnnanononcncnnncninnnanos 10 1 Advantages of Using the Easy I O for DAQ Library ooonocnnocinoconicnnonncnancnannno 10 1 Limitations of Using the Easy I O for DAQ Library coooccnnccnnocononcnancnonanconncnnns 10 2 Easy I O for DAQ Library Function PanelS ooonoococnnoccconoccconancnonnccnonnncnonnnnnn 10 2 Device Numbers 0 A A A BAe E NE 10 4 Channel String for Analog Input Functions oooocccnoccnonacnoncnoncnonnnono nono ncnoncnnnno 10 4 Command SUMA adan iii 10 6 LabWindows CVI Standard Libraries xiv National Instruments Corporation Contents Channel String for Analog Output Functions cooccnnccnnonononononnnonnnono nono ncnonccnnnos Valid Counters for the Counter Timer Functions ooooocncccncnnnnonunanicicncnnonononos Easy I O for DAQ Function Re
234. es 2 52 National Instruments Corporation Chapter 2 Formatting and I O Library Integer and Real to String with Literals char buf 20 Ink 5 T double v f 4 r 3 v 1 2 Fmt buf s lt F iR i VS f r v Remarks After the Fmt call buf contains F4R3 V1 2 Two Integers to ASCII File with Error Checking int a b n file_handle a 12 b 456 file_handle OpenFile FILE DAT 2 0 1 if file_handle lt 0 FmtOut Error opening file n exit 1 n FmtFile if n 2 FmtOut E exit 1 file_handle s lt i i a b rror writing file n CloseFile file_handle Remarks OpenFile opens the file FILE DAT as an ASCII file for writing only If the function succeeds it returns a file handle with a positive integer value FmtFile writes the ASCII representation of two integer values to the file If Fmt File succeeds it returns 2 because there are two source specifiers in the format string Real Array to ASCII File in Columns and with Comma Separators double x 100 int file_handle i file handle OpenFile FILE DAT 2 0 1 for i 0 i lt 100 i FmtFile file handle s lt f w15 x il National Instruments Corporation 2 53 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 if 1 5 4 WriteFile file _ handle An 1 CloseFile file handle Remarks
235. es Under UNIX rename fails if the source and target files are on different file systems The functions fgetpos and ftell set errno to EFILPOS on error errno Set by File I O Functions The errno global variable is set to indicate specific error conditions by the ANSI C file I O functions and the low level I O functions The possible values of errno are declared in cvi include ansi errno h There is a base set of values that is common to all platforms There are additional values that are specific to particular platforms Under Windows 3 1 errno gives very limited information If the operating system returns an error errno is set to EIO Under Windows 95 and NT you can call the Windows SDK Get LastError function to obtain system specific information when errno is set to one of the following values EACCES EBADF EIO ENOENT ENOSPC Mathematical Functions The macro HUGE_ VAL defined in the header math h as well as the macros FLT_EPSILON FLT_MAX FLT_MIN DBL_EPSILON DBL_MAX DBL_MIN LDBL_EPSILON LDBL_MAX and DBL_MIN defined in the header float h all refer to variables Consequently these macros cannot be used in places where constant expressions are required such as in global initializations Time and Date Functions Function t ime returns the number of seconds since January 1 1990 Functions mkt ime and localtime require time zone information t
236. es 8 16 National Instruments Corporation Chapter 8 Utility Library Return Value Return Codes Handle is invalid Executable is still running Executable has been terminated Note If you launch another LabWindows CVI executable under Windows 3 x the launched executable process will terminate itself after launching the new copy of the CVI Run time Engine If you use ExecutableHasTerminated the return value will always be 1 because the process identification for the second Run time Engine cannot be tracked See LaunchExecutableEx for more information GetBreakOnLibraryErrors int state GetBreakOnLibraryErrors void Purpose This function returns the state of the Break on library errors option It returns a 1 if the Break on library errors option is enabled or a 0 if it is disabled The state of the Break on Library errors option can be changed interactively using the Run Options command in the Options menu of the Project window The state of the Break on Library errors option can also be changed programmatically using SetBreakOnLibraryErrors or the EnableBreakOnLibraryErrors and DisableBreakOnLibraryErrors functions If debugging is disabled this function always returns 0 Return Value The current state of the Break on library errors option Return Codes Break on Library Errors option enabled Break on Library Errors option disabled National Instruments Corporation 8 17 LabWindows CVI S
237. es are in the input queue Once this event has occurred it does not trigger again until the input queue falls below and then rises back above notify Count bytes OpenCom int result OpenCom int COMPort char deviceName Purpose Opens a com port Parameter COMPort integer Range 1 through 32 deviceName string Name of the COM port O National Instruments Corporation 5 25 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Return Value Parameter Discussion deviceName is the name of the com port in the ASCII string For example COM1 for com port 1 on Microsoft Windows using COMM DRV and dev ttya for com port 1 on UNIX using the Zilog 8530 SCC serial comm driver If you pass a NULL pointer or an empty string for deviceName the library uses the following device names depending on the COM port number you have specified Port Number deviceName on Windows deviceName on UNIX COM1 dev ttya COM dev ttyb COM3 dev ttys1 COM4 dev ttys2 and so on Using This Function OpenCom uses 512 bytes of the buffer for the input queue 512 bytes for the output The function assumes the default baud rate parity stop bits data bits port address and handshake mode established through the com port configuration of the operating system The time out for VO operations is 5 seconds Refer to the functions Set XMode SetCTSMode and SetComTime if you want to
238. es are read in FIFO first in first out fashion If the RQS bit of the status word is not set when you call ibrsp the function conducts a serial poll and returns whatever response it receives If your application requires that requests for service be noticed call the ibrsp function whenever the RQS bit appears in the status word A serial poll response queue of a device can overflow with old status bytes when you neglect to call ibrsp ibrsp returns the error condition ESTB when status bytes have been discarded because the queue is full If your application has no interest in SRQ or status bytes you can ignore the occurrence of the automatic polls Note If the ROS bit of the device status word is still set after you call ibrsp the response byte queue has at least one more response byte remaining You should call ibrsp until RQS is cleared to gather all stored response bytes and to guard against queue overflow Autopolling Compatibility You cannot detect the SRQI bit in device status words ibsta if you enable Autopolling The goal of Autopolling is to remove the SRQ from the IEEE 488 bus thus preventing visibility of the SRQI bit in status words for both board calls and device calls If you choose to look for SRQI in your program you must disable Autopolling Board functions are also incompatible with Autopolling The handler disables Autopolling whenever you make a board call and re enables it at the end of a subsequent device call
239. eters arrayXReal array Y Imaginary numberofElements Output magnitude phaseRadians Return Value double precision array double precision array integer double precision array double precision array Chapter 3 X coordinate Y coordinate Number of elements Magnitude Phase in radians status integer Refer to error codes in Table 3 2 ToRect int status ToRect double magnitude double phaseRadians double xReal double yImaginary Purpose Converts the polar coordinates magnitude phaseRadians to rectangular coordinates xReal yImaginary The formulas used to obtain the rectangular coordinates are as follows x mag cos phase y mag sin phase Parameters magnitude phaseRadians xReal double precision double precision double precision Magnitude Phase in radians X coordinate Y coordinate yImaginary LabWindows CVI Standard Libraries double precision O National Instruments Corporation Chapter 3 Analysis Library Return Value status integer Refer to error codes in Table 3 2 ToRect1D int status ToRect1D double magnitude double phaseRadians int numberofElements double outputArrayReal double outputArrayImaginary Purpose Converts the set of polar coordinate points magnitude phaseRadians to a set of rectangular coordinate points outputArrayReal outputArrayImaginary The function obtains the ith element o
240. eturn Value National Instruments Corporation 8 21 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Codes Success Out of memory Invalid file format Undefined references Cannot open file Invalid module ID Identifier not defined globally in module DLL initialization failed e g DLL file not found Parameter Discussion modulelD is the value LoadExternalModule returns name is the name of the identifier whose address is obtained from the external module The identifier must be a variable or function name defined globally in the external module status is zero if the function is a success or a negative error code if it fails If GetExternalModuleAddr succeeds it returns the address of the variable or function in the module If the function fails it returns NULL Example void funcPtr char buf double dval int ival int module_id t status ar buf 100 ouble dval n A t ival 0 P oQ0PerPp n har pathname char funcname pathname EXTMOD OBJ funcname my_function module_id LoadExternalModule pathname if module_id lt 0 FmtOut Unable to load s n pathname else funcPtr GetExternalModuleAddr module_id funcname amp status if funcPtr NULL FmtOut Could not get address of s n funcname else funcPtr buf dval amp ival LabWindows CVI Standard Libraries 8 22 National Instruments Corpor
241. events The system can process events in the following situations e You have called RunUserInterface and none of your callback functions is currently executing or e Youcall GetUserEvent or e Youcall ProcessSystemEvents Only one callback function can apply for each COM port Each call to this function for the same COM port supersedes the previous call To disable callbacks for a board or device pass 0 for the eventMask and or callbackFunction parameters LabWindows CVI Standard Libraries 5 22 National Instruments Corporation Chapter 5 RS 232 Library Note The callback function may receive more than one event at a time When using this function at higher baud rates some LWRS_RXCHAR events may be missed It is recommended to use LWRS_RECEIVE or LWRS_RXFLAG instead Note Once the LWRS_RECEIVE event occurs it is not triggered again until the input queue falls below and then rises back above notifyCount bytes Example notifyCount 50 Wait for at least 50 bytes in queue eventChar 13 Wait for LF eventMask LWRS_RXFLAG LWRS_TXEMPTY LWRS_RECEIVE InstallComCallback comport eventMask notifyCount eventChar ComCallback NULL Callback Function void ComCallback int portNo int evnetMask void data if eventMask amp LWRS_RXFLAG printf Received specified character n if eventMask amp LWRS_TXEMPTY printf Transmit queue now empty n if even
242. exist on the window There is insufficient memory to perform the operation CreateXProperty There is insufficient memory to store the property information or there are already 256 properties CreateXPropType There is insufficient memory to store the property information or there are already 64 property types An Xlib function failed for an unknown reason The connection to the X server was broken This occurs if the remote server terminated 9 6 National Instruments Corporation Chapter 9 X Property Library Using the Library Outside of LabWindows CVI You can use the LabWindows CVI X Property Library in applications developed outside of LabWindows CVI By linking your program with the library file 1ibxprogp a in the misc lib directory of the LabWindows CVI installation directory you can use all the functions of the X Property Library in your program You cannot use the 1ibxprop a library within LabWindows CVI The following two functions are available only outside of LabWindows CVI e void _InitXPropertyLib DisplayPtrx eviDisplay WindowX rootWindow WindowX hiddenWindow This function sets the global variables CVIXDisplay CVIXRootWindow CVIXHiddenWindow of the X Property Library e void HandlePropertyNotifyEvent EventPt rX event This function calls the functions that are installed as property callbacks You should call this function whenever you receive an XPropertyNot ify event to automatica
243. f the rectangular set by using the following formulas x mag cos phase y mag sin phase The function performs the operations in place that is outputArrayReal and magnitude and outputArrayImaginary and phaseRadians can be the same arrays respectively Parameters magnitude double precision Magnitude array phaseRadians double precision Phase in radians array numberofElements integer Number of elements outputArrayReal double precision X coordinate array outputArrayImaginary double precision Y coordinate array Return Value status integer Refer to error codes in Table 3 2 National Instruments Corporation 3 35 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Transpose int status Transpose void inputMatrix int numberofRows int numberofColumns void outputMatrix Purpose Finds the transpose of a 2D input matrix The ith jth element of the resulting matrix uses the formula Vig iy Parameters inputMatrix double precision 2D Input matrix numberofRows Size of first dimension numberofColumns Size of second dimension array Note If the input matrix is dimensioned numberofRows by numberofColumns then the output matrix must be dimensioned numberofColumns by numberofRows Return Value integer Refer to error codes in Table 3 2 LabWindows CVI Standard Libraries 3 36 National Instruments Corporation Chapter 3 Analysis Libra
244. f you are using a Lab PC DAQCard 500 700 1200 DAQPad 1200 PC LPM 16 These devices can only sample input channels in descending order and you must end with channel 0 3 0 If you are using a Lab PC or 1200 product in differential mode you must use even numbered channels 6 4 2 0 If you are using a DAQPad MIO 16XE 50 You can read the value of the cold junction compensation temperature sensor using the following string as the channel cjtemp If you are using SCXI You can address SCXI channels when you attach one or more SCXI chassis to a plug in data acquisition board If you operate a module in parallel mode you can select a SCXI channel either by specifying the corresponding onboard channels or by using the SCXI channel syntax described below If you operate the modules in multiplexed mode you must use the SCXI channel syntax The SCXI channel syntax is as follows OB1 SCx MDy a channel a on the module in slot y of the chassis with ID x is multiplexed into onboard channel 1 OBO SCx MDy a b channels a through b inclusive on the module in slot y of the chassis with ID x is multiplexed into onboard channel 0 SCXI channel ranges cannot cross module boundaries SCXI channel ranges must always increase in channel number The following examples of the SCXI channel syntax introduce the special SCXI channels OBO SCx MDy MTEMP The temperature sensor configured in MTEMP mode on the multiplexed
245. ference usina a ea AIAcquireTriggeredWaveforms 4 neietietsaier ene eee rte tenets ATAcquire Waveforms iii nea Ae AIChe rc RACQUIS IO A eleven whereas ged BICIS CISCO A nde AlReadAcquiSI OM ici taaedasunsadeasdepesaasccncoues Al Sample anne its AlSampleChamel ts a oia Ea ATS Car ACUI S LOT siren E A R A a NE R AOClearW ay CLOTS 5 ae iesin esnie seai ire eeit ige iis AOGener teWavef orm S enana naaa aa a a a a a A a nat AOUpdateChannel 250 A A A A E NA ContinuousPulseGenConfig voices iia arica dedica CounterEyemOrTmeCoOnS eccccoiss cscs sineveses ces aiasedssucsduessucsancaveusdeden axes acpsevedetenans COAST ALEA UA aa COUMCER Gat 2 5 0 aia A II AS OUEST A A ounces E eae ded ae ne hl oat cet Cor OP ii Delayed Pulse Gem oni T nise cise A Brequeney Divider Omi trad tia GetAILimitsOfChannel ui inniinn e ii eiis G tChannellndic s fs GetChannelNameFromlndex io GEDA OEE ESO di Gerundio GroupByChameldiciiio id ii cn es Ree ICounterControl RN PlotLastAIWaveformsPopup sesesssessseeessseesseessesssesesseessseesseesseesseessseeesseesseese PulseWidthOrPeriodMeasConfiB ooococnnococonocononoccnononinononcnnnnnconnnnonnnoncnnncncnnnnnnnns Rea brom Die allem seine e aas isc Reach rom g tal PONE A raa e a e a setEasylOMultit skins Modernne vaca cuss teasers oat tarda WriteroDigital OS Write TODigital Port ici ini eieaa iwin Error Conditlons sts Sere ei hres lesa aay eta setae ores ea ces aed cs ees eos a Appendix A Customer Com
246. file was invalid Either it was not a Windows application or there was an error in the EXE image 13 Application was designed for a different operating system 14 Application was designed for MS DOS 4 0 15 Type of executable file was unknown 16 Attempt made to load a real mode application developed for an earlier Windows version 17 Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read only 20 Attempt was made to load a compressed executable file The file must be decompressed before it can be loaded 21 Dynamic link library DLL file was invalid One of the DLLs required to run this application was corrupt 22 Application requires Microsoft Windows 32 bit extensions 23 Could not find toolhelp dll ortoolhelp dl1 is corrupted 24 Could not allocate a Get ProcUserDefinedHandle The exit function does not actually flush and close the open streams LabWindows CVI leaves files open so that they may be used from within the Interactive Window after execution of the project terminates The Close Libraries menu option under the Run menu performs this library cleanup This library cleanup is also performed when you restart execution of the project by selecting Run Project from the Run menu The argument passed to function exit is not used by the LabWindows CVI environment Under UNIX standalone executables created by LabWindows CVI return the value of the ar
247. for basic communication to take place Hardware handshaking and modem control can require other lines depending on your National Instruments Corporation LabWindows CVI Standard Libraries RS 232 Library Chapter 5 application Refer to the Hardware Handshaking section later in this chapter for more information about using the lines 4 5 6 and 20 Another area that requires special attention is the gender of the connectors of your serial cable The serial cable plugs into sockets in the PC and the serial device just as a lamp cord plugs into a wall socket Both the connector and the socket can be male with pins like a lamp plug or female with holes like an outlet If your serial cable connector and PC socket are the same gender you cannot plug the cable into the socket You can change this by attaching a small device called a gender changer to your cable One type of gender changer converts a female connector to a male connector and the other type converts a male connector to a female connector The size of the connector on your serial cable can also differ from the size of the socket Most serial ports require a 25 pin connector However some serial ports require a 9 pin connector To resolve this incompatibility you must either change the connector on your serial cable or attach a small device that converts from a 25 pin connector to a 9 pin connector Handshaking A common error condition in RS 232 communications is that the
248. formation it gathers from compiling your source code to make extensive run time checks to protect your program When it encounters a protection error at run time LabWindows CVI displays a dialog box and suspends execution Examples of protection errors are e An invalid pointer value is dereferenced in source code e An attempt is made in source code to read or write beyond the end of an array e A function call is made in source code in which an array is smaller than is expected by the function e Pointer arithmetic is performed in source code which generates an invalid address LabWindows CVI Standard Libraries 5 64 National Instruments Corporation Chapter 8 Utility Library You can use this function to prevent LabWindows CVI from displaying the dialog box and suspending execution when it encounters a protection error In general it is better not to disable the break on protection errors feature Nevertheless you may want to disable it temporarily around a line of code for which LabWindows CVI is erroneously reporting a protection error If debugging is disabled this function has no effect Run time errors are not reported when debugging is disabled Note If an invalid memory access generates a processor exception LabWindows CVI reports the error and terminates your program regardless of the debugging level or the state of the break on protection errors feature Parameters Pass a nonzero value to enable Pass zero to disable
249. function 2 7 CloseInstrDevs function 4 14 Cls function 8 7 ComBreak function 5 9 ComFromFile function 5 3 5 9 to 5 10 communications functions See RS 232 Library functions CompareBytes function 2 7 to 2 8 CompareStrings function 2 8 to 2 9 complex operation functions CxAdd 3 7 to 3 8 CxAdd1D 3 8 to 3 9 CxDiv 3 9 CxDiv1D 3 10 CxLinEv1D 3 11 CxMul 3 12 CxMul 1D 3 12 to 3 13 LabWindows CVI Standard Libraries Index CxRecip 3 13 to 3 14 CxSub 3 14 CxSub1D 3 15 ToPolar 3 32 to 3 33 ToPolar1D 3 33 to 3 34 ToRect 3 34 to 3 35 ToRect1D 3 35 ComRd function 5 11 ComRdByte function 5 12 ComRdTerm function 5 12 to 5 13 ComSetEscape function 5 14 to 5 15 ComToFile function 5 3 5 15 to 5 16 ComWrt function 5 16 to 5 17 ComWrtByte function 5 17 to 5 18 configuration functions GPIB Library 4 2 ConnectToDDEServer function 6 2 6 13 to 6 15 ConnectToTCPServer function 7 5 to 7 7 ConnectToXDisplay function 9 3 9 7 to 9 9 ContinuousPulseGenConfig 10 24 to 10 26 control functions ANSI C library 1 7 to 1 9 error codes 1 8 RS 232 Library ComBreak 5 9 ComSetEscape 5 14 to 5 15 FlushInQ 5 18 SetComTime 5 29 SetCTSMode 5 7 5 30 SetX Mode 5 6 5 31 Copy1D function 3 7 CopyBytes function 2 9 to 2 10 CopyFile function 8 7 to 8 8 CopyString function 2 10 Count control GPIB 4 6 Count Variables ibcnt ibcntl 4 6 4 10 CounterEventOrTimeConfig function 10 26 to 10 29 CounterMeasureFrequenc
250. g The buffer without the o modifier is guaranteed to be in the mode of the host processor LabWindows CVI will reverse the byte ordering of the buffer without the o modifier depending on which architecture the program is running For example if your GPIB instrument sends two byte binary data in Intel byte order your code should appear as follows LabWindows CVI Standard Libraries 2 44 National Instruments Corporation Chapter 2 Formatting and I O Library short int instr_buf 100 short int prog_buf 100 status ibrd ud instr_buf 200 Scan instr_buf 100d b2001 gt 100d prog_buf If instead your GPIB instrument sends two byte binary data in Motorola byte order the Scan function should appear as follows Scan instr_buf 100d b2010 gt 100d prog_buf In either case the o modifier is used only on the buffer containing the raw data from the instrument inst r_buf LabWindows CVI will ensure that the program buffer prog_buf is in the proper byte order for the host processor Note When using both the bn and on modifiers on an integer specifier the bn modifier must be first Scanning Floating Point Modifiers f bn in wn Specify Length The b floating point modifier specifies the length of the floating point argument or the length of an individual array element in bytes The default length is 8 B therefore double precision values do not need this modifier Single precision floating point
251. g fileSize Purpose Verifies if a file exists Returns an integer value of zero if no file is present and 1 if file is present fileSize is a long variable that contains the file size in bytes or zero if no file exists Parameters Input fileName string Pathname of the file to be checked Return Value Return Codes File exists File does not exist Maximum number of files already open Example Ls Check for presence of file A DATA TEST1 DAT Print its size if file exists or message stating file does not exist int n long size n GetFileInfo a data testl dat amp size if n 0 FmtOut File does not exist else FmtOut File size i b4 size National Instruments Corporation 2 17 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 GetFmtErrNdx int n GetFmtErrNdx void Purpose Returns the zero based index into the format string where an error occurred in the last formatting or scanning call Parameters None Return Value integer Position of error in format string Return Code Using This Function If the format string of the preceding call contains an error such as an invalid format or inappropriate modifier the return value indicates the position within the format string beginning with position zero where the error was found The function can report only one error per call even if several errors existed within
252. generates one analysis function call The names of the corresponding analysis function calls appear in bold italics to the right of the function panel names Table 3 1 The Analysis Library Function Tree Analysis Array Operations 1D Operations Clear Array Clear1D Set Array SetID Copy Array CopyID 1D Array Addition AddID 1D Array Subtraction SubID 1D Array Multiplication MullD 1D Array Division DivID 1D Absolute Value AbsID 1D Negative Value NegID continues O National Instruments Corporation 3 1 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Table 3 1 The Analysis Library Function Tree Continued 1D Linear Evaluation 1D Maximum amp Minimum 1D Array Subset 1D Sort Array 2D Operations 2D Array Addition 2D Array Subtraction 2D Array Multiplication 2D Array Division 2D Linear Evaluation 2D Maximum amp Minimum Complex Operations Complex Numbers Complex Addition Complex Subtraction Complex Multiplication Complex Division Complex Reciprocal Rectangular to Polar Polar to Rectangular 1D Complex Operations 1D Complex Addition 1D Complex Subtraction 1D Complex Multiplication 1D Complex Division 1D Complex Linear Evaluation 1D Rectangular to Polar 1D Polar to Rectangular Statistics Mean Standard Deviation Histogram Vector amp Matrix Algebra Dot Product Matrix Multiplication Matrix Inversion Transpose Determinant Array Utilities Clear Array Set Array Copy Array Get Error String
253. gered in a number of ways from client applications Whenever a client application attempts to connect to your server program or requests information from your program the callback function in your LabWindows CVI Standard Libraries 7 2 National Instruments Corporation Chapter 7 TCP Library program is invoked to process the request The parameter prototypes for the TCP callback functions in LabWindows CVI are defined below int CallbackFunction int handle int xType int errCode void callbackData where handle represents the conversation handle xType represents the transaction type see table below errCode for TCP_DISCONNECT is negative if the connection is being terminated due to an error callbackData is a user defined data value All of the TCP transaction types xType that can trigger a callback function are listed in Table 7 2 Table 7 2 TCP Transaction Types xType TCP_CONNECT Y N When a new client requests for connection TCP_DISCONNECT Y Y When conversation partner quits TCP_DATAREADY Y Y When conversation partner sends data Refer to the descriptions for RegisterTCPServer and Connect ToTCPServer for more information about the TCP callback function TCP Library Function Reference ClientTCPRead int status ClientTCPRead unsigned int conversationHandle void dataBuffer unsigned int dataSize unsigned int timeout Purpose Reads data from a TCP server application when it c
254. gramArray double axisArray int intervals Purpose Computes the histogram of the inputArray The histogram is obtained by counting the number of times that the elements in the input array fall in the ith interval Let Ax xTop xBase intervals _ Jl ifiAx lt x xBase lt i 1 Ax Ys 0 otherwise The ith element of the histogram is n 1 hist Y yai j 0 The values of the histogram axis are the mid point values of the intervals axis Ax Ax 2 xBase National Instruments Corporation 3 19 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Parameters inputArray double precision Input array array numberofElements integer Number of elements in Input Array base double precision Lower range top double precision Upper range intervals integer Number of intervals Output histogramArray integer array Histogram of input Array axisArray double precision Histogram axis array array Return Value status integer Refer to error codes in Table 3 2 InvMatrix int status InvMatrix void inputMatrix int matrixSize void outputMatrix Purpose Finds the inverse matrix of an input matrix The operation can be performed in place that is inputMatrix and outputMatrix can be the same matrices Parameters inputMatrix double precision 2D Input matrix matrixSize Dimension of matrix array Note The input matrix must be a matrixSize by matrixSize square mat
255. grated circuit that converts a digital number into a corresponding analog voltage or current 1 Collecting and measuring electrical signals from sensors transducers and test probes or fixtures and inputting them to a computer for processing 2 Collecting and measuring the same kinds of electrical signals with A D and or DIO boards plugged into a PC and possibly generating control signals with D A and or DIO boards in the same PC Direct current Device is used to refer to a DAQ device inside your computer or attached directly to your computer via a parallel port Plug in boards PCMCIA cards and devices such as the DAQPad 1200 which connects to your computer parallel port are all examples of DAQ devices SCXI modules are distinct from devices with the exception of the SCXI 1200 which is a hybrid An analog input consisting of two terminals both of which are isolated from computer ground whose difference is measured See port Digital I O A voltage pulse from an external source that triggers an event such as A D conversion A first in first out memory buffer the first data stored is the first data sent to the acceptor A mini program that instructs the formatting and scanning functions how to transform the input arguments to the output arguments For conciseness format strings are constructed using single character codes LabWindows CVI Standard Libraries Glossary G G gain gender gender changer GPIB
256. gument passed to the exit function LabWindows CVI Standard Libraries 1 8 National Instruments Corporation Chapter 1 ANSI C Library The UNIX version of LabWindows CVI works with all the signals supported by UNIX in addition to the ANSI C signals ANSI C Library Function Reference For ANSI C function descriptions consult a reference work such as C A Reference Manual which is listed in the Related Documentation section of About This Manual Alternatively you can use LabWindows CVI function panel help The following function description is provided because it is an extension of the ANSI C function set fdopen FILE fp fdopen int fileHandle char mode Note This function is available only in the Windows version of LabWindows CVI Purpose You can use this function to obtain a pointer to a buffered I O stream from a file handle returned by one of the following functions open low level I O sopen low level I O You can use the return value just as if you had obtained it from fopen Although this function is not in the ANSI standard it is included in this library because it returns a pointer to a buffered I O stream Parameters Input fileHandle integer File handle returned by open or sopen mode string Specifies the read write binary text and append modes Return Value FILE Pointer to a buffered I O file stream Return Codes NULL 0 Failure More specific information is in errno O
257. h CMPL set the callback is called immediately At the board level you can specify any of the status word bits that can be specified in the waitMask parameter to the ibwait function for a board other than ERR This includes SRQI END CMPL TIMO CIC and others At the device level you can specify any of the status word bits that can be specified in the waitMask parameter to the ibwait function for a device other than ERR This includes ROS END CMPL and TIMO LabWindows CVI Standard Libraries 4 18 O National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library SRQL RQS and Auto Serial Polling If you want to install a callback for the SROT board level event Auto Serial Polling must be disabled You can disable Auto Serial Polling with the following function call ibconfig boardIndex IbcAUTOPOLL 0 If you want to install a callback for the ROS device level event Auto Serial Polling must be enabled for the board You can enable Auto Serial Polling with the following function call ibconfig boardIndex IbcAUTOPOLL 1 CallbackFunction The callback function must have the following form void __stdcall CallbackFunctionName int boardOrDevice int sta int err long entl void callbackData The callbackData parameter is the same callbackData value passed to ibInstallCallback The sta err and cntl parameters contain the information that you normally obtain using the ibsta iberr a
258. h as copy dir and others you can call system with the command command com C DosCommand args where DosCommand is the shell command you would like executed Refer to your DOS documentation for further help with command com DOS executables exe com and bat files use the settings in _de fault pif in your Windows directory when they are running You can change their priority display options and more by editing default pif National Instruments Corporation 1 7 LabWindows CVI Standard Libraries ANSI C Library Chapter 1 or by creating another pif file Refer to your Microsoft Windows documentation for help on creating and editing pif files If the function is passed a null pointer LabWindows CVI returns a non zero value if a command processor is available Under UNIX if the argument is not a null pointer the program returns a zero Under Microsoft Windows if the argument is not a null pointer the program returns zero if the program was successfully started otherwise it returns one of the following error codes 1 System was out of memory executable file was corrupt or relocations were invalid 3 File was not found 4 Path was not found 6 Attempt was made to dynamically link to a task or there was a sharing or network protection error 7 Library required separate data segments for each task 9 There was insufficient memory to start the application 11 Windows version was incorrect 12 Executable
259. h count and terminationByte are disabled the function terminates on EOF or error Using This Function To guarantee that all bytes were removed from the output queue before closing the port call GetOutQLen to determine the number of bytes remaining in the output queue If you close the port before every byte has been sent you lose the bytes remaining in the queue The function returns a negative error code if the output queue remains full for the duration of the time out period the file handle is bad a read error occurs the port is not open or the COMPort is invalid LabWindows CVI Standard Libraries 5 10 National Instruments Corporation Chapter 5 RS 232 Library ComRd int nbytes ComRd int COMPort char buffer int count Purpose Reads count bytes from input queue of the specified port and stores them in buffer Returns either on time out or when count bytes have been read Returns an integer value indicating the number of bytes read from queue Parameters Input COMPort integer Range 1 through 16 count integer 0 value takes no bytes from queue data Return Value integer Number of bytes read from the input queue Using This Function This function times out 1f the input queue remains empty in the specified time out period This may occur when no data has been received within the time out period The function returns an error code if the port is not open or parameter values are invalid Example R
260. hapter 10 Easy I O for DAQ Library Parameters Input taskID unsigned long The reference number assigned to the counting integer operation by one of the counter configuration functions Output overflow short integer 1 counter rolled past terminal count 0 counter did not roll past terminal count count long integer The value of the counter at the time it is read Return Value Refer to error codes in Table 10 5 Parameter Discussion overflow indicates whether the counter rolled over past its terminal count If overflow is 1 the value of count is inaccurate CounterStart short error CounterStart unsigned long taskID Purpose Starts the counter identified by taskID Parameters Input taskID unsigned The reference number assigned to the counting long integer operation by one of the counter configuration functions Return Value short integer Refer to error codes in Table 10 5 O National Instruments Corporation 10 33 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 CounterStop short error CounterStop unsigned long taskID Purpose Stops a count operation immediately Parameters Input taskID unsigned The reference number assigned to the long integer counting operation by one of the counter configuration functions Return Value short integer Refer to error codes in Table 10 5 DelayedPulseGenConfig short error DelayedPulseGenConfig short dev
261. har fullPathName Purpose Gets the full pathname for the specified file if the file is in the currently loaded project Parameters Name of file in project fullPathName Full pathname of file Return value result Result of operation Return codes Success 0 1 File was not found in project Parameter Discussion fileName is the name of a file that is in the currently loaded project The name must be a simple file name and should not contain any directory paths For example file c is a simple file name whereas dir file c is not fullPathName must be at least MAX_PATHNAME_LEN bytes long National Instruments Corporation 8 29 LabWindows CVI Standard Libraries Utility Library Chapter 8 Using This Function This function is useful when your program needs to access a file in the project and you do not know what directory the file is in Example char fileName char fullPath MAX_PATHNAME LEN fileName myfile c if GetFullPathFromProject fileName fullPath lt 0 FmtOut File s is not in the project n fileName Note Runtime errors are not reported for this function GetInterruptState int interruptstate GetInterruptState void Note This function is available only on the Windows versions of LabWindows CVI Purpose This function returns the state of the interrupt bit of the 80x86 CPU status flag On Windows NT this function always returns 1 Interrupts are always
262. hat the integer is to be considered a non negative integer Discard Terminator The x integer causes the character that terminated the numeric data to be discarded In this way terminator characters can be skipped when reading lists of numeric input Thus 3i x reads three integer numbers disregarding the terminator character which appears after each one You can use this specifier to scan the string 3 7 32 Discard Data When applied to a target specifier the d integer modifier indicates that there is no target argument to correspond to the target specifier The data that otherwise is placed in the target argument is discarded instead The count returned by the Scan ScanFile ScanIn functions will include the target specifier even if the d modifier is used Specify Byte Ordering The o integer modifier is used to describe the byte ordering of raw data so that LabWindows CVI can map it to the byte order appropriate for the Intel PC or Motorola SPARCstation architecture The number of n s must be equal to the byte size of the integer argument as specified by the bn modifier which must precede the o modifier In the case of a four byte integer 00123 indicates that the bytes are in ascending order of precedence Intel style and 03210 indicates that the bytes are in descending order of precedence Motorola style In a Scan function the buffer containing the raw instrument data should have the o modifier describing the byte orderin
263. he input queue Parameter Discussion The function returns an error if the port is not open or if COMPort is invalid GetOutQLen int len GetOutQLen int COMPort Purpose Returns the number of characters in the output queue of the specified port Parameter Return Value integer Number of characters in the output queue Using This Function You can use this function to ensure the output queue has emptied before you close the port This function has no effect on the output queue The function returns an error if the port is not open or if COMPort is invalid National Instruments Corporation 5 21 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 GetRS232ErrorString char message GetRS232ErrorString int errorNum Purpose Converts the error number returned by an RS 232 Library function into a meaningful error message Parameters Input errorNum integer Error Code returned by RS 232 function Return Value InstallComCallback int status InstallComCallback int COMPort int eventMask int notifyCount int eventCharacter ComCallbackPtr callbackPtr void callbackData Note This function is available only in the Windows version of LabWindows CVI Purpose This function allows you to install a callback function for a particular COM port The callback function is called whenever any of the events specified in the eventMask parameter occur on the COM port and you allow the system to process
264. he OUT pin of counter 1 For a specified Counter Counter 1 and Counter 1 are defined as shown in Table 10 4 O National Instruments Corporation 10 29 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Table 10 4 Adjacent Counters Am9513 counter 1 counter counter 1 counter 1 2 3 4 5 6 7 8 9 q DAQ STC 1 0 This function is useful for relatively high frequency signals when many cycles of the signal occur during the timing period Use the PulseWidthOrPeriodMeasConfig function for relatively low frequency signals Keep in mind that period 1 frequency This function configures the specified counter and counter 1 optional as event counters to count rising edges of the signal on counters SOURCE pin The function also configures counter 1 to generate a minimum delayed pulse to gate the event counter starts the event counter and then the gate counter waits the expected gate period and then reads the gate counter until 1ts output state is low Next the function reads the event counter and computes the signal frequency number of events actual gate pulse width and stops the counters You can optionally gate or trigger the operation with a signal on counter 1 s GATE pin LabWindows CVI Standard Libraries 10 30 O National Instruments Corporation Chapter 10 Parameters device short integer counter string counterSize unsigned short integer gate WidthSampleTimeinSec double max
265. he first call to Scan treats the 1 byte integers as signed values from 128 to 127 The second call includes a u in the format string This causes Scan to treat the 1 byte integers as unsigned values from 0 to 255 String Containing Binary Integers to Integer Array char s 200 string containing 100 2 byte integers int ivals 100 100 2 byte integers Scan s 100i z gt 100i ivals Scan s 97i zi6 gt 97i ivals Remarks Sometimes data from a programmable instrument is read into a character buffer even though it contains binary data This example shows how to treat a character buffer as an integer array The format string in each Scan call specifies that the source s contains an array of 100 integers The z modifier is used to indicate that the source is actually a character buffer In some cases the integer data may not start at the beginning of the character buffer For instance the data in the buffer can begin with an ASCII header In the second call to Scan the i6 modifier is used to indicate that the first 6 bytes of s are to be ignored Note When the i modifier is used in conjunction with a character buffer the number following the i specifies the number of bytes within the buffer to ignore This is true even when the z modifier is also present On the other hand when the i modifier is used in conjunction with an array variable the number following the i indicates the number of array elements to igno
266. he same specifier in which case the string terminates when any of the terminators occur If no t modifier is present reading of the source string stops on an ASCII NUL When applied to a target string that is being filled from a source string the t modifier specifies that filling of the target is terminated on the first occurrence of the character n where n is the ASCII value of the character Thus s t59 causes reading of the source string to stop on an ASCII semicolon More than one t modifier can occur in the same specifier in which case filling of the target terminates when any of the terminators occur If no t modifier is present filling of the target stops on any whitespace character Terminate when Full This is similar to tn except that it specifies that there are no terminating characters When applied to a source string t specifies that reading of the source string terminates when all of the targets are full or when the number of bytes specified with the w modifier have been read When applied to a target string t specifies that filling of the target string terminates when the source is exhausted or when the number of bytes specified with the w modifier have been placed into the target Terminate on Number This is equivalent to repeating the t modifier with the ASCII values of the characters and O through 9 When applied to a source target it specifies that reading of the source string filling of the target string
267. he value of the thread specific ibent 1 variable for the current thread The global variables ibsta iberr ibcnt and ibcnt1 are maintained on a process specific rather than thread specific basis If you are calling GPIB functions in more than one thread the values in these global variables may not always be reliable Status variables analogous to ibsta iberr ibcnt and ibcnt1 are maintained for each thread This function returns the value of the thread specific ibcnt1 variable LabWindows CVI Standard Libraries 4 22 O National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library If you are not using multiple threads the value returned by this function is identical to the value of the ibcnt1 global variable Parameters none Return Value threadSpecificCount long The number of bytes actually transferred by the most integer recent GPIB read write or command operation for the current thread of execution If an error occurred loading the GPIB DLL this is the error code returned by the MS Windows LoadLibrary function See Also Threadlbsta Threadlberr ThreadIbcnt ThreadIberr int threadSpecificError ThreadIberr void Note This function is available only under Windows 95 and NT This function returns the value of the thread specific iberr variable for the current thread The global variables ibsta iberr ibcnt and ibcnt1 are maintained on a process specific rather than thread specific basis If you
268. hen applied to a source string the t string modifier specifies that the source string is terminated on the first occurrence of the character n where n is the ASCII value of the character Thus s t44 causes reading of the source string to stop on an ASCII comma Using s t44 and the source string Hello World as an example Hello is placed into the target More than one t modifier can occur in the same specifier in which case the string terminates when any of the terminators occur If no t modifier is present reading of the source string stops on an ASCII NUL This modifier has no effect when applied to the target specifier ES Terminate when Full This is similar to t n except that 1t specifies that there are no terminating characters Reading of the source string terminates when the target is full or when the number of bytes specified with the w modifier have been read t Terminate on Number This is equivalent to repeating the t modifier with the ASCII values of the characters and O through 9 It specifies that reading of the source string be terminated upon occurrence of a numeric expression Using s t with the source string ab567 ab is placed in the target Fmt FmtFile FmtOut Asterisks Instead of Constants in Format Specifiers Often one or more integer values are required in a format specifier The format specifier for an integer array for example requires the number of elements rep You can use constants f
269. hin the valid range LabWindows CVI Standard Libraries 8 74 National Instruments Corporation Chapter 8 Utility Library Parameter Discussion To vertically center the Standard Input Output window client area within the area of the screen pass VAL_AUTO_CENTER as the top parameter To horizontally center the Standard Input Output window client area within the area of the screen pass VAL_AUTO_CENTER as the left parameter SetStdioWindowSize int status SetStdioWindowSize int height int width Purpose Sets the height and width in pixels of the client area of the Standard Input Output window The client area excludes the frame and the title bar Parameters Input height integer The height in pixels of the client area of the Standard Input Output window Valid Range 0 to 16000 integer The width in pixels of the client area of the Standard Input Output window Valid Range 0 to 16000 Return Value Indicates whether the function succeeded Return Codes Success height is not within the valid range width is not within the valid range National Instruments Corporation 8 75 LabWindows CVI Standard Libraries Utility Library Chapter 8 SetStdio Window Visibility void SetStdioWindowVisibility int visible Purpose Either brings to the front or hides the Standard Input Output window Parameters Input visible integer 1 Standard I O window is visible 0 Standard I O window is h
270. his shorter timeout period takes effect whenever a serial poll is conducted Because devices normally respond quickly to polls there is no need to wait the relatively lengthy TO timeout period for a nonresponsive device National Instruments Corporation 4 9 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 Global Variables for the GPIB Library The following global variables are used by the GPIB Library and the GPIB 488 2 Library e Status Word ibsta e Error ibent ibcnt1 These variables are updated after each NI 488 or NI 488 2 routine to reflect the status of the device or board just accessed Refer to your NI 488 2 user manual for detailed information on the GPIB global variables Different Levels of Functionality Depending on Platform and GPIB Board In general the GPIB library is same for all platforms and GPIB boards There are however some exceptions most notably relating to SRQ notification support for multithreading and limitations on transfer size These particular issues are discussed later in this chapter This section explains the various categories of GPIB support Windows 95 There are two kinds of GPIB support for Windows 95 The native 32 bit driver and the compatibility driver You can see which one you have installed on your system by running the GPIB Information program in your GPIB Software group and noting the name of the driver NI 488 2M Native 32 bit driver NI 488
271. ice char counter double pulseDelay double pulseWidth unsigned short timebaseSource unsigned short gateMode unsigned short pulsePolarity double actualDelay double actualPulseWidth unsigned long taskID Purpose Configures a counter to generate a delayed TTL pulse or triggered pulse train on its OUT pin The signal is created by decrementing the counter twice first for the delay to the pulse phase 1 then for the pulse itself phase 2 The function selects the highest resolution timebase to achieve the desired characteristics You can also call the CounterStart function to gate or trigger the operation with a signal on the counter s GATE pin LabWindows CVI Standard Libraries 10 34 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Parameters device short integer Assigned by configuration utility counter string The counter to be used for the counting operation pulseDelay double The desired duration of the delay phase 1 before the pulse pulseWidth double The desired duration of the pulse phase 2 after the delay timebaseSource unsigned short The signal that causes the counter to count integer gateMode unsigned short Specifies how the signal on the counter s integer GATE pin is used pulsePolarity unsigned short The polarity of phase 2 of each cycle integer actualDelay double The achieved delay based on the resolution and range of your hardware actualPulse
272. ices without specific device names thereby preventing device name conflicts They also help the LabWindows CVI interactive program ensure that devices are closed when no longer needed Device and Board Functions Device functions are high level functions that execute command sequences to handle bus management operations required by activities such as reading from and writing to devices or polling them for status Device functions access a specific device and take care of the addressing and bus management protocol for that device Because they execute automatically you do not need to know any GPIB protocol or bus management details A descriptor of the accessed device is one of the arguments of the function In contrast board functions are low level functions that perform rudimentary GPIB operations They are necessary because high level functions may not always meet the requirements of applications In such cases low level functions offer the flexibility to meet your application needs Board functions access the GPIB interface board directly and require you to do the addressing and bus management protocol for the bus A descriptor of the accessed board is one of the arguments of the function Automatic Serial Polling Automatic Serial Polling relieves you of the burden of sorting out occurrences of SRQ and status bytes of a device you can enable To enable Automatic Serial Polling or Autopolling use the configuration utility IBCONF
273. idden SetSystemDate int status SetSystemDate int month int day int year Note This function is only available on the Windows version of LabWindows CVI Under Windows NT you must have system administrator status to use this function Purpose Sets the system date Parameters integer Month 1 12 integer Day of month 1 31 integer Year Under Windows 3 1 the year is limited to the values 1980 2099 Return Value status Success or failure Return Codes 0 Success 1 Failure reported by operating system probably due to invalid parameter LabWindows CVI Standard Libraries 8 76 O National Instruments Corporation Chapter 8 Utility Library SetSystemTime int status SetSystemTime int hours int minutes int seconds Note This function is only available on the Windows version of LabWindows CVI Under Windows NT you must have system administrator status to use this function Purpose Sets the system time Parameters Hours 0 23 Minutes 0 59 Seconds 058 Odd values are rounded down Return Value status integer Success or failure Return Codes Success Failure reported by operating system probably due to an invalid parameter SplitPath void SplitPath char pathName char driveName char directoryName char fileName Purpose Splits a path name into the drive name the directory name and the file name O National Instruments Corporation 8 77
274. ied by the w modifier is too small Long Integer to String char buf 20 long a a 123456 Fmt buf s lt i b4 a a 123456 Fmt buf s lt x b4 a a 123456 Fmt buf s lt o b4 a a l Fmt buf Ss lt i b4 a a l Fmt buf s lt i b4u a a 123456 Fmt buf s lt i b4w8 a a 123456 Fmt buf s lt i b4w8p0 a a 123456 Fmt buf s lt i b4w4 a Remarks result result result result resul resul resul resul 123456 1e240 361100 wig t 4294967295 te 123456 t 00123456 ES MASE The results shown are the contents of buf after each call to Fmt The last call demonstrates what occurs when the width specified by the w modifier is too small Real to String in Floating Point Notation char buf 30 double x x 12 3456789 Fmt buf s lt f x x 12 3456789 Fmt buf Ss lt f p2 x x 12 3456789 Fmt buf Ss lt f p10 x x 12 345 Fmt buf s lt f x x 12 345 National Instruments Corporation result result result result 2 51 12 345679 AS on Sty 12 3456789000 12 345 xs LabWindows CVI Standard Libraries Formatting and I O Library Remarks Fmt buf Ss lt S f p0 x x 12 345 Fm
275. ier that describes the nature of the source parameter and target_specs_and_literals is a sequence of format specifiers and literal characters that indicate how to divide and reformat the source argument into the desired target Examples of format strings for the scanning functions are 3 gt i Ss gt 20f wl0x The character gt is a visual reminder of the direction of the data transformation and also separates the single source format specifier from the possibly multiple target format specifiers and literals The source format specifier can be omitted in which case a Ss string format is assumed If the source format specifier is omitted the gt character can be omitted also or retained for clarity Notice that the source format specifier is located to the left of the gt symbol just as the source parameter is located to the left of the format string Likewise the target format specifiers are located to the right of the gt symbol just as the target parameters are located to the right of the format string Format specifiers describe the inputs and outputs of data transformations Each format specifier is of the following form rep formatcode modifiers The character introduces all format specifiers rep indicates how many times the format repeats with respect to the arguments format code is a code character which indicates the nature of the data items being formatted modifiers is an optional bracket enclosed seq
276. ies RS 232 Library Chapter 5 Parameter Discussion This function times out if the output queue has not been updated in the specified time out period This can occur if the output queue is full and no further data can be sent because XON XOFF is enabled and the device has sent an XOFF character without sending the follow on XON character It can also occur if Hardware Handshaking is enabled and the Clear To Send CTS line is not asserted Bytes are sent from the output queue to the serial device under interrupt control without program intervention If you close the port before all bytes have been sent you lose the bytes remaining in the queue To guarantee that all bytes have been removed from the output queue before closing the port call GetOutQLen GetOutQLen returns the number of bytes remaining in the output queue The function returns an error if the port is not open or parameter values are invalid FlushInQ int status FlushInQ int COMPort Purpose Removes all characters from the input queue of the specified port Parameter Return Value status integer Refer to Error Codes in Table 5 6 Using This Function You can use this function to flush a flawed transmission in preparation for re transmission It alleviates the need to read bytes into a buffer to empty the queue If the queue is already empty this function does nothing The function returns a negative error code if the port is not open or if COMPort is inva
277. ify an object to which the data refers For example in Excel the item name specifies a cell The dataFmt is one of the Windows defined data types for example CF_TEXT The dataSize specifies the number of bytes in the data pointed to by dataPtr Note The dataSize value is the value LabWindows CVI receives from Microsoft Windows This value can be larger than the actual number of bytes written by the client DDE_REQUEST Received when the client is requesting that data be sent to it via DDE The itemName can specify an object to which the data refers For example in Excel the item name specifies a cell The dataFmt is one of the Windows defined data types for example CF_TEXT DDE_ADVISELOOP Received when the client is requesting a hot or warm link advisory loop on a specific item When a hot or warm link is in effect the server is supposed to notify the client whenever the specified item changes value The server notifies the client of the change in value by calling the function AdviseDDEDat aReady or BroadcastDDEDataReady The itemName and dataFmt parameters contain significant values The itemName can specify an object to which the data item refers For example in Excel the item name specifies a cell The dataF mt is one of the Windows defined data types for example CF_TEXT DDE_ADVISESTOP Received when the client is requesting the termination of an advisory loop The itemName
278. ig PPollUnconfig EnableRemote EnableLocal SetRWLS SendLLO ResetSys SendlFC TestSys FinsLstn PassControl SendCmds SendSetup SendDataBytes ReceiveSetup RevRespMsg The Open Close function panels open and close GPIB boards and devices The Configuration function panels alter configuration parameters that were set during installation of the GPIB handler or during the execution of previous program statements The I O function panels read and write data over the GPIB These functions can be used at either the board or the device level The Device Control function panels provide high level commonly used GPIB services for instrument control applications LabWindows CVI Standard Libraries National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library e The Bus Control function panels provide low level control of the GPIB bus e The Board Control function panels provide low level control of the GPIB board These functions are normally used when the GPIB board is not controller in charge e The Callbacks function panels install callback functions that are invoked when certain GPIB events occur The functions in this class are available only under Windows Under UNIX you can use the ibsgn1 function e The Thread Specific Status function panels return the value of the thread specific GPIB status variables for the current thread The functions in this class are needed only for multithreaded applications and are avai
279. ignal that causes the counter to count This parameter accepts the following attributes e USE_INTERNAL_TIMEBASE An internal timebase is selected based on the pulse delay and width in units of seconds e USE_COUNTER_SOURCE The signal on the counter s SOURCE pin is used and the units of pulse delay and width are cycles of that signal gateMode specifies how the signal on the counter s GATE pin is used This parameter accepts the following attributes e UNGATED_SOFTWARE_START ignore the gate signal and start when CounterStart is called e COUNT_WHILE_GATE_HIGH count while the gate signal is TTL high after CounterStart is called e COUNT_WHILE_GATE_LOW count while the gate signal is TTL low after CounterStart is called e START_COUNTING_ON_RISING_EDGE start counting on the rising edge of the TTL gate signal after CounterStart is called e START_COUNTING_ON_FALLING_EDGE start counting on the falling edge of the TTL gate signal after CounterStart is called e RESTART_ON_EACH_RISING_EDGE restart counting on each rising edge of the TTL gate signal after CounterStart is called e RESTART_ON_EACH_FALLING_EDGE restart counting on each falling edge of the TTL gate signal after CounterStart is called pulsePolarity is the polarity of phase 2 of each cycle This parameter accepts the
280. ile handle with a positive integer value ScanFile reads the ASCII representation of two integer values from the file If ScanFile succeeds it returns 2 indicating that two target specifiers were satisfied ASCII File with Comma Separated Numbers to Real Array with Number of Elements at Beginning of File double values 1000 int file handle count file handle OpenFile FILE DAT 1 2 1 ScanFile file handle s gt i count if count gt 1000 FmtOut Count too large n exit 1 ScanFile file handle s gt f x count values CloseFile file handle Remarks The first ScanFile call reads the number of elements into the integer variable count If the value in count exceeds the number of elements in the real array values an error is reported Otherwise the second ScanF ile call matches count to the asterisk in the format string It LabWindows CVI Standard Libraries 2 68 National Instruments Corporation Chapter 2 Formatting and I O Library then reads the correct number of elements into values The x modifier causes the comma separators to be discarded Binary File to Integer Array Assuming a Fixed Number of Elements int readings 100 int file_handle nbytes file handle OpenFile FILE DAT 1 2 0 ScanFile file_handle 1001 gt 100i readings nbytes NumFmtdBytes CloseFile file_handle Remarks The ScanFile call reads 100 integers from a binar
281. ilure status of the function call A negative value indicates an error The following table shows status values NoXErr O The function was successful InvalidCallbackXErr The function specified is not installed as a callback O National Instruments Corporation 9 33 LabWindows CVI Standard Libraries Chapter 10 Easy I O for DAQ Library This chapter describes the functions in the Easy I O for DAQ Library The Easy I O for DAQ Library Function Overview section contains general information about the functions and guidelines and restrictions you should know when using the Easy I O for DAQ Library The Easy I O for DAQ Library Function Reference section contains an alphabetical list of function descriptions Easy I O for DAQ Library Function Overview The functions in the Easy I O for DAQ Library make it easier to write simple DAQ programs than if you use the Data Acquisition Library This library implements a subset of the functionality of the Data Acquisition Library but it does not use the same functions as the Data Acquisition Library Read the advantages and limitations listed here to see if the Easy I O for DAQ Library is appropriate for your application You must have NI DAQ for PC Compatibles installed to use the Easy I O for DAQ library The Easy I O for DAQ library has been tested using version 4 6 1 and later of NI DAQ It has not been tested using previous versions of NI DAQ The sample programs for the Easy I O for
282. ilure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to the unit parameter InvalidPropTypeXErr The propertyType argument is not a valid property type This value must either be one of the predefined property types or be a value returned by CreateXPropType See Also CreateXPropType O National Instruments Corporation 9 19 LabWindows CVI Standard Libraries X Property Library Chapter 9 GetX WindowPropertyItem PropLibXErrType status GetXWindowPropertyItem DisplayPtrxX display WindowX window PropertyHandleX property void propertyItem Purpose Get a single property item from a window This function obtains the value of the specified property on the window and copies a single item into the supplied buffer When there are more than one item in the property value this function obtains only the first one This function does not change the property value If the property does not exist on the window this function reports the MissingPropertyXErr error Use the function Get XWindowPropertyValue to get multiple property items Parameters display DisplayPtrX A pointer to the display of the X server to which the window belongs window WindowX The window from which the property item is to be obtained property PropertyHandleX Handle of the property to be obtained This
283. in your NI 488 2 function reference manual The GPIB Function Reference section contains an alphabetical list of descriptions for the Device Manager functions the callback installation functions and the functions for returning the thread specific status variables National Instruments Corporation xvii LabWindows CVI Standard Libraries About This Manual e Chapter 5 RS 232 Library describes the functions in the LabWindows CVI RS 232 Library The RS 232 Library Function Overview section contains general information about the RS 232 Library functions and panels The RS 232 Library Function Reference section contains an alphabetical list of function descriptions e Chapter 6 DDE Library describes the functions in the LabWindows CVI DDE Dynamic Data Exchange Library The DDE Library Function Overview section contains general information about the DDE Library functions and panels The DDE Library Function Reference section contains an alphabetical list of function descriptions This library is available for LabWindows CVI for Microsoft Windows only e Chapter 7 TCP Library describes the functions in the LabWindows CVI TCP Transmission Control Protocol Library The TCP Library Function Overview section contains general information about the TCP Library functions and panels The TCP Library Function Reference section contains an alphabetical list of function descriptions e Chapter 8 Utility Library describes the functions in the LabWind
284. indicates that the corresponding parameter is an integer or if rep is present an integer array As a source specifier in conversions to string formats the integer is converted into digits of the specified radix default is decimal As a target specifier in conversions from string format bytes of the source parameter are consumed as long as they match the pattern of integer ASCII numbers in the appropriate radix or until the end of the string is encountered The scanned characters are converted to integer values and placed into the corresponding target parameter which is an integer or integer array passed by reference If the format is repeated the operation is repeated the appropriate number of times with successive elements of the integer array parameter The pattern for integer ASCII numbers depends on the radix of the number and consists of an optional sign or followed by a series of one or more digits in the appropriate radix The decimal digits are 01234 56789 The octal digits are 01234567 The hexadecimal digits are 012345678 9ABCDEFabcdef integer hexadecimal This specifier indicates a i format with hexadecimal radix integer octal This specifier indicates a Si format with octal radix integer decimal This specifier indicates a Si format with decimal radix Since decimal is the default radix for integers d is equivalent to 1 and is included for compatibility with the C scanf family of functions LabWindows
285. ing changes to the registry entry for the key name KEY_LOCAL_MACHINE Software Microsoft CurrentVersion Winlogon e Change the value for SHELL to the pathname of your application executable e Add a value with the name TASKMAN Set the data to an empty string Preventing Interference With Real Time Processing Under Windows many user actions can interfere with real time processing The actions in the following list suspend the processing of events e Moving and sizing top level windows e Bringing down the System menu e Pressing the lt Alt Tab gt key combination You can prevent these user actions from interfering with event processing by doing all of the following e Call DisableTaskSwitching or use the alternative for Windows NT mentioned in this section e Make all of your top level panels non movable and non sizable LabWindows CVI Standard Libraries 8 14 National Instruments Corporation Chapter 8 Utility Library e Do not use the Standard I O Window in your final application e If you use any of the built in pop ups in the User Interface Library make the following calls SetSystemPopupsAttribute ATTR_MOVABLE 0 SetSystemPopupsAttribute ATTR_SYSTEM_MENU_VISIBLE 0 An alternative approach is available on Windows 95 and NT You can enable timer control callbacks while lt Alt Tab gt is pressed while the system menu is pulled down or in some cases while a window is bei
286. ing file pointer CloseFile handle StringLength int n StringLength char string Purpose Returns the number of bytes in the string before the first ASCII NUL Parameter Return Value integer Number of bytes in string before ASCII NUL Example char s 100 int nbytes nbytes StringLength s StringLowerCase void StringLowerCase char string Purpose Converts all uppercase alphabetic characters in the NUL terminated string to lowercase Parameter LabWindows CVI Standard Libraries 2 28 National Instruments Corporation Chapter 2 Formatting and I O Library Return Value None StringUpperCase void StringUpperCase char string Purpose Converts all lowercase alphabetic characters in the NUL terminated string to uppercase Parameter Return Value None WriteFile int n WriteFile int fileHandle char buffer unsigned int count Purpose Writes up to count bytes of data from buffer to a file or to STDOUT Writing starts at the current position of the file pointer and when the function completes the file pointer is incremented by the number of bytes written Parameters fileHandle File handle buffer Data buffer count Number of bytes to write Return Value file National Instruments Corporation 2 29 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Return Code Parameter Discussion file Handle is the file hand
287. ing system is unable to determine the module directory moduleHandle is probably invalid LabWindows CVI Standard Libraries 8 32 National Instruments Corporation Chapter 8 Utility Library GetNextFile int result GetNextFile char fileName Purpose Gets the next file found in the search starting with Get FirstFile Parameters Return Value Return Codes Success No more files found matching criteria GetFirstFile must initiate search Parameter Discussion fileName will contain the basename and extension of the next matching file and must be at least MAX_FILENAME_LEN characters in length GetPersistentV ariable void GetPersistentVariable int value Purpose Returns the value set by Set PersistentVariable However if you unloaded the project since you last called SetPersistentVariable zero is returned In a standalone executable zero is returned if you have not called SetPersistentVariable since the start of execution Parameters Output The current value of the persistent variable National Instruments Corporation 8 33 LabWindows CVI Standard Libraries Utility Library Chapter 8 GetProjectDir int result GetProjectDir char directoryName Purpose Gets the name of the directory containing the currently loaded project file Parameters directoryName Directory of project Return value Return codes Success Current project has no pathname it is untitled
288. int Modifiers Pf 2 37 Formatting String Modifiers 8 coocooccnnonnnocononccnnnnnnanonnncnnno 2 38 Fmt FmtFile FmtOut Asterisks Instead of Constants did Format Specifier Seien coy ete ts ue dead reas is ocsnassvgacete comes S ence 2 39 Fmt FmtFile FmtOut Literals in the Format String eee 2 40 cantina FUNCHUONS cess rorot ies 2 40 Scanning Functions Format StriNB cooccnnocononnnonnnonanononcnonenannnnnnncnnncnns 2 41 Scans Modifiers saeia lad a ere A ia 2 43 Scanning Integer Modifiers 1 d Vx 0 7cC 2 43 Scanning Floating Point Modifiers Jf 2 45 Scanning String Modifiers S oooooooccccooccconacnnonancnonnnnnnnnnnonns 2 46 Scan ScanFile ScanIn Asterisks Instead of Constants Tid Format Ss peo as 2 48 Scan ScanFile ScanIn Literals in the Format String ee 2 48 Formatting and I O Library Programming Examples oooococnnocccnnccccnoncnononcconnncnonananinns 2 49 Fmt FmtFile FmtOut Examples in Eat coors 2 50 Integer to Sting n oe seg acre aa S Ra E E R ESE 2 50 Long Integer to String 5 cscsssscccieisdedaeteasaccovasdevecsaavecaceudnecaedateecadaasdunecee s 2 51 Real to String in Floating Point Notation ooooocococcconcnnocnconncconocannnonnnon 2 51 Real to String in Scientific Notation oooconnncnnonononcnonnnonancnoncnonccnnncnnncno 2 52 Integer and Real to String with Literals oononnonnnnnnnccnnncnnoccnonnnannnnnnno 2 53 Two Integers to ASCII File wi
289. integers so the s modifier is never explicitly required Specify as Unsigned The u integer modifier indicates that the integer is considered an unsigned integer Specify Byte Ordering The o integer modifier is used to describe the byte ordering of raw data so that LabWindows CVI can map it to the byte order appropriate for the Intel PC or Motorola SPARCstation architecture The number of n s must be equal to the byte size of the integer argument as specified by the bn modifier which must precede the o modifier In the case of a four byte integer 00123 indicates that the bytes are in ascending order of precedence Intel style and 03210 indicates that the bytes are in descending order of precedence Motorola style In a Fmt function the buffer containing the raw instrument data should have the o modifier describing the byte ordering The buffer without the o modifier is guaranteed to be in the mode of the host processor In other words LabWindows CVI will reverse the byte ordering of the buffer without the o modifier depending on which architecture the program is running on For example if your GPIB instrument sends two byte binary data in Intel byte order your code should appear as follows short int instr_buf 100 short int prog_buf 100 status ibrd ud instr_buf 200 Fmt prog_buf 100d lt 100d b2001 instr_buf If instead your GPIB instrument sends two byte binary data in Motorola byte order the Fmt func
290. into which you read data You must allocate space for this buffer before you call this function count specifies the number of bytes to read count must not be greater than buffer size LabWindows CVI Standard Libraries 2 22 National Instruments Corporation Chapter 2 Formatting and I O Library Using This Function The return value can be less than number of bytes requested if end of file was reached before byte count was satisfied Notice that if you open the file in ASCII mode each CR LF combination read is counted as 1 character because the pair is translated into LF when stored in the buffer Note This function does not terminate the buffer with an ASCII NUL ReadLine int n ReadLine int fileHandle char lineBuffer int maximum Bytes Purpose Reads bytes from a file until a linefeed is encountered Parameters fileHandle File handle maximum Bytes Maximum number of bytes to read into line excluding the ASCII NUL Return Value integer Number of bytes read excluding linefeed Return Codes Parameter Discussion This function places up to maximum Bytes bytes excluding the linefeed into lineBuffer Appends an ASCII NUL to lineBuffer If there are more than maximum Bytes bytes before the linefeed the extra bytes are discarded fileHandle is the file handle that was returned from the OpenFile function and specifies the file from which to read the line The file should be opened in ASCII mode so
291. inuous buffer filled with data so that when the trigger conditions are met the sample includes the data leading up to the trigger condition Points The smallest signal increment that can be detected by a measurement system Resolution can be expressed in bits in proportions or in percent of full scale For example a system has 12 bit resolution one part in 4 096 resolution and 0 0244 percent of full scale Resistance temperature detector A metallic probe that measures temperature based upon its coefficient of resistivity Seconds Samples per second used to express the rate at which a DAQ board samples an analog signal A circuit that acquires and stores an analog voltage on a capacitor for a short period of time Signal Conditioning eXtensions for Instrumentation the National Instruments product line for conditioning low level signals within an external chassis near sensors so only high level signals are sent to DAQ boards in the noisy PC environment A property of a DAQ board that has an extremely stable onboard reference and calibrates its own A D and D A circuits without manual adjustments by the user An analog input that is measured with respect to a common ground A programmed event that triggers an event such as data acquisition The LabWindows CVI Analysis ANSI C DDE Formatting and I O GPIB and GPIB 488 2 RS 232 TCP and Utility libraries Timing Controller 1 Hardware Property of an event tha
292. ion Control Protocol Library functions See TCP Library functions Transpose function 3 36 trigger functions GPIB 488 2 Library 4 3 troubleshooting RS 232 Library functions 5 3 to 5 4 TruncateRealNumber function 8 84 two dimensional array operation functions Add2D 3 5 to 3 6 Div2D 3 17 to 3 18 LinEv2D 3 22 MaxMin2D 3 24 to 3 25 Mul2D 3 27 Sub2D 3 31 U UninstallXPropertyCallback function 9 4 9 33 UnloadExternalModule function 8 84 to 8 85 UnregisterDDEServer function 6 23 UnregisterTCPServer function 7 11 to 7 12 Utility Library functions function panels classes and subclasses 8 4 to 8 5 function tree table 8 1 to 8 4 function reference Beep 8 5 Breakpoint 8 6 CloseCVIRTE 8 6 Cls 8 7 CopyFile 8 7 to 8 8 CVILowLevelSupportDriverLoaded 8 8 to 8 9 DateStr 8 9 Delay 8 9 to 8 10 O National Instruments Corporation DeleteDir 8 10 DeleteFile 8 10 to 8 11 DisableBreakOnLibraryErrors 8 11 to 8 12 DisableInterrupts 8 12 DisableTaskSwitching 8 12 to 8 15 EnableBreakOnLibraryErrors 8 15 EnableInterrupts 8 15 to 8 16 EnableTaskSwitching 8 16 ExecutableHasTerminated 8 16 to 8 17 GetBreakOnLibraryErrors 8 17 GetBreakOnProtectionErrors 8 18 GetCurrentPlatform 8 19 GetCVIVersion 8 18 to 8 19 GetDir 8 20 GetDrive 8 20 to 8 21 GetExternalModuleAddr 8 21 to 8 22 GetFileAttrs 8 23 to 8 24 GetFileDate 8 24 to 8 25 GetFileSize 8 25 to 8 26 GetFileTime 8 26 to 8 27 GetFirstFile 8 27 t
293. ion class contains all of the functions that perform D A conversions e The Digital Input Output function class contains all of the functions that perform digital input and output operations e The Counter Timer function class contains all of the functions that perform counting and timing operations e The Miscellaneous function class contains functions that do not fit into the other categories but are useful when writing programs using the Easy I O for DAQ Library National Instruments Corporation LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Device Numbers The first parameter to most of the Easy I O for DAQ functions is the device number of the DAQ device you want to use for the given operation After you have followed the installation and configuration instructions in Chapter 1 Introduction to NI DAQ of the NI DAQ User Manual for PC Compatibles the configuration utility displays the device number for each device you have installed in the system You can use the configuration utility to verify your device numbers You can use multiple DAQ devices in one application to do so simply pass the appropriate device number to each function Channel String for Analog Input Functions The second parameter to most of the analog input functions is the channel string containing the analog input channels that are to be sampled Refer to Chapter 2 Hardware Overview in your NI DAO User Manual for PC Compati
294. irectory path fileName string Base file name and extension Return Value None Parameter Discussion pathName must be at least MAX_PATHNAME_LEN bytes long If the pathName constructed from directoryName and fileName exceeds that size an empty string is returned in pathName Example char dirname MAX_PATHNAME LEN char pathname MAX_PATHNAME LEN GetProjectDir dirname MakePathname dirname FILE DAT pathname National Instruments Corporation 8 55 LabWindows CVI Standard Libraries Utility Library Chapter 8 outp char byte Written outp int portNumber char byteToWrite Note This function is available only on the Windows versions of LabWindows C VI Purpose Writes a byte to a port Note For you to be able to use this function under Windows NT the LabWindows CVI low level support driver must be loaded Parameters portNumber integer The port byteToWrite char The byte to be written Return Value byteWritten char The byte that was written outpw short wordWritten outpw short portNumber int wordToWrite Note This function is available only on the Windows versions of LabWindows CVI Purpose Writes a word to a port Note For you to be able to use this function under Windows NT the LabWindows CVI low level support driver must be loaded Parameters portNumber integer The port wordToWrite short The word to be written Return Value
295. is invalid 100 07 badChanErr A channel is out of range for the device type or input configuration the combination of channels is invalid or you must reverse the scan order so that channel 0 is last 10008 badGroupErr The group parameter is invalid 10009 badCounterErr The counter parameter is invalid badCountErr The count parameter is too small or too large for the specified counter O badIntervalErr The interval parameter 1s too small or too large for the associated 01 0 counter or I O channel 0 7 2 badRangeErr The analog input or analog output voltage range is invalid for the specified channel badErrorCodeErr The driver returned an unrecognized or unlisted error code groupTooLargeErr The group size is too large for the device 0 continues O National Instruments Corporation 10 57 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Table 10 5 Easy I O for DAQ Error Codes Continued badClkFrequencyErr The frequency parameter is invalid badTimebaseErr The timebase parameter is invalid badLimitsErr The limits are beyond the range of the device L0022 badWriteCountErr Your data array contains an incomplete update or you are trying to write past the end of the internal buffer or your output operation is continuous and the length of your array is not a multiple of one half of the internal buffer size badWriteModeErr The write mode
296. is out of range or is invalid 10 10024 badWriteOffsetErr The write offset plus the write mark is greater than the internal buffer size or it must be set to 0 10 10 025 limitsOutOfRangeErr The voltage limits are out of range for this device in the current configuration Alternate limits were selected 026 badInputBufferSpecification The input buffer specification is invalid This error results 1f for example you try to configure a multiple buffer acquisition for a device that cannot perform multiple buffer acquisition 10027 badDAQEventErr For DAQEvents 0 and 1 general value A must be greater than 0 and less than the internal buffer size If DMA is used for DAQEvent 1 general value A must divide the internal buffer size evenly with no remainder If the TIO 10 is used for DAQEvent 4 general value A must be 1 or 2 badFilterCutoffErr The cutoff frequency is not valid for this device 10080 badGainErr The gain parameter is invalid 10081 badPretrigCountErr The pretrigger sample count is invalid 10084 badTrigCountErr The trigger count is invalid badTrigRangeErr The trigger range or trigger hysteresis window is invalid 10086 badExtRefErr The external reference value is invalid 1 0 10083 badTrigModeErr The trigger mode is invalid badTrigTypeErr The trigger type parameter is invalid badTrigLevelErr The trigger level parameter is invalid 10082 badPosttrigCountErr The pos
297. ity Library Refer to your DOS documentation for further help with command com DOS executables exe com and bat files use the settings in _default pif in your Windows directory when they are running You can change their priority display options and more by editing default pif or by creating another pif file Refer to your Microsoft Windows documentation for help on creating and editing pif files Parameter Input fileName string Pathname of executable file and arguments Return Value Return Codes Under UNIX Command was successfully started The system imposed limit on the total number of processes under execution or the total number of processes per user would be exceeded This limit is determined when the system is generated There is insufficient swap space for the new process vfork failed for unknown reason Search permission is denied for a directory listed in the path prefix of the new process image file or the new process image file denies execution permission or the new process image file is not a regular file The length of the path or file or an element of the environment variable PATH prefixed to a file exceeds PATH_MAX or a pathname component is longer than NAME_MAX while _POSIX_NO_TRUNC is in effect for that file see man page for pathconf 2V One or more components of the pathname of the new process image file do not exist A component of the path prefix of the new process imag
298. k list by disabling the Task Manager Change a line in your system ini boot section from taskman exe taskman exe to taskman exe Forcing your window to cover the entire screen or disabling the Task Manager does not prevent the user from task switching using the lt Alt Tab gt and lt Alt Esc gt key combinations You must also call DisableTaskSwitching to disable the lt Alt Tab gt and lt Alt Esc gt key combinations As an alternative to calling DisableTaskSwitching you can arrange for O National Instruments Corporation 8 13 LabWindows CVI Standard Libraries Utility Library Chapter 8 your standalone application to be brought up in place of the Program Manager when Windows boots You can do this by changing the following line in your system ini boot section shell progman exe to shell lt full path of your executable gt Alternatives in Windows 95 Under Windows 95 you can arrange for your standalone application to appear in place of the desktop when Windows boots You can do this by changing the following line in your system ini boot section shell Explorer exe to shell lt full path of your executable gt Alternatives in Windows NT Under Windows NT you can achieve the same results as DisableTaskSwitching by arranging for your LabWindows CVI application to be brought up in place of the Program Manager and by disabling the Task Manager You can do this by making follow
299. l currency symbol for the current locale Decimal point character for monetary values Monetary digit group separator character or characters Monetary digit groupings Sign character or characters for non negative monetary quantities Sign character or characters for negative monetary quantities Digits appear to the right of the decimal point for international monetary formats Digits appear to the right of the decimal point for other than international monetary formats lifcurrency_symbol precedes non negative monetary values 0 if it follows lifcurrency_symbol is separated from non negative monetary values by a space else 0 Like p_cs_precedes for negative values Like p_sep_by_space for negative values The positioning of positive_sign fora non negative monetary quantity then its currency_symbol The positioning of negative_sign fora negative monetary quantity then its currency_symbol LabWindows CVI Standard Libraries ANSI C Library Chapter 1 Under Windows LabWindows CVI implements the default locale by using the appropriate items from the Int 1 section of the WIN INI file and appropriate Microsoft Windows functions Anything not mentioned here has the same behavior under the default locale as specified in the C locale For the LC_NUMERIC locale e decimal_point maps to the value of sDecimal thousands_sep maps to the value of sThousand For the LC_MONETAR
300. lable only on Windows 95 and NT e The GPIB 488 2 Functions function panels directly adhere to the IEEE 488 2 standard for communicating with and controlling GPIB devices The Device I O function panels read data from and write data to devices on the GPIB The Trigger and Clear function panels trigger and clear GPIB devices The SRQ and Serial Polls function panels handle service requests and perform serial polls The Parallel Polls function panels conduct parallel polls and configure devices to respond to them The Remote Local function panels enable and disable operation of devices remotely via the GPIB or locally via the front panel of the device The System Control function panels perform system wide functions obtain system wide status information and pass system control to other devices The Low Level I O function panels perform I O functions at a lower level than the function panels in the other classes GPIB Library Concepts This section contains general information about the GPIB Library the GPIB device driver guidelines and restrictions you should know when using the GPIB Library and descriptions of the types of GPIB functions that the GPIB Library contains GPIB Libraries and the GPIB Dynamic Link Library Device Driver LabWindows CVI for Windows uses National Instruments standard Windows GPIB DLL LabWindows CVI for Sun uses the standard Sun Solaris installed GPIB device drivers The
301. lback functions installed with ibInstal1Callback are synchronous callbacks that is they are invoked only when LabWindows CVI is processing events LabWindows CVI processes events when you call ProcessSystemEvents or GetUserEvent or when RunUserInterfacelis active and you are not in a callback function Consequently the latency between the occurrence of the GPIB event and the invocation of the callback can be large On the other hand you are not restricted in what you can do in the callback function Asynchronous Callbacks You have the ability to install asynchronous callbacks on Windows NT and on Windows 95 with the native 32 bit driver Asynchronous callbacks are installed with the ibnotify function and can be called at any time with respect to the rest of your program Consequently the latency between the occurrence of the GPIB event and the invocation of the callback is smaller than with synchronous callbacks but you are restricted in what you can do in the callback function See the documentation of the ibnotify function later in this chapter for more details Driver Version Requirements If you are using Windows NT you must have version 1 2 or later of the GPIB driver to use the ibInstallCallback and ibnotify functions If you are using the native 32 bit GPIB driver on Windows 95 you must have version 1 1 or later to use the ibInstallCallback and ibnotify functions If you are using the Windows 3 1 compatibilit
302. le 10 5 Easy I O for DAQ Error Codes Continued 10780 se2040InputModeErr When you have an SC2040 attached to your device all analog input channels must be configured for differential input mode 10800 timeOutErr The operation could not complete within the time limit calibrationErr An error occurred during the calibration process 10802 dataNotAvailErr The requested amount of data has not yet been acquired or the acquisition has completed and no more data is available to read 10803 transferStoppedErr The transfer has been stopped to prevent regeneration of output data earlyStopErr The transfer stopped prior to reaching the end of the transfer buffer overRunErr The clock source for the input transfer is faster than the maximum input clock rate the integrity of the data has been compromised Alternatively the clock source for the output transfer is faster than the maximum output clock rate a data point was generated more than once because the update occurred before new data was available 10806 noTrigFoundErr No trigger value was found in the input transfer buffer 10807 earlyTrigErr The trigger occurred before sufficient pretrigger data was acquired 10809 gateSignalErr Attempted to start a pulse width measurement with the pulse in the active state 10840 softwareErr The contents or the location of the driver file was changed between accesses to the driver 10841 firmwareErr The firmware does no
303. le that was returned from the OpenFile function If fileHandle 1 data is written to STDOUT and no prior OpenFile call is needed buffer is the buffer from which to write data count specifies number of bytes to write The count parameter overrides the buffer size in determining the number of bytes to write Buffers containing embedded NUL bytes are written in full count must not be greater than buffer size Using This Function For files opened in ASCII mode each LF character is replaced with a CR LF combination in the output In this case the return value does not include the CR character written to the output An error can indicate a bad file handle an attempt to access a protected file an attempt to write to a file opened as ReadOnly or no more space left on disk WriteLine int n WriteLine int fileHandle char lineBuffer int numberofB ytes Purpose Writes numberofBytes bytes from lineBuffer to a file and then writes a linefeed to the file Parameters file Handle File handle lineBuffer Data buffer numberofB ytes Number of bytes to write Return Value integer Number of bytes written including line feed LabWindows CVI Standard Libraries 2 30 O National Instruments Corporation Chapter 2 Formatting and I O Library Return Code Parameter Discussion If numberofBytes is 1 only the bytes in lineBuffer before the first ASCII NUL are written followed by a linefeed fileHandle is the file handle
304. length of the output queue with the GetOutQLen function When the output queue length becomes zero it is safe to close the port If the XModemReceive function fails to complete properly verify that the input queue length is greater than or equal to the packet size Refer to the functions OpenComConfig and XModemConfig If the receiver appears to lose data transmitted by the sender the input queue of the receiver may be overflowing This means that the input queue of the receiver is not emptied as quickly as data is coming in You can solve this problem using handshaking provided both devices offer the same handshaking support Refer to the Handshaking section of this chapter for further information If an XModem file transfer with a large packet size and a low baud rate fails you might need to increase the wait period Ten seconds is sufficient for most transfers RS 232 Cable Information An RS 232 cable consists of wires or lines that are joined with a connector at each end The connectors plug into the serial ports of each device to form a communications link over which data and control signals flow Each serial port consists of pins that are numbered and have meaning The PC pins are numbered and described as shown in Table 5 2 Table 5 2 PC Cable Configuration rin Meoning i O TxD Transmit Data RxD Receive Data RTS Request to Send CTS Clear to Send DSR Data Set Ready DTR Data Terminal Ready Comm
305. lid LabWindows CVI Standard Libraries 5 18 National Instruments Corporation Chapter 5 RS 232 Library FlushOutQ int status FlushOutQ int COMPort Purpose Removes all characters from the output queue of the specified port Parameter Input COMPort Range 1 through 32 Return Value status integer Refer to Error Codes in Table 5 6 Using This Function The function returns an error if the port is not open or if COMPort is invalid GetComStat int status GetComStat int COMPort Purpose Returns information about the status of the specified COM port COM port conditions are accumulated until you call Get ComStat Parameter Input COMPort Range through 16 Return Value status integer Bits indicate COM port status lt 0 Error Refer to Table 5 5 Using This Function Table 5 5 lists definitions of specific bits in the return value Several bits can be set to indicate the presence of more than one condition National Instruments Corporation 5 19 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Table 5 5 Bit Definitions for the GetComStat Function Hex Mnemonic Description Value INPUT LOST Input queue filled and input characters lost characters were not removed fast enough ASYNCH ERROR Problem determining number of characters in input queue This is an internal error and normally should not occur PARITY Parity error detected OVERRUN Overrun error detected a charac
306. lly invoke callback functions The event must be a valid XPropertyEvent X Property Library Function Reference This section describes the functions in the LabWindows CVI X Property Library The LabWindows CVI X Property functions are arranged alphabetically ComnectToX Display PropLibXErrType status ConnectToXDisplay const char displayName DisplayPtrxX display WindowX rootWindow Purpose Connect to a remote X server Use this function to access an X server on a remote computer This function returns a display pointer and the root window which you can use to read and write properties on the root window of the remote X server If you want to communicate only with applications using the same display as your application you do not need this function Instead use the global variables CVIXDisplay and CVIXRootWindow which contain the display and root window of the X server used by LabWindows CVI National Instruments Corporation 9 7 LabWindows CVI Standard Libraries X Property Library Chapter 9 Parameters Input displayName string Determines the X server connection and which communication domain to use display DisplayPtrX Pointer to the display of the remote X server passed by Use this value as the argument to other reference library functions to communicate with the remote X server rootWindow WindowX Root window of the remote X server Use passed by this value as the parameter to other libr
307. lose Instrument Devices Find Board Device Find Unused Device Offline Online Configuration Change Primary Address Change Secondary Address Change Access Board Change Time Out Limit Set EOS Character Enable Disable END Enable Disable DMA System Control Change Config Parameter Get Config Parameter Read Read Asynchronously Read to File Write Write Asynchronously Write from File Stop Asynchronous I O Device Control Get Serial Poll Byte Clear Device Trigger device Check for Listeners Wait for Event Dev Go to Local Dev Parallel Poll Cfg Dev Pass Control LabWindows CVI Standard Libraries 4 2 OpenDev CloseDev CloseInstrDevs ibfind ibdev ibonl ibpad ibsad ibbna ibtmo ibeos ibeot ibdma ibrsc ibconfig ibask ibrd ibrda ibrdf ibwrt ibwrta ibwrtf ibstop ibrsp ibclr ibtrg ibln ibwait ibloc ibppc ibpct continues National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library Table 4 1 The GPIB Functions Library Function Tree Continued Bus Control Send Interface Clear Become Active Controller Go to Standby Set Clear Remote Enable Send Commands Send Commands Async Parallel Poll Read Control Lines Board Control Wait for Board Event Dequeue Board Event Set UNIX Signal Request Go to Local Mode Parallel Poll Configuration Request Service Set Clear IST Write to Board Key Read from Board Key Callbacks Windows only Install Synchronous Callback
308. lot of memory If the results you want do not require that you keep the original array or intermediate arrays of data perform analysis operations in place where possible e The Interactive window maintains a record of generated code If you forget to keep the code from a function panel you can cut and paste code between the Interactive and Program windows Reporting Analysis Errors The functions in the Analysis Library return status information through a return value If the return value status is zero after an Analysis Library function call the function properly executed with no errors Otherwise status is set to the appropriate error value Error messages corresponding to the possible status values are listed at the end of this chapter Analysis Library Function Reference This section describes each function in the LabWindows CVI Analysis Library The LabWindows CVI Analysis Library functions are arranged alphabetically Abs1D int status Abs1D double inputArray int numberofElements double outputArray Purpose Finds the absolute value of the inputArray The function performs the operation in place inputArray and outputArray can be the same array Parameters inputArray double precision Input array array numberofElements integer Number of elements outputArray double precision Absolute value of input array array LabWindows CVI Standard Libraries 3 4 National Instruments Corporation Chapter 3 A
309. ly identifies the conversation Return Value integer Refer to error codes in Table 6 3 Note This function ends a conversation between a client and server corresponding to the conversationHandle that was passed Remember that there can be more than one conversation between a client and a server See Also Connect ToDDEServer RegisterDDEServer GetDDEErrorString char message GetDDEErrorString int errorNum Purpose Converts the error number returned by a DDE Library function into a meaningful error message Parameters errorNum integer Status returned by a DDE function National Instruments Corporation 6 15 LabWindows CVI Standard Libraries DDE Library Chapter 6 Return Value RegisterDDEServer int status RegisterDDEServer char serverName ddeFuncPtr serverCallbackFunction void callbackData Purpose Registers your program as a valid DDE server allowing other Windows applications to connect to 1t for interprocess communication Parameters serverName string Name of the server application serverCallbackFunction DDE function Pointer to the user callback pointer function callbackData void pointer Pointer to the user data Return Value status integer Refer to error codes in Table 6 3 Parameter Discussion serverName must be a string of length from 1 to 255 It is used without regard to case The serverCallbackFunction is the name of the callb
310. m When a hot or warm link is set up your server callback function receives a DDE_ADVISELOOP transaction type xType for a particular data object identified by itemName When the hot or warm link is terminated your server callback function receives a DDE_ADVISESTOP transaction type for the data object During the period when the hot or warm link is in effect your server program is responsible for notifying the client whenever the value of the data object changes When the data object s value changes your server program should call either of the following functions BroadcastDDEDataReady or AdviseDDEDataReady BroadcastDDEDataReady differs from AdviseDDEDataReady in that it is not restricted to a particular client BroadcastDDEDataReady sends the data automatically to all clients with hot links to the item BroadcastDDEDataReady notifies all clients with warm links to the item For each warm linked client that requests the data your server callback function is invoked with the DDE_REQUESTDATA message You must call ServerDDEWrite in the callback to send the data When successful this function returns the number of bytes sent Otherwise this function returns a negative error code Consult the table at the end of this chapter to see the error code values Note Your program should not call this function within a tight loop because it will compe
311. mDate rien isabelino 8 76 a A A A eA 8 77 SP a ir E E 8 77 SIM di ds 8 79 System do 8 79 TerminateExecutable oia aia ira 8 82 MO A Ass 8 83 TIMES adds dit 8 83 TruncateR alNUMDeL esmas asa 8 84 O National Instruments Corporation xiii LabWindows CVI Standard Libraries Contents DnloadE tema MAME orde 8 84 Write PoP ys METIO A daa 8 85 Write To Physics MemobrEx da 8 86 Chapter 9 X Property Library a a eotea unas nee 9 1 X Property Library Oda 9 1 The X Property Library Function Panels oooooconnnococnnocccconcccnoncnonnncnnnnnccnnnnnnnn 9 1 X Interclient Communication iii dial 9 2 Property Handles and Types ii a 9 3 Communicating with Local Applications oooccnnnncccnncccnonaccnonaccnonnnnnonnncnnnnnnnns 9 3 The Hidden WINdoW issirindadanid acted dia 9 3 Property Callback Bunun ii ii 9 4 Frror Cod A cae iad espce eee Sete eGo ee RAA 9 4 Using the Library Outside of LabWindows CVl ec eeeeecceeseesseeeseeeeeenaeenes 9 7 X Property Library Function Reference ocoococnnococnoncccnoncnononcnonnncnnnnncnnnnncconnncncnnncnnnnnos 9 7 Connect OX Display ii ni 9 7 Gers 1G ca AAA e A es TE 9 9 E 9 10 Destroy X Property santa 9 12 Destroy X Prop Type o dais 9 13 DisconnectFromX Display dd 9 14 GetXPropErrorS Wane testar e g E EE id 9 15 G tXProperty NaMe ladito aiii 9 15 GetX Property Ly Pe sitiada did A R ERES 9 16 GetX Prop l PEN ADE cani 9 17 A A E EE REN 9 18 GetXPropT ype UI vinos dida dando n 9 19 GetXWindowProp
312. mat void dataBuffer unsigned int dataSize unsigned int timeout Purpose Called by client to read data from a DDE server application Parameters Input conversationHandle unsigned integer A handle uniquely identifies the conversation itemName string Uniquely identifies the output item for example system LabWindows CVI Standard Libraries 6 10 National Instruments Corporation Chapter 6 DDE Library dataFormat unsigned integer Valid data format for example CF_TEXT dataSize unsigned integer Number of bytes to read Limited to 64 KB under Windows 3 1 and Windows 95 timeout unsigned integer Timeout in ms dataBuffer Buffer in which to receive data Return Value status integer Refer to error codes in Table 6 3 Parameter Discussion dataFormat must be a valid data format recognized by Microsoft Windows The following are the valid data formats supported by Microsoft Windows CF_TEXT CF_PALET CF_BITMAP CF_PENDATA CF_METAFILEPICT CF_RIFF CF_SYLK CF_WAVE CF_DIF CF_OWNERDISPLAY CF_TIFF CF_DSPTEXT CF_OEMTEXT CF_DSPBITMAP CF_DIB CF_DSPMETAFILEPICT Refer to Microsoft programmers documention for Windows 3 x for an in depth discussion of DDE programming and meaning of each data format type status returns a positive number representing the number of bytes that were successfully read A negative number corresponds to the error code
313. matting and I O Library Parameters fileName string Pathname read writeMode integer Read write mode action integer File pointer reposition location fileType integer ASCII binary mode Return Value integer File handle to be used in subsequent ReadFile WriteFile calls Return Code Function failed unable to open file or bad argument to function Parameter Discussion fileName is a pathname specifying the file to be opened If the read writeMode argument is write or read write this function creates the file if it does not already exist If a file is created it is created with no protection that is both reading and writing can be performed on it Use the function Get FileInfo if it is necessary to determine whether a file already exists read writeMode specifies how the file is opened e VAL_READ_WRITE open file for reading and writing e VAL_READ_ONLY open file for reading only e VAL _WRITE_ONLY open file for writing only action specifies whether to delete the old contents of the file and whether to force the file pointer to the end of the file before each write operation action is meaningful only if read writeMode write or read write After read operations are performed the file pointer points to the byte following the last byte read action values are as follows e VAL_TRUNCATE truncate file deletes its old contents and positions the file pointer at the beginning of the file
314. meters inputArray numberofRows numberofColumns maximumV alue maximumRow Index maximumColumnIndex minimum Value minimum RowIndex minimumColumnIndex Return Value status Mean double precision 2D array integer integer double precision integer integer double precision integer integer integer Analysis Library Input array Number of elements in first dimension of inputArray Number of elements in second dimension of inputArray Maximum value Index of maximum Value in inputArray array first dimension Index of maximum Value in inputArray second dimension Minimum value Index of minimum Value in inputArray first dimension Index of minimum Value in inputArray array second dimension Refer to error codes in Table 3 2 int status Mean double inputArray int numberofElements double mean Purpose Compute the mean average value of the input array The function uses the following formula to find the mean n 1 meanval Y x In i 0 National Instruments Corporation LabWindows CVI Standard Libraries Analysis Library Chapter 3 Parameters inputArray double precision Input array array numberofElements integer Number of elements in inputArray Return Value status integer Refer to error codes in Table 3 2 Mul1D int status Mul1D double arrayX double arrayY int numberofElements double outputArray
315. mples show how to use Init CVIRTE in each case int main int argc char argv if InitCVIRTE 0 argv 0 0 return 1 out of memory your other code return 0 int _ stdcall WinMain HINSTANCE hInstance HINSTANCE hPrevinstance LPSTR lpszCmdLine int nCmdShow if InitCVIRTE hInstance 0 0 0 return 1 out of memory your other code return 0 int _ stdcall DllMain void hinstDLL int fdwReason void lpvReserved if fdwReason DLL _PROCESS_ATTACH if InitCVIRTE hinstDLL 0 0 0 return 0 out of memory your other ATTACH code else if fdwReason DLL PROCESS _DETACH National Instruments Corporation 8 41 LabWindows CVI Standard Libraries Utility Library Chapter 8 your other DETACH code CloseCVIRTE return 1 Note The prototypes for InitCVIRTE and CloseCVIRTE are in cvirte h which is included by utility h inp char byteRead inp int portNumber Note This function is available only on the Windows versions of LabWindows CVI Purpose Reads a byte from a port Note For you to be able to use this function under Windows NT the LabWindows CVI low level support driver must be loaded Parameters Return Value byteRead char Byte read from port inpw short wordRead inpw int portNumber Note This function is available only on
316. multiple connections as long as they are under different topic names National Instruments Corporation 6 13 LabWindows CVI Standard Libraries DDE Library Chapter 6 clientCallbackFunction defines a callback function through which all messages from the server will be routed The callback function must be of the following form int ddeFuncPtr int handle char topicName char itemName int xType int dataFmt int dataSize void dataPtr void callbackData The xType transaction type parameter specifies the type of message received from the server The clientCallbackFunction can receive only two transaction types DDE_DISCONNECT and DDE_DATAREADY DDE_DISCONNECT Received when a server is requesting the termination of a connection or when Windows terminates the connection due to an internal error DDE_DATAREADY Received when you have already set up a hot or warm link by calling SetUpDDEHot Link or SetUpDDEWarmLink and the server notifies you that new data is available If the server program uses the LabWindows CVI DDE Library it notifies you by calling AdviseDDEDat aReady or BroadcastDDEDat aReady The data is received in the callback in the dataPtr parameter The topicName itemName dataFmt dataSize and dataPtr parameters contain significant data The itemName can specify an object to which the data refers For example in Excel the item name specifies a cell The dataFm
317. munication cceccccceccscssecesseecsevescessescsacssessccaessesaavecenaeeees National Instruments Corporation xv LabWindows CVI Standard Libraries Contents Tables Table 1 1 ANSI C Standard Library Classes ooooocnnnnccnnnnoccnonacononacononacononocononononnnocnonanononanoos 1 1 Table 1 2 C Locale Information Y alues tt A Ge ts 1 3 Table 2 1 The Formatting and I O Library Function Tree oooconincccnnonccnoncconnnccoonccononanonnncnnns 2 2 Table 3 1 The Analysis Library Function Tree ceececessecesnceceeeeeceeeeecseeeecsneeeenneeeenaeeees 3 1 Table 3 2 Analysis Library ELTON ia 3 37 Table 4 1 The GPIB Functions Library Function Tree ooooconococnnocccooacccnonanononacononacnnnnccnnnnccnns 4 2 Table 5 1 The RS 232 Library Function Tre idas 5 1 Table 5 2 PC Cable Configuration tn ia did 5 4 Table 5 3 DTE to DCE Cable Configuration wsicosetcssavsevecdavctes caus dnsesdesaes seasbucsdgwn shed saanceenseesens 5 5 Table 5 4 PC to DTE Cable Comfiguration cccsccssscsssssccsensessserscesseccesssseesnsnesensncesseetoens 5 5 Table 5 5 Bit Definitions for the GetComStat Function coococnnocccnonccconncnononcnnnnnnnonancconnncnnnnos 5 20 Table 5 6 RS 232 Library EOS a ont E SAREA 5 36 Table 6 1 DDE Library Function Tr ii dic 6 1 Table 6 2 DDE Transaction Types Gol ype A A dra 6 4 Table6 3 DDE Library Error Codes dd E 6 24 Table 7 1 The TCP Library Function Tree miii ainia 7 1 Table 7 2 TCP Transaction Types ATI A
318. n Chapter 8 Utility Library HELP_CONTEXTPOPUP Displays in a pop up window a particular Help topic identified by a context number that has been defined in the MAP section of the HPJ file The main help window is not displayed In this case additionalLongData is the context number of the topic HELP_HELPONHELP Displays the contents topic of the designated Using Help file HELP_KEY Displays the topic in the keyword list that matches the keyword passed in the additionalStringData parameter if there is one exact match If there is more than one match it displays the first topic found If there is no match it displays an error message HELP_PARTIALKEY Displays the topic found in the keyword list that matches the keyword passed in the additionalStringData parameter if there is one exact match If there is more than one match displays the Search dialog box with the topics listed in the Go To list box If there is no match it displays the Search dialog box If you just want to bring up the Search dialog box without passing a keyword you should use a pointer to an empty string HELP_POPUP ID Displays in a pop up window the topic identified by a context string The main window help is not displayed HELP_QUIT Closes the help file It will have no effect if the help file was opened by another executable HELP_SETCONTENTS Determines which Contents topic Help should display when the user chooses the
319. n 1 Remarks The x modifier causes the comma separators to be discarded Scan considers an array target to be satisfied when at least one element of the array is filled in If the source string in this example were 12 3 only the first element of a would be filled in the other elements would remain unmodified and Scan would return 1 Scanning Strings That Are Not NUL Terminated int bd double x char s 20 ibrd bd s 15 Scan s Ss w gt Sf ibcnt X Remarks All of the previous examples assume that s is a NUL terminated string However when reading data from programmable instruments using the GPIB and RS 232 Library functions the data transferred is not NUL terminated This example uses ibrd to read up to 15 B from a GPIB instrument The global variable ibcnt contains the actual number of bytes transferred Scan uses the value in ibcnt in conjunction with the w modifier to specify the width of the source string For example if ibcnt is 12 the format string is interpreted as Ss w12 gt f causing Scan to use only the first 12 bytes of s The following example is an alternative method for handling strings that are not NUL terminated int bd double x char s 20 ibrd bd s 15 s 15 0 ASCII NUL is O Scan s SS gt Sf AXN National Instruments Corporation 2 65 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 This code shows how to insert an AS
320. n 9 16 to 9 17 GetXPropTypeName function 9 17 to 9 18 GetXPropTypeSize function 9 18 GetXPropTypeUnit function 9 19 GetX WindowPropertyltem function 9 20 to 9 22 GetX WindowProperty Value function 9 22 to 9 25 global variables See also status functions CVIXDisplay 9 3 CVIXHiddenWindow 9 4 Error iberr 4 6 4 11 GPIB GPIB 488 2 libraries 4 10 rs232err 5 3 Status Word ibsta 4 6 4 10 GPIB and GPIB 488 2 Libraries automatic serial polling 4 7 to 4 8 board functions 4 7 device functions 4 7 function panels classes and subclasses 4 4 to 4 5 function tree table 4 2 to 4 4 functions See Device Manager functions GPIB global variables 4 10 GPIB dynamic link library device driver 4 6 guidelines and restrictions 4 6 to 4 7 LabWindows CVI Standard Libraries Index hardware interrupts and autopolling 4 8 to 4 9 overview 4 1 platform and board considerations 4 10 to 4 11 read and write termination 4 9 status and error controls 4 6 timeouts 4 9 Windows 95 support 4 10 to 4 11 compatibility driver 4 11 native 32 bit driver 4 10 Windows NT and GPIB driver 4 11 limitations on transfer size 4 11 multithreading 4 11 notification of SRQ and other GPIB events 4 12 writing instrument modules note 4 7 GPIB device drivers 4 5 to 4 6 GPIB DLL 4 5 GroupByChannel function 10 44 to 10 45 H handshaking for RS 232 communications 5 6 to 5 8 hardware handshaking 5 7 to 5 8 software handshaking 5
321. n panel LabWindows CVI Standard Libraries 5 2 National Instruments Corporation Chapter 5 RS 232 Library Using RS 485 You can use all of the functions in the RS 232 Library with the National Instruments RS 485 AT Serial board The ComSetEscape function allows you to control the transceiver mode of the board Reporting RS 232 Errors The functions in the RS 232 Library return negative values when an error occurs In addition the global variable rs232err is updated after each function call to the RS 232 Library If the function executes properly it sets rs232err to zero Otherwise it sets rs232err to the same error code that it returns A list of the possible error conditions that can occur while using the RS 232 Library functions are at the end of this chapter XModem File Transfer Functions With the XModem functions you can transfer files using a data transfer protocol The protocol uses a generally accepted technique for serial file transfers with error checking Files transfer packets that contain data from the files plus error checking and synchronization information You do not need to understand the protocol to use the functions To transfer a file open the com port use the XModemSend function on the sender side of the transfer and the XModemReceive function on the receiver side of the transfer and then close the com port The XModem functions handle all aspects of the transfer protocol You can treat the XModem function
322. n be the same array Parameters inputArray double precision 2D Input array array numberofRows integer Number of elements in first dimension numberofColumns integer Number of elements in second dimension multiplier double precision Multiplicative constant additiveConstant double precision Additive constant outputArray double precision 2D Linearly evaluated array array Return Value status integer Refer to error codes in Table 3 2 LabWindows CVI Standard Libraries 3 22 National Instruments Corporation Chapter 3 Analysis Library MatrixMul int status MatrixMul void matrixX void matrixY int ofRowsInx int cols rowsInX Y int ofColumnsInY void outputMatrix Purpose Multiplies two 2D input matrices The function obtains the ith jth element of the output matrix by using the following formula k 1 Zij y Xip F Yo Parameters matrixX double precision 2D matrixX input matrix matrix Y double precision 2D matrix Y input matrix HofRowsInx First dimension of matrixX cols rowsInX Y Second dimension of matrixX first dimension of matrixY ofColumnsInY Second dimension of matrixY array Return Value status integer Refer to error codes in Table 3 2 Parameter Discussion Note Be sure to use the correct array sizes The following array sizes must be met e matrixX must be ofRowsInX by cols rowsInX Y e matrixY must be cols rowsInX Y by ofColumnsInY
323. n converting to or from the string format Ss A modifier is available to specify the radix to be used in such a conversion default is decimal x integer hexadecimal This source or target specifier indicates that the corresponding parameter is an integer or if rep is present an integer array The function performs conversions to ASCII hexadecimal digits 012345678 9abcdef when converting to or from the string format 3s integer octal This source or target specifier indicates that the corresponding parameter is an integer or if rep is present an integer array The function performs conversions to ASCII octal digits 01234567 when converting to or from the string format s d integer decimal This format specifier is identical to i and is included for compatibility with the C printf family of functions LabWindows CVI Standard Libraries 2 34 National Instruments Corporation Chapter 2 Formatting and I O Library f real number This source or target specifier indicates that the corresponding parameter is a real number or if rep is present a real array The function performs conversions to ASCII when converting to or from the string format s c character This source or target specifier indicates that the corresponding parameter is an integer with one significant byte or if rep is present an array of 1 byte integers The function does not perform conversion to ASCII when converting to or from the string format 3s The byte
324. n integer passed by reference If the format is repeated this operation is repeated the appropriate number of times and the results stored into successive elements of the integer array Scanning Modifiers modifiers are optional codes used to describe the nature of the source or target data If you use them you must enclose the modifiers in square brackets and place them immediately after the format code they modify If one format specifier requires more than one modifier enclose all modifiers in the same set of brackets There is a different set of modifiers for each possible format specifier Scanning Integer Modifiers i d x 0 c bn in Specify Length The b integer modifier specifies the length of the integer argument or the length of an individual integer array element in bytes The default length is 4 B therefore simple 4 B integers do not need this modifier The modifier b2 represents short integers The modifier b1 represents single byte integers Specify Array Offset Use the i integer modifier to specify an offset within an integer array argument It indicates the location within the array where processing is to begin nis the zero based index of the first element to process Thus 10d i2 applied to a source integer array reads the 10 integer values from the third through the twelfth elements of the array The i modifier is valid only if rep is present If the i modifier is used with the z modifier then n is in t
325. n returns an integer value indicating the lexicographic relationship between the two sets of bytes CompareStrings int result CompareStrings char string 1 int string 1Index char string 2 int string 2Index int caseSensitive Purpose Compares the NUL terminated string starting at position string 1 Index of string 1 to the NUL terminated string starting at position string 2Index of string 2 Both string 1Index and string 2Index are zero based Parameters string 1 String 1 string 1Index Starting position in string 1 string 2 String 2 string 2Index Starting position in string 2 caseSensitive Case sensitivity mode LabWindows CVI Standard Libraries 2 8 National Instruments Corporation Chapter 2 Formatting and I O Library Return Value result integer Result of the compare operation Return Codes Bytes from string 1 less than bytes from string 2 Bytes from string 1 identical to bytes from string 2 Bytes from string 1 greater than bytes from string 2 Parameter Discussion If caseSensitive is zero alphabetic characters are compared without regard to case If caseSensitive is non zero alphabetic characters are equal only if they have the same case The function returns an integer value indicating the lexicographic relationship between the two strings CopyBytes void CopyBytes char targetBuffer int targetIndex char sourceBuffer int sourceIndex int numberofBytes Purpose
326. nConnectionXErr The connection to the X server was broken This occurs if the remote server terminated Parameter Discussion display must either be the predefined value CVIXDi splay or be the value returned by ConnectToXDisplay Use CVIXDisplay 1f the window is on the same display used by LabWindows CVI For the window parameter use CVIXRoot Window to access the default root window of the display used by LabWindows CVI Use CVIXHiddenWindow to access the hidden window associated with your application propertyItem must point to an object of the same size as the property item You can get the size of the property item by calling the function GetXPropertySize O National Instruments Corporation 9 21 LabWindows CVI Standard Libraries X Property Library Chapter 9 See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XGetWindowPropert y function GetX WindowProperty Value PropLibXErrType status GetX WindowPropertyValue DisplayPtrx display WindowX window Propert yHandleX property unsigned int index unsigned int numberofItemsRequested int delete unsigned int numberofItemsReturned unsigned int numberOflItemsRemaining void property Value Purpose Get the value of a property on a window This function obtains the value of the specified property on the window and copies it into the supplied buffer Note
327. nDisplay and DefaultRootWindow functions CreateXProperty PropLibXErrType status CreateXProperty const char propertyName PropTypeHandlexX propertyType PropertyHandleX property Purpose Create X property information Use this function to define the attributes of the properties that you read and write on X windows You must create properties with this function before you can access them on X windows Each property has a unique name and a type created by CreateXPropType that you cannot change except by destroying the property and recreating it Note You can create a maximum of 256 different properties Parameters propertyName Name of the property Each property name is unique and has a type which cannot be changed once the property is created propertyType PropTypeHandleX Type of the property This value must be either a predefined type or a value returned by CreateXPropType Output property PropertyHandleX Handle to the property information passed by reference created Use this value as the parameter to other library functions to access the property on X windows O National Instruments Corporation 9 9 LabWindows CVI Standard Libraries X Property Library Chapter 9 Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParam
328. nLibraryErrors A AA 8 11 Dis edo e a gas did 8 12 DisableTaskS A 8 12 Enable BrcakO nb aDrary EOS ia 8 15 Enable aia dci 8 15 Enable FaskS withing inician 8 16 Executable Has Terminada ainia 8 16 GetBreakOnLibra y Error id 8 17 Get reak ONnProrecHOn Errors ata 8 18 Gt NV VV GL S10 Bis id tds 8 18 GetCurrentPlathorins 2 a2ssccsaacscagededy ita a decia aa 8 19 A ed ace ueametacadun gate A a A saute tea ree meee ena 8 20 IN 8 20 GetExternalModuleA ddr ionnan airada ninn 8 21 CALAS A OI A O 8 23 Ern ADEN e EEE AE ausaco osname 8 24 A 8 25 Ge tFile Time a ida 8 26 GetBlrstBile iia as 8 27 GethullPathPromProject se a A A dd le 8 29 Genntetrupestate dos 8 30 A a A EE AE le Gens A A AEAT E E aat 8 30 G tMod leDit atadas 8 31 EEN CE TG ccs sacs E E E E E E T eaese 8 33 ds ee AA A we alien ute cases tae cet 8 33 G tProjectDIT sia 8 34 GEtS CIOP osa idas 8 35 Gesto Window OplONns dd 8 35 G tStdio WIN POSTION cat 8 36 GetStdlo WINDOWSIZS sssrin es deadaanasdendesednncceds spadadeedesdacdesssdaa uns 8 37 GetStdio WINDOW V ISIDILILY it A A sedyausacaatarseenees 8 37 LabWindows CVI Standard Libraries xii National Instruments Corporation Contents A O 8 38 A 8 39 CEWINOWDI PASO O ie Nu oe 8 39 A A eee Re ene pre Meee SiN et nee er eee 8 40 MA ad 8 42 A Sen Cera 8 42 InStandaloneExecutable ooooooooonncccnnonnnonananonocnononnnnononononnononnnno no nononcononannn conos 8 43 Ke Mitin T E R A AE A a L iaa 8 43 LaunchExec table ic
329. nalysis Library Return Value status integer Refer to error codes in Table 3 2 Add1D int status Add1D double arrayX double arrayY int numberofElements double outputArray Purpose Adds one dimensional 1D arrays The function obtains the ith element of the output array by using the following formula X The function performs the operation in place that is outputArray can be the same array as either arrayX or array Y Parameters arrayX double precision Input array array array Y double precision Input array array numberofElements integer Number of elements to be added array Return Value status integer Refer to error codes in Table 3 2 Add2D int status Add2D void arrayX void arrayY int numberofRows int numberofColumns void outputArray O National Instruments Corporation 3 5 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Purpose Adds two 2D arrays The function obtains the ith jth element of the output array by using the following formula Zij Sak Nag The function performs the operation in place outputArray can be the same array as either arrayX or arrayY Parameters arrayX double precision 2D Input array array arrayY double precision 2D Input array array numberofRows integer Number of elements in first dimension numberofColumns integer Number of elements in second dimension array Return Value status in
330. nary form The first two asterisks in the format string are matched to count The third asterisk is matched to start For instance if count is 100 and start is 30 then the format string is equivalent to 100f lt 100f 130 Because the i modifier specifies a zero based index into the real array the array elements from x 30 through x 129 are written to the file National Instruments Corporation 2 55 LabWindows CVI Standard Libraries Formatting and I O Library Concatenating Two Strings char buf 30 int wave_type signal_output char wave_str signal_str int nbytes wave_type 1 signal_output 0 switch wave_type case 0 wave_str SINE break case 1 wave_str SQUARE break case 2 wave_str TRIANGL break switch signal_output case 0 signal_str OUTPUT OFF break case 1 signal_str OUTPUT ON break Fmt buf Ss lt Ss s wave_str signal_str nbytes NumFmtdBytes Remarks Chapter 2 The two switch constructs assign constant strings to the string variables wave_st r and signal_str The Fmt call concatenates the contents of wave_str and signal_str into buf After the call buf contains SQUARE OUTPUT OFF the number of bytes in the concatenated string Appending to a String char buf 30 int wave_type signal_output int nbytes switch wave_type case 0 Fmt buf s lt SINE break
331. nction does not check whether the memory actually exists If the memory does not exist the success value is returned but no data is read Note For you to be able to use this function under Windows 95 or NT the LabWindows CVI low level support driver must be loaded Parameters physicalAddress unsigned integer The physical address to be written to There are no restrictions on the address 1t can be below or above 1 MB sourceBuffer void pointer The buffer from which the physical memory will be copied numberOfBytes unsigned integer The number of bytes to copy to physical memory National Instruments Corporation 8 85 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Value status integer Indicates whether the function succeeded Return Codes Success Failure reported by the operating system or low level support driver not loaded WriteToPhysicalMemoryEx int status WriteToPhysicalMemoryEx unsigned int physicalAddress void sourceBuffer unsigned int numberOfBytes int bytesAtA Time Note This function is available only in the Windows version of LabWindows CVI Purpose This function copies the contents of the specified buffer to a region of physical memory It can copy the data in units of 1 2 or 4 bytes at a time The function does not check whether the memory actually exists If the memory does not exist success is returned but no data is written Note For you to be able t
332. nction reverses the effect of the last call to DisableInterrupts It restores the signal processing state to the condition prior to the Disablelnterrupts call O National Instruments Corporation 8 15 LabWindows CVI Standard Libraries Utility Library Chapter 8 Note For you to be able to use this function under Windows 95 the LabWindows CVI low level support driver must be loaded Note Under Windows NT the EnableInterrupts and Disablelnterrupts functions have no effect Interrupts are always enabled while your program is running at the user as opposed to the kernel level Parameter None Return Value None EnableTaskSwitching void EnableTaskSwitching void Note This function is available only on the Windows versions of LabWindows CVI Purpose This function lets the user switch to another task by using the lt Alt Tab gt lt Alt Esc gt and lt Ctrl Esc gt key combinations as well as the Switch To item in the Control System menu This function only affects the behavior of these keys while LabWindows CVI or a LabWindows CVI standalone executable is the active application ExecutableHasTerminated int status ExecutableHasTerminated int executableHandle Purpose Determines whether an application started with LaunchExecutableEx has terminated Parameters Input executableHandle integer The executable handle acquired from LaunchExecutableEx LabWindows CVI Standard Librari
333. nd I O Library Chapter 2 Table 2 1 The Formatting and I O Library Function Tree Formatting and I O File VO Open File Close File Read from File Write to File Array to File File to Array Get File Information Set File Pointer String Manipulation Get String Length String to Lowercase String to Uppercase Fill Bytes Copy Bytes Copy String Compare Bytes Compare Strings Find Pattern Read Line Write Line Data Formatting Formatting Functions Fmt to Memory Sample Panel Fmt to File Sample Panel Fmt to Stdout Sample Panel Scanning Functions Scan from Mem Sample Panel Scan from File Sample Panel Scan from Stdin Sample Panel Status Functions Get Formatted Bytes Get Format Index Error OpenFile CloseFile ReadFile Write File ArrayToFile FileToArray GetFileInfo SetFilePtr StringLength StringLowerCase String UpperCase FillBytes CopyBytes CopyString CompareBytes CompareStrings FindPattern ReadLine Write Line Fmt FmtFile FmtOut Scan ScanFile ScanIn NumF mtdBytes GetF mtErrNdx Get I O Error GetFmtIOError Get I O Error String GetF mtIOErrorString The classes and subclasses in the tree are described below e The File I O function panels open close read write and obtain information about files e The String Manipulation function panels manipulate strings and character buffers LabWindows CVI Standard Libraries 2 2 National Instruments Corporation Chapter 2 Formatting an
334. nd ibcnt1 global variables or the ThreadIbsta ThreadIberr and ThreadIbcnt1 functions The global variables and thread status functions return undefined values within the callback function So you must use the sta err and cntl parameters instead The value that you return from the callback function is very important It is the event mask that is used to rearm the callback If you return 0 the callback is disarmed that is it is not called again until you make another call to ibnotify If you return an event mask different than the one you originally passed to ibnot ify the new event mask is used Normally you want to return the same event mask that you originally passed to ibnotify If you return an invalid event mask or if there is an operating system error in rearming the callback the callback is called with the sta set to ERR err set to EDVR and entl set to BNOTIFY_REARM_FATLED Warning Because the callback can be called as the result of a rearming error you should always check the value of the sta parameter to make sure that one of the requested events has in fact occurred If invoked because of an SRQI or ROS condition the callback function should call the ibrsp function to read the status byte For an SRQI board level condition calling the ibrsp function is necessary to cause to requesting device to turn off the SRQ line char statusByte ibrsp device amp statusByte Nation
335. ndard Libraries Index using literals 2 40 scanning functions 2 41 to 2 43 examples 2 41 form of 2 41 format codes 2 42 to 2 43 using literals 2 48 to 2 49 Formatting and I O Library functions function panels classes and subclasses 2 2 to 2 3 function tree table 2 2 function reference ArrayToFile 2 4 to 2 6 CloseFile 2 7 CompareBytes 2 7 to 2 8 CompareStrings 2 8 to 2 9 CopyBytes 2 9 to 2 10 CopyString 2 10 FileToArray 2 11 to 2 12 FillBytes 2 13 FindPattern 2 13 to 2 14 Fmt 2 14 to 2 15 2 32 FmtFile 2 15 to 2 16 2 32 FmtOut 2 16 to 2 17 2 32 GetFileInfo 2 17 GetFmtErrNdx 2 18 GetFmtIOError 2 18 to 2 19 GetFmtlOErrorString 2 19 NumFmtdBytes 2 20 OpenFile 2 20 to 2 22 ReadFile 2 22 to 2 23 ReadLine 2 23 to 2 24 Scan 2 24 2 40 ScanFile 2 25 2 40 ScanIn 2 25 to 2 26 2 40 SetFilePtr 2 26 to 2 28 StringLength 2 28 StringLowerCase 2 28 to 2 29 StringUpperCase 2 29 WriteFile 2 29 to 2 30 WriteLine 2 30 to 2 31 formatting function programming examples appending to a string 2 56 to 2 57 concatenating two strings 2 56 creating array of file names 2 47 integer and real to string with literals 2 53 LabWindows CVI Standard Libraries I 8 integer array to binary file assuming fixed number of elements 2 54 integer to string 2 50 to 2 51 list of examples 2 49 to 2 50 long integer to string 2 51 real array to ASCII file in columns with comma separators 2 53 to 2 54
336. ndle char itemName unsigned int dataFormat unsigned int timeout Purpose Sets up a warm link advisory loop between the client and the server The function returns zero for success and a negative error code for failure Parameters conversationHandle unsigned integer Uniquely identifies the conversation itemName string Uniquely identifies the output item for example system dataFormat unsigned integer Valid data format for example CF_TEXT timeout unsigned integer Timeout in ms Return Value National Instruments Corporation 6 21 LabWindows CVI Standard Libraries DDE Library Chapter 6 Parameter Discussion The itemName represents the information in the server application where the DDE link is established For example the item name could represent an Excel range of cells by using the range description R1C1 R10C10 Note To the client LabWindows CVI does not distinguish between a hot link and a warm link For both types of links the clientCallbackFunction is called with a transaction type Of DDE_DATAREADY when the data item is changed at the server site and the new data is available in the dataPtr parameter of the callback function LabWindows CVI has two different functions for setting up a warm link or hot link in case some applications only accept one or the other kind of link See Also RegisterDDEServer SetUpDDEHotLink TerminateDDELink int status Terminate
337. ndle is the file handle that was returned from the OpenFile function and specifies the file to close Parameter Return Value status integer Result of the close file operation Return Codes Bad file handle Success CompareBytes int result CompareBytes char buffer 1 int buffer 1Index char buffer 2 int buffer 2Index int numberofBytes int caseSensitive Purpose Compares the numberofBytes starting at position buffer 1 Index of buffer 1 to the numberofBytes starting at position buffer 2Index of buffer 2 Parameters buffer 1 string String 1 buffer Index integer Starting position in buffer 1 buffer 2 string String 2 buffer 2Index integer Starting position in buffer 2 numberofBytes integer Number of bytes to compare caseSensitive integer Case sensitivity mode National Instruments Corporation 2 7 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Return Value result integer Result of the compare operation Return Codes Bytes from buffer 1 less than bytes from buffer 2 Bytes from buffer 1 identical to bytes from buffer 2 Bytes from buffer 1 greater than bytes from buffer 2 Parameter Discussion Both buffer 1 Index and buffer 2Index are zero based If caseSensitive is zero alphabetic characters are compared without regard to case If caseSensitive is non zero alphabetic characters are considered equal only if they have the same case The functio
338. ndow Applications communicate by reading and writing properties to and from windows In addition an X application can request that the X server notify it whenever a specific property value changes on a window The X applications that need to communicate with each other must first connect to the same X display Then they must agree upon the names and types of properties as well as the X window IDs that they use to transfer the data Although it is a simple matter to agree upon the names and types of properties in advance the window IDs cannot be known in advance because they are different for each invocation of the program There must be a mechanism for transferring the window IDs from one client to another A client usually accomplishes this by placing a property that contains the window ID on the root window which is a window that all clients can access The window ID refers to the window containing the data for transfer to other clients The other clients read this property from the root window to determine where the data is stored LabWindows CVI Standard Libraries 9 2 National Instruments Corporation Chapter 9 X Property Library With the LabWindows CVI X Property Library functions you can connect to X displays and obtain the root window ID read and write properties on windows and monitor when specific properties change Property Handles and Types Before you can read or write properties on windows you must create the property and it
339. ndow zoomState GetWindowDisplaySetting amp showWindow amp zoomState load panel or create panel if showWindow SetPanelAttribute panel ATTR_WINDOW_ZOOM zoomState SetPanelAttribute panel ATTR_VISIBLE 1 InitCVIRTE int status InitCVIRTE void hInstance char argv void reserved Purpose This function performs initialization of the CVI Run Time Engine It is needed only in executables or DLLs that are linked using an external compiler Otherwise it is harmless Note In LabWindows CVI version 4 0 1 this function was expanded from one to three parameters Executables and DLLs created with the one parameter version of the function will continue to work properly LabWindows CVI Standard Libraries 8 40 O National Instruments Corporation Chapter 8 Utility Library Parameters hInstance void 0 if called from main pointer hInstance if called from WinMain first parameter hInstDLL if called from D11Main first parameter argv string argv if called from main second parameter array Otherwise 0 reserved void Reserved for future use Pass 0 pointer Return Value status integer 1 indicates success 0 indicates failure probably out of memory Using this Function The function should be called in your main WinMain or D11Main function Which of these three functions you are using determines the parameter values you should pass to Init CVIRTE The following exa
340. ndshaking 2 LWRS_HWHANDSHAKE_CTS_RTS Hardware handshaking is enabled The CTS line is monitored The RTS is used for handshaking The DTR line is raised the entire time the port is open Using This Function By default hardware handshaking is not used The function returns an error if the port is not open or parameter values are invalid LabWindows CVI Standard Libraries 5 30 National Instruments Corporation Chapter 5 RS 232 Library SetXMode int result SetXMode int COMPort int mode Purpose Enables or disables software handshaking by enabling or disabling XON XOFF sensitivity on transmission and reception of data Parameters COMPort Range through 16 mode 0 to disable non zero to enable Return Value result integer Refer to error codes in Table 5 6 Using This Function By default XON XOFF sensitivity is disabled See the Software Handshaking section at the beginning of this chapter The function returns an error if the port is not open or parameter values are invalid XModemConfig int result XModemConfig int COMPort double startDelay int maximum ofRetries double waitPeriod int packetSize Purpose Sets the XModem configuration parameters for the specified com port National Instruments Corporation 5 31 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Parameters COMPort integer Range 1 through 32 startDelay double precision 0 0 selects the default v
341. ng manipulation functions The Using the Formatting and Scanning Functions section describes in detail this special class of functions Although these functions are listed in the function reference their versatility and complex nature require a more complete discussion The final section Formatting and I O Library Programming Examples contains many examples of program code that call Formatting and I O Library functions Most of the examples use the formatting and scanning functions Formatting and I O Library Function Overview This section contains general information necessary for understanding the Formatting and I O Library functions and panels The Formatting and I O Library Function Panels The Formatting and I O Library function panels are grouped in a tree structure according to the types of operations performed The Formatting and I O Library function tree is shown in Table 2 1 The first and second level bold headings in the tree are the names of function classes and subclasses Function classes and subclasses are groups of related function panels The third level headings in plain text are the names of individual function panels The names of the functions are in bold italics to the right of the function panels Refer to the Sample Function Panels for the Formatting and Scanning Functions section later in this chapter for more information National Instruments Corporation 2 1 LabWindows CVI Standard Libraries Formatting a
342. ng moved or sized You can do this by using the following function call SetSystemAttribute ATTR_ALLOW_UNSAFE_TIMER_EVENTS 1 This alternative is incomplete and can be unsafe See the discussion on Unsafe Timer Events in the Using the System Attributes section of Chapter 3 Programming with the User Interface Library of the LabWindows CVI User Interface Reference Manual EnableBreakOnLibraryErrors void EnableBreakOnLibraryErrors void Purpose If debugging is enabled if the debugging level in the Run Options dialog box of the Options menu in the Project window is set to Standard or Extended this function directs LabWindows CVI to display a run time error dialog box when a National Instruments library function reports an error If debugging is disabled this function has no effect In general you should check the Break on Library Errors check box in the Run Options dialog box of the Options menu in the Project window to enable this feature However you can use this function in conjunction with DisableBreakOnLibraryErrors to temporarily suppress the Break on Library Errors feature around a segment of code It does not affect the state of the Break on Library Errors check box Note This function has been superseded by Set BreakOnLibraryErrors Enablelnterrupts void Enablelnterrupts voi d Under Windows 3 1 and Windows 95 this function uses the STI instruction to turn on all maskable 80x86 interrupts On UNIX this fu
343. nics and symbols e The Index contains an alphabetical list of key terms and topics in this manual including the page where you can find each one LabWindows CVI Standard Libraries xviii National Instruments Corporation About This Manual Conventions Used in This Manual The following conventions are used in this manual bold italic bold italic monospace italic monospace lt gt paths Bold text denotes a parameter menu item return value function panel item or dialog box button or option Italic text denotes emphasis a cross reference or an introduction to a key concept Bold italic text denotes a note caution or warning Text in this font denotes text or characters that you should literally enter from the keyboard Sections of code programming examples and syntax examples also appear in this font This font also is used for the proper names of disk drives paths directories programs subprograms subroutines device names variables filenames and extensions and for statements and comments taken from program code Italic text in this font denotes that you must supply the appropriate words or values in the place of these items Angle brackets enclose the name of a key A hyphen between two or more key names enclosed in angle brackets denotes that you should simultaneously press the named keys for example lt Ctrl Alt Delete gt The symbol leads you through nested menu items and
344. nks to the same item AdviseDDEDataReady sends the data without invoking your server callback function However if there are other clients with warm links to the same item they are all notified that new data is available If they request the new data your server callback function is invoked with the DDE_REQUESTDATA message If you do not want to send the data to those other clients you must write your server callback function so that it does not call ServerDDEWrite in this case If you pass NULL 0 as the dataPointer and 0 as the dataSize no data is sent to the specified client Instead all clients with warm links to the item are notified If they request the new data your server callback function is invoked with the DDE_REQUESTDATA message and you can use the ServerDDEWrite function to send the data in response National Instruments Corporation 6 7 LabWindows CVI Standard Libraries DDE Library Chapter 6 If successful this function returns the number of bytes sent Otherwise this function returns a negative error code See the help for the status control for the error code values Note Your program should not call AdviseDDEDataReady in a tight loop because the iterations will compete with user interface events for the CPU time You should use this function sparingly and only when the value of the hot or warm linked data object changes In cases when large data object
345. nnel String for Analog Input Functions subsection of the Easy I O for DAO Library Function Overview section of this chapter for the syntax of this string triggerType is the trigger type The trigger types are Hardware Analog Trigger HW_ANALOG_TRIGGER Digital Trigger A DIGITAL _TRIGGER_A Digital Triggers A amp B DIGITAL_TRIGGER_AB Scan Clock Gating SCAN_CLOCK_GATING Software Analog Trigger SW_ANALOG_TRIGGER Equivalent Time Sampling ETS_TRIGGER e If you choose Hardware or Software Analog Trigger data is retrieved after the analog triggering parameters have been satisfied Be sure that the Trigger Source is one of the channels listed in the channel string Hardware triggering is more accurate than software triggering but it is not available on all boards e If you choose Digital Trigger A If pretriggerScans is 0 the trigger starts the acquisition For the MIO 16 connect the digital trigger signal to the START TRIG input If pretriggerScans is greater than 0 the trigger stops the acquisition after all posttrigger data is acquired For the MIO 16 connect the digital trigger signal to the STOP TRIG input e If you choose Digital Trigger A B pretriggerScans must be greater than 0 A digital trigger starts the acquisition and a digital trigger stops the acquisition after all posttrigger data is acquired For the MIO 16 the START TRIG input starts the acquisition and the
346. nnns 2 4 A aE Er aA E Een 2 4 Closefile ii ai a ds 2 7 Comparsa 2 7 ON 2 8 COPY BYTES nidad 2 9 COPA ds il e ed a e O dd a 2 10 A e IU rest een 2 11 PUBS A A A A ae ean a 2 13 NL cies sce hss cand n ana scatunyetde E E E E Ea E 2 13 Fdo 2 14 Entries asta ed 2 15 O 2 16 G tFile nfo nas 2 17 National Instruments Corporation v LabWindows CVI Standard Libraries Contents Sai A OS 2 18 CAPTA A A See canes 2 18 GEetEMIOETOTS MINE or A A s 2 19 o annn e tes ions ores iC nhl Set S cu ttec 2 20 Opa ri 2 20 MRA LL sca iin hl ra Saul eth EA R E A 2 22 BG a ON 2 23 A hac aie ia tig ease desea wade E S 2 24 A dh anata i han Ns 2 25 A sce if eaceast net ES pctaheamidatvsec 2 25 SetFleP ea A dis 2 26 SUITES ES thiir a deg shag use stuaedaed oes bea a aeaa aeset 2 28 StineLower Case acia tddi andanada 2 28 String UpperCase iii A A aaa eee dete 2 29 A E ees ie ea 2 29 WroutelLine cusisiiajla ieee heehee latas 2 30 Using the Formatting and Scanning Functions ooconoccconocconononnnonnnonn nono nononnnnnncnnn cono ncnnns 2 31 Introductory Formatting and Scanning ExampleS ooooonnccnnnccnoccnoncnnnancnoncconannnos 2 31 Formatting Functions eee ee a ele de eee Ble 2 32 Formatting Functions Format String eeeeeeceeeseeeseeceseeeeeeeeneees 2 33 Formatting Modifiers lt ccassacsavaseeeadeednaccavs secesstedeecuetesheendvassecsdnetensvetens 2 35 Formatting Integer Modifiers i Yd x P0 cC 2 35 Formatting Floating Po
347. noLineAvailErr No line is available sI noChanAvailErr No channel is available chanBusyErr The specified channel is in use 10409 groupBusyErr The specified group is in use 0410 relatedLCGBusyErr A related line channel or group is in use if the driver configures the specified line channel or group the configuration data or handshaking lines for the related line channel or group will be disturbed counterBusyErr The specified counter is in use 10412 noGroupAssignErr No group is assigned or the specified line or channel cannot be assigned to a group 10413 groupAssignErr A group is already assigned or the specified line or channel is already assigned to a group continues 0402 040 noGroupA vailErr No group is available lineBusyErr The specified line is in use 0409 j Si LabWindows CVI Standard Libraries 10 60 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Table 10 5 Easy I O for DAQ Error Codes Continued 10414 reservedPinErr Selected signal indicates a pin reserved by NI DAQ You cannot configure this pin yourself 10440 sysOwnedRsrcErr The specified resource is owned by the driver and cannot be accessed or modified by the user 10441 memConfigErr No memory is configured to work with the current data transfer mode or the configured memory does not work with the current data transfer mode If block transfers are in use the memory mu
348. nsuccessful LoadExternalModule returns a negative error code Resolving External References from Object and Static Library Files on Windows 95 NT There is an important difference between loading an object or static library module and loading a DLL via an import library DLLs are prelinked that is when an DLL is loaded no external references need to be resolved Object and static library modules on the other hand do have external references that need to be resolved LoadExternalModule resolves them using symbols defined in the project or in object static library or import library modules that have already been loaded using LoadExternalModule This is true even when you call LoadExternalModule from a DLL LoadExternalModule does not use symbols in a DLL to resolve external references unless those symbols have been exported in the import library When you load an object or library module from a DLL you may want external references to be resolved through global symbols in the DLL that have not been exported in the import library If this is your intention you must call LoadExternalModuleEx rather than LoadExternalModule Using This Function pathname may be a relative or absolute pathname If it is a simple file name such as module obj LoadExternalModule attempts to find the file as follows 1 It first looks for the file in the project list 2 It then looks for the file in the directory that contains the currently load
349. nt memory to perform the operation GeneralXErr An Xlib function failed for some unknown reason BrokenConnectionXErr The connection to the X server was broken This occurs if the remote server terminated Parameter Discussion display must either be the predefined value CVIXDi splay or be the value returned by ConnectToXDisplay Use CVIXDisplay 1f the window is on the same display used by LabWindows CVI For the window parameter use CVIXRoot Window to access the default root window of the display used by LabWindows CVI Use CVIXHiddenWindow to access the hidden window associated with your application numberofItemsReturned will be less than or equal to the number of property items requested If the property does not exist on the window or there is no property value this value will be 0 You must check this value to determine if any property items were read LabWindows CVI Standard Libraries 9 24 National Instruments Corporation Chapter 9 X Property Library See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XGetWindowPropert y function InstallXPropertyCallback PropLibXErrType status InstallXPropertyCallback DisplayPtrx display const WindowX windowList unsigned int numberofWindows const PropertyHandleX propertyList unsigned int numberofProperties const void callbackData PropertyCallbackTypeX
350. ntains the five letters in HELLO and 123 zero bytes The standard XModem protocol only supports 128 and 1024 packet sizes The sender sends an SOH 0x01 character to indicate that the packet size is 128 or an STX character 0x02 to indicate that the packet size is 1024 LabWindows CVI attempts to support any packet size As a receiver when LabWindows CVI receives an STX character from the sender it switches to 1024 packet size regardless of what the user specifies When it receives an SOH character from the sender it uses the packet size specified by the user For transfers with a large packet size and a low baud rate a large delay period is recommended Example Receive the file c test data from COM1 NOTE use in path name in C instead of Y int ny OpenComConfig 1 9600 1 8 1 256 256 0 0 n XModemReceive 1 c test data if n 0 FmtOut Error d in receiving file rs232err else FmtOut File successfully received XModemSend int result XModemSend int COMPort char fileName Purpose Reads data from fileName file and sends it in packets over the com port specified by COMPort Parameters COMPort integer Range through 32 fileName string Contains the pathname LabWindows CVI Standard Libraries 5 34 National Instruments Corporation Chapter 5 RS 232 Library Return Value result integer Result of the XModem send operation lt 0 Failure 0
351. nters for counter timer functions table 10 7 EnableBreakOnLibraryErrors function 8 15 EnableInterrupts function 8 15 to 8 16 EnableTaskSwitching function 8 16 END message GPIB 4 9 end of string EOS character GPIB 4 9 end or identify EOI signal GPIB 4 9 errno global variable set by file I O functions 1 6 error codes control functions 1 8 X Property Library 9 4 to 9 6 National Instruments Corporation error conditions Analysis Library functions 3 37 DDE Library functions 6 23 to 6 24 Easy I O for DAQ Library 10 57 to 10 66 RS 232 Library functions 5 36 to 5 37 TCP Library functions 7 12 Error control GPIB 4 6 Error iberr global variable 4 6 4 11 error reporting Analysis Library functions 3 4 RS 232 Library functions 5 3 error related functions See also status functions DisableBreakOnLibraryErrors 8 11 to 8 12 EnableBreakOnLibraryErrors 8 15 GetAnalysisErrorString 3 19 GetBreakOnLibraryErrors 8 17 GetBreakOnProtectionErrors 8 18 GetDDEErrorString 6 15 to 6 16 GetFmtErrNdx 2 18 GetRS232ErrorString 5 22 GetTCPErrorString 7 8 GetXPropErrorString 9 15 ReturnRS232Err 5 28 SetBreakOnLibraryErrors 8 63 to 8 64 SetBreakOnProtectionErrors 8 64 to 8 65 example programs See formatting function programming examples scanning function programming examples ExecutableHasTerminated function 8 16 to 8 17 executables launching See standalone executables launching extended character sets
352. o 8 29 GetFullPathFromProject 8 29 to 8 30 GetInterruptState 8 30 GetKey 8 30 to 8 31 GetModuleDir 8 31 to 8 32 GetNextFile 8 33 GetPersistentVariable 8 33 to 8 34 GetProjectDir 8 34 GetStdioPort 8 35 GetStdioWindowOptions 8 35 to 8 36 GetStdioWindowPosition 8 36 to 8 37 GetStdioWindowSize 8 37 GetStdioWindow Visibility 8 37 to 8 38 GetSystemDate 8 38 GetSystemTime 8 39 GetWindowDisplaySetting 8 39 to 8 40 InitCVIRTE 8 40 to 8 42 inp 8 42 National Instruments Corporation I 17 Index inpw 8 42 to 8 43 InStandaloneExecutable 8 43 KeyHit 8 43 to 8 44 LaunchExecutable 8 44 to 8 46 LaunchExecutableEx 8 47 to 8 48 LoadExternalModule 8 49 to 8 52 LoadExternalModuleEx 8 52 to 8 54 MakeDir 8 54 to 8 55 MakePathname 8 55 outp 8 56 outpw 8 56 ReadFromPhysicalMemory function 8 57 ReadFromPhysicalMemoryEx 8 58 ReleaseExternalModule 8 59 RenameFile 8 60 to 8 61 RetireExecutableHandle 8 61 RoundRealToNearestInteger 8 61 to 8 62 RunExternalModule 8 62 to 8 63 SetBreakOnLibraryErrors 8 63 to 8 64 SetBreakOnProtectionErrors 8 64 to 8 65 SetDir 8 66 SetDrive 8 66 to 8 67 SetFileAttrs 8 67 to 8 68 SetFileDate 8 68 to 8 69 SetFileTime 8 70 SetPersistentVariable 8 71 SetStdioPort 8 71 to 8 72 SetStdioWindowOptions 8 72 to 8 74 SetStdioWindowPosition 8 74 to 8 75 SetStdioWindowSize 8 75 SetStdioWindow Visibility 8 76 SetSystemDate 8 76 SetSystemTime 8 77 SplitPath 8 77 to
353. o it and exchange information The server callback function will then be invoked as discussed in the following section The DDE Callback Function Callback functions provide the mechanism for sending and receiving data to and from other applications through DDE Similar to the method in which a callback function responds to user interface events from your User Interface Library object files a DDE callback function responds to incoming DDE information As shown in Table 6 2 a callback function in a client application can respond to only two types of DDE messages DDE_DISCONNECT and DDE_DATAREADY After you set up a warm link or hot link also called an advisory loop to another application the callback function defined in the SetUpDDEHotLink or SetUpDDEWarmLink function will be called whenever the data values change in the other application or when the other application is closed LabWindows CVI Standard Libraries 6 2 O National Instruments Corporation Chapter 6 DDE Library DDE callback functions used in a program that acts as a DDE server can be triggered in a number of ways from client applications Whenever a client application attempts to connect to your server program or requests information from your program the callback function in your program is executed to process the request The parameter prototypes for the DDE callback functions in LabWindows CVI are defined below int CallbackFun
354. o point to a data object that you need to access in the callback function In this way you would not need to declare the data object as a global variable If you do not want to use the callback data you can pass zero Note In the case of DDE_DISCONNECT the value of callbackData is undefined See Also ConnectToDDEServer UnregisterDDEServer LabWindows CVI Standard Libraries 6 18 O National Instruments Corporation Chapter 6 DDE Library ServerDDE Write int status ServerDDEWrite unsigned int conversationHandle char itemName unsigned int dataFormat void dataPointer unsigned int dataSize unsigned int timeout Purpose Writes data to a DDE client application when it requests data Parameters conversationHandle unsigned integer Uniquely identifies the conversation itemName string Uniquely identifies the output item for example system dataFormat unsigned integer Valid data format for example CF_TEXT dataPointer void pointer Buffer holding data dataSize unsigned integer Number of bytes to write Limited to 64 KB under Windows 3 1 and Windows 95 unsigned integer Timeout in ms Return Value integer Refer to error codes in Table 6 3 Parameter Discussion dataFormat must be a valid data format recognized by Microsoft Windows The following are the valid data formats supported by Microsoft Windows CF_
355. o produce correct results LabWindows CVI obtains time zone information from the environment variable named TZ if it exists The value of this variable should have the format AAA S HH MM BBB where optional items are in square brackets LabWindows CVI Standard Libraries 1 6 National Instruments Corporation Chapter 1 ANSI C Library The AAA and BBB fields specify the names of the standard and daylight savings time zones respectively such as EST for Eastern Standard Time and EDT for Eastern Daylight Time The optional sign field S indicates whether the local time zone is to the west or to the east of UTC Greenwich Mean Time The hour field HH and the optional minutes field MM specify the number of hours and minutes from UTC As an example the string ESTO5EDT specifies the time zone information for the eastern part of the United States The functions gmt ime Localtime and mkt ime make corrections for daylight savings time DST LabWindows CVI uses a set of rules for determining when daylight savings time begins and ends A string in the messages file cvimsgs txt in the LabWindows CVI bin directory specifies these rules The following is the default value of this string 1986 040102 0 110102 0 1967 040102 0 110102 0 This states that for the years from 1986 to the present DST begins at 2 00 a m on the first Sunday in April and ends at 2 00 a m on the last Sunday in October For the years from 1967 to
356. o use this function on Windows 95 or NT the LabWindows CVI low level support driver must be loaded Parameters physicalAddress unsigned The physical address to write to There are no integer restrictions on the address it can be above or below 1 MB sourceBuffer void pointer The buffer from which the physical memory is written numberOfBytes unsigned The number of bytes to copy to physical memory integer bytesAtA Time integer The unit size in which to copy the data Can be 1 2 or 4 LabWindows CVI Standard Libraries 8 86 O National Instruments Corporation Chapter 8 Utility Library Return Value Indicates whether the function succeeded Return Codes Success Failure reported by operating system or low level support driver not loaded or numberOfBytes is not a multiple of bytesAtA Time or invalid value for bytesAtA Time Parameter Discussion numberOfBytes must be a multiple of bytesAtA Time O National Instruments Corporation 8 87 LabWindows CVI Standard Libraries Chapter 9 X Property Library This chapter describes the functions in the Lab Windows CVI X Property Library The X Property Library contains functions that read and write properties to and from X Windows The X Property Library Overview section contains general information about the X Property Library functions and panels The X Property Library Function Reference section contains an alphabetical list of function descriptions Thes
357. oconncccnonocinoncccnonaccnoncnonononononcncnnncnnnns 3 1 Hints for Using Analysis Function Panels ooooonnnccnoconoccconacnonccannnnnnnon 3 3 Reporting Analysis Errors sas 3 4 Analysis Library Function Reference viciado di 3 4 ADD dl 3 4 AMD ii a 3 5 O Ta 3 5 A A E rer ne a 3 6 COPYUD aiii a a a asthe 3 7 EA cak ces Rea sini ct nite sect a e sad a ies teak ot edn alain 3 7 PAD a eh ad soe aie ghee ada a nt a de E ean had lod ads 3 8 Gs et ee RN NR o UO 3 9 O A EN 3 10 CELINE Y UD van leidas 3 11 EN ia 3 12 O 3 12 CR REGIP dan 3 13 CDi ia 3 14 A O 3 15 Determinant oe sad in 3 16 DTW D E egos dndahad septs eek geod ae TE 3 16 Div 2D sanidad dae ap aad ace ese aR Aue es 3 17 DAPR ads 3 18 GetAmal Y Ot i 3 19 Histogt M isa ad droit 3 19 o Re neea ds gest bac uce uss aa e seas aed a a oep unease amp 3 20 DAU ED A IA 3 21 A oleate sage ae dali g EAO ea estate ee ena 3 22 A sees a vadunsoeded a a ae E ee Ee 3 23 MaxMin D pesar i aia E EEE A ET a Eai 3 24 MaxMin Dorae E e e a ee 3 24 Met a ed ea 3 25 MUD areeiro eE a AR a T A E h 3 26 PETIT EEEE EE A E A E E E E 3 27 No e a 3 28 O O 3 28 e e a e loe 3 29 SHADE iii dio a 3 29 A O 3 30 S11 8A A TA 3 31 Subset Di 3 32 TOP td a e pe de dl da a Ee 3 32 LabWindows CVI Standard Libraries viii O National Instruments Corporation Contents O A OO 3 33 A ON 3 34 TORRE Dd E ee aetgaye 3 35 RO 3 36 Error COIN oee aana a AE E E EE aS E AATAS ASE e RET 3 37 Chapter 4 GPIB GPIB 488 2 Li
358. ode is a non zero value that specifies the type of error that occurred The currently defined error codes and their meanings are given in Table 5 6 Table 5 6 RS 232 Library Error Codes Unknown system error Invalid port number Port is not open Unknown I O error Unexpected internal error No serial port found Cannot open port Memory allocation error in creating buffers Invalid parameter Invalid baud rate Invalid parity Illegal number of data bits Illegal number of stop bits Bad file handle Error in performing file I O Invalid count Must be greater than or equal to 0 Invalid interrupt level VO operation timed out Value must be between 0 and 255 Requested input queue size must be 0 or greater Requested output queue size must be 0 or greater General I O error Buffer parameter is NULL Packet was sent but no acknowledgment was received continues LabWindows CVI Standard Libraries 5 36 National Instruments Corporation Chapter 5 RS 232 Library Table 5 6 RS 232 Library Error Codes Continued Packet not sent within retry limit Packet not received within retry limit End of transmission character encountered when start of data character expected Packet number could not be read Packet number inconsistency Packet data could not be read Checksum could not be read Checksum received did not match computed checksum Packet size exceeds input queue size Error opening file
359. odule int status ReleaseExternalModule int moduleID Purpose Decreases the reference count for a module loaded using LoadExternalModule When LoadExternalModule is called successfully on a module that module s reference count is incremented by one When you call ReleaseExternalModule its reference count is decremented by one If the reference count is decreased to zero then the module ID is invalidated and you cannot access the module through Get ExternalModuleAddr or RunExternalModule If in addition the module file is not in the project and not loaded as an instrument the external module is removed from memory If you want to unload the module regardless of the reference count call UnloadExternalModule rather than ReleaseExternalModule Use ReleaseExternalModule when multiple calls may have been made to LoadExternalModule on the same module and you do not want to unload the module in case it is still being used by other parts of the application Parameter moduleID The module ID returned by LoadExternalModule Return Value Indicates the result of the operation Return Codes Success but the module was not unloaded The value indicates the number of remaining references Success and the module was unloaded The module cannot be unloaded because it is referenced by another external module that is currently loaded Invalid module ID National Instruments Corporation 8 59 LabWindow
360. of seconds indicated by interval have elapsed since beginTime Parameters beginTime double precision Value returned by Timer interval double precision Number of seconds to wait after begin_time Parameter Discussion beginTime must be a value returned by the Timer function The resolution on Windows is normally 1 millisecond However if the following line appears in the CVI section of your WIN INT file the resolution is 55 milliseconds useDefaultTimer True The resolution on Sun Solaris is 1 millisecond Return Value None SystemHelp int status SystemHelp char helpFile unsigned int command unsigned long additionalLongData char additionalStringData Note This function is available only on the Windows versions of LabWindows CVI Purpose Starts Windows Help WINHELP EXE and passes optional data indicating the nature of the help requested by the application The application specifies the path of the help file that the application is to display For information about creating help files see the Microsoft Windows Programming Documentation not included with LabWindows CVI National Instruments Corporation 8 79 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameters helpFile string Points to a string containing the help file that the Help application is to display command unsigned integer Specifies the type of help requested additionalLongData unsign
361. on The items with an asterisk indicate the lines that the PC drives and all other items indicate the lines the PC monitors LabWindows CVI Standard Libraries 5 4 National Instruments Corporation Chapter 5 RS 232 Library All serial devices are either of the type Data Communication Equipment DCE or Data Transmission Equipment DTE The PC is of type DTE The difference between the two devices is in the meaning assigned to the pins A DCE device reverses the meaning of pins 2 and 3 4 and 5 and 6 and 20 In the simplest scenario a DTE device is attached to a DCE device such as a modem Therefore the cable required for a PC or DTE to talk to a device that is a DCE is shown in Table 5 3 Table 5 3 DTE to DCE Cable Configuration PC Connect pins as indicated TxD RxD RTS CTS DSR DTR common RxD TxD CTS RTS DTR DSR common You need a different cable for the PC to talk to a DTE device because both devices transmit data over pin 2 The cable to connect a PC to a DTE is called a null modem cable A null modem cable must be built as shown in Table 5 4 Table 5 4 PC to DTE Cable Configuration TxD RxD RTS CTS DSR DTR common RxD TxD CTS RTS DTR DSR common For further information on the meaning of DTE and DCE refer to a reference book on RS 232 communication In the simplest case a serial cable needs lines 2 3 and 7
362. on n Fmt target formatstring sourcel sourcen where format string contains the information to transform the source arguments to the target argument Format strings for all the formatting functions are of the form target_spec lt source_specs_and_literals where target_spec is a format specifier that describes the nature of the target data item and source_specs_and_literals is a sequence of format specifiers and literal characters that indicate how the source material is to be combined into the target Examples of format strings for the formatting functions are as follows Ss lt RANGE i The character lt is a visual reminder of the direction of the data transformation that is from the sources to the target and also separates the single target format specifier from the perhaps multiple source format specifiers and literals The target format specifier can be omitted in which case a s string format is assumed If the target format specifier is omitted the lt character can be omitted also or retained for clarity Notice that the target format specifier is located to the left of the lt symbol just as the target parameter is located to the left of the format string Likewise the source format specifiers are located to the right of the lt symbol just as the source parameters are located to the right of the format string National Instruments Corporation 2 33 LabWindows CVI Standard Libraries Forma
363. on an MIO non E Series board by setting portWidth to 8 e When portWidth is greater than the physical port width of a digital port the following restrictions apply The portWidth must be an integral multiple of the physical port width and the port numbers in the combined port must begin with the port named by portNumber and must increase consecutively For example if portNumber is 3 and portWidth is 24 bits LabWindows CVI uses ports 3 4 and 5 LabWindows CVI Standard Libraries 10 50 O National Instruments Corporation Chapter 10 Easy I O for DAQ Library e The portWidth for the 8255 based digital I O ports including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 should be at least 8 configure specifies whether to configure the digital port before reading e When this function is called in a loop it can be optimized by only configuring the digital port on the first iteration e When you configure a digital I O port that is part of an 8255 PPI including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 the 8255 PPI goes through a configuration phase where all the ports within the same PPI chip get reset to logic low regardless of the data direction The data directions on other ports however are maintained ReadFromDigitalPort short erro
364. on is called Pass O to disable callbacks Windows 3 1 See discussion below callbackFunction GPIBCallbackPtr The name of the user function that is called when the specified events occur See discussion below callbackData void pointer A pointer to a user defined four byte value that 1s passed to the callback function O National Instruments Corporation 4 15 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 Return Value status integer The same value as the ibsta status variable short integer on Refer to your NI 488 2 or NI 488 2M user Windows 3 1 manual for a description of the values of ibsta status variable eventMask The conditions upon which to invoke the callback function are specified as bits in the eventMask parameter The bits corresponds to the bits of the ibsta status word This value reflects a sum of one or more events If any one of the conditions occur the callback is called If when you install the callback one of the bits you have set in the mask is already TRUE the callback is scheduled immediately For example if you pass CMPL as the eventMask and the ibwait function would currently return a status word with CMPL set the callback is scheduled immediately If you are using a NI 488 2M native 32 bit driver then the following mask bits are valid e At the board level you can specify any of the status word bits that can be specified in the waitMask parameter to the ibw
365. on is received in the callback function a numeric display is updated by passing the data pointer value to a numeric control on the UIR file When the DDE event is DDE_DISCONNECT the DisconnectFromDDEServer function ends the DDE conversation and program execution is halted DDE Library Function Reference AdviseDDEDataReady int status AdviseDDEDataReady unsigned int conversationHandle char itemName unsigned int dataFormat void dataPointer unsigned int dataSize unsigned int timeout Purpose Called by a server to write data to a DDE client application The server should call this only when the value of a data item changes and a warm or hot link has been established for the data item Parameters conversationHandle unsigned integer Uniquely identifies the conversation itemName string Uniquely identifies the output item forexample system dataFormat unsigned integer Valid data format for example CF_TEXT dataPointer void pointer Pointer to buffer holding data dataSize unsigned integer Number of bytes in data Must be 0 if dataPointer is NULL Limited to 64 kbytes under Windows 3 1 and Windows 95 timeout unsigned integer Timeout in ms Return Value status integer Refer to error codes in Table 6 3 LabWindows CVI Standard Libraries 6 6 National Instruments Corporation Chapter 6 DDE Library Parameter Discussion dataFormat must be a valid data format recognized by Mic
366. on occurs during a call to any of the functions in the LabWindows CVI TCP Library the status return value contains the error code This code is a non zero value that specifies the type of error that occurred Error code return values are negative numbers The currently defined error codes and their associated meanings are shown in Table 7 3 Table 7 3 TCP Library Error Codes KkTCP_Nokrror kTCP_UnableToRegisterServic kTCP_UnableToEstablishConnection kTCP_ExistingServer kTCP_FailedToConnect kTCP_ServerNotRegistered kTCP_TooManyConnections kTCP_ReadFailed kTCP_WriteFailed kTCP_InvalidParameter kTCP_OutOfMemory kTCP_TimeOutErr kTCP_NoConnectionEstablished kTCP_Generall0Err kTCP_ConnectionClosed kTCP_UnableToLoadWinsockDLL kTCP_IncorrectWinsockDLLVersion kTCP_NetworkSubsystemNotReady kTCP_ConnectionsStillOpen LabWindows CVI Standard Libraries 7 12 National Instruments Corporation Chapter 8 Utility Library This chapter describes the functions in the LabWindows CVI Utility Library The Utility Library contains functions that do not fit into any of the other LabWindows CVI libraries The Utility Library Function Panels section contains general information about the Utility Library functions and panels The Utility Library Function Reference section contains an alphabetical list of function descriptions The Utility Library Function Panels The Utility Library function panels are g
367. ontains an alphabetical list of function descriptions In order to use this library in Microsoft Windows a version of WINSOCK DLL has to be present The DLL comes with the program that drives the network card TCP Library Function Overview This section contains general information about the TCP Library functions and network communication using TCP TCP Library functions provide a platform independent interface to the reliable connection oriented byte stream network communication protocol The TCP Library Function Panels The first and second level bold headings in the tree are the names of function classes and subclasses Function classes and subclasses are groups of related function panels The third level headings in plain text are the names of individual function panels Each TCP Library function panel generates one TCP Library function call The names of the corresponding TCP Library function calls appear in bold italics to the right of the function panel names The TCP Library function tree appears in Table 7 1 Table 7 1 The TCP Library Function Tree Server Functions Register TCP Server RegisterTCPServer Server TCP Read ServerTCPRead Server TCP Write ServerTCP Write Unregister TCP Server UnregisterTCPServer Disconnect TCP Client DisconnectTCPClient Client Functions Connect To TCP Server ConnectToTCPServer Client TCP Read ClientTCPRead Client TCP Write ClientTCP Write Disconnect From TCP Server DisconnectFromTCPServ
368. ontains data that is ready for TCP network transmission National Instruments Corporation 7 3 LabWindows CVI Standard Libraries TCP Library Parameters conversationHandle dataBuffer dataSize timeout unsigned integer void pointer unsigned integer Chapter 7 Uniquely identifies the conversation Buffer in which to receive data Maximum number of bytes to read Timeout in ms Return Value unsigned integer integer Returns the number of bytes read or a negative error code if an error occurs Refer to error codes in Table 7 3 See Also Connect ToTCPServer ClientTCPWrite ClientTCPWrite int status ClientTCPWrite unsigned int conversationHandle void dataPointer int dataSize unsigned int timeout Purpose Writes data to a TCP server application Parameters conversationHandle dataPointer dataSize timeout unsigned integer void pointer unsigned integer Uniquely identifies the conversation Buffer holding data Number of bytes to write Timeout in ms LabWindows CVI Standard Libraries unsigned integer 7 4 National Instruments Corporation Chapter 7 TCP Library Return Value status integer Returns the number of bytes written or a negative error code if an error occurs Refer to error codes in Table 7 3 See Also Connect ToTCPServer Client TCPRead ConnectToTCPServer int status ConnectToTCPServer unsigned int conv
369. open or parameter values are invalid ComFromFile int nbytes ComFromFile int COMPort int fileHandle int count int terminationByte Purpose Reads from the specified file and writes to output queue of the specified COM port National Instruments Corporation 5 9 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Parameters COMPort integer Range 1 through 32 file Handle integer File handle returned by OpenFile count integer If O this value is ignored terminationByte integer If 1 this value is ignored Return Value integer Number of bytes written to the output queue Error Refer to error codes in Table 5 6 Parameter Discussion Reads count bytes from the file unless it encounters terminationByte reaches EOF or encounters an error The function returns the number of bytes successfully written to the output queue The function returns immediately after placing all bytes in the output queue not when bytes have all been sent out the com port If count is zero the function terminates on terminationByte EOF or error If terminationByte is 1 it is ignored and the function terminates on count bytes written EOF or error If terminationByte is not 1 reading from the file stops when terminationByte is encountered It does not write terminationByte to the output queue If terminationByte is CR or LF then the function treats CR LF and LF CR combinations just as ComRdTerm does If bot
370. opertyHandlexX property Purpose Remove the property from a window This function deletes the property value and removes the property from the window Parameters display DisplayPtrX A pointer to the display of the X server to which the window belongs window WindowX The window from which the property is to be removed property PropertyHandlexX Handle of the property to be removed This value must have been obtained with CreateXProperty O National Instruments Corporation 9 31 LabWindows CVI Standard Libraries X Property Library Chapter 9 Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to one or more parameters InvalidDisplayXErr The display argument is not a valid display This argument must either be the predefined value CVIXDisplay or be the value returned by ConnectToXDisplay lidWindowXErr The window argument is not a valid window lidPropertyXErr The property argument is not a valid property handle This argument must be the value returned by CreateXProperty InsuffMemXErr There is insufficient memory to perform the operation BrokenConnectionXErr The connection to the X server was broken This occurs if the remote server terminated Parameter Discussion dis
371. or these integer values in format specifiers Alternatively you can specify an integer value using an argument in the argument list When you use this method substitute an asterisk for the constant in the format specifier You can use the asterisk in the following format specifier elements rep For integer or floating point arrays in For integer or floating point arrays or strings wn For any format specifier pn For floating point specifiers only en For floating point specifiers only rn For integer specifiers only When you use one or more asterisks instead of constants in a target specifier the arguments corresponding to the asterisks must appear after the format string in the same order as their corresponding asterisks appear in the format specifier When you use one or more asterisks instead of constants in a source specifier the arguments corresponding to the asterisks must precede the source argument and must be in the same order as their corresponding asterisks in the format specifier National Instruments Corporation 2 39 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Fmt FmtFile FmtOut Literals in the Format String Literal characters appearing in a formatting function format string indicate that the literal characters are to be combined with the source parameters in the appropriate positions They do not correspond to any source parameters but are copied directly into the target item
372. or checking on I O operations in this section except for the ASCII File to Two Integers with Error Checking example String to Integer char s int a n s 32 n Scan s Ss gt i amp a AE fesulti a 32 n 1 s 32 n Scan s Ss gt i amp a result a 32 n 1 s 32 n Scan s Ss gt i amp a E resulto a 32 n 1 s x32 n Scan s Ss gt i amp a result a n 0 Remarks When locating an integer in a string Scan skips over white space characters such as spaces tabs linefeeds and carriage returns If a non numeric character other than a white space character or is found before the first numeric character the Scan call fails Thus Scan fails on the xin x32 it leaves the value in a unmodified and returns zero indicating that no target specifiers were satisfied ars t032 n Scan s Ss gt i amp a result a 32 n 1 s 32a n Scan s Ss gt i amp a result a 32 n 1 s 32 n Scan s Ss gt 0 amp a result a 26 n 1 s 32 n Scan s s gt x amp a result a 50 n 1 Remarks When the i specifier is used numeric characters are interpreted as decimal even when they might appear to be octal as in 032 or hexadecimal asin 32a When the o specifier is used the numeric characters 01234567 are always interpreted as octal When the x specifier is
373. oration LabWindows CVI Standard Libraries Analysis Library Chapter 3 CxMul int status CxMul double xReal double xImaginary double yReal double yImaginary double outputReal double outputImaginary Purpose Multiplies two complex numbers The function obtains the resulting complex number by using the following formulas zr xr yr xi yi zi xr yi xi yr Parameters xReal double precision Real part of x xImaginary double precision Imaginary part of x yReal double precision Real part of y yImaginary double precision Imaginary part of y Output outputReal double precision Real part of z outputImaginary double precision Imaginary part of z Return Value CxMul1D int status CxMul1D double arrayXReal double arrayXImaginary double arrayYReal double arrayYImaginary J int numberofElements double outputArrayReal double outputArrayImaginary Purpose Multiplies two 1D complex arrays The function obtains the ith element of the resulting complex array by using the formulas Zr xm yr xi yi Zl Xn yl X1 yr LabWindows CVI Standard Libraries 3 12 National Instruments Corporation Chapter 3 Analysis Library The function performs the operations in place that is the input and output complex arrays can be the same Parameters arrayXReal double precision Real part of x array arrayXImaginary double precision Imaginary part of x array
374. ormat string argument The results of the transformations are placed into the targetptrl targetptrn arguments All of the above functions return the number of t arget format specifiers satisfied The function returns a 1 if there is an error in the format string The scanning functions break apart a source item into component parts and store the parts into parameters passed to the function The only difference between the three functions is the location of the source data For the function Scan the source item is a data item in memory which is passed to the function For ScanFile the source item is a file whose handle is passed as the first argument The handle is obtained by a call to the LabWindows CVI function OpenFile For the function ScantIn the source is taken from Standard In typically the keyboard and the source argument present in the other two functions is omitted All target parameters must be passed by reference LabWindows CVI Standard Libraries 2 40 National Instruments Corporation Chapter 2 Formatting and I O Library Scanning Functions Format String Consider the following scanning function n Scan source formatstring targetptrl targetptrn where format string contains the information to transform the source argument to the targetptr arguments Format strings for the scanning functions are of the following form source_spec gt target_specs_and_literals where source_spec is a format specif
375. orms continues LabWindows CVI Standard Libraries 10 2 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Table 10 1 Easy I O for DAQ Function Tree Continued Digital Input Output Read From Digital Line Read From Digital Port Write To Digital Line Write To Digital Port Counter Timer Counter Measure Frequency Counter Event or Time Configure Continuous Pulse Gen Configure Delayed Pulse Gen Configure Frequency Divider Configure Pulse Width or Period Meas Conf Counter Start Counter Read Counter Stop I Counter Control Miscellaneous Get DAQ Error Description Get Number Of Channels Get Channel Indices Get Channel Name From Index Get AI Limits of Channel Group By Channel Set Multitasking Mode ReadFromDigitalLine ReadFromDigitalPort Write ToDigitalLine Write ToDigitalPort CounterMeasureFrequency CounterEventOrTimeConfig Continuous PulseGenConfig DelayedPulseGenConfig FrequencyDividerConfig Pulse WidthOrPeriodMeasConfig CounterStart CounterRead CounterStop ICounterControl GetDAQErrorString GetNumChannels GetChannelIndices GetChannelNameFromIndex GetAILimitsOfChannel GroupByChannel SetEasyIOMultitaskingMode e The Analog Input function class contains all of the functions that perform A D conversions e The Asynchronous Acquisition function class contains all of the functions that perform asynchronous background A D conversions e The Analog Output funct
376. ort that you configure as input National Instruments Corporation 10 49 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Parameters device short integer Assigned by configuration utility portNumber string Specifies the digital port this function configures line short integer Specifies the individual bit or line within the port to be used for I O zero based portWidth short integer The total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port on an MIO non E Series board by setting portWidth to 8 configure long integer 1 Configure the digital port before reading 0 Don t configure the digital port before reading When this function is called in a loop it can be optimized by only configuring the digital port on the first iteration Output lineState unsigned Returns the state of the digital line 1 logical long integer high O logical low Return Value Parameter Discussion portNumber specifies the digital port this function configures e A portNumber value of 0 signifies port 0 a portNumber of signifies port 1 and so on If you use an SCXI 1160 SCXI 1161 SCXI 1162 or SCXI 1163 module use the SCx MDy 0 syntax where x is the chassis ID and y is the module device number to specify the port on a module portWidth is the total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port
377. ould make a call to Get Key to flush the keyboard buffer Otherwise KeyHit will continue to return 1 Note This function always returns 0 if you are running on UNIX and have done one of the following Selected Use hosts system s standard Input Output in the dialog box brought up by selecting Options Environment in the Project window or Called SetStdioPort to set the port to HOST_SYSTEM_STDIO Example flush any pending keystrokes while KeyHit GetKey perform loop indefinitely until the user presses key while KeyHit LaunchExecutable int result LaunchExecutable char fileName Purpose Starts running a program and returns without waiting for it to exit The program must be an actual executable that is you cannot launch commands intrinsic to a command interpreter Under Microsoft Windows the executable can be either an DOS or Windows executable including exe com bat and pif files If you need to execute a command built into command com such as copy dir and others you can call LaunchExecutable with the command command com C DosCommand args where DosCommand is the shell command you would like executed For example the following command string would copy file tmp from the temp directory to the tmp directory command com C copy c temp file tmp c tmp LabWindows CVI Standard Libraries 8 44 National Instruments Corporation Chapter 8 Util
378. ounter double frequency double dutyCycle unsigned short gateMode unsigned short pulsePolarity double actualFrequency double actualDutyCycle unsigned long taskID Purpose Configures a counter to generate a continuous TTL pulse train on its OUT pin The signal is created by repeatedly decrementing the counter twice first for the delay to the pulse phase 1 then for the pulse itself phase 2 The function selects the highest resolution timebase to achieve the desired characteristics You can also call the CounterStart function to gate or trigger the operation with a signal on the counter s GATE pin LabWindows CVI Standard Libraries 10 24 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Parameters device short Assigned by configuration utility integer counter string The counter to be used for the counting operation frequency double The desired repetition rate of the continuous pulse train dutyCycle double The desired ratio of the duration of the pulse phase phase 2 to the period phase 1 phase 2 gateMode unsigned Specifies how the signal on the counter s GATE pin short 1s used integer pulsePolarity unsigned The polarity of phase 2 of each cycle short integer actualFrequency double The achieved frequency based on the resolution and range of your hardware actualDutyCycle double The achieved duty cycle based on the resolution and range of your hardware
379. ows CVI Utility Library The Utility Library contains functions that do not fit into any of the other LabWindows CVI libraries The Utility Library Function Panels section contains general information about the Utility Library functions and panels The Utility Library Function Reference section contains an alphabetical list of function descriptions e Chapter 9 X Property Library describes the functions in the Lab Windows CVI X Property Library The X Property Library contains functions that read and write properties to and from X Windows The X Property Library Overview section contains general information about the X Property Library functions and panels The X Property Library Function Reference section contains an alphabetical list of function descriptions e Chapter 10 Easy I O for DAQ Library describes the functions in the Easy I O for DAQ Library The Easy I O for DAQ Library Function Overview section contains general information about the functions and guidelines and restrictions you should know when using the Easy I O for DAQ Library The Easy I O for DAQ Library Function Reference section contains an alphabetical list of function descriptions e Appendix A Customer Communication contains forms you can use to request help from National Instruments or to comment on our products and manuals e The Glossary contains an alphabetical list and description of terms used in this manual including abbreviations acronyms metric prefixes mnemo
380. pass 0 as the iterations parameter you need to pass the taskID to AOClearWaveforms to clear the waveform generation Return Value Parameter Discussion channelString is the analog output channels to which the voltages are applied Refer to the Channel String for Analog Output Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter for the syntax of this string National Instruments Corporation 10 21 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 updatesPerChannel is the number of D A conversions that compose a waveform for a particular channel If updatesPerChannel is 10 then each waveform is composed of 10 elements from the waveforms array iterations is the number of waveform iterations that are performed before the operation is complete If you pass 0 the waveform s are generated continuously and you need to call AOClearWaveforms to clear waveform generation waveforms is the array containing the voltages to be applied to the channels specified in the channelString The voltages are applied to the analog output channels in the order specified in the channelString For example if the channelString is 19235 the array should contain the voltages in the following order waveforms 0 the lst update on channel 0 waveforms 1 the 1st update on channel 1 waveforms 2 the 1st update on channel 2 waveforms 3 the 1st
381. pears in the file The two choices are as follows e VAL_GROUPS_AS_COLUMNS e VAL_GROUPS_AS_ROWS If there is only one group VAL_GROUPS_AS_COLUMNS specifies that each value in the file is on a separate line FileType specifies whether the file is in ASCII or binary format The choices are as follows e VAL_ASCII VAL_BINARY LabWindows CVI Standard Libraries 2 12 National Instruments Corporation Chapter 2 Formatting and I O Library FillBytes void FillBytes char buffer int startingIndex int numberofBytes int value Purpose Sets the numberofBytes bytes starting at position startingIndex of buffer to the value in the lower byte of value startingIndex is zero based Parameters buffer Destination buffer startingIndex Starting position in buffer numberofBytes Number of bytes to fill value Value to place in bytes Return Value None FindPattern int ndx FindPattern char buffer int startingIndex int numberofBytes char pattern int caseSensitive int startFromRight Purpose Searches a character buffer for a pattern of bytes The pattern of bytes is specified by the string pattern Parameters buffer Buffer to be searched startingIndex Starting position in buffer numberofBytes Number of bytes to search pattern Pattern to search for caseSensitive Case sensitivity mode startFromRight Direction of search National Instruments Corporation 2 13 LabWindows CVI Standard
382. pertyCallback function 9 4 9 25 to 9 27 InStandaloneExecutable function 8 43 integer modifiers i d x 0 c formatting functions 2 35 to 2 37 scanning functions 2 43 to 2 45 interrupts DisableInterrupts function 8 12 EnableInterrupts function 8 15 to 8 16 GetInterruptState function 8 30 O National Instruments Corporation hardware interrupts and autopolling 4 8 to 4 9 InvMatrix function 3 20 to 3 21 K keyboard utility functions GetKey 8 30 to 8 31 KeyHit 8 43 to 8 44 L LaunchExecutable function 8 44 to 8 46 LaunchExecutableEx function 8 47 to 8 48 launching executables See standalone executables launching LC_COLLATE locale 1 5 LC_CTYPE locale 1 4 to 1 5 LC_MONETARY locale 1 4 LC_NUMERIC locale 1 4 LC_TIME locale 1 5 LinEv1D function 3 21 LinEv2D function 3 22 literals in format string formatting functions 2 40 scanning functions 2 48 to 2 49 LoadExternalModule function 8 49 to 8 52 LoadExternalModuleEx function 8 52 to 8 54 local functions GPIB 488 2 Library 4 4 locale See C locale low level I O functions ANSIC Library 1 2 GPIB 488 2 Library 4 4 M MakeDir function 8 54 to 8 55 MakePathname function 8 55 managing property information See property information managing manual See documentation mathematical functions ANSI C 1 6 National Instruments Corporation I 11 Index matrix algebra functions See vector and matrix algebra functions MatrixMul f
383. physical memory addresses Supported only under Microsoft Windows e Persistent Variable functions store and retrieve an integer value across multiple builds and executions of a project in the LabWindows CVI development environment e Task Switching functions control whether a user can switch to another task under Microsoft Windows Launching Executables functions start another executable check whether it is still running and terminate it e Miscellaneous functions perform a variety of operations that do not fit into any of the other function classes The online help with each panel contains specific information about operating each function panel Utility Library Function Reference This section describes the functions in the LabWindows CVI Utility Library The LabWindows CVI Utility Library functions are arranged alphabetically Beep void Beep void Purpose Sounds the speaker Parameters None Return Value None National Instruments Corporation 8 5 LabWindows CVI Standard Libraries Utility Library Chapter 8 Breakpoint void Breakpoint void Purpose During execution of a program a call to Breakpoint suspends program operation While the program is suspended you can inspect or modify variables and use many other features of the LabWindows CVI interactive program Calling Breakpoint with the debugging level set to None or from a compiled module has no effect Parameters None Return Value None Clos
384. play must either be the predefined value CVIXDisplay or be the value returned by ConnectToXDisplay Use CVIXDisplay if the window is on the same display used by LabWindows CVI For the window parameter use CVI XRoot Window to access the default root window of the display used by LabWindows CVI Use CVIXHiddenWindow to access the hidden window associated with your application See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XDeleteProperty function LabWindows CVI Standard Libraries 9 32 National Instruments Corporation Chapter 9 X Property Library UninstallXPropertyCallback PropLibXErrType status UninstallXPropertyCallback PropertyCallbackTypex callbackFunction Purpose Uninstall a property callback function After a callback function is uninstalled it is no longer called when properties change All property callback functions are automatically uninstalled when the program terminates Note Although you cannot selectively uninstall certain properties or windows associated with a callback function you can reinstall a callback function with a new set of windows and properties using Install1XPropertyCallback Parameters Input callbackFunction PropertyCallbackTypex The function that was installed with InstallXPropertyCallback Return Values The return value indicates the success or fa
385. put outputReal double precision Real part of z outputImaginary double precision __ Imaginary part of z Return Value CxAdd1D int status CxAdd1D double arrayXReal double arrayXImaginary double arrayYReal double arrayYImaginary int numberofElements double outputArrayReal double outputArrayImaginary Purpose Adds two 1D complex arrays The function obtains the ith element of the resulting complex array by using the following formulas The function performs the operations in place that is the input and output complex arrays can be the same Parameters array XReal double precision array Real part of x array XImaginary double precision array Imaginary part of x arrayY Real double precision array Real part of y array Y Imaginary double precision array Imaginary part of y numberofElements integer Number of elements Output outputArrayReal double precision array Real part of z outputArrayImaginary double precision array Imaginary part of z LabWindows CVI Standard Libraries 3 8 National Instruments Corporation Chapter 3 Analysis Library Return Value status integer Refer to error codes in Table 3 2 CxDiv int status CxDiv double xReal double xImaginary double yReal yImaginary double outputReal double outputImaginary Purpose Divides two complex numbers The function obtains the resulting complex number by using the following formulas z
386. r xr yr xi yi yr2 yi2 zi xi yr xr yi r2 yi2 Parameters xReal double precision Real part of x xImaginary double precision Imaginary part of x yReal double precision Real part of y yImaginary double precision Imaginary part of y Output outputReal double precision Real part of z outputImaginary double precision Imaginary part of z Return Value status integer Refer to error codes in Table 3 2 National Instruments Corporation 3 9 LabWindows CVI Standard Libraries Analysis Library Chapter 3 CxDiv1D int status CxDiv1D double arrayXReal double arrayXImaginary double arrayYReal double arrayYImaginary int numberofElements double outputArrayReal double outputArrayImaginary Purpose Divides two 1D complex arrays The function obtains the ith element of the resulting complex array by using the following formulas zr xr yr xi yi yr yi zi xi yr xr yi yr yi The function performs the operations in place that is the input and output complex arrays can be the same Parameters arrayXReal double precision Real part of x array array XImaginary double precision Imaginary part of x array array Y Real double precision Real part of y array array YImaginary double precision Imaginary part of y array numberofElements integer Number of elements outputArrayReal double precision Real part of z array ou
387. r ReadFromDigitalPort short device char portNumber short portWidth 1ong configure unsigned long pattern Purpose Reads a digital port that you configure for input Parameters device short integer Assigned by configuration utility portNumber string Specifies the digital port this function configures line short integer Specifies the individual bit or line within the port to be used for I O portWidth short integer The total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port on an MIO non E Series board by setting portWidth to 8 configure long integer 1 Configure the digital port before reading 0 Don t configure the digital port before reading When this function is called in a loop it can be optimized by only configuring the digital port on the first iteration Output pattern unsigned The data read from the digital port long integer National Instruments Corporation 10 51 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Return Value short integer Refer to error codes in Table 10 5 Parameter Discussion portNumber specifies the digital port this function configures A portNumber value of 0 signifies port 0 a portNumber of 1 signifies port 1 and so on If you use an SCXI 1160 SCXI 1161 SCXI 1162 or SCXI 1163 module use the SCx MDy 0 syntax where x is the chassis ID and y is the module device number to spe
388. r be a value returned by CreateXPropType Output typeName character pointer The property type name passed by reference Warning The typeName pointer points to memory allocated by CreateXPropType You must not attempt to free this pointer or to change its contents Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamXErr NULL was passed to the name parameter InvalidPropTypexErr The propertyType argument is not a valid property type This value must either be one of the predefined property types or be a value returned by CreateXPropType National Instruments Corporation 9 17 LabWindows CVI Standard Libraries X Property Library Chapter 9 See Also CreateXPropType GetXPropTypeSize PropLibXErrType status GetXPropTypeSize PropTypeHandlexX propertyType unsigned int size Purpose Gets a property type size This function returns the size associated with the property type The size 1s the number of bytes in a single property item Parameters Input propertyType PropTypeHandleX Handle to property type for which the size 1s to be obtained This value must either be one of the predefined property types or be a value returned by CreateXPropType unsigned integer The size associated with the property type passed by referen
389. ration e When you configure a digital I O port that is part of an 8255 PPI including all digital ports on Lab boards SCXI 1200 DAQPad 1200 DAQCard 1200 DIO 24 DIO 32F DIO 96 and AT MIO 16DE 10 AT MIO 16D ports 2 3 and 4 the 8255 PPI goes through a configuration phase where all the ports within the same PPI chip get reset to logic low regardless of the data direction The data directions on other ports however are maintained WriteT oDigitalPort short error WriteToDigitalPort short device char portNumber short portWidth long configure unsigned long pattern Purpose Outputs a decimal pattern to a digital port Parameters device short integer Assigned by configuration utility portNumber string Specifies the digital port this function configures portWidth short integer The total width in bits of the port For example you can combine two 4 bit ports into an 8 bit port on an MIO non E Series board by setting portWidth to 8 configure long integer 1 Configure the digital port before writing 0 Don t configure the digital port before writing When this function is called in a loop it can be optimized by only configuring the digital port on the first iteration pattern unsigned Specifies the new state of the lines in the port long integer National Instruments Corporation 10 55 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Return Value short integer Refer to
390. ration Chapter 9 X Property Library default root window of the display used by LabWindows CVI Use amp CVIXHiddenWindow to specify the hidden window associated with your application If numberofProperties is 0 or the propertyList value is ANY_X_PROPERTY the callback function is called whenever any property changes on any of the windows in the windowList The values in the propertyList array must have been obtained with CreateXProperty To specify a single property named prop pass the expression amp prop for this parameter and pass 1 for the numberOfProperties If this value is ANY_X_PROPERTY or the numberOfProperties is 0 the callback function is called whenever any property changes on any of the windows in the windowList See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the Propert yNotify event PutX WindowPropertylItem PropLibXErrType status PutX WindowPropertyltem DisplayPtrx display WindowX window PropertyHandleX property void propertyItem Purpose This function stores the supplied property item with the specified property on the window Any existing property value is replaced by this value To store multiple property items use the function Put XWindowPropertyValue Parameters display DisplayPtrX A pointer to the display of the X server to which the window belongs window WindowX The window on which the prop
391. re String Containing an IEEE Format Real Number to a Real Variable char s 100 double x Scan s SIELZIL gt SE EX Scan s S1lf zi5 gt Sf amp x Remarks This example is similar to the previous example except that s contains a single binary real number in IEEE format rather an array of binary integers The format string in each Scan call indicates that the source s is to be treated as a 1 element array of real numbers The z modifier indicates that the source is actually a character buffer The repetition count of 1 in the format string is required otherwise the z modifier is not accepted National Instruments Corporation 2 67 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 The first call to Scan assumes that the real number is at the beginning of s The second call assumes that the real number starts at the sixth byte of s The i5 modifier causes the first 5 bytes of s to be ignored ASCII File to Two Integers with Error Checking int file_handle n a b file handle OpenFile FILE DAT 1 2 1 if file_handle lt 0 FmtOut Error opening file n exit 1 n ScanFile file handle s gt i i amp a amp b if n 2 FmtOut Error reading file n exit 1 CloseFile file handle Remarks OpenFile opens the file FILE DAT as an ASCII file for reading only If OpenFile succeeds in opening the file it returns a f
392. receiver appears to lose data transmitted by the sender This condition typically results from the input queue of the receiver not being emptied quickly enough Handshaking prevents overflow of the input queue that occurs when the receiver is unable to empty its input queue as quickly as the sender is able to fill it The RS 232 Library has two types of handshaking software handshaking and hardware handshaking You should enable one or the other if you want to ensure that your application program synchronizes its data transfers with other serial devices that perform handshaking Software Handshaking The Set XMode function enables software handshaking You can use software handshaking when you are transferring ASCII data or text and your serial device uses software handshaking The RS 232 Library performs software handshaking by sending and monitoring incoming data for special data bytes XON and XOFF or decimal 17 and 19 These bytes indicate whether the receiver is ready to receive data You must not enable software handshaking when transmitting binary data because the special XON XOFF characters can occur as part of the data stream and are mistaken as control codes However you can enable hardware handshaking regardless of the type of data transferred No special cable configuration is required to perform software handshaking LabWindows CVI Standard Libraries 5 6 National Instruments Corporation Chapter 5 RS 232 Library Hardware H
393. recognize 10246 communicationsErr The driver is unable to communicate with the specified external device 10247 emosConfigErr The CMOS configuration memory for the computer is empty or invalid or the configuration specified does not agree with the current configuration of the computer 10248 dupAddressErr The base addresses for two or more devices are the same consequently the driver is unable to access the specified device 10249 intConfigErr The interrupt configuration is incorrect given the capabilities of the computer or device 10250 dupIntErr The interrupt levels for two or more devices are the same 10251 dmaConfigErr The DMA configuration is incorrect given the capabilities of the computer DMA controller or device dupDMAErr The DMA channels for two or more devices are the same 210253 switchlessBoardErr NI DAQ was unable to find one or more switchless boards you have configured using WOAQCONF 0254 DAQCardConfigErr Cannot configure the DAQCard because 1 The correct version of card and socket services software is not installed 2 The card in the PCMCIA socket is not a DAQCard 3 The base address and or interrupt level requested are not available according to the card and socket services resource manager Try different settings or use AutoAssign in the NIDAQ configuration utility continues National Instruments Corporation 10 59 LabWindows CVI Standard Libraries Easy I O for DAQ
394. rix LabWindows CVI Standard Libraries 3 20 O National Instruments Corporation Chapter 3 Analysis Library Return Value status integer Refer to error codes in n Table 3 2 LinEv1D int status LinEv1D double inputArray int numberofElements double multiplier double additiveConstant double outputArray Purpose Performs a linear evaluation of a 1D array The function obtains the ith element of the output array by using the following formula y a x b The operation can be performed in place that is inputArray and outputArray can be the same array Parameters inputArray double precision Input array array numberofElements integer Number of elements multiplier double precision Multiplicative constant additiveConstant double precision Additive constant outputArray double precision Linearly evaluated array array Return Value status integer Refer to error codes in Table 3 2 National Instruments Corporation 3 21 LabWindows CVI Standard Libraries Analysis Library Chapter 3 LinEv2D int status LinEv2D void inputArray int numberofRows int numberofColumns double multiplier double additiveConstant void outputArray Purpose Performs a linear evaluation of a 2D array The function obtains the ith jth element of the output array by using the following formula g Ye a x b The function performs the operation in place that is inputArray and outputArray ca
395. rmat fileLayout specifies how the data appears in the file The two choices are as follows e VAL _GROUPS_AS COLUMNS e VAL _GROUPS_AS_ROWS If you have only one group use VAL_GROUPS_AS_ COLUMNS to write each array element on a separate line If you specify that multiple values be written on each line colSepStyle specifies how the values are separated The choices are as follows e VAL CONST _WIDTH constant field width for each column e VAL_SEP_BY_comMA values followed by commas except last value on line e VAL_SEP_BY_TAB values separated by tabs If you have specified a colSepStyle of VAL_CONST_WIDTH field Width specifies the width of the columns FileType specifies whether to create the file in ASCII or binary format The choices are as follows e VAL_ASCII e VAL_BINARY FileAction specifies the location in the file to begin writing data if the named file already exists The choices are as follows e VAL_TRUNCATE Positions the file pointer to the beginning of the file and deletes its prior contents e VAL_APPEND AIl write operations append data to file e VAL_OPEN_AS_1S Positions the file pointer at the beginning of the file but does not affect the prior file contents LabWindows CVI Standard Libraries 2 6 National Instruments Corporation Chapter 2 Formatting and I O Library CloseFile int status CloseFile int fileHandle Purpose Closes the file associated with fileHandle fileHa
396. rmat type status returns a positive number representing the number of bytes that were successfully read A negative number corresponds to the error code LabWindows CVI Standard Libraries 6 12 O National Instruments Corporation Chapter 6 DDE Library See Also Connect ToDDEServer ClientDDERead ConnectToDDEServer int status ConnectToDDEServer unsigned int conversationHandle char serverName char topicName ddeFuncPtr clientCallbackFunction void callbackData Purpose Establishes a connection conversation between your program and a named server on a given topic name Parameters serverName string Name of the server application topicName string Specifies the type of conversation with the server clientCallbackFunction DDE function Pointer to the user callback pointer function callbackData void pointer User defined data Output conversationHandle unsigned integer Uniquely identifies the conversation Return Value status integer Refer to error codes in Table 6 3 Parameter Discussion The conversationHandle returns an integer value that uniquely represents a conversation between a server and a client serverName and topicName must be strings of length from to 255 They are used without regard to case Each server application defines its own set of valid topic names Refer to the command function reference manual for the server application A client and a server can have
397. rminant void inputMatrix int matrixSize double determinant Purpose Finds the determinant of a matrixSize by matrixSize 2D input matrix Parameters inputMatrix double precision 2D Input matrix matrixSize Dimension size of input matrix Note The input matrix must be a matrixSize by matrixSize square matrix Return Value status integer Refer to error codes in Table 3 2 Div1D int status Div1D double arrayX double arrayY int numberofElements double outputArray Purpose Divides two 1D arrays The function obtains the ith element of the output array by using the following formula Zz x y The function performs the operation in place that is outputArray can be the same array as either arrayX or arrayY LabWindows CVI Standard Libraries 3 16 National Instruments Corporation Chapter 3 Analysis Library Parameters arrayX double precision Input array array array Y double precision Input array array numberofElements integer Number of elements to be divided array Return Value Div2D int status Div2D void arrayX void arrayY int numberofRows int numberofColumns void outputArray Purpose Divides two 2D arrays The function obtains the ith jth element of the output array by using the following formula Zij Xi Vij The function performs the operation in place that is outputArray can be the same array as either arrayX or array Y Parameters
398. rminated 2 65 to 2 66 string containing binary integers to integer array 2 67 string containing IEEE format real number to real variable 2 67 to 2 68 string to integer 2 59 to 2 60 string to integer and real 2 61 string to integer and string 2 63 string to long integer 2 60 string to real 2 60 to 2 61 after finding semicolon in string 2 64 after finding substring in string 2 64 skipping over non numeric characters 2 63 string to string 2 62 string with comma separated ASCII numbers to real array 2 65 LabWindows CVI Standard Libraries I 14 scanning functions See also Formatting and VO Library functions formatting functions string manipulation functions asterisks instead of constants in format specifiers 2 48 format string 2 41 to 2 43 introductory examples 2 31 to 2 32 literals in format string 2 48 to 2 49 purpose and use 2 40 Scan 2 24 2 40 ScanFile 2 25 2 40 ScanIn 2 25 to 2 26 2 40 special nature of 2 3 to 2 4 scanning modifiers See also formatting modifiers floating point modifiers f 2 45 to 2 46 integer modifiers i Yd x 0 c 2 43 to 2 45 string modifiers s 2 46 to 2 48 serial communications functions See RS 232 Library functions serial poll functions GPIB 488 2 Library 4 4 serial polling automatic See automatic serial polling ServerDDEWrite function 6 19 to 6 20 ServerTCPRead function 7 10 ServerTCPWrite function 7 11 Set1D function 3 28 SetBreakOnLibraryE
399. rosoft Windows The following are the valid data formats supported by Microsoft Windows CF_TEXT CF_PALET CF_BITMAP CF_PENDATA CF_METAFILEPICT CF_RIFF CF_SYLK CF_WAVE CED EE CF_OWNERDISPLAY CF_TIFF CF_DSPTEXT CF_OEMTEXT CF_DSPBITMAP CF_DIB CF_DSPMETAFILEPICT The Microsoft Windows 3 x Programmer s Reference contains an in depth discussion of DDE programming and meaning of each data format type Using This Function This function allows your program acting as a DDE server to send data to a client that has set up a hot or warm link When a hot or warm link is set up your server callback function receives a DDE_ADVISELOOP transaction type xType for a particular data object identified by itemName When the hot or warm link is terminated your server callback function receives a DDE_ADVISESTOP transaction type for the data object During the period when the hot or warm link is in effect your server program is responsible for notifying the client whenever the value of the data object changes When the data object s value changes you can call this function AdviseDDEDataReady or BroadcastDDEDataReady AdviseDDEDataReady differs from BroadcastDDEDataReady in that you specify a particular conversation with a client AdviseDDEDat aReady sends the data only to the specified client even 1f other clients have hot or warm li
400. rouped in a tree structure according to the type of operations they perform The Utility Library function tree is shown in Table 8 1 The bold headings in the tree are the names of function classes Function classes are groups of related function panels The headings in plain text are the names of the individual function panels The names of the Utility Library functions appear in bold italics beneath the corresponding function panel names Table 8 1 The Utility Library Function Tree Timer Wait Timer Timer Delay Delay Synchronized Wait Sync Wait Date Time Date in ASCII Format DateStr Time in ASCII Format TimeStr Get System Date GetSystemDate Set System Date SetSystemDate Get System Time GetSystemTime Set System Time SetSystemTime Keyboard Key Hit KeyHit Get a Keystroke GetKey continues National Instruments Corporation 8 1 LabWindows CVI Standard Libraries Utility Library Chapter 8 Table 8 1 The Utility Library Function Tree Continued File Utilities Delete File Rename File Copy File Get File Size Get File Date Set File Date Get File Time Set File Time Get File Attributes Set File Attributes Get First File Get Next File Make Pathname Split Path Directory Utilities Get Directory Get Project Directory Get Module Directory Get Full Path From Project Set Directory Make Directory Delete Directory Get Drive Set Drive External Modules Load External Module Load External Module Ex Run External
401. rporation 5 1 LabWindows CVI Standard Libraries RS 232 Library Table 5 1 The RS 232 Library Function Tree Continued Read To File Write Buffer Write Byte Write From File XModem XModem Send File XModem Receive File XModem Configure Control Set Time out Limit Set XON XOFF Mode Set CTS Mode Flush Input Queue Flush Output Queue Send Break Signal Set Escape Code ComToFile ComWrt ComWrtByte ComFromFile XModemSend XModemReceive XModemConfig SetComTime SetXMode SetCTS Mode FlushInQ FlushOutQ ComBreak ComSetEscape Chapter 5 Status Get COM Status GetComStat Get Input Queue Length GetInQLen Get Output Queue Length GetOutQLen Return RS232 Error ReturnRS232Err Get Error String GetRS232ErrorString Callbacks Install COM Callback InstallComCallback The classes and subclasses in the tree are described below e The Open Close function panels open close and configure a com port The Input Output function panels read from and write to a com port The XModem function panels transfer files using the XModem protocol e The Control function panels set the time out limit set communication modes flush the I O queues and send the break signal e The Status function panels return the com port status and the length of the I O queues e The Callbacks function panel installs callback functions for COM events The online help with each panel contains specific information about operating each functio
402. rrors function 8 63 to 8 64 SetBreakOnProtectionErrors function 8 64 to 8 65 SetComTime function 5 29 SetCTSMode function 5 7 5 30 SetDir function 8 66 SetDrive function 8 66 to 8 67 SetEasyIOMultitaskingMode function 10 53 SetFileAttrs function 8 67 to 8 68 SetFileDate function 8 68 to 8 69 SetFilePtr function 2 26 to 2 28 SetFileTime function 8 70 SetPersistent Variable function 8 71 SetStdioPort function 8 71 to 8 72 National Instruments Corporation SetStdioWindowOptions function 8 72 to 8 74 SetStdioWindowPosition function 8 74 to 8 75 SetStdioWindowSize function 8 75 SetStdioWindow Visibility function 8 76 SetSystemDate function 8 76 SetSystemTime function 8 77 SetUpDDEHotLink function 6 2 6 4 6 20 to 6 21 SetUpDDEWarmLink function 6 2 6 4 6 21 to 6 22 SetX Mode function 5 6 5 31 software handshaking 5 6 Sort function 3 29 SplitPath function 8 77 to 8 78 SRQ functions GPIB 488 2 Library function tree 4 4 Windows NT and Windows 95 asynchronous callbacks 4 12 device version requirements 4 12 synchronous callbacks 4 12 SRQI event and auto serial polling ibInstallCallback function 4 17 ibNotify function 4 19 standalone executables launching ExecutableHasTerminated function 8 16 to 8 17 LaunchExecutableEx function 8 47 to 8 48 RetireExecutableHandle function 8 61 TerminateExecutable function 8 82 Standard Input Output window functions GetStdioPort 8 35 GetStdioWindowOptions
403. rticular conversation 2 Establishes a DDE warm link with a particular cell in the Excel worksheet The function SetUpDDEWarmLink with the cell address R5C2 as the item name establishes a DDE link between the cell in the worksheet Thereafter whenever the value of cell B5 row 5 column 2 changes Excel sends information to LabWindows CVI by triggering the clientCallbackFunction 3 Sends data to the Excel worksheet from LabWindows CVI After the data is formatted as a string it is sent to Excel using the ClientDDEWrite function with the Excel cell region R1C2 R50C2 as the item name and the character array containing 50 elements as the buffer pointer 4 The callback function responds to DDE transactions from the Excel worksheet The callback function automatically returns the following information handle The conversation which triggered the callback multiple DDE conversations can be processed by the same callback function item name The cell s involved topic name The Excel system or file in Excel involved transaction type Either DDE_DATAREADY or DDE_DISCONNECT data format CF_TEXT in this case data size Number of bytes in the data data pointer Pointer to the data callback data User defined NULL in this case National Instruments Corporation 6 5 LabWindows CVI Standard Libraries DDE Library Chapter 6 When the DDE_DATAREADY transacti
404. ry Error Conditions If an error condition occurs during a call to any of the functions in the LabWindows CVI Analysis Library the status return value contains the error code This code is a value that specifies the type of error that occurred The currently defined error codes and their associated meanings are given in Table 3 2 Table 3 2 Analysis Library Error Codes Symbolic Name BaseGETopAnlysErr Base must be less than Top DivByZeroAnlysErr Divide by zero err IndexLengthAnlys The following condition must be met 0 lt index length lt samples NoAnlysErr No error the call was successful OutOfMemAnlysE There is not enough space left to perform the specified routine SamplesGEZeroAnlysE The number of samples must be greater than or equal to zero SamplesGTZeroAnlysErr The number of samples must be greater than zero SingularMatrixAnlysE The input matrix is singular The system of equations cannot be solved National Instruments Corporation 3 37 LabWindows CVI Standard Libraries Chapter 4 GPIB GPIB 488 2 Library This describes the NI 488 and NI 488 2 functions in the LabWindows CVI GPIB Library as well as the Device Manager functions in LabWindows CVI The GPIB Library Function Overview section contains general information about the GPIB Library functions and panels the GPIB DLL and guidelines and restrictions you should know when using the GPIB Librar
405. ry File Assuming a Fixed Number of Elements Real Array to Binary File Assuming a Fixed Number of Elements Real Array to Binary File Assuming a Variable Number of Elements A Variable Portion of a Real Array to a Binary File Concatenating Two Strings Appending to a String Creating an Array of File Names Writing a Line Containing an Integer with Literals to the Standard Output Writing to the Standard Output without a Linefeed Carriage Return The Scan ScanFile ScanIn examples are logically organized as shown String to Integer String to Long Integer String to Real National Instruments Corporation 2 49 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 String to Integer and Real String to String String to Integer and String String to Real Skipping over Non Numeric Characters in the String String to Real after Finding a Semicolon in the String String to Real after Finding a Substring in the String String with Comma Separated ASCII Numbers to Real Array Scanning Strings That Are Not NUL Terminated Integer Array to Real Array Integer Array to Real Array with Byte Swapping Integer Array Containing 1 Byte Integers to Real Array String Containing Binary Integers to Integer Array String Containing an IEEE Format Real Number to a Real Variable ASCII File to Two Integers with Error Checking ASCII File with Comma Separated Numbers to Real Array with Number of Elements at Beginning of File Binary Fil
406. s Data Acquisition Hardware Revision Interrupt Level of Hardware DMA Channels of Hardware Base I O Address of Hardware NI DAQ LabVIEW or LabWindows Version Other Products Computer Make and Model Microprocessor Clock Frequency Type of Video Board Installed Operating System Operating System Version Operating System Mode Programming Language Programming Language Version Other Boards in System Base I O Address of Other Boards DMA Channels of Other Boards Interrupt Level of Other Boards Documentation Comment Form National Instruments encourages you to comment on the documentation supplied with our products This information helps us provide quality products to meet your needs Title LabWindows CVI Standard Libraries Reference Manual Edition Date July 1996 Part Number 320682C 01 Please comment on the completeness clarity and organization of the manual If you find errors in the manual please record the page numbers and describe the errors Thank you for your help Name Title Company Address Fax Phone Mail to Technical Publications Fax to Technical Publications National Instruments Corporation National Instruments Corporation 6504 Bridge Point Parkway 512 794 5678 Austin TX 78730 5039 Glossary Numbers Symbols 1D One dimensional 2
407. s The DDE Library Function Panels The DDE Library function tree appears in Table 6 1 The first and second level bold headings in the tree are the names of function classes and subclasses Function classes and subclasses are groups of related function panels The third level headings in plain text are the names of individual function panels Each DDE function panel generates one or more DDE function calls The names of functions are in bold italics to the right of the function panel name Table 6 1 DDE Library Function Tree Server Functions Register DDE Server RegisterDDEServer Server DDE Write ServerDDE Write Advise DDE Data Ready AdviseDDEDataReady Broadcast DDE Data Ready BroadcastDDEDataReady Unregister DDE Server UnregisterDDEServer Client Functions Client DDE Execute ClientDDE Execute Client DDE Read ClientDDERead Client DDE Write ClientDDE Write Connect To DDE Server ConnectToDDE Server Set Up DDE Hot Link SetUpDDEHotLink Set Up DDE Warm Link SetUpDDE WarmLink Terminate DDE Link TerminateDDE Link Disconnect From DDE Server DisconnectFromDDEServer Get Error String GetDDEErrorString National Instruments Corporation 6 1 LabWindows CVI Standard Libraries DDE Library Chapter 6 DDE Clients and Servers Interprocess communication with DDE involves a client and a server in each DDE conversation A DDE server can execute commands sent from another application and send and receive information to and from a client application
408. s Refer to the functions Set XMode Set CTSMode and SetComTime if you want to change these defaults If the specified port is already open OpenComConf ig closes the port see CloseCom then opens it again ReturnRS232Err int status ReturnRS232Err void Purpose Returns the value of rs232err Parameters None Return Value status integer Refer to error codes in Table 5 6 LabWindows CVI Standard Libraries 5 28 National Instruments Corporation Chapter 5 RS 232 Library SetComTime int result SetComTime int COMPort double timeoutSeconds Purpose Sets time out limit for input output operations Parameters COMPort integer Range 1 through 32 timeoutSeconds double precision Time out period for all read write functions Return Value result integer Refer to error codes in Table 5 6 Using This Function This function sets the time out parameters for all read and write operations The default value of timeoutSeconds is 5 For an RS 232 read operation timeoutSeconds specifies the time allowed from the start of the transfer to the arrival of the first byte It also specifies the time allowed to elapse between the arrival of any two consecutive bytes An RS 232 read operation waits for at least the specified amount of time for the next incoming byte before it returns a time out error For an RS 232 write operation timeoutSeconds specifies the time allowed before the first byte is transferred to the ou
409. s CVI Standard Libraries Utility Library Chapter 8 RenameFile int result RenameFile char existingFileName char newFileName Purpose Renames an existing file Parameters existingFileName string Existing file name newFileName string New file name Return Value Return Codes Success File not found or directory in path not found General I O error occurred Insufficient memory to complete operation Invalid path for either of the file names Access denied Specified existing path is a directory not a file Disk is full New file already exists Parameter Discussion existingFileName and newFileName may contain DOS wildcard characters and If existingFileName has wildcards all matching files are renamed If newFileName has wildcards it will be matched to existingFileName existingFileName may be the empty string in which case the file found by the most recent call to Get FirstFile or GetNextFile is renamed Under Microsoft Windows if the arguments to RenameF ile specify files on different disk drives RenameF ile copies the source to the target and then deletes the source file LabWindows CVI Standard Libraries 8 60 National Instruments Corporation Chapter 8 Utility Library Under UNIX if the arguments to RenameF ile specify files on different file systems RenameF ile copies the source to the target and then deletes the source file RetireExecutableHandle int st
410. s Corporation 2 15 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Return Value integer Number of source format specifiers satisfied Return Codes Format string error T O error Using This Function The return value indicates how many source format specifiers were satisfied 1 if the format string 1s in error or 2 if there was an I O error A complete discussion of this function is in the Using the Formatting and Scanning Functions section later in this chapter FmtOut int n FmtOut char formatString sourcel sourcen Purpose Formats the source sourcen arguments according to descriptions in the formatString argument The result of the formatting is written to the Standard I O window Parameters formatString String sourcel sourcen Types must match formatString contents Return Value integer Number of source format specifiers satisfied Return Codes Format string error T O error LabWindows CVI Standard Libraries 2 16 National Instruments Corporation Chapter 2 Formatting and I O Library Using This Function The return value indicates how many source format specifiers were satisfied 1 if the format string 1s in error or 2 if there was an I O error A complete discussion of this function is in the Using the Formatting and Scanning Functions section later in this chapter GetFileInfo int status GetFileInfo char fileName 1 on
411. s are to be returned from the server your program should only call AdviseDDEDataReady when the user interface is not busy See Also RegisterDDEServer SetUpDDEHot Link SetUpDDEWarmLink BroadcastDDEDataReady BroadcastDDEDataReady int status BroadcastDDEDataReady char serverName char itemName char topicName unsigned int dataFormat void dataPointer unsigned int dataSize Purpose Called by a server to send to send data to all clients that have set up hot or warm links on the specified topic and item Parameters serverName string Identifies the server from which to send the data topicName string Identifies the topic with which the data is associated itemName string Identifies the item with which the data is associated dataFormat unsigned Valid data format for example CF_TEXT integer dataPointer void pointer Pointer to buffer holding data dataSize unsigned Number of bytes in data Limited to 64 KB on integer Windows 3 1 and Windows 95 Return Value LabWindows CVI Standard Libraries 6 8 National Instruments Corporation Chapter 6 DDE Library Parameter Discussion serverName topicName and itemName must be strings of length from 1 to 255 They are used without regard to case Using this Function This function allows your program acting as a DDE server to send data to all clients that have set up hot or warm links on the specified topic and ite
412. s as higher level functions that perform a more precisely defined task than the functions ComToFile and ComFromFile Use ComToFile and ComF romF ile if you need finer control over the file operations Remember that the Xmodem functions calculate the check sum and retransmit when an error is detected whereas ComToFile and ComFromFile do not do so Troubleshooting Establishing communication between two RS 232 devices can be difficult because of the many different possible configurations When using this library you must know the device requirements such as baud rate parity number of data bits and number of stop bits Basically these configurations must match between the two parties of communication If you encounter difficulty in establishing initial communication with the device refer to an elementary RS 232 communications handbook for information about cable requirements and general RS 232 communication Refer also to the section RS 232 Cable Information later in this chapter National Instruments Corporation 5 3 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 All functions except the Open and Close functions require the com port to be opened with OpenCom or OpenComConfig If the program writes data to the output queue and then immediately closes the com port the data in the queue may be lost 1f it has not had time to be sent over the port To guarantee that all bytes were written before closing the port monitor the
413. s to read timeout unsigned integer Timeout in ms Return Value status integer Returns the number of bytes written or a negative error code if an error occurs Refer to error codes in Table 7 3 See Also RegisterTCPServer ServerTCPWrite LabWindows CVI Standard Libraries 7 10 National Instruments Corporation Chapter 7 TCP Library ServerTCP Write int status ServerTCPWrite unsigned int conversationHandle void dataPointer unsigned int dataSize unsigned int timeout Purpose Writes data to a TCP client application Parameters conversationHandle unsigned integer Uniquely identifies the conversation dataPointer void pointer Buffer holding data dataSize unsigned integer Number of bytes to write timeout unsigned integer Timeout in ms Return Value status integer Returns the number of bytes written or a negative error code if an error occurs Refer to error codes in Table 7 3 See Also RegisterTCPServer ServerTCPRead UnregisterTCPServer int status UnregisterTCPServer unsigned int portNumber Purpose Unregisters your server application program as a TCP server Parameters Input portNumber unsigned integer Uniquely identifies a server on a single machine National Instruments Corporation 7 11 LabWindows CVI Standard Libraries TCP Library Chapter 7 Return Value See Also RegisterTCPServer Error Conditions If an error conditi
414. s type The function CreateXPropert y takes a property name and a property type and returns a property handle you can use to access properties on windows The property type created by the function CreateXPropType contains the attributes that determine how data for the property are stored and retrieved More specifically these attributes are the size and unit The size is the number of bytes in a single property item The unit is the number of bytes in the basic entities that make up a property item See the description of CreateXPropType for more information on the meanings of the size and unit attributes Table 9 2 lists the three predefined property types that you do not have to create These types are useful for defining properties to store X window IDs integers and strings Table 9 2 Predefined Property Types Property Type WINDOW_X_PROP_TYPE WINDOW sizeof WindowX INTEGER_X_PROP_TYPE INTEGER sizeof int STRING_X_PROP_TYPE STRING sizeof char Communicating with Local Applications You can use the function Connect ToXDisplay to connect to any X server on a network However 1f your program communicates only with other applications connected to the same display as LabWindows CVI you do not need to connect to the display using ConnectToXDisplay Instead use the global variable CVIXDi splay which is a pointer to the X display that LabWindows CVI uses The variable CVIXRoot Window contains th
415. se National Instruments Corporation 4 5 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 drivers are packaged with your GPIB interface board and are not included with LabWindows CVI LabWindows CVI does not require any special procedures for installing and using the device driver Follow the directions outlined in your board documentation You can use a utility program called IBCONF included with your GPIB software to specify configuration parameters for devices on the GPIB If your device has special configuration parameters such as a secondary address or a special termination character you can specify these using IBCONF When you are using the LabWindows CVI GPIB Library function panels parameters that you specified using IBCONF are still in effect You can also modify configuration parameters directly from one of the LabWindows CVI configuration function panels or from your program If you are using a LabWindows CVI Instrument Library module you do not need to make any changes using IBCONF The module takes into account any special configuration requirements for the instrument controlled by the module If special parameters must be specified the module sets them programmatically Guidelines and Restrictions for Using the GPIB Libraries Follow these guidelines when using the GPIB Libraries e Before performing any other operations open the device You must use either the OpenDev the ibfind or the
416. serEvent or when you have called RunUserInterface and none of your callback functions are currently active The callbacks are termed synchronous because they can be invoked only in the context of normal event processing Unlike asynchronous callbacks there are no restrictions on what you can do in a synchronous callback On the other hand the latency between the occurrence of a GPIB event and the invocation of the callback function is greater and more unbounded with synchronous callbacks than with asynchronous callbacks Only one callback function can apply for each board or device Each call to this function for the same board or device supersedes the previous call To disable callbacks for a board or device pass O for the event Mask parameter To use this function with the NI 488 2M native 32 bit driver you must have one of the following versions e For Windows 95 Version 1 1 or later e For Windows NT Version 1 2 or later If you use the NI 488 2 driver the Windows 3 1 driver or the compatibility driver in Windows 95 you must pass a board index for the first parameter and you can use only SROT or CMPL for the event mask parameter Parameters boardOrDevice integer A board index or a board or device descriptor short integer on returned by OpenDev ibfind or ibdev Windows 3 1 On Windows 3 1 must be a board index eventMask integer Specifies the events upon which the callback short integer on functi
417. singleChamnel double initialHighLimitVolts double initialLowLimit Volts double highLimitVolts double lowLimitVolts Purpose Returns the high and low limits for a particular channel in the channel string Parameters device short Assigned by configuration utility integer channelString string Analog input channels that are to be sampled singleChannel string A single channel of the channel string initialHighLimitVolts double Specifies the maximum voltage to be measured for all channels in the channel string listed before a command string that specifies a new high limit initialLowLimitVolts double The minimum voltage to be measured for all channels in the channel string listed before a command string that specifies a new low limit Output highLimit Volts double Returns the high limit for the specified channel lowLimitV olts double Returns the low limit for the specified channel Return Value error short Refer to error codes in Table 10 5 integer Parameter Discussion channelString is the analog input channels that are to be sampled Refer to the Channel String for Analog Input Functions subsection of the Easy I O for DAO Library Function Overview section of this chapter for the syntax of this string singleChannel is a single channel of the channel string For example if the channel string is EOE Sg a single channel could be 2 or 5 and so on LabWindows CVI Standard Libraries 10 40 N
418. ssing ANSI C 1 5 Sub1D function 3 30 to 3 31 Sub2D function 3 31 Subset1D function 3 32 LabWindows CVI Standard Libraries Index synchronous callbacks 4 12 SyncWait function 8 79 system control functions GPIB 488 2 Library 4 4 SystemHelp function 8 79 to 8 81 T task switching functions DisableTaskSwitching 8 12 to 8 15 EnableTaskSwitching 8 16 TCP Library functions callback function 7 2 to 7 3 clients and servers 7 2 error conditions 7 12 function reference ClientTCPRead 7 3 to 7 4 ClientTCP Write 7 4 to 7 5 ConnectToTCPServer 7 5 to 7 7 DisconnectFromTCPServer 7 7 to 7 8 DisconnectTCPClient 7 7 GetTCPErrorString 7 8 RegisterTCPServer 7 2 7 8 to 7 10 ServerTCPRead 7 10 ServerTCPWrite 7 11 UnregisterTCPServer 7 11 to 7 12 function tree table 7 1 technical support Appendix 1 TerminateDDEL ink function 6 22 TerminateExecutable function 8 82 thread specific status functions ThreadIbent 4 22 ThreadIbentl function 4 22 to 4 23 ThreadIberr 4 23 to 4 25 ThreadIbsta 4 25 time date functions ANSIC Library 1 6 to 1 7 DateStr 8 9 GetSystemDate 8 38 GetSystemTime 8 39 SetSystemDate 8 76 SetSystemTime 8 77 TimeStr 8 83 timeouts GPIB 4 9 LabWindows CVI Standard Libraries I 16 timer wait utility functions Delay 8 9 to 8 10 SyncWait 8 79 Timer 8 83 TimeStr function 8 83 ToPolar function 3 32 to 3 33 ToPolar1D function 3 33 to 3 34 ToRect function 3 34 to 3 35 Transmiss
419. st be capable of performing block transfers 10442 memDisabledErr The specified memory is disabled or is unavailable given the current addressing mode 10443 memAlignmentErr The transfer buffer is not aligned properly for the current data transfer mode For example the memory buffer is at an odd address is not aligned to a 32 bit boundary is not aligned to a 512 bit boundary and so on Alternatively the driver is unable to align the buffer because the buffer is too small memFullErr No more system memory is available on the heap or no more memory is available on the device memLockErr The transfer buffer cannot be locked into physical memory memPageErr The transfer buffer contains a page break system resources may require reprogramming when the page break is encountered stackMemErr The driver is unable to continue parsing a string input due to stack limitations cacheMemEtrr A cache related error occurred or caching does not work in the current mode physicalMemErr A hardware error occurred in physical memory or no memory is located at the specified address 0451 virtualMemErr The driver is unable to make the transfer buffer contiguous in virtual memory and therefore cannot lock the buffer into physical memory thus you cannot use the buffer for DMA transfers 0444 0445 0446 0447 memPageLockErr The operating environment is unable to grant a page lock 0448 0449 0450 noDMAA vailErr No D
420. sterisk in the following format specifier elements rep For integer or floating point arrays in For integer or floating point arrays or strings wn For any format specifier pn For floating point specifiers only en For floating point specifiers only rn For integer specifiers only When you use one or more asterisks instead of constants in a source specifier the arguments corresponding to the asterisks must appear after the format string in the same order as their corresponding asterisks appear in the format specifier When you use one or more asterisks instead of constants in a target specifier the arguments corresponding to the asterisks must precede the target argument and must be in the same order as their corresponding asterisks in the format specifier Scan ScanFile ScanIn Literals in the Format String Literal characters appearing in a scanning function format string indicate that the literal characters are expected in the source parameter They are not stored into any target parameter but are skipped over when encountered If a literal character specified in the format string fails to appear in the source in the expected position the scanning function immediately returns LabWindows CVI Standard Libraries 2 48 O National Instruments Corporation Chapter 2 Formatting and I O Library Some formats may have been correctly detected in the input and the corresponding target parameters will have been filled in Formats situa
421. string is considered to be terminated by a white space character To include embedded white space in the target string use the t modifier to change the target string termination character In the second call to Scan t59 changes the termination character to a semicolon ASCH 59 s abcdefghijklmnop n Scan s Ss gt s w9 buf result buf abcdefghi s abc n Scan s s gt s w9 buf result buf abc s abc n Scan s s gt s w9 q buf result buf abc Remarks The w modifier can be used to prevent Scan from writing beyond the end of a target string The width specified does not include the ASCII NUL that Scan places at the end of the target string Therefore the width specified should be at least one less than the width of the target character buffer When the w modifier is used and the string extracted is smaller than the width specified the remaining bytes in the target string are blank filled However if the q modifier is also used ASCII NULs fill the remaining bytes LabWindows CVI Standard Libraries O National Instruments Corporation Chapter 2 Formatting and I O Library String to Integer and String char s char buf 10 int a n s 32abc n Scan s SS gt i S amp a buf result a 32 but abc n 2 s 32abc n Scan s SS gt i SS Sa buf f results a 32 buf 22222 n 1 Remarks After the first call to Sc
422. struments Corporation R read termination GPIB 4 9 ReadFile function 2 22 to 2 23 ReadFromDigitalLine function 10 49 to 10 51 ReadFromDigitalPort function 10 51 to 10 52 ReadFromPhysicalMemory function 8 57 ReadFromPhysicalMemoryEx function 8 58 ReadLine function 2 23 to 2 24 RegisterDDEServer function 6 2 6 16 to 6 18 RegisterTCPServer function 7 2 7 8 to 7 10 ReleaseExternalModule function 8 59 remote functions GPIB 488 2 Library 4 4 remote hosts ConnectToXDisplay function 9 3 9 7 to 9 9 DisConnectFromXDisplay 9 14 to 9 15 RemoveXWindowProperty function 9 31 to 9 32 RenameFile function 8 60 to 8 61 ResetDevs function no longer supported note 4 13 RetireExecutableHandle function 8 61 ReturnRS232Err function 5 28 RoundRealToNearestInteger function 8 61 to 8 62 RQS events and auto serial polling ibInstallCallback function 4 17 ibNotify function 4 19 RS 232 cables 5 4 to 5 6 DTE to DCE cable configuration table 5 5 gender of connectors 5 6 PC cable configuration table 5 4 PC to DTE cable configuration table 5 5 RS 232 Library functions error conditions 5 36 to 5 37 function panels classes and subclasses 5 2 function tree table 5 1 to 5 2 National Instruments Corporation I 13 Index function reference CloseCom 5 8 to 5 9 ComBreak 5 9 ComFromFile 5 3 5 9 to 5 10 ComRd 5 11 ComRdByte 5 12 ComRdTerm 5 12 to 5 13 ComSetEscape 5 14 to 5 15 ComToFile 5 3 5 15 to 5
423. t buf Ss lt Sf p6 x x 12 345 Fmt buf Ss lt f wl2 x x 12 3456789 Fmt buf Ss lt f w6 x x 0 00000012 Fmt buf Ss lt Sf p8 x x 0 00000012 Emt but Ss lt Si x x 4 5e050 Fmt buf SS lt Sf x r Chapter 2 result 12 result 12 345000 result 12 345 result 12 3 result 0 00000012 result 1 2e 007 result 4 56050 The results shown are the contents of buf after each call to Fmt The last two calls demonstrate that very large and very small values are sometimes forced into scientific notation even when the e modifier is absent Real to String in Scientific Notation Remarks char buf 20 double x x 12 3456789 Fmt buf s lt f e x x 12 3456789 Fmt buf s lt f ep2 x x 12 3456789 Fmt buf Ss lt f e2p2 x x 12 345 Fmt buf s lt f e x x 12 345 Fmt buf s lt f ep2w12 x 12 345 Fmt buf Ss lt f ep2w6 result 1 234568e 001 result 1 23e 001 result 1 23e 01 result 1 234500e 001 result 1 23e 001 result 1 23e The results shown are the contents of buf after each call to Fmt The last call demonstrates what occurs when the width specified by the w modifier is too small LabWindows CVI Standard Librari
424. t channels Parameters device short Assigned by configuration utility integer channelString string Analog input channels that are to be sampled highLimit Volts double Maximum voltage to be measured lowLimitVolts double Minimum voltage to be measured Output voltageArray double Array containing the voltages acquired on the array channels specified in the channelString Return Value error short Refer to error codes in Table 10 5 integer Parameter Discussion channelString is the analog input channels that are to be sampled Refer to the Channel String for Analog Input Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter for the syntax of this string voltageArray is an array containing the voltages acquired on the channels specified in the channelString The acquired voltages are placed into the array in the order specified in the channelString This array must be declared as large as the number of channels specified in the channelString You can use the function Get NumChannel1s to determine the number of channels LabWindows CVI Standard Libraries 10 18 National Instruments Corporation Chapter 10 Easy I O for DAQ Library AIStartAcquisition short error AIStartAcquisition short device char channelString int bufferSize double scansPerSecond double highLimitVolts double lowLimitVolts double actualScanRate unsigned long taskID Purpose This func
425. t com VISA visa support natinst com Lookout lookout support natinst com Fax and Telephone Support National Instruments has branch offices all over the world Use the list below to find the technical support number for your country If there is no National Instruments office in your country contact the source from which you purchased your software to obtain support Australia 03 9 879 9422 03 9 879 9179 Austria 0662 45 79 90 0 0662 45 79 90 19 Belgium 02 757 00 20 02 757 03 11 Canada Ontario 519 622 9310 Canada Quebec 514 694 8521 514 694 4399 Denmark 45 76 26 00 45 76 26 02 Finland 90 527 2321 90 502 2930 France 1 48 14 24 24 1 48 14 24 14 Germany 089 741 31 30 089 714 60 35 Hong Kong 2645 3186 2686 8505 Italy 02 413091 02 41309215 Japan 03 5472 2970 03 5472 2977 Korea 02 596 7456 02 596 7455 Mexico 95 800 010 0793 5 520 3282 Netherlands 0348 433466 0348 430673 Norway 32 84 84 00 32 84 86 00 Singapore 2265886 2265887 Spain 91 640 0085 91 640 0533 Sweden 08 730 49 70 08 730 43 70 Switzerland 056 200 51 51 056 200 51 55 Taiwan 02 377 1200 02 737 4644 U K 01635 523545 01635 523154 LabWindows CVI Standard Libraries A 2 National Instruments Corporation Telephone Fax Technical Support Form Photocopy this form and update it each time you make changes to your software or hardware and use the completed copy of this form as a reference for your current configuration Completing this form accurately before contacting Na
426. t integer string long integer double double double unsigned short integer unsigned short integer double string long integer double short integer double array Easy I O for DAQ Library Assigned by configuration utility Analog input channels that are to be sampled Number of scans to be acquired complete One scan involves sampling every channel in the channelString once Number of scans performed per second Any particular channel to be scanned at this rate Maximum voltage to be measured Minimum voltage to be measured The trigger type The edge slope condition for triggering Voltage at which the trigger is to occur Specifies which channel is the trigger source Specifies the number of scans to retrieve before the trigger point The maximum length of time in seconds to wait for the data Specifies whether the waveforms array are in GROUP_BY_CHANNEL or GROUP_BY_SCAN mode The actual scan rate The actual scan rate may differ slightly from the scan rate you specified given the limitations of your particular DAQ device Array containing the voltages acquired on the channels specified in the channelString short integer Refer to error codes in Table 10 5 National Instruments Corporation 10 9 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Parameter Discussion channelString is the analog input channels that are to be sampled Refer to the Cha
427. t is one of the Windows defined data types for example CF_TEXT The dataSize specifies the number of bytes in the data pointed to by dataPtr Note The dataSize value is the value LabWindows CVI receives from Microsoft Windows This value can be larger than the actual number of bytes written by the client Note The callback function should return TRUE if the message can be processed successfully Otherwise it should return FALSE The callback function should be short and return as soon as possible callbackData is a four byte value that will be passed to the callback function each time it is called for this client You can define the meaning of the callback data For example you can use the callback data as a pointer to a data object that you need to access in the callback function In this way you would not need to declare the data object as a global variable If you do not want to use the callback data you can pass zero Note In the case of DDE_DISCONNECT the value of callbackData is undefined See Also DisconnectFromDDEServer RegisterDDEServer LabWindows CVI Standard Libraries 6 14 National Instruments Corporation Chapter 6 DDE Library DisconnectFromDDEServer int status DisconnectFromDDEServer unsigned int conversationHandle Purpose Disconnects your client program from a server application Parameters conversationHandle unsigned integer Unique
428. t is synchronized to a reference clock 2 Software Property of a function that begins an operation and returns only when the operation is complete National Instruments Corporation T TC throughput rate transfer rate U unipolar V V VDC X Xmodem functions Glossary Terminal count The data measured in bytes s for a given continuous operation calculated to include software overhead Throughput Rate Transfer Rate Software Overhead Factor The rate measured in bytes s at which data is moved from source to destination after software initialization and set up operations the maximum rate at which the hardware can operate A signal range that is always positive for example O to 10 V Volts Volts direct current Allow you to transfer files using a data transfer protocol The protocol uses a generally accepted technique for performing serial file transfers with error checking Files are sent in packets that contain data from the files plus error checking and synchronization information National Instruments Corporation G 7 LabWindows CVI Standard Libraries Index Numbers Symbols 1D array functions See one dimensional array operation functions 1D complex operation functions See one dimensional complex operation functions 2D array functions See two dimensional array Operation functions asterisks in format specifiers formatting functions 2 39 scanning functions 2 48
429. t need this information Property value obtained from window This parameter must point to an array of size N by M bytes where N is the size of the property item and M is the number of items requested LabWindows CVI Standard Libraries X Property Library Chapter 9 Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr The function was successful InvalidParamxErr NULL was passed to one or more parameters InvalidDisplayXErr The display argument is not a valid display This argument must either be the predefined value CVIXDisplay or be the value returned by ConnectToXDisplay lidWindowXErr The window argument is not a valid window lidPropertyError The property argument is not a valid property handle This argument must be the value returned by CreateXProperty TypeMismatchXErr The actual X type of the property value on the window does not match the type specified for property UnitMismatchXErr The actual X format of the property value on the window does not match the unit specified for property InvalidindexXErr The index specified is larger than the actual number of property items on the window SizeMismatchXErr The number of bytes in the property value is not a multiple of the size specified for property InsuffMemXErr There is insufficie
430. t support the specified operation or the firmware operation could not complete due to a data integrity problem 10842 hardwareErr The hardware is not responding to the specified operation or the response from the hardware is not consistent with the functionality of the hardware 10843 underFlowErr The update rate exceeds your system s capacity to supply data to the output channel 10844 underWriteErr At the time of the update for the device resident memory insufficient data was present in the output transfer buffer to complete the update L0845 overFlowErr At the time of the update clock for the input channel the device resident memory was unable to accept additional data one or more data points may have been lost 210846 overWriteErr New data was written into the input transfer buffer before the old data was retrieved 10847 dmaChainingErr New buffer information was not available at the time of the DMA chaining interrupt DMA transfers will terminate at the end of the currently active transfer buffer continues National Instruments Corporation 10 65 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Table 10 5 Easy I O for DAQ Error Codes Continued transfer count register in the DMA controller 10854 miscFileErr An error occurred accessing a file 10880 updateRateChangeErr A change to the update rate is not possible at this time because 1 When waveform genera
431. t the integer value 23 to its ASCII representation and place the contents in a string variable char a 5 ant 0315 b 23 n Fmt a SS lt i b After the Fmt call a contains the string 23 In this example a is the target argument b is the source argument and the string s lt i is the format string The Fmt call uses the format string to determine how to convert the source argument into the target argument With the Scan function you can convert the string 23 to an integer char a a 23 r n Scan a s gt i b After the Scan call b 23 In this example a is the source argument b is the target argument and s gt i is the format string In both the formatting and the scanning functions the format string defines the variable types of the source and target arguments and the method by which the source arguments are transformed into the target arguments Formatting Functions The following information is a brief description of the three formatting functions n Fmt target formatstring sourcel sourcen The Fmt function formats the sourcel sourcen arguments according to descriptions in the format string argument The function places the result of the formatting into the target argument n FmtFile handle formatstring sourcel sourcen The FmtF ile function formats the sourcel sourcen arguments according to descriptions in the format string argument The func
432. t to carry out an extended function such as clearing or setting the RTS signal line or setting the transceiver mode for RS 485 The extended functions are defined by the serial device driver Not all device drives support all escape codes Unknown System Error 1 is returned when the device driver does not support a particular escape code Note This function is supported in the MS Windows version of LabWindows CVI only Parameters COMPort integer Range 1 through 32 escapeCode integer Specifies the escape code of the extended function Return Value Parameter Discussion The following values can be used for escape code CLRDTR Clears the DTR data terminal ready signal CLRRTS Clears the RTS request to send signal GETMAXCOM Returns the maximum com port identifier supported by the system This value ranges from 0x00 to 0x7F such that 0x00 corresponds to COM1 0x01 to COM2 0x02 to COM3 and so on SETDTR Sends the DTR data terminal ready signal SETRTS Sends the RTS request to send signal SETXOFF Causes the port to act as if an XOFF character has been received SETXON Causes the port to act as if an XON character has been received LabWindows CVI Standard Libraries 5 14 National Instruments Corporation Chapter 5 RS 232 Library The following values may be used only with the RS 485 serial driver developed by National Instruments WIRE_4 Sets the transceiver to Four Wire Mode
433. t1 are maintained for each thread This function returns the value of the thread specific ibsta variable If you are not using multiple threads the value returned by this function is identical to the value of the ibsta global variable Parameters none Return Value threadSpecificStatus integer The status value for the current thread of execution The status value describes the state of the GPIB and the result of the most recent GPIB function call in the thread Any value with the ERR bit set indicates an error Call ThreadIberr for a specific error code National Instruments Corporation 4 25 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 Return Codes The return value is a sum of the following bits Defined Constant Hex Value Condition GPIB error END or EOS detected SRQ is on Device requesting service I O completed GPIB PC in Lockout State GPIB PC in Remote State GPIB PC is Controller In Charge Attention is asserted GPIB PC is Talker GPIB PC is Listener GPIB PC in Device Trigger State GPIB PC in Device Clear State See Also Threadlberr ThreadIbcnt ThreadIbcntl LabWindows CVI Standard Libraries 4 26 National Instruments Corporation Chapter 5 RS 232 Library This chapter describes the functions in the LabWindows CVI RS 232 Library The RS 232 Library Function Overview section contains general information about the RS 232 Library func
434. tComStat function 5 19 to 5 20 GetCurrentPlatform function 8 19 GetCVIVersion function 8 18 to 8 19 GetDAQErrorString function 10 43 to 10 44 GetDDEErrorString function 6 15 to 6 16 GetDir function 8 20 GetDrive function 8 20 to 8 21 GetExternalModuleA ddr function 8 21 to 8 22 GetFileAttrs function 8 23 to 8 24 GetFileDate function 8 24 to 8 25 GetFileInfo function 2 17 GetFileSize function 8 25 to 8 26 GetFileTime function 8 26 to 8 27 GetFirstFile function 8 27 to 8 29 GetFmtErrNdx function 2 18 GetFmtIOError function 2 18 to 2 19 GetFmtlOErrorString function 2 19 GetFullPathFromProject function 8 29 to 8 30 GetInQLen function 5 20 to 5 21 GetInterruptState function 8 30 GetKey function 8 30 to 8 31 GetModuleDir function 8 31 to 8 32 GetNextFile function 8 33 GetNumChannels function 10 44 GetOutQLen function 5 4 5 21 National Instruments Corporation 1 9 Index GetPersistent Variable function 8 33 GetProjectDir function 8 34 GetRS232ErrorString function 5 22 GetStdioPort function 8 35 GetStdioWindowOptions function 8 35 to 8 36 GetStdioWindowPosition function 8 36 to 8 37 GetStdioWindowSize function 8 37 GetStdioWindowVisibility function 8 37 to 8 38 GetSystemDate function 8 38 GetSystemTime function 8 39 GetTCPErrorString function 7 8 GetWindowDisplaySetting function 8 39 to 8 40 GetXPropErrorString function 9 15 GetXPropertyName function 9 15 to 9 16 GetXPropertyType functio
435. tMask amp LWRS_RECEIVE printf 50 or more bytes in input queue n Parameters COMPort integer Range through 32 eventMask integer The events upon which the callback function is called See the Parameter Discussion for a list of valid events If you want to disable callbacks pass 0 notifyCount integer The minimum number of bytes the input queue must contain before sending the LWRS_RECEIVE event to the callback function Valid Range 0 to Size of Input Queue eventCharacter integer Specifies the character or byte value that triggers the LWRS_RXF LAG event Valid Range 0 to 255 callbackPtr ComCallbackPtr The name of the user function that processes the event callback callbackData void A pointer to a user defined four byte value that is passed to the callback function National Instruments Corporation 5 23 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 Return Value Parameter Discussion The callback function must have the following form void CallbackFunctionName int COMPort int eventMask void callbackData The eventMask and callbackData parameters are the same values that were passed to InstallComCallback The events are specified using bits in the eventMask parameter You can specify multiple event bits in the eventMask parameter The valid event bits are listed in the table below Com Port Event Constant Name 0x0001 Any character receiv
436. tandard Libraries Utility Library Chapter 8 GetBreakOnProtectionErrors int state GetBreakOnProtectionErrors void Purpose This function returns the state of the break on protection errors feature It returns a 1 if the option is enabled or a 0 if it is disabled If debugging is disabled this function always returns 0 For more information on the feature see the documentation for SetBreakOnProtectionErrors Return Value The current state of the break on protection errors option Return Codes Break on protection errors option enabled Break on protection errors option disabled GetCVIVersion int versionNum GetCVIVersion void Purpose This function returns the version of LabWindows CVI you are running In a standalone executable this tells you which version of the LabWindows CVI run time libraries you are using The value is in the form Nnn where the N nn is the version number that shows in the About LabWindows CVI dialog box For example for LabWindows CVI version 4 0 Get CVIVersion returns 400 For version 4 1 it would return 410 The values will always increase with each new version of LabWindows CVI The return value of Get CVIVersion should not be confused with the predefined macro _CVI_ which specifies the version of LabWindows CVI in which the source file is compiled Return Value versionNum integer The version number of LabWindows CVI or the run time libraries LabWindows CVI S
437. tandard Libraries 8 18 National Instruments Corporation Chapter 8 Utility Library Return Codes Where N nn is the LabWindows CVI version GetCurrentPlatform int platformCode GetCurrentPlatform void Purpose This function returns a code representing the operating system under which a project or standalone executable is running The return value of GetCurrentPlatform should not be confused with the predefined macros such as _NI_mswin_ _NI_unix_ and others which specify the platform on which the project is compiled This function is useful when you have a program that can run on multiple operating systems but must take different actions on the different systems For example the same standalone executable can run on both Windows 95 and Windows NT If the program needs to behave differently on the two platforms you can use Get CurrentPlat form to determine the platform at run time Return Value platformCode Indicates the current operating system Return Codes Windows 3 1 Windows 95 Windows NT Sun Solaris 1 Sun Solaris 2 HP UX 9 x HP UX 10 x National Instruments Corporation 8 19 LabWindows CVI Standard Libraries Utility Library Chapter 8 GetDir int result GetDir char currentDirectory Purpose Gets the current working directory on the default drive Parameter Output currentDirectory Current directory Return Value Return Codes Success General
438. tart is called e START_COUNTING_ON_RISING_EDGE start counting on the rising edge of the TTL gate signal after CounterStart is called e START_COUNTING_ON_FALLING_EDGE start counting on the falling edge of the TTL gate signal after CounterStart is called outputBehavior is the behavior of the output signal when counter reaches terminal count This parameter accepts the following attributes e HIGH_PULSE high pulse lasting one cycle of the source or timebase signal LOW_PULSE low pulse lasting one cycle of the source or timebase signal H IGH_TOGGLE high toggle lasting until the next TC LOW_TOGGLE low toggle lasting until the next TC For a Timebase Divisor of N and a pulsed output an output pulse equal to the period of the source or timebase signal appears on counter s OUT pin once each N cycles of that signal For a toggled output the output toggles after each N cycles The toggled output frequency is thus half that of the pulsed output in other words pulsedFrequency sourceFrequency N and toggledFrequency sourceFrequency 2 N thus if N 3 the OUT pin would generate pulses as follows source Po Tesi del del dear eel MEL lest Reb tet lek J HIGH_PULSE HIGH_TOGGLE National Instruments Corporation 10 39 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 GetAILimitsOfChannel short error GetAILimitsOfChannel short device char channelString char
439. taskID unsigned The reference number assigned to this operation long You pass taskID to CounterStart integer CounterRead and CounterStop Return Value error short Refer to error codes in Table 10 5 integer Parameter Discussion counter is the counter to be used for the counting operation The valid counters are shown in Table 10 2 which is found in the Valid Counters for the Counter Timer Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter dutyCycle is the desired ratio of the duration of the pulse phase phase 2 to the period phase 1 phase 2 The default of 0 5 generates a square wave e If dutyCycle 0 0 the function computes the closest achievable duty cycle using a minimum pulse phase phase 2 of three timebase cycles e If dutyCycle 1 0 the function computes the achievable duty cycle using a minimum delay phase phase 1 of three timebase cycles e A duty cycle very close to 0 0 or 1 0 may not be possible National Instruments Corporation 10 25 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 gateMode specifies how the signal on the counter s GATE pin is used The options are e UNGATED_SOFTWARE_START ignore the gate signal and start when CounterStart is called e COUNT_WHILE_GATE_HIGH count while the gate signal is TTL high after CounterStart is called e COUNT_WHILE_GATE_LOW count while the gate signal
440. te int status SetFileDate char fileName int month int day int year Purpose Sets the date of a file LabWindows CVI Standard Libraries 8 68 National Instruments Corporation Chapter 8 Utility Library Parameters fileName string File to set attributes month integer Month 1 to 12 January February March April May June July August September October November December Day of month 1 to 31 Year 1980 2099 1 2 3 4 5 6 7 8 9 Return Value Return Codes Success File not found or directory in path not found General I O error occurred Insufficient memory to complete operation Invalid date or invalid path for example c filename in Windows Access denied Parameter Discussion fileName may be the empty string in which case the date of the file found by the most recent call to GetFirstFile or GetNextFile is set O National Instruments Corporation 8 69 LabWindows CVI Standard Libraries Utility Library Chapter 8 SetFileTime int result SetFileTime char fileName int hours int minutes int seconds Purpose Sets the time of a file Parameters fileName string File to set date hours integer Hours 0 to 23 minutes integer Minutes 0 to 59 seconds integer Seconds 0 58 Odd Values are rounded down Return Value Return Codes Success File not found or directory in path not found General I O error occ
441. te with user interface events for the CPU time This function should be used sparingly and only when the value of the hot or warm linked data object changes In cases when large data objects are to be returned from the server it should only be called when the user interface is not busy See Also RegisterDDEServer SetUpDDEHot Link SetUpDDEWarmLink AdviseDDEDataReady ClientDDEExecute int status ClientDDEExecute unsigned int conversationHandle char commandString unsigned int timeout O National Instruments Corporation 6 9 LabWindows CVI Standard Libraries DDE Library Chapter 6 Purpose Called by client to send a command to be executed by a DDE server application Parameters conversationHandle unsigned integer Uniquely identifies the conversation commandString string Command to be executed by the server application timeout unsigned integer Timeout in ms Return Value status integer Refer to error codes in Table 6 3 Parameter Discussion The commandString represents a valid command sequence for the server application to execute Refer to the command function reference manual for the application to which you are connecting for more information on the commands supported See Also Connect ToDDEServer ClientDDERead ClientDDEWrite ClientDDERead int status ClientDDERead unsigned int conversationHandle char itemName unsigned int dataFor
442. ted after the literal which did not appear however will not have been executed The function return value can be used to determine exactly how many target parameters were actually fulfilled by the input You can use the function NumFmt dBytes to determine the number of bytes consumed from the source parameter Because the left side of the gt symbol must be a single format specifier literal characters if present must be on the right side of the symbol Literals on the left side or more than one format specifier on the left side result in a 1 error indicating a faulty format string The function Get Fmt ErrNdx can then be used to determine exactly where in the format string the error lies The characters lt and gt have special meaning in the format strings To specify that these characters be taken literally they should be preceded by Formatting and I O Library Programming Examples This section contains examples of program code that use the Formatting and I O Library functions The formatting and scanning functions are the basis of most of the examples The Fmt Fmt File FmtOut examples are logically organized as shown Integer to String Long Integer to String Real to String in Floating Point Notation Real to String in Scientific Notation Integer and Real to String with Literals Two Integers to ASCII File with Error Checking Real Array to ASCII File in Columns and with Comma Separators Integer Array to Bina
443. teger Refer to error codes in Table 3 2 Clear1D int status Clear1D double array int numberofElements Purpose Sets the elements of the array to zero Parameters numberofElements Number of elements in array Output array double precision Cleared array array LabWindows CVI Standard Libraries 3 6 National Instruments Corporation Chapter 3 Analysis Library Return Value status integer Refer to error codes in Table 3 2 Copy1D int status Copy1D double inputArray int numberofElements double outputArray Purpose Copies the elements of the inputArray This function is useful to duplicate arrays for in place operations Parameters inputArray double precision Input array numberofElements Number of elements in inputArray outputArray double precision Duplicated array array Return Value CxAdd int status CxAdd double xReal double xImaginary double yReal double yImaginary double outputReal doub1le outputImaginary Purpose Adds two complex numbers The function obtains the resulting complex number by using the formulas zr xrt yr zi xi yi National Instruments Corporation 3 7 LabWindows CVI Standard Libraries Analysis Library Chapter 3 Parameters xReal double precision Real part of x xImaginary double precision Imaginary part of x yReal double precision Real part of y yImaginary double precision Imaginary part of y Out
444. ter was received before the receiver data register was emptied FRAMING Framing error detected stop bits were not received when expected BREAK Break signal detected REMOTE XOFF XOFF character received If XON XOFF was enabled see the SetXMode function description no characters are removed from the output queue and sent to the other device until that device sends an XON character LOCAL XOFF XOFF character sent to the other device If XON XOFF was enabled see the Set XMode function description XOFF is transmitted when the input queue is 50 75 and 90 full If the other device is sensitive to XON XOFF protocol it transmits no further characters until it receives an XON character You use this process to avoid the INPUT LOST error Notice the ambiguity in this status information If an error occurs on the indicated port the application program knows that one or more bytes are invalid The program cannot know from the status word which byte read since the last call to Get ComSt at is invalid The function returns a negative error code if the port is not open or if COMPort is invalid GetInQLen int len GetInQLen int COMPort Purpose Returns the number of characters in the input queue of the specified port This function does not change the input queue LabWindows CVI Standard Libraries 5 20 National Instruments Corporation Chapter 5 RS 232 Library Parameter Return Value integer Number of characters in t
445. th Error Checking ooooncccnnccnnociconcconoss 2 53 Real Array to ASCII File in Columns and with Comma Separators 2 53 LabWindows CVI Standard Libraries vi O National Instruments Corporation Contents Integer Array to Binary File Assuming a Fixed Number Gf Elements eset esc E vt ais secede ches 2 54 Real Array to Binary File Assuming a Fixed NUMBER of Elements e ato 2 54 Real Array to Binary File Assuming a Variable Number Of Elements ni Ai da aes Mae eats 2 55 A Variable Portion of a Real Array to a Binary File eee 2 55 Concatenating Two Strings 4 6 s0ds schcdeassccdea ss ceeenaavesdcessadenedaseecalaasanecesens 2 56 Appending toa Sting id 2 56 Creating an Array of File Names sessssesessesssesssesessseessresserssesesseesssees 2 57 Writing a Line Containing an Integer with Literals to the Standard OUPO oo eein iia inn 2 58 Writing to the Standard Output without a Linefeed Carriage Read ae eQedee 2 58 Scan ScanFile ScanIn Examples in C scsccssscsessscssseccsesascessecesenascesnnccssnes 2 59 String to Intuicion pitido delia add dosis 2 59 String to Long Integer IA Adina 2 60 SET LTE IRS E E E E E EN EE 2 60 String to Integer atid Real A ee 2 61 String to A A a a iaa a peng es 2 62 String to Integer and String 3 35 25ccccassascas cspesscceasacecdasdesndeadeetacteseaceeeans 2 63 String to Real Skipping over Non Numeric Characters A T E AN 2 63 String to Real After Finding a Semicolon in the String
446. that a National Instruments Corporation 2 23 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 carriage return linefeed combination will be treated as a linefeed If fileHandle is zero the line will be read from the standard input lineBuffer is a character buffer It should be large enough to contain maximum Bytes bytes plus an ASCII NUL ReadLine returns the number of bytes read from the file including discarded bytes but excluding the linefeed Hence the return value will exceed maximum Bytes if and only if bytes are discarded If no bytes are read because the end of the file has been reached ReadLine returns 2 If an I O error occurs ReadLine returns 1 Scan int n Scan void source char formatString targetptr1 targetptrn Purpose Scans a single source item in memory and breaks it into component parts according to format specifiers found in a formatString The components are then placed into the target parameters Parameters source Type must match formatString contents formatString string targetptr1 targetptrn Types must match formatString contents Return Value integer Number of target format specifiers satisfied Return Code Using This Function The return value indicates how many target format specifiers were satisfied or 1 if the format string is in error A complete discussion of this function is in the Using the Formatting and Scanning Functions sec
447. that was returned from the OpenFile function The file should be opened in ASCII mode so that a carriage return will be written before the linefeed If fileHandle is 1 the line will be written to the STDOUT Using This Function WriteLine returns the number of bytes written to the file excluding the linefeed If an I O error occurs WriteLine returns 1 Using the Formatting and Scanning Functions You use data formatting functions to translate or reformat data items into other forms Typical usages might be to translate between data stored on external files and the internal forms which the program can manipulate or to reformat a foreign binary representation into one on which the program can operate There are three subclasses of data formatting functions in the LabWindows CVI Formatting and VO Library e Formatting functions e Scanning functions e Status functions You use formatting functions to combine and format one or more source items into a single target item and you use scanning functions to break apart a single source item into several target items The status functions return information regarding the success or failure of the formatting or scanning functions Introductory Formatting and Scanning Examples To introduce you to the formatting and scanning functions consider the following examples National Instruments Corporation 2 31 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Conver
448. the DSR pin of the receiver translates to the DTR pin of the sender If you want to use hardware handshaking but your device uses a different hardware handshake protocol than the ones described here you can build a cable that overcomes the differences You can construct a cable to serve your special needs be referencing the pin description in Table 5 2 RS 232 Library Function Reference This section describes each function in the LabWindows CVI RS 232 Library The LabWindows CVI RS 232 Library functions are arranged alphabetically CloseCom int result CloseCom int COMPort Purpose Closes a COM port Parameter Return Value result integer Refer to error codes in Table 5 6 LabWindows CVI Standard Libraries 5 8 National Instruments Corporation Chapter 5 RS 232 Library Parameter Discussion The function does nothing if the port numbers are invalid port is not open or parameter value is not in the range 1 through 32 ComBreak int result ComBreak int COMPort int breakTimeMsec Purpose Generates a break signal Parameters COMPort Range through 32 breakTimeMsec Range 1 through 255 or 0 to select 250 Return Value result integer Refer to error codes in Table 5 6 Using This Function The function generates a break signal for the number of milliseconds indicated or for 250 ms if the breakTimeMsec parameter is zero For most applications 250 ms is adequate Errors may occur if the port is not
449. the Windows versions of LabWindows CVI Purpose Reads a word from a port Note For you to be able to use this function under Windows NT the LabWindows CVI low level support driver must be loaded LabWindows CVI Standard Libraries 8 42 National Instruments Corporation Chapter 8 Utility Library Parameters Return Value InStandaloneExecutable int standalone InStandaloneExecutable vo id Purpose Returns a non zero value if your program is running as a standalone executable If your program is running in the LabWindows CVI development environment a zero is returned Return Value standalone integer 1 Program is running as a standalone executable 0 Program is running as in LabWindows CVI KeyHit int result KeyHit void Purpose Indicates whether the user has pressed a key on the keyboard Note This function only detects keystrokes in the Standard I O window It does not detect keystrokes in windows created with the User Interface Library or in the console window in a Windows Console Application Parameters None Return Value result integer Indicates if a key has been pressed National Instruments Corporation 8 43 LabWindows CVI Standard Libraries Utility Library Chapter 8 Return Codes 0 Key has not been pressed 1 Key has been pressed Using This Function The function returns 1 if a keystroke is available in the keyboard buffer O otherwise After a keystroke is available you sh
450. the function terminates on error which can include a time out Using This Function The function returns an error if the output queue remains full for the duration of the time out period the file handle is bad a read error occurs the port is not open or the COMPort is invalid ComWrt int nbytes ComWrt int COMPort char buffer int count Purpose Writes count bytes to the output queue of the specified port Returns an integer value indicating the number of bytes placed in the queue Returns immediately without waiting for the bytes to be sent out of the serial port Parameters COMPort _ integer Range 1 through 32 buffer string Buffer containing data to be written or actual string count integer 0 value places no bytes in queue Return Value integer Number of bytes placed in the output queue Error code See Table 5 6 Byte not placed in the output queue Using This Function This function times out if the output queue has not been updated in the specified time out period This can occur if the output queue is full and no further data can be sent because XON XOFF is enabled and the device has sent an XOFF character without sending the follow on XON character It can also occur if Hardware Handshaking is enabled and the Clear To Send CTS line is not asserted Bytes are sent from the output queue to the serial device under interrupt control without program intervention If you close the port before
451. the string Example int 1 n Scan 1234 Ss gt d amp i n GetFmtErrNdx n will have the valu 1 indicating that there was no error found in the format string GetFmtIOError int status GetFmtIOError void Purpose This function returns specific I O information for the last call to a Formatting and I O function that performs file I O If the last function was successful GetLastFmtIOError returns zero no LabWindows CVI Standard Libraries 2 18 National Instruments Corporation Chapter 2 Formatting and I O Library error If the last function that performs I O encountered an I O error GetLastFmtIOError returns a nonzero value Return Value status integer Indicates success or failure of last function that performed file I O Return Codes tIONoErr No error ONoFileErr File not found tIO0GenErr General I O error Invalid file handle Not enough memory tIOBadHandleErr OInsuffMemErr IOFileExistsErr File already exists tIlOAccessErr Permission denied OInvalArgErr Invalid argument OMaxFilesErr Maximum number of files open Disk is full File name is too long VD AN DN FP WY NY YF O O TODiskFullErr O IONameTooLongErr GetFmtIOErrorString char message GetFmtIOErrorString int errorNum Purpose Converts the error number returned by GetLastFmtIOError into a meaningful error message
452. theless the data in the string is treated as an integer array The z modifier is valid only if rep is present rn Specify Radix The r integer modifier specifies the radix of the integer argument which is important if the integer was to be converted into string format Legal radixes are 8 octal 10 decimal the default 16 hexadecimal and 256 a special radix representing single 8 bit ASCII characters wn Specify String Size The w integer modifier specifies the exact number of bytes in which to store a string representation of the integer argument in the event that National Instruments Corporation 2 35 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 pc onnnn the integer is converted to a string format You can enter any non negative value here If n is less than the number of digits required to represent the integer an asterisk will be inserted into the string to signify an overflow The default for n is zero which indicates that the integer can occupy whatever space is necessary Specify Padding The p integer modifier specifies a padding character c which fills the space to the left of an integer in the event it does not require the entire width specified with the wn modifier The default padding character is a blank Specify as Two s Complement The s integer modifier indicates that the integer argument is considered a signed two s complement number This is the default interpretation of
453. time Engine If you use ExecutableHasTerminated the return value always will be 1 because the process identification for the second Run time Engine cannot be tracked This behavior can also occur with non LabWindows CVI executables You can work around this problem when launching LabWindows CVI runtime executables by executing the Run Time Engine directly and passing it the pathname of the executable For example c cvi cvirt4 exe c test myapp exe The pathname of the Run Time Engine might not be c cvi cvirt4 exe You can determine the pathname of the Run Time Engine by looking at the cvirt 4 section in win ini If the runtime executable was made with a different version of CVI look in the cvirtnn section for that version If you need to pass arguments to your application create a file containing the arguments and pass the pathname of that file as the second argument to the Run Time Engine For example c cvi cvirt4 exe c test myapp exe myargs The file containing the arguments must be in the same directory as the executable The first three characters in the file containing the arguments must be CVI in uppercase as in the following example CVI argl arg2 arg3 The Run Time Engine deletes the file containing the arguments after reading it LabWindows CVI Standard Libraries 8 48 O National Instruments Corporation Chapter 8 Utility Library LoadExternalModule int module_id LoadExternalModule char pathName
454. tion The valid counters are shown in Table 10 2 which is found in the Valid Counters for the Counter Timer Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter sourceTimebase determines whether the counter uses its SOURCE pin or an internal timebase as its signal source Pass USE_COUNTER_SOURCE to count TTL edges at counter s SOURCE pin or pass a valid internal timebase frequency to count the TTL edges of an internal clock Valid internal timebase frequencies are 1000000 Am9513 100000 Am9513 10000 Am9513 1000 Am9513 100 Am9513 20000000 DAQ STC 100000 DAQ STC LabWindows CVI Standard Libraries 10 38 National Instruments Corporation Chapter 10 Easy I O for DAQ Library timebaseDivisor is the source frequency divisor For example if the source signal is 1000 Hz the timebaseDivisor is 10 and the output is pulsed the frequency of the counter s OUT signal is 100 Hz If the output is toggled the frequency is 50 Hz gateMode specifies how the signal on the counter s GATE pin is used This parameter accepts the following attributes e UNGATED_SOFTWARE_START ignore the gate signal and start when CounterStart is called e COUNT_WHILE_GATE_HIGH count while the gate signal is TTL high after CounterStart is called e COUNT_WHILE_GATE_LOW count while the gate signal is TTL low after CounterS
455. tion is in progress you cannot change the interval timebase 2 When you make several changes in a row you must wait long enough for each change to take effect before you request further changes 10920 gpctrDataLossErr One or more data points may have been lost during buffered GPCTR operations due to speed limitations of your system LabWindows CVI Standard Libraries 10 66 National Instruments Corporation Appendix A Customer Communication For your convenience this appendix contains forms to help you gather the information necessary to help us solve technical problems you might have as well as a form you can use to comment on the product documentation Filling out a copy of the Technical Support Form before contacting National Instruments helps us help you better and faster National Instruments provides comprehensive technical assistance around the world In the U S and Canada applications engineers are available Monday through Friday from 8 00 a m to 6 00 p m central time In other countries contact the nearest branch office You may fax questions to us at any time Electronic Services Bulletin Board Support National Instruments has BBS and FTP sites dedicated for 24 hour support with a collection of files and documents to answer most common customer questions From these sites you can also download the latest instrument drivers updates and example programs For recorded instructions on how to use the bulletin
456. tion later in this chapter LabWindows CVI Standard Libraries 2 24 National Instruments Corporation Chapter 2 Formatting and I O Library ScanFile int n ScanFile int fileHandle char formatString targetptr1 targetptrn Purpose Performs the same basic operation as the Scan function except that the source material is obtained from the file referred to by the fileHandle argument which is obtained by calling the LabWindows CVI function OpenFile Parameters fileHandle Integer formatString String targetptr1 targetptrn Types must match formatString contents Return Value integer Number of target format specifiers satisfied Return Codes Format string error VO error Using This Function The amount of data read from the file depends on the amount needed to fulfill the formats in the format string The return value indicates how many target format specifiers were satisfied 1 if the format string is in error or 2 if there was an I O error A complete discussion of this function is in the Using the Formatting and Scanning Functions section later in this chapter ScanIn int n ScanIn char formatString targetptr1 targetptrn Purpose Performs the same basic operation as the ScanF ile function except that the source material is obtained from STDIN National Instruments Corporation 2 25 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Parameters
457. tion or termination of the operation A feature in which serial polls are executed automatically by the GPIB polling driver whenever a device asserts the SRQ line Bytes Data is acquired by a DAQ system while another program or processing routine is running without apparent interruption A signal range that includes both positive and negative values for example 5 V to 5 V A high speed data transfer in which the address of the data is sent followed by a specified number of back to back data words The LabWindows CVI feature that creates code based on a uir file to connect your GUI to the rest of your program This code is complete and can be compiled and run as soon as it is created A method of compensating for inaccuracies in thermocouple circuits The time required in an analog input or output system from the moment a channel is interrogated such as with a read instruction to the moment that accurate data is available counter timer A circuit that counts external pulses or clock pulses timing coupling The manner in which a signal is connected from one location to another LabWindows CVI Standard Libraries G 2 National Instruments Corporation D D A DAC D A converter Data acquisition DC device differential input digital port DIO E external trigger F FIFO format string O National Instruments Corporation G 3 Glossary Digital to analog An electronic device often an inte
458. tion should appear as follows Fmt prog_buf 100d lt 100d b2010 prog_buf In either case the o modifier is used only on the buffer containing the raw data from the instrument inst r_buf LabWindows CVI will ensure that the program buffer prog_buf is in the proper byte order for the host processor LabWindows CVI Standard Libraries 2 36 O National Instruments Corporation Chapter 2 Formatting and I O Library Note When using both the bn and on modifiers on an integer specifier the bn modifier must be first Formatting Floating Point Modifiers f bn Specify Length The b floating point modifier specifies the length of the floating point argument or the length of an individual array element in bytes The default length is 8 bytes therefore double precision values do not need this modifier Single precision floating point values are indicated by b4 8 and 4 are the only valid values for n in Specify Array Offset You use the i modifier to specify an offset within a floating point array argument It indicates the location within the array where processing is to begin n is the zero based index of the first element to process Thus 10 12 applied to a source floating point array reads the 10 floating point values from the third through the twelfth elements of the array The i modifier is valid only if rep is present If the i modifier is used with the z modifier then n is in terms of bytes Z Treat String as Flo
459. tion starts a continuous asynchronous acquisition on the analog input channels specified in the channelString Data is acquired into an internal circular buffer Use AlReadAcquisition to retrieve scans from the internal buffer Parameters device short integer Assigned by configuration utility channelString string Analog input channels that are to be sampled bufferSize integer The size of the internal circular buffer in scans scansPerSecond double Number of scans performed per second Any particular channel is scanned at this rate highLimitVolts double Maximum voltage to be measured lowLimitVolts double Minimum voltage to be measured actualScanRate double The actual scan rate may differ slightly from the scan rate you specified given the limitations of your particular DAQ device taskID unsigned An identifier for the asynchronous acquisition long integer Return Value Parameter Discussion channelString is the analog input channels that are to be sampled Refer to the Channel String for Analog Input Functions subsection of the Easy I O for DAQ Library Function Overview section of this chapter for the syntax of this string taskID is an identifier for the asynchronous acquisition that must be passed to AICheckAcquisition ATReadAcquisition AIClearAcquisition National Instruments Corporation 10 19 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 AOClearWaveforms short error AOCle
460. tion writes the result of the formatting into the file corresponding to the handle argument n FmtOut formatstring sourcel sourcen The Fmt Out function formats the sourcel sourcen arguments according to descriptions in the format string argument The function writes the result of the formatting to Standard Out LabWindows CVI Standard Libraries 2 32 O National Instruments Corporation Chapter 2 Formatting and I O Library Each of these formatting functions return the number of source format specifiers satisfied If there is an error in the format string 1 is returned The formatting functions are used to format and combine multiple source items into a single target item The only difference in the workings of the three functions is the location of the target data For the function Fmt the target is a data item in memory which is passed to the function by reference For Fmt File the target is a file whose handle is passed as the first argument The LabWindows CVI function OpenF ile returns this handle For the function Fmt Out the target is Standard Out typically the display and in this case the target argument present in the other two functions is omitted Except for these differences the following descriptions apply to all the formatting functions The target parameter for Fmt must be passed by reference that is must be a pointer Formatting Functions Format String Consider the following formatting functi
461. tional Instruments for technical support helps our applications engineers answer your questions more efficiently If you are using any National Instruments hardware or software products related to this problem include the configuration forms from their user manuals Include additional pages if necessary Name Company Address Fax Phone Computer brand Model Processor Operating system Windows 3 1 Windows for Workgroups 3 11 Windows NT 3 1 Windows NT 3 5 Windows 95 other include version number Clock Speed MHz RAM MB Display adapter Mouse yes no Other adapters installed Hard disk capacity MB Brand Instruments used National Instruments hardware product model Revision Configuration National Instruments software product Version Configuration The problem is List any error messages The following steps will reproduce the problem Hardware and Software Configuration Form Record the settings and revisions of your hardware and software on the line to the right of each item Complete a new copy of this form each time you revise your software or hardware configuration and use this form as a reference for your current configuration When you complete this form accurately before contacting National Instruments for technical support our applications engineers can answer your questions more efficiently National Instruments Product
462. tions and panels The RS 232 Library Function Reference section contains an alphabetical list of function descriptions In order to use the RS 232 Library on UNIX your UNIX kernel must support asynchronous I O functions for example aioread and aiowrite You can enable this by building your UNIX kernel as Generic instead of Generic Small RS 232 Library Function Overview This section contains general information about the RS 232 Library functions and panels The RS 232 Library can also be used with a National Instruments RS 485 serial board The RS 232 Library Function Panels The RS 232 Library function panels are grouped in a tree structure according to the types of operations performed The RS 232 Library function tree appears in Table 5 1 The first and second level bold headings in the tree are the names of function classes and subclasses Function classes and subclasses are groups of related function panels The third level headings in plain text are the names of individual function panels Each RS 232 function panel generates one or more RS 232 function calls The names of functions are in bold italics to the right of the function panel name Table 5 1 The RS 232 Library Function Tree RS 232 Open Close Open COM and Configure OpenComConfig Close COM CloseCom Open COM Current State OpenCom Input Output Read Buffer ComRd Read Terminated Buffer ComRdTerm Read Byte ComRdByte continues National Instruments Co
463. top trigger 10692 chanClockDisabledErr Cannot start the acquisition because the channel clock is disabled 10693 extScanClockErr Cannot use an external scan clock when performing a single scan of a single channel 10694 unsafeSamplingFreqErr The sampling frequency exceeds the safe maximum rate for the ADC gains and filters you are using 10695 DMAnotAllowedErr You must use interrupts DMA does not work 10696 multiRateModeErr Multi rate scanning can not be used with AMUX 64 SCXI or pre triggered acquisitions 10697 rateNotSupportedErr NI DAQ was unable to convert your timebase interval pair to match the actual hardware capabilities of the specified board 10698 timebaseConflictErr You cannot use this combination of scan and sample clock timebases for the specified board 10699 polarityConflictErr You cannot use this combination of scan and sample clock source polarities for this operation for the specified board 10700 signalConflictErr You cannot use this combination of scan and convert clock signal sources for this operation for the specified board 10740 SCXITrackHoldErr A signal has already been assigned to the SCXI track and hold trigger line or a control call was inappropriate because the specified module is not configured for one channel operation continues LabWindows CVI Standard Libraries 10 64 O National Instruments Corporation Chapter 10 Easy I O for DAQ Library Tab
464. tput queue It also specifies the time allowed between the transfer of any two consecutive bytes to the output queue The transfer of bytes to the output queue can become stalled if the output queue is full and hardware or software handshaking is held off If the hold off is not resolved within the time out period the RS 232 write operation returns a time out error If the timeoutSeconds parameter is zero it disables time outs and the read or write functions wait indefinitely for the operation to complete The function returns an error if the port is not open or parameter values are invalid National Instruments Corporation 5 29 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 SetCTSMode int result SetCTSMode int COMPort int mode Purpose Enables or disables hardware handshaking as described in the Hardware Handshaking section of the RS 232 Library Function Overview Parameters COMPort integer Range 1 through 32 mode integer 0 to disable hardware handshaking non zero to enable hardware handshaking See discussion below Return Value Parameter Discussion The following are the valid values for mode 0 LWRS_HWHANDSHAKE_OFF Hardware handshaking is disabled The CTS line is ignored The RTS and DTR lines are raised the entire time the port is open 1 LWRS_HWHANDSHAKE_CTS_RTS_DTR Hardware handshaking is enabled The CTS line is monitored Both the RTS and DTR lines are used for ha
465. tputArrayImaginary double precision Imaginary part of z array Return Value status integer Refer to error codes in Table 3 2 LabWindows CVI Standard Libraries 3 10 National Instruments Corporation Chapter 3 Analysis Library CxLinEv1D int status CxLinEv1D double arrayXReal double arrayXImaginary int numberofElements double aReal double almaginary double bReal double bImaginary double outputArrayReal J double outputArrayImaginary Purpose Performs a complex linear evaluation of a 1D complex array The function obtains the ith element of the resulting complex array by using the following formulas yr ar xr ai x1 br yi ar xi ai xr bi The function performs the operations in place that is the input and output complex arrays can be the same Parameters array XReal array XImaginary numberofElements aReal almaginary bReal bImaginary Output outputArrayReal outputArrayImaginary Return Value double precision array double precision array integer double precision double precision double precision double precision double precision array double precision array Real part of x Imaginary part of x Number of elements Real part of a Imaginary part of a Real part of b Imaginary part of b Real part of y Imaginary part of y status integer Refer to error codes in Table 3 2 National Instruments Corp
466. tring must be assigned to each array element Then Fmt is used to format each file name The resulting file names are FILEO000 DAT FILEOOO1 O National Instruments Corporation DAT Fl LEO002 DAT and F LEO003 DAT LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Writing a Line Containing an Integer with Literals to the Standard Output int a b a 12 b 34 FmtOut s lt A i n a FmtOut s lt B i n b Remarks In this example the output is as follows A 12 B 34 Writing to the Standard Output without a Linefeed Carriage Return char s int b double c a One FmtOut s lt s a b 2 FmtOut s lt i b c 3 4 FmtOut Ss lt Sf Cc Remarks This example demonstrates how to write to the Standard Output without a linefeed carriage return by omitting the n from the format string The output in this example is as follows One 2 3 4 The following code produces the same output a One b 23 c 3 4 FmtOut s lt s Si S a b c LabWindows CVI Standard Libraries 2 58 National Instruments Corporation Chapter 2 Formatting and I O Library Scan ScanFile ScanIn Examples in C This section contains examples of program code that use the Scan ScanFile and ScanIn functions from the Formatting and I O Library To eliminate redundancy the examples include no err
467. tting and I O Library Chapter 2 Format specifiers describe the inputs and outputs of data transformations Each format specifier has the following form rep formatcode modifiers The character introduces all format specifiers rep indicates how many times the format repeats with respect to the arguments format code is a code character which indicates the nature of the data items being formatted modifiers is an optional bracket enclosed sequence of codes which further describe the data format Examples of format specifiers are as follows 3s 100f i b2u Note rep is not allowed when formatcode is s string formatcode is specified with one of the following codes s string As a source or target specifier this indicates that the corresponding parameter is a character string As a target specifier the default if no target specifier is present this can mean that numeric source parameters become converted into an ASCII form for inclusion in the target string See the individual numeric formats such as Si and f for details of these conversions Arrays of strings are not allowed For example 10s is not a valid format string Note When a target string is filled in an ASCII NUL is always placed in the string after the last byte i integer This source or target specifier indicates that the corresponding parameter is an integer or if rep is present an integer array The function performs conversions to ASCII digits whe
468. ttrigger sample count is invalid 10 10089 badTotalCountErr The total count specified is inconsistent with the buffer 10 configuration and pretrigger scan count or with the device type 10090 badRPGErr The individual range polarity and gain settings are valid but the combination specified is invalid for this device continues LabWindows CVI Standard Libraries 10 58 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Table 10 5 Easy I O for DAQ Error Codes Continued 10091 badIterationsErr The analog output buffer iterations count is invalid It must be 0 for indefinite iterations or 1 10100 badPortWidthErr The requested digital port width is not a multiple of the hardware port width 10240 noDriverErr The driver interface could not locate or open the driver 10241 oldDriverErr The driver is out of date 10242 functionNotFoundErr The specified function is not located in the driver 10243 configFileErr The driver could not locate or open the configuration file or the format of the configuration file is not compatible with the currently installed driver 10244 deviceInitErr The driver encountered a hardware initialization error while attempting to configure the specified device 10245 osInitErr The driver encountered an operating system error while attempting to perform an operation or the driver performed an operation that the operating system does not
469. tus integer Success or failure Return Codes Success Failure reported by operating system LabWindows CVI Standard Libraries 8 38 O National Instruments Corporation Chapter 8 Utility Library GetSystemTime int status GetSystemTime int hours int minutes int seconds Note This function is only available on the Windows version of LabWindows CVI Purpose Obtains the system time in numeric format Parameters Hours 0 23 Minutes 0 59 Seconds 0 59 Return Value status Success or failure Return Codes Success Failure reported by operating system GetWindowDisplaySetting void GetWindowDisplaySetting int visible int zoomState Note This function is only available on the Windows version of LabWindows CVI Purpose Indicates how the user of your application wants the initial application window to be displayed The values returned by this function reflect the display options set for the program in Program Manager and other MS Windows shells O National Instruments Corporation 8 39 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameters visible 0 if window is to be hidden 1 if window is to be displayed zoomState ATTR_NO_ZOOM normal display ATTR_MINIMIZE ATTR_MAXIMIZE Return Value None Example If you want to honor the user s display options put the following code where you display your initial panel int showWi
470. type is TCP_DISCONNECT The following describes each transaction type TCP_DISCONNECT Received when a server is requesting the termination of a connection or when a connection is being terminated due to an error If the connection is terminated due to an error the errCode parameter contains a negative error code Refer to Table 7 3 for the list of error codes TCP_DATATREAD Y Received when the server has sent data via TCP to the client Your program acting as the client should call Client TCPRead to obtain the data The client callback function should return TRUE if the message can be processed successfully Otherwise the function should return FALSE Note The callback function should be short and should return as soon as possible callbackData is a four byte value that will be passed to the callback function each time it is called for this client You should define the meaning of the callback data One way to use the callbackData is as a pointer to a data object that you need to access in the callback function In this way you would not need to declare the data object as a global variable If you do not want to use the callbackData you can pass zero LabWindows CVI Standard Libraries 7 6 O National Instruments Corporation Chapter 7 TCP Library See Also RegisterTCPServer DisconnectFromTCPServer DisconnectFromTCPServer int status DisconnectFromTCPServer unsigned int conversationHandle Purpose
471. uble x s 32 ES n Scan s Ss gt S1 f amp a X RO FASults a 32 DO nee 2 SoH 32 1233 n Scan s SS gt Si x S 8a X E result Ja 32 tS 132350 1 Sk ES s gt t327 15 23 n Scan s Ss gt S1 f amp a X result a 32 x 2722 n 1 Remarks After each of the first two calls to Scan a 32 x 1 23 and n 2 indicating that two target specifiers were satisfied In the second call the x modifier is used to discard the separating comma In the third call there is a comma separator after the integer but the x modifier is absent Consequently Scan fails when attempting to find the real number x remains unmodified and n indicating that only one target specifier was satisfied National Instruments Corporation 2 61 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 String to String char s char buf 10 int ns 8 abc Wa Scan s w abc Ws Scan s s gt s y s gt 2s result buf abc buf Bo pH buf result buf abc Remarks When extracting a substring from a string Scan skips leading spaces and tabs unless the y modifier is present s a b G an n Scan s s gt s buf result buf a s a b G al n Scan s s gt s t59 buf result buf a b ce When Scan extracts a substring from a string and the t modifier is not present the sub
472. ue returned by CreateXPropType PropTypelnUsexErr 11 There is a property created by CreateXPropert y that has this property type DisconnectFromXDisplay PropLibXErrType status DisconnectFromXDisplay DisplayPt rx display Purpose Disconnects from a remote X server You can use this function to end access to a remote X server you connected using ConnectToXDisplay After this function is called you can no longer access the remote X server Parameter Input display DisplayPtrX A pointer to the display of the remote X server to be disconnected This value must have been obtained from ConnectToXDisplay Return Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values NoXErr 0 The function was successful InvalidParamXErr 1 NULL was passed to the parameter InvalidDisplayXErr 2 The display argument is not a valid display This value must be the value returned by Connect ToXDisplay LabWindows CVI Standard Libraries 9 14 O National Instruments Corporation Chapter 9 X Property Library See Also Refer to the Xlib Programming Manual or to Xlib C Language X Interface MIT X Consortium Standard for more information about the XCloseDisplay function GetXPropErrorString char message GetXPropErrorString PropLibXErrType errorNum Purpose Converts the error numb
473. uence of codes which further describe the data format The following are examples of format specifiers s t59 100i z sf Note rep is not allowed when formatcode is s or 1 string National Instruments Corporation 2 41 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 formatcode is specified with one of the following codes S string As a source or target specifier this indicates that the corresponding parameter is a character string As a source specifier the number of bytes of the source parameter that are consumed depends on the target specifier If the target specifier is 3s bytes are consumed until a termination character is encountered see the t modifier for strings for more information on termination characters If the target specifier is one of the numeric formats bytes are consumed as long as they correspond to the pattern for the particular numeric item being converted Leading spaces and tabs are skipped unless the y modifier is used Note When a target string is filled in an ASCII NUL is always placed in the string after the last byte string This is allowed only as a source specifier It is the same as the s specifier except that bytes from the source argument are to be consumed only until a linefeed is encountered Also when modified with c as in 1 c a comma is used as the target string terminator in place of white space characters integer As a source or target specifier this
474. ult GetModuleDir char directoryName void moduleHandle Note This function is available only in the Windows 95 and NT versions of LabWindows CVI O National Instruments Corporation 8 31 LabWindows CVI Standard Libraries Utility Library Chapter 8 Purpose This function obtains the name of the directory of the specified DLL module This function is useful when a DLL and its related files are distributed to multiple users who may place them in different directories If your DLL needs to access a file that is in the same directory as the DLL you can use the Get ModuleDir and MakePathname functions to construct the full pathname If the specified module handle is zero then this function returns the same result as GetProjectDir Parameter List directoryPathname Directory of module Input moduleHandle void Module handle of DLL or zero for the pointer project Parameter Discussion directoryPathname must be at least MAX_PATHNAME_ LEN bytes long If you want to obtain the directory name of the DLL in which the call to GetModuleDir resides then pass__CVIUserHInst as the moduleHandle You can pass any valid Windows module handle If you pass O for the moduleHandle this function obtains the directory of the project or standalone executable Return Value Return Codes Success The current project has no pathname that is it is untitled There is no current project Out of memory The operat
475. unction TCP function Pointer to the user callback pointer function callbackData void pointer Pointer to the user data LabWindows CVI Standard Libraries 7 8 National Instruments Corporation Chapter 7 TCP Library Return Value status integer Refer to error codes in Table 7 3 Parameter Discussion serverCallbackFunction is the name of the function to be called to process client requests The callback function must be of the following form int tcpFuncPtr int handle int xType int errCode void callbackData The xType parameter specifies the type of message received from the server The server callback function can receive the following transaction types TCP_CONNECT TCP_DISCONNECT TCP_DATAREADY The errCode parameter is used only when the transaction type is TCP_DISCONNECT The following describes each transaction type TCP_CONNECT The transaction type is received when a client is requesting a connection TCP_DISCONNECT Received when a client is requesting the termination of a connection or when a connection is being terminated due to an error If the connection is terminated due to an error the errCode parameter contains a negative error code Refer to Table 7 3 for the list of error codes TCP_DATATREAD Y Received when the client has sent data via TCP to the server Your program acting as the server should call ServerTCPRead to obtain the data The server
476. unction 3 23 MaxMin1D function 3 24 MaxMin2D function 3 24 to 3 25 Mean function 3 25 to 3 26 memory access See physical memory access functions miscellaneous Easy I O for DAQ functions GetAILimitsOfChannel 10 40 to 10 41 GetChannellIndices 10 41 to 10 42 GetChannelNameFromIndex 10 42 to 10 43 GetDAQErrorString 10 43 to 10 44 GetNumChannels 10 44 GroupByChannel 10 44 to 10 45 SetEasyIOMultitaskingMode 10 53 miscellaneous utility functions Beep 8 5 Breakpoint 8 6 CloseCVIRTE 8 6 Cls 8 7 CVILowLevelSupportDriverLoaded 8 8 to 8 9 DisableInterrupts 8 12 EnableInterrupts 8 15 to 8 16 GetCurrentPlatform 8 19 GetCVIVersion 8 18 to 8 19 GetInterruptState 8 30 GetWindowDisplaySetting 8 39 to 8 40 InitCVIRTE 8 40 to 8 42 InStandaloneExecutable 8 43 RoundRealToNearestInteger 8 61 to 8 62 SystemHelp 8 79 to 8 81 TruncateRealNumber 8 84 Mul1D function 3 26 to 3 27 Mul2D function 3 27 multithreading Windows 95 and Windows NT 4 11 LabWindows CVI Standard Libraries Index N Neg1D function 3 28 null modem cable 5 5 NumFmtdBytes function 2 20 O one dimensional array operation functions Abs1D 3 4 to 3 5 Add1D 3 5 Div1D 3 16 to 3 17 LinEv1D 3 21 MaxMIin1D 3 24 Mull1D 3 26 to 3 27 Neg1D 3 28 Sub1D 3 30 to 3 31 Subset1D 3 32 one dimensional complex operation functions CxAdd1D 3 8 to 3 9 CxDiv1D 3 10 CxLinEv1D 3 11 CxMul 1D 3 12 to 3 13 CxSub1D 3 15 ToPolar1D 3 33 to 3 34 ToR
477. under Windows A DDE client can send commands to a server application to be executed and request data from a server application With the LabWindows CVI DDE Library you can write programs to act as a DDE client or server A detailed example using Microsoft Excel and LabWindows CVI follows later in this chapter to illustrate how to use the DDE Library functions To connect to a DDE server from a LabWindows CVI program you must know some information about the application to which you would like to connect All DDE server applications have a name and topic that defines the connection For example you can connect to Microsoft Excel as a server in two ways with the Connect ToDDEServer function from a LabWindows CVI program If you want to send commands to be executed by the Excel application such as opening worksheets and creating charts you should specify excel as the server name and system as the topic name in the call to the Connect ToDDEServer function However 1f you want to send data to an Excel spreadsheet you should specify excel as the server name and the filename of the worksheet that is already loaded in Excel as the topic name If your program acts as a DDE server where other Windows applications will be sending and receiving commands and data you need to call the RegisterDDEServer function in your program The RegisterDDEServer function establishes your program as a valid DDE server so that other applications can connect t
478. update on channel 3 waveforms 4 the 1st update on channel 5 waveforms 5 the 2nd update on channel 0 waveforms 6 the 2nd update on channel 1 waveforms 7 the 2nd update on channel 2 waveforms 8 the 2nd update on channel 3 waveforms 9 the 2nd update on channel 5 waveforms n 5 the last update on channel 0 waveforms n 4 the last update on channel 1 waveforms n 3 the last update on channel 2 waveforms n 2 the last update on channel 3 waveforms n 1 the last update on channel 5 AOUpdateChannel short error AOUpdateChannel short device char singleChannel J double voltage Purpose This function applies a specified voltage to a single analog output channel LabWindows CVI Standard Libraries 10 22 National Instruments Corporation Chapter 10 Easy I O for DAQ Library Parameters device short integer Assigned by configuration utility singleChannel string The analog output channel to which the voltage are applied voltage double The voltage that is applied to the analog output channel Return Value short integer Refer to error codes in Table 10 5 Parameter Discussion singleChannel is the analog output channel to which the voltage are applied Refer to the Channel String for Analog Output Functions subsection of the Easy I O for DAO Library Function Overview section of this chapter for the syntax of this string AOUpdateChannels
479. ur program whenever a property or set of properties on a window or set of windows changes The function InstallPropertyCallback registers a function that is called whenever any of the specified properties changes The callback function must have the type PropertyCallbackTypex as defined in xproplib h LabWindows CVI passes the X display window and property that changed to the callback function The state parameter of the callback function will be either NewValuexX if the property value changed or DeletexX if the property was deleted The function UninstallPropertyCallback disables the callback function Error Codes PropLibXErrType is the data type of all return values in the X Property Library functions PropLibXErrType is an enumerated enum type containing descriptive constant names and numeric values for the errors PropLibXErrType and its enumerated values are all integers All error values are negative numbers The following table lists all the enumerated constant names and their corresponding numeric values Detailed descriptions of these error types appear in the function descriptions in the following section LabWindows CVI Standard Libraries 9 4 National Instruments Corporation Chapter 9 X Property Library Table 9 3 X Property Library Error Types and Descriptions Constant Name NoXErr InvalidParamXErr InvalidDisplayXErr InvalidWindowXErr InvalidPropertyXErr
480. ure around a segment of code It does not affect the state of the Break on Library Errors check box in the Run Options dialog box of the Options menu in the Project window Note This function has been superseded by Set BreakOnLibraryErrors DisableInterrupts void DisableInterrupts void Purpose Under Windows 3 1 and Windows 95 this function uses the CLI instruction to turn off all maskable 80x86 interrupts On UNIX this function uses sigblock to block all blockable signals Note For you to be able to use this function under Windows 95 the LabWindows CVI low level support driver must be loaded Note Under Windows NT the EnableInterrupts and Disablelnterrupts functions have no effect Interrupts are always enabled while your program is running at the user as opposed to the kernel level Parameter None Return Value None DisableTaskSwitching void DisableTaskSwitching void Note This function is available only on the Windows versions of LabWindows CVI Purpose This function prevents the end user from using one of the following Windows features to switch another task LabWindows CVI Standard Libraries 8 12 National Instruments Corporation Chapter 8 Utility Library e The lt Alt Tab gt lt Alt Esc gt or lt Ctrl Esc gt key combination under Windows 3 1 or Windows 95 e The Switch To item in the system menu under Windows 3 1 This function affects the behavior of these keys only
481. urn Values The return value indicates the success or failure status of the function call A negative value indicates an error The following table shows status values Table 9 4 Status Values for InstallXPropertyCallback NoXErr O The function was successful InvalidParamXErr NULL was passed to one or more parameters The number of windows argument is 0 lidDisplayXErr The display argument is not a valid display This argument must either be the predefined value CVIXDisplay or be the value returned by ConnectToXDisplay lidWindowXErr One or more of the windows in the windowList argument are not valid lidPropertyXErr One or more of the property handles in the propertyList argument are not valid These properties must be values returned by CreateXProperty InsuffMemxErr There is insufficient memory to perform the operation BrokenConnectionXErr The connection to the X server was broken This occurs if the remote server terminated Parameter Discussion display must either be the predefined value CVIXDi splay or be the value returned by ConnectToXDisplay Use CVIXDisplay if the window is on the same display used by LabWindows CVI To specify a single window named win pass the expression amp win for the windowList parameter and pass 1 for the numberOfWindows Use amp CVIXRoot Window to access the LabWindows CVI Standard Libraries 9 26 National Instruments Corpo
482. urred Insufficient memory to complete operation Invalid time or invalid path for example c filename in Windows Access denied Parameter Discussion fileName may be the empty string in which case the time of the file found by the most recent call to GetFirstFileor GetNextFile is set seconds value must be entered in increments of 2 LabWindows CVI Standard Libraries 8 70 O National Instruments Corporation Chapter 8 Utility Library SetPersistent Variable void SetPersistentVariable int value Purpose Lets you store an integer value across multiple builds and executions of your project in the LabWindows CVI development environment When you unload a project or load a new project the value is reset to zero This function is useful when your program performs an action such as setting up your instruments that takes a long time and that you do not want to be repeated each time you re run your program Global variables in your program are reinitialized to zero each time you run your project Thus they cannot be used to indicate that you have already taken the action once To get around this problem LabWindows CVI maintains an integer variable across multiple builds and executions of your project This function sets the value of that variable To retrieve the variable value call GetPersistentVariable Parameters Input value integer The value to assign to the persistent variable SetStdioPort int stat
483. us SetStdioPort int stdioPort Purpose Sets the current destination for data written to the standard output and the source of data read from standard input You can specify either the CVI Standard Input Output window or the standard input output of the host system Note This function is valid only on the UNIX version of LabWindows CVI O National Instruments Corporation 8 71 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameters Input stdioPort integer CVI_STDIO_WINDOW 0 the CVI Standard Input Output window HOST SYSTEM STDIO 1 the host system s standard output Return Value status integer Indicates whether the function succeeded Return Codes Success Destination was not a valid range Parameter Discussion In a standalone executable the default value for stdioPort is CVI_STDIO_WINDOW In the CVI Development System the default value for stdioPort is the current state of the Use host system s standard input output option in the dialog box brought up by the Environment command in the Options menu of the Project window The value that you set using this function is reflected the next time you bring up the environment dialog SetStdioWindowOptions int status SetStdioWindowOptions int maxNumLines int bringToFrontWhenModified int showLineNumbers Purpose Sets the current value of the following Standard Input Outp
484. used the numeric characters 012345678 9abcde f are always interpreted as hexadecimal s 32x1 n Scan s s gt 1 amp a result a 32 n 1 O National Instruments Corporation 2 59 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Scan considers the occurrence of a non numeric character such as the x in 32x1 to mark the end of the integer s 32567 n Scan s s gt i w3 amp a result a 325 n 1 The w3 modifier specifies that only the first 3 bytes of the string are scanned String to Long Integer Ghar rgs long a int ny s 99999 n Scan s s gt i b4 amp a result a 99999 n 1 s 303237 n Scan s s gt o b4 amp a result a 99999 n 1 s EPEE n Scan s s gt x b4 amp a result a 65535 n 1 Remarks Scan extracts long integers from strings in the same way it extracts integers The only differences are that the b4 modifier must be used and the target argument must be a long integer See the String to Integer example earlier in this section for more details on using Scan to extract integers and long integers from strings String to Real char s double x int n s 12 3 n Scan s s gt 8 x result x 12 3 n 1 s 1 23e 1 n Scan s Ss gt f amp xX result x 1 23 n 1 s 1 23e 1 n Scan s Ss gt f amp xX result x 0 123 n 1
485. ut window options Maximum Number of Lines Bring To Front When Modified Show Line Numbers LabWindows CVI Standard Libraries 8 72 National Instruments Corporation Chapter 8 Utility Library Parameters maxNumLines integer The maximum number of lines that can be stored in the Standard Input Output Window If this amount is exceeded lines are discarded from the top Valid range 100 to 1000000 bringToFrontWhenModified integer Indicates whether the Standard Input Output window is brought to the front each time a string or character is added to it 1 Yes 0 No showLineNumbers integer Indicates whether line numbers are shown in the Standard Input Output window 1 Yes 0 No Return Value status integer Indicates whether the function succeeded Return Codes Success Maximum number of lines is not within the valid range Parameter Discussion maxNumLines In an executable the default value is 10000 In the CVI Development System the default value is the value set in the dialog box brought up by the Environment command in the Options menu of the Project window The value that you set using this function is reflected the next time you bring up the Environment dialog box bringToFrontWhenModified In an executable the default value is 1 bring to front when modified In the CVI Development System the default value is the current state of the Bring Standard Input Output window to front whenever mo
486. ut window to the left edge of the screen GetStdioWindowSize void GetStdioWindowSize int height int width Purpose Gets the height and width in pixels of the client area of the Standard Input Output window The client area excludes the frame and the title bar Parameters Output height integer The current height in pixels of the client area of the Standard Input Output window integer The current width in pixels of the client area of the Standard Input Output window GetStdioWindow Visibility void GetStdioWindowVisibility int visible Purpose Indicates whether the Standard Input Output window is currently visible If the window has been made into an icon it is considered to be not visible If the window cannot be seen merely because its position is off the screen it is considered to be visible National Instruments Corporation 8 37 LabWindows CVI Standard Libraries Utility Library Chapter 8 Parameters visible integer 1 Standard I O window is visible 0 Standard I O window is not visible GetSystemDate int status GetSystemDate int month int day int year Note This function is only available on the Windows version of LabWindows CVI Purpose Obtains the system date in numeric format Parameters Output month integer Month 1 12 day integer Day of month 1 31 integer Year Under Windows 3 1 the year is limited to the values 1980 2099 Return Value sta
487. utes and returns the first matching file If you select multiple attributes a match occurs on the first file for which one or more of the specified attributes are set and which matches the pattern in the searchPath parameter The search attributes are e Normal e Read only e System e Hidden e Archive e Directory Under UNIX only the directory attribute is honored If you pass 1 for the directory attribute only directories match If you pass 0 for the directory attribute only non directories match National Instruments Corporation 8 27 LabWindows CVI Standard Libraries Utility Library Chapter 8 Under Windows all of the attributes are honored The normal attribute specifies files with no other attributes set or with only the archive bit set The archive attribute specifies files that have been modified because they were last backed up using the DOS BACKUP command The read only attribute specifies files that are protected from being modified or overwritten The system and hidden attributes specify files which normally do not appear in a directory listing The directory attribute specifies directories If you pass 1 only for the normal attribute any file that is not read only not a system file not hidden and not a directory can match A normal file s archive bit may be either on or off The normal attribute is the only attribute that requires other attributes not to be set For example if you use the read only attribute any
488. veforms for an explanation of grouped by scan versus grouped by channel Parameters Input array double Pass in the grouped by scan array and it is Output array grouped by channel in place numberOfScans long integer The number of scans contained in the data array numberOfChannels unsigned Specifies the number of channels that were long integer scanned You can use GetNumChannels to determine the number of channels contained in your channel string Return Value short integer Refer to error codes in Table 10 5 ICounterControl short error ICounterControl short device short counter short controlCode unsigned short count short binaryorBCD short outputState unsigned short readValue Purpose Controls counters on devices that use the 8253 timer chip Lab boards SCXI 1200 DAQPad 1200 PC LPM 16 DAQCard 700 O National Instruments Corporation 10 45 LabWindows CVI Standard Libraries Easy I O for DAQ Library Chapter 10 Parameters device short integer Assigned by configuration utility counter short integer The counter to be controlled valid counters are 0 through 2 controlCode short integer Determines the counter s operating mode count unsigned The period between output pulses short integer binaryorBCD short integer I_BINARY The counter operates as a 16 bit binary counter 0 to 65 535 1_BCD The counter operates as a 4 decade BCD counter 0 to 9
489. void destinationBuffer unsigned int numberOfBytes int bytesAtA Time Note This function is available only in the Windows version of LabWindows CVI Purpose This function copies the contents of a region of physical memory into the specified buffer It can copy the data in units of 1 2 or 4 bytes at a time The function does not check whether the memory actually exists If the memory does not exist the success value is returned but no data is read Note For you to be able to use this function under Windows 95 or NT the LabWindows CVI low level support driver must be loaded Parameters physicalAddress unsigned The physical address to read from There are integer no restrictions on the address it can be above or below 1 MB destinationBuffer void pointer The buffer into which the physical memory is copied numberOfBytes unsigned The number of bytes to copy from physical integer memory bytesAtA Time integer The unit size in which to copy the data Can be 1 2 or 4 Return Value Indicates whether the function succeeded Return Codes Success Failure reported by operating system or low level support driver not loaded or numberOfBytes is not a multiple of bytesAtA Time or invalid value for bytesAtA Time Parameter Discussion numberOfBytes must be a multiple of bytesAtA Time LabWindows CVI Standard Libraries 8 58 O National Instruments Corporation Chapter 8 Utility Library ReleaseExternalM
490. was invalid One of the DLLs required to run this application was corrupt Application requires Microsoft Windows 32 bit extensions Parameter Discussion fileName is the program to be run If the program is not in one of the directories specified in the PATH environment variable you must specify the full path The path can include arguments to be passed to the program Under Microsoft Windows if the program is a pif bat or con file the extension must be included in the path name For example under Microsoft Windows the following command string launches the Edit program with the file file dat c dos edit com c file dat LabWindows CVI Standard Libraries 8 46 O National Instruments Corporation Chapter 8 Utility Library LaunchExecutableEx int result LaunchExecutableEx char fileName int windowState int handle Purpose LaunchExecutableEx performs the same operation as LaunchExecutable with the following extended features e Under Windows you can specify how the Windows application displays e This function returns a handle to the executable that can show whether the executable is still running and also terminate the executable Parameters fileName string Pathname of executable file and arguments windowState integer Specifies how a Windows program is to be shown Ignored under UNIX Output handle integer A handle representing the executable launched Return Value Return Codes
491. wchar_t type operate only on 8 bit characters LabWindows CVI supports variable argument functions using the ANSI C macros with one exception none of the unspecified arguments can have a struct type As a result the macro va_arg ap type should never be used when type is a structure Note LabWindows CVI will not warn you about this error Under UNIX LabWindows CVI implements only the C locale as defined by the ANSI C standard The native locale which is specified by the empty string is also the C locale The following table shows the locale information values for the C locale LabWindows CVI Standard Libraries 1 2 National Instruments Corporation Chapter 1 ANSI C Library Table 1 2 C Locale Information Values C locale Value decimal_point thousands_sep grouping int_curr_symbol currency_symbol mon_decimal_point mon_thousands_sep mon_grouping positive_sign negative_sign int_frac_digits frac_digits p_cs_precedes p_sep_by_space n_cs_precedes n_sep_by_space p_sign_posn n_sign_posn O National Instruments Corporation CHAR_MAX CHAR_MAX CHAR_MAX CHAR_MAX Decimal point character for non monetary values Non monetary digit group separator character or characters Non monetary digit groupings The three character international currency symbol plus the character used to separate the international symbol from the monetary quantity The loca
492. while LabWindows CVI or a LabWindows CVI Standalone Executable is the active application under Microsoft Windows This function has no effect in Windows NT See the Alternatives in Windows NT section for instructions on how to achieve the desired effect Note To use this function on Windows 95 the LabWindows CVI low level support driver must be loaded Disabling the Task List DisableTaskSwitching does not prevent the user from clicking on the desktop to get the task list in Windows 3 1 or clicking on the task bar in Windows 95 You can prevent the user from clicking on the desktop by forcing your window to cover the entire screen Forcing Window to Cover Entire Screen You can force your window to cover the entire screen by making the following calls to functions in the User Interface Library SetPanelAttribute panel ATTR_SIZABLE FALSE SetPanelAttribute panel ATTR_CAN_MINIMIZE FALSE SetPanelAttribute panel ATTR_CAN_MAXIMIZE FALSE SetPanelAttribute panel ATTR_SYSTEM_MENU_VISIBLE FALSE SetPanelAttribute panel ATTR_MOVABLE FALSE SetPanelAttribute panel ATTR_WINDOW_ZOOM VAL_MAXIMIZE In these calls panel is the panel handle for your top level window These calls will work in Windows 3 1 Windows 95 and Windows NT Alternatives in Windows 3 1 Under Windows 3 1 you can prevent the end user accessing the tas
493. y Parameters COMPort integer Range 1 through 32 count integer If 0 no bytes are removed from queue terminationByte integer Low byte contains the numeric equivalent of the terminating character data Return Value nbytes integer Number of bytes read from the input queue Using This Function This function times out if the input queue remains empty within the specified time out period This may occur when no data has been received during the time out period If the read terminates on the termination byte the byte is neither written to the buffer nor included in the count If the termination character is either a carriage return CR or decimal 13 or a linefeed LF or decimal 10 the function handles it as follows e If terminationByte CR and if the character immediately following CR is LF discard the LF in addition to the CR If terminationByte LF and if the character immediately following LF is CR discard the CR in addition to the LF Only the bytes placed in buffer are included in the return count If CR or LF is discarded because it follows an LF or CR it is not counted toward satisfying the count The function returns an error if the port is not open or parameter values are invalid National Instruments Corporation 5 13 LabWindows CVI Standard Libraries RS 232 Library Chapter 5 ComSetEscape int result ComSetEscape int COMPort int escapeCode Purpose Directs the specified com por
494. y Detailed descriptions of the NI 488 and NI 488 2 functions can be found in your NI 488 2 function reference manual The GPIB Function Reference section contains an alphabetical list of descriptions for the Device Manager functions the callback installation functions and the functions for returning the thread specific status variables GPIB Library Function Overview This section describes the functions in the LabWindows CVI GPIB Library These functions are arranged alphabetically according to their names in C For detailed function descriptions refer to the NI 488 2 function reference manual that accompanied your GPIB interface board GPIB Functions Library Function Panels The GPIB Functions Library function panels are grouped in a tree structure according to the types of operations performed The GPIB Functions Library function tree is in Table 4 1 The first and second level bold headings in the function tree are names of the function classes Function classes are groups of related function panels The third level headings in plain text are the names of individual function panels Each GPIB function panel generates a GPIB function call The actual function names are in bold italics in columns to the right National Instruments Corporation 4 1 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 Table 4 1 The GPIB Functions Library Function Tree GPIB GPIB 488 2 Library Open Close Open Device Close Device C
495. y Ex Write To Physical Memory Write To Physical Memory Ex Persistent Variable Set Persistent Variable Get Persistent Variable Task Switching Disable Task Switching Enable Task Switching O National Instruments Corporation Cls GetStdio WindowOptions SetStdio WindowOptions GetStdio Window Position SetStdio WindowPosition GetStdio WindowSize SetStdio WindowSize GetStdio Window Visibility SetStdio Window Visibility GetStdioPort SetStdioPort SetBreakOnLibraryErrors GetBreakOnLibraryErrors SetBreakOnProtectionErrors GetBreakOnProtectionErrors DisableBreakOnLibrary Errors EnableBreakOnLibraryErrors DisableInterrupts EnableInterrupts GetInterruptState ReadFromPhysicalMemory ReadFromPhysicalMemoryEx Write ToPhysicalMemory Write ToPhysicalMemoryEx SetPersistentVariable GetPersistentVariable DisableTaskSwitching EnableTaskSwitching continues LabWindows CVI Standard Libraries Utility Library Chapter 8 Table 8 1 The Utility Library Function Tree Continued Launching Executables Launch Executable Extended Functions Launch Executable Extended Has Executable Terminated Terminate Executable Retire Executable Handle Miscellaneous System Help Get CVI Version Get Current Platform In Standalone Executable Initialize CVI Run Time Engine Close CVI Run Time Engine Low Level Support Driver Loaded Beep Breakpoint Round Real To Nearest Integer Truncate Real Number Get Window Display Setting The cl
496. y I O for DAQ Library currently only works with Analog I O Counter Timers and simple Digital I O The Easy I O for DAQ Library does not currently work with multirate scanning Easy I O for DAQ Library Function Panels The Easy I O for DAQ Library function panels are grouped in a tree structure according to the types of operations performed The Easy I O for DAQ Library function tree is in Table 10 1 The first and second level bold headings in the function tree are names of the function classes Function classes are groups of related function panels The third level headings in plain text are the names of individual function panels Each Easy I O for DAQ function panel generates a function call The actual function names are in bold italics in columns to the right Table 10 1 Easy I O for DAQ Function Tree Analog Input AI Sample Channel AISampleChannel AI Sample Channels AISampleChannels AI Acquire Waveform s AlAcquire Waveforms AI Acq Triggered Waveform s AlAcquireTriggered Waveforms Asynchronous Acquisition AI Start Acquisition AlStartAcquisition AI Check Acquisition AlCheckAcquisition AI Read Acquisition AlReadAcquisition AI Clear Acquisition AlClearAcquisition Plot Last Waveform s to Popup PlotLastAI WaveformsPopup Analog Output AO Update Channel AOUpdateChannel AO Update Channels AOUpdateChannels AO Generate Waveform s AOGenerate Waveforms AO Check Waveform s AOCheck Waveforms AO Clear Waveform s AOClearWavef
497. y driver on Windows 95 you can use the limited version of ibInstallCallback but you cannot use ibnotify LabWindows CVI Standard Libraries 4 12 National Instruments Corporation Chapter 4 GPIB GPIB 488 2 Library GPIB Function Reference Most of the functions in the GPIB GPIB 488 2 Library are described in the software reference manual that you received with your GPIB board This section contains descriptions only for the Device Manager functions the callback installation functions and the functions for returning the thread specific status variables Note ResetDevs is not available in LabWindows CVI This function was available in a previous LabWindows version CloseDev int result CloseDev int Device Purpose Closes a device Parameter Return Value result integer Result of the close device operation Return Codes Error cannot find device Success Using This Function Takes a device offline CloseDev performs an ibloc then an ibon1 with a value of zero Device is the device descriptor returned when the device was opened with OpenDev If CloseDev cannot find the device descriptor in its table a 1 is returned CloseDev should be used only in conjunction with OpenDev Never call CLloseDev with a device descriptor obtained by calling ibfind O National Instruments Corporation 4 15 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library Chapter 4 CloseInstrDevs int
498. y file and stores them in the integer array readings Ifthe ScanFile call is successful nbytes 200 100 integers 2 bytes per integer Binary File to Real Array Assuming a Fixed Number of Elements double waveform 100 int file_handle nbytes file handle OpenFile FILE DAT 1 2 0 ScanFile file handle 100f gt 100f waveform nbytes NumFmtdBytes CloseFile file_handle Remarks The ScanFile call reads 100 real numbers from a binary file and stores them in the real array waveform If the ScanFile call is successful nbytes 800 100 integers 8 bytes per real number Binary File to Real Array Assuming a Variable Number of Elements void StoreArray double x int count char filename int file_handle file handle OpenFil filename 1 2 0 ScanFile file handle f gt f count count x CloseFile file_handle National Instruments Corporation 2 69 LabWindows CVI Standard Libraries Formatting and I O Library Chapter 2 Remarks This example shows how a subroutine can be used to read an array of real numbers from a binary file The subroutine takes as parameters a real array the number of elements to be read and the filename The ScanFile call reads the first count elements of x from a binary file The two asterisks in the format string are matched to count For instance if count is 100 then the format string is equivalent to 100f gt 100f R
499. y function 10 29 to 10 32 CounterRead function 10 32 to 10 33 CounterStart function 10 33 CounterStop function 10 34 counter timer functions See also Easy I O for DAQ Library LabWindows CVI Standard Libraries I 4 ContinuousPulseGenConfig 10 24 to 10 26 CounterEventOrTimeConfig 10 26 to 10 29 CounterMeasureFrequency 10 29 to 10 32 CounterRead 10 32 to 10 33 CounterStart 10 33 CounterStop 10 34 DelayedPulseGenConfig 10 34 to 10 36 FrequencyDividerConfig 10 37 to 10 39 ICounterControl 10 45 to 10 47 Pulse WidthOrPeriodMeasConfig 10 48 to 10 49 valid counters table 10 7 CreateXProperty function 9 3 9 9 to 9 10 CreateXPropType function 9 3 9 10 to 9 12 customer communication xx Appendix 1 CVILowLevelSupportDriverLoaded function 8 8 to 8 9 CVIXDisplay global variable 9 3 CVIXHiddenWindow global variable 9 4 CVIXRootWindow variable 9 3 CxAdd function 3 7 to 3 8 CxAdd1D function 3 8 to 3 9 CxDiv function 3 9 CxDiv1D function 3 10 CxLinEv1D function 3 11 CxMul function 3 12 CxMul1D function 3 12 to 3 13 CxRecip function 3 13 to 3 14 CxSub function 3 14 CxSub1D function 3 15 D data acquisition functions See Easy I O for DAQ Library data formatting functions See formatting functions scanning functions status functions DateStr function 8 9 date time functions ANSI C Library 1 6 to 1 7 O National Instruments Corporation DateStr 8 9 GetSystemDate 8 38 GetSystemTime 8
500. yte For an SRQI board level condition calling the ibrsp function is necessary to cause the requesting device to turn off the SRQ line char statusByte ibrsp device statusByte If invoked because an asynchronous I O operation started by ibrda ibwrta or ibcmda completed the callback function should contain the following call ibwait boardOrDevice TIMO CMPL The ibcnt and ibcnt 1 status variables are not updated until this call to ibwait is made See Also ibnotify ibNotify int status ibnotify int boardOrDevice int eventMask GpibNotifyCallback_t callbackFunction void callbackData Note This function is available only on Windows 95 and NT On UNIX use the ibsgn1 function Purpose This function allows you to install an asynchronous callback function for a specified board or device If you want to install a synchronous callback use the ibInstallCallback function instead The callback function is called when any of the GPIB events specified in the eventMask parameter have occurred on the specified board or device Asynchronous callbacks can be called at any time while your program is running You do not have to allow the system to process events Because of this you are restricted in what you can do in the callback See the Restrictions on Operations in Asynchronous Callbacks discussion below National Instruments Corporation 4 17 LabWindows CVI Standard Libraries GPIB GPIB 488 2 Library
Download Pdf Manuals
Related Search
Related Contents
USER`S MANUAL Fire Line Automatic Vicmarc Grinding System User Manual User manual - Energy Sistem Instruccion No. 7 de 2011 取扱説明書 ジャッキ エア 油圧式 20tоn 品番: 44501200 型式 取扱説明書 別冊 Toastmaster TFP2 User's Manual RoomMate 26” & 32” Programming Manual Copyright © All rights reserved.
Failed to retrieve file