Home
NRP-NI-VISA Passport Software Manual
Contents
1. SENS FUNC POW AVG n viPrintf SensorSes SENS FREQ 1e9 n viPrintf SensorSes SENS AVER COUN AUTO OFF n viPrintf SensorSes SENS AVER COUN 16 n viPrintf SensorSes SENS AVER STAT ON n viPrintf SensorSes SENS AVER TCON REP n ie viPrintf SensorSes SENS POW AVG APER 5e 3Mn viPrintf SensorSes FORMAT ASCII n gt if checkErrors SensorSes return false viPrintf SensorSes INIT IMMMn if waitForCompletion SensorSes return false if viPrintf SensorSes FETCH n 0 return false char cData 256 memset cData 0 256 ViUInt32 iRetCnt if viBufRead SensorSes ViPBuf cData 256 amp iRetCnt 0 return false three comma seperated values printf Raw Result Ss n cData double dResult atof cData printf Pav 10 2f dBm n 30 0 10 0 1og10 fabs dResult 1e 32 return true R amp S NRP VISA Passport Table of Contents 4 5 Reading Binary Data The following function reads a block of binary data in Float32 format from the sensor This function can therefore be used with trace or CCDF measurements bool readArray ViSession SensorSes float pData int iPoints ViUInt32 iRetCnt 0 if pData 0 return false if viPrintf SensorSes FETCH n 0 return false int iBufLen iPoints 4 32 char cTmpBuf char malloc if cTmpBuf 0 return false pis Buf
2. example programs in C C and C Source code which show how to construct your own applications utilizing NI VISA and R amp S NRP VISA Passport After the installation of the R amp S NRP Toolkit SDK see C ProgramData Rohde Schwarz NRP Toolkit SDK examples Visa for further references 19
3. viScanf to exchange data with the power sensor 4 1 Checking for Errors The function below repeatedly polls the driver s error queue The return code is false if errors occurred or t rue if the queue does not contain any errors bool checkErrors ViSession SensorSes bool bOK true static const int BUFFER_SIZE 4096 char buf BUFFER SIZE 0 memset buf 0 sizeof buf do if viPrintf SensorSes SYST ERR n 0 return false if viScanf SensorSes t amp buf 0 return false H buf 0 0 break bOK false printf Error s Wn buf while true return bOK 11 4 2 Wait for Completion The function below polls the driver s cache for the measurement completion state The function times out after about 2 seconds bool waitForCompletion ViSession SensorSes int Status static const int BUFFER_SIZE 4096 char buf BUFFER SIZE 0 pr ntf Xm ys for int i 0 i 20 i sleep for 100 milliseconds Sleep 100 memset buf 0 sizeof buf if viPrintf SensorSes STAT OPER COND n 0 return false if viScanf SensorSes St amp buf 0 return false Status atoi buf printf Ta y if Status 0 break printf in if Status 0 return false return true R amp S NRP VISA Passport Table of Contents 4 3 Zeroing Sensor This exampl
4. AUTO filter off explicitly Otherwise the automatic filter takes precedence over the manual setting The FORMAT command sets the return data format to ASCII After the configuration is complete the sensor s error queue should be checked for pending errors This is done by calling the SYST ERR query until the error number is zero The following command INIT IMM starts the measurement The command returns immediately and therefore it is required to poll the measurement completion state before fetching the result Polling the sensor state is done with the query STAT OPER COND A zero return value indicates that the result is available The following FETCH query returns the measured power value Since some R amp S power sensor models can be configured to also return auxiliary values min max or random max the string returned by FETCH contains three result values In the example above no auxiliary values have been configured therefore only the first value is used and contains the average power in Watts If you want to learn more about auxiliary values search your sensor s operating manual for command SENS AUX However bear in mind that not all sensors implement the SENS AUX command In such cases the second and third value would always be 0 0 The following C code example demonstrates how this measurement can be implemented 14 bool contav ViSession SensorSes viPrintf SensorSes INIT CONT OFF n j viPrintf SensorSes
5. Len viSetAttribute SensorSes VI ATTR TERMCHAR EN false if viRead SensorSes ViPBuf cTmpBuf iBufLen amp iRetCnt 0 delete cTmpBuf viSetAttribute SensorSes VI_ATTR_TERMCHAR EN true return false viSetAttribute SensorSes VI ATTR TERMCHAR EN true if cTmpBuf 0 delete cTmpBuf printf Unexpected prefix n return false int iLenLen cTmpBuf 1 0 if iLenLen 1 iLenLen gt 9 delete cTmpBuf printf Invalid length of length n return false char cLenBuf 10 memcpy cLenBuf amp cTmpBuf 2 iLenLen cLenBuf iLenLen 0 int iDataLen atoi cLenBuf if iDataLen lt 0 iDataLen iPoints 4 iDataLen 4 0 16 delete cTmpBuf printf Invalid data length n return false memcpy pData cTmpBuf 2 iLenLen iPoints 4 delete cTmpBuf if int iRetCnt lt iPoints 4 2 iLenLen printf Insufficient number of points n return false return true R amp S NRP VISA Passport 4 6 Measuring Trace Table of Contents The code example below demonstrates how a simple trace measurement can be configured and how the measured data is read back to the host PC bool trace ViSession SensorSes viPrintf SensorSes INIT CONT OFF n viPrintf Sens
6. R amp S NRP VISA Passport User Manual R amp S NRP VISA Passport Table of Contents Table of Contents 1 Driver ArchiteCture ccsssssseeeeeeeeeeeeeeeseseeeeeeeeeeeeeeeeeeeees 3 2 In Sta liati e 4 2 1 Messag E T E 4 3 Using the NRP VISA Passport eeeeeeee 6 3 1 Resource DescriptOr orent torre kn nx ERR b Ana E kak ka kaka a kaka ka 6 3 2 VISA F nctlOns 1i eerle deceret ien 6 3 3 Return Data FOTITIA i kiya kus ccete castes ku kalk kulla n k k k kanan k awke ku eds 8 3 4 Specific SCPI COMMand cccceeeeeeseeeeeeneeeeeeeeeeeaeeeeeeeeeeeeeeeeeeees 9 4 cor 11 4 1 Checking for Errors eieenerie erreur ka RERA RA RRA h RAWA RA RAA RR RA RAA 11 4 2 Wait for Com pleti On ukkkkkkkkkkkkk kk kk AA kk KK KAKA KAKA 12 4 3 Zeroing SENSO nisrani itt RA RAN a R n ah ERKE MEKE KAR ARA KERR R RRR D B D N 13 4 4 Continuous Averagge eeeeeeeeeeeeeeeennn nennen KANA KAKA KAKA AKA KARE 14 4 5 Reading Binary Data esses nnne nnn 16 4 6 Measuring Trace teneret inrer tmn WERA R R ARRAES 18 4 7 Further information eeeeeeeeseeeeneeeeeenen nnne 19 1 Driver Architecture The diagram below shows how the R amp S NRP VISA Passport fits into the overall VISA architecture The application generally uses t
7. e shows how to execute zero compensation on a power sensor The command is CAL ZERO AUTO ONCI Er Depending on the type of sensor zero compensation may take 4 s to 8 s or sometimes even longer After executing the sensor s zero compensation an error check should follow The following snippet shows an implementation in C C code bool zeroSensor ViSession SensorSes This may take some sesonds viPrintf SensorSes CAL ZERO AUTO ONCE n if checkErrors SensorSes printf Zeroing failed n return false printf Zeroing successful n feturm Erus 13 R amp S NRP VISA Passport Table of Contents 4 4 Continuous Average The example below measures the average power of a signal The sampling window is set to 5 ms Averaging is turned on with an average count of 16 INTTI CONT OFF SENS FUNC POW AVG SENS FREQ 1e9 SENS AVER COUN AUTO OFF SENS AVER COUN 16 SENS AVER STAT ON SENS AVER TCON REP SENS POW AVG APER 5e 3 FORMAT ASCII SYST ERR Error INIT IMM TAT OPER COND S 0 FETCH 1 001674e 002 0 000000e 000 0 000000e 000 The first set of commands configures the measurement mode as well as basic parameters The complete list of commands varies between sensors and can be found in the sensor s operating manual When the sensor is used in manual filter mode it is required to turn the
8. he VISA functions to access an instrument When an instrument is opened a unique resource identifier is used to define the physical instrument link for example GPIB LAN VXI 11 or USB The R amp S NRP series power sensors use a proprietary binary protocol for the data transfer between the host PC and the sensor Therefore a driver is required on the PC side to translate SCPI commands into the binary data required by the sensor The so called VISA Passport is the defined extension interface to install links between VISA and a custom drivers and provides a way to route SCPI commands to these drivers APPLICATION VISA VISA32 dll Passport Interface NRP NrpControl2 dll NRP Sensor USB Note Although the above picture illustrates only 32 bit modules the R amp S9NRP VISA Passport driver is available in both 32 bit and 64 bit versions 2 1 2 Installation Prior to installing the R amp S9 NRP VISA Passport driver the following other software packages must be installed 1 Install the R amp S NRP Toolkit This package provides the USB drivers for the NRP series power meters as well as the low level power sensor drivers 2 Install the National Instruments VISA runtime Currently only this VISA version is supported Once the above prerequisites are met the R amp S NRP VISA Passport can be installed The setup is provided as a standard installation package which will guide you through the installat
9. ion process The name of the installation package looks like RsViNrp x y z exe Where x y and z identify the major minor and sub version of the current release for example at the time of this document being written the current installation package is called RsViNrp 2 5 0 exe Depending on the architecture of your system either only the 32 bit version of R amp S NRP VISA Passport RsViNrp d11 or both 32 bit and 64 bit versions RsViNrp d11l and RsViNrp64 d11 become installed If the R amp S NRP VISA Passport is updated from an earlier version the old version is removed first In this case a reboot may be required after the installation is complete Message Log The R amp S NRP VISA Passport component supports a logging mechanism for debugging purposes The log level is set by changing a registry key as mentioned below Changing can be made by following the steps listed below 1 Start the registry editor by executing regedit on the command line 2 Navigate to the following location HKEY LOCAL MACHINE SOFTWARE National Instruments NI VISA CurrentVersion IoLibraries RsViNrp dll 3 Modifies the following entries as needed OG FILE C NRsViNrp log OG LEVEL NONE 4 Close the registry editor tool The following log levels are supported DEBUG All messages are logged INFO Human readable messages warning and errors are logged WARN Warnings and errors are logged ERROR On
10. ly error messages are logged FATAL Only fatal errors are logged NONE Logging is off default R amp S NRP VISA Passport Table of Contents 3 3 1 3 2 Using the NRP VISA Passport Resource Descriptor In order to operate a device under VISA a so called VISA sessions must be opened A VISA session is generally opened using the viOpen function This function requires a resource descriptor string that clearly identifies the hardware interface as well as the instrument used with this VISA session The format of the resource descriptor for the R amp S NRP series power sensors is as follows RSNRP lt id gt lt serial gt INSTR lt id gt USB device ID in hex format serial the sensor s serial number e g 100123 Please note that the hardware type is RSNRP and not USB Using the RSNRP hardware type instructs the VISA layer to route all further communication through the R amp S NRP VISA Passport driver to the corresponding power sensor s VISA Functions The R amp S NRP VISA Passport supports the following VISA functions and attributes e viGetAttribute VI ATTR RSRC SPEC VERSION VI ATTR INTF INST NAME VI ATTR MANF ID VI ATTR MANF NAME VI ATTR RSRC NAME VI ATTR RSRC MANF NAME VI ATTR RSRC MANF ID VI ATTR RSRC IMPL VERSION VI ATTR RSRC CLASS VI ATTR TMO VALUE in ms VI ATTR USB INTFC NUM VI ATTR USB PROTOCOL VI ATTR USB SERIAL NUM e viSetAttribute R amp S NRP VISA Pas
11. orSes SENS FUNC XTIM POW n viPrintf SensorSes SENS FREQ le9 n viPrintf SensorSes SENS TRAC POIN 200 n viPrintf SensorSes SENS TRAC TIME 5e 3 n viPrintf SensorSes SENS TRAC OFFS TIME 500e 6 n viPrintf SensorSes TRIG SLOP POS n viPrintf SensorSes TRIG LEV le 3 n viPrintf SensorSes TRIG SOUR INT n viPrintf SensorSes TRIG DTIM On viPrintf SensorSes SENS AVER COUN 16 n viPrintf SensorSes SENS AVER STAT ON n viPrintf SensorSes SENS AVER TCON REP n viPrintf SensorSes FORMAT REAL 32 n if checkErrors SensorSes return false viPrintf SensorSes INIT IMM n if waitForCompletion SensorSes return false float FloatData 200 if readArray SensorSes FloatData 200 return false simple conversion to dBm double OutData 200 for int i 0 i lt 200 i OutData i 30 0 10 0 1log10 fabs FloatData i 1e 32 Lf a plot data s return true 18 R amp S NRP VISA Passport Table of Contents 4 7 Further information As mentioned earlier the basic driver package for R amp S USB power sensors the so called R amp S NRP Toolkit needs to be installed before you are able to communicate with the device s During the R amp S NRP Toolkit installation you will have an option of installing the NRP Toolkit software development kit SDK When selecting this option the package also installs some VISA Passport
12. r sensors is a proprietary binary format As a result the R amp S NRP VISA passport forwards SCPI commands to the low level drivers which translates them into binary information that the sensor can process In turn all results received from the sensor are cached by the driver and forwarded to the VISA layer as needed Some specific SCPI commands do not have a direct functional representation inside of the power sensor Instead this functionality is mimicked by the low level NRP power sensor driver layer SYSTem ERRor This query returns the next error message from the driver s error queue STATus OPERation CONDition This query returns the status byte from the driver s status cache The following table lists which bits reflect a certain sensor state Bit Function 0 0 1 0 2 0 3 0 4 sensor state is MEASURING 5 sensor state is WAIT FOR TRIGGER 6 0 7 0 FORMat ASCii This command sets the format of all returned numeric data to ASCII FORMat REAL 32 This command sets the format of all returned numeric data to floating point 32 bit FETCh The query returns values from the driver s internal data cache The format depends on the SCPI commands that were send before R amp S NRP VISA Passport Table of Contents 4 Examples This section provides C code examples that may be used as a starting point for own software projects The code examples use the standard VISA functions e g viPrintf or
13. sport Table of Contents VI ATTR TMO VALUE in ms e viEnableEvent VI EVENT SERVICE REQ The event will be generated if the status of the NRP series power sensor changes VI EVENT USB INTR This event will be generated if a power sensor gets connected or disconnected VI EVENT EXCEPTION This event will be generated if an error occurs e viDisableEvent e viWrite e viRead e viAssertTrigger e viReadSTB e viClear e viOpen e viClose e viParseRsrc e viFindRsrc R amp S NRP VISA Passport Table of Contents 3 3 Return Data Format The viRead function as well as the FETCH query are both used to read data from the ower sensor Typically this data was requested by a previous SCPI command and the result was stored in the driver cache The format of the data returned by the two methods therefore depends on this SCPI query The following data types are currently supported Binary result unsigned char Integer value in ASCII format Floating point number in exponential ASCII format Multiple comma separated floating point values in ASCII format Fixed length binary data block according to SCPI standard LC e B1 B2 Bn LC Number of characters in CO length of length CO Data block length in bytes B1 1 byte B2 2 byte Bn n byte R amp S NRP VISA Passport Table of Contents 3 4 Specific SCPI Commands The protocol between the low level NRP power sensor drivers and the NRP series powe
Download Pdf Manuals
Related Search
Related Contents
Manual del operador MADITA-FUN M3 GPS APPROACH - CMC Electronics Inc. Professional - English RM31A (v1.3) User`s Manual - Page 1 of 4 Sound Card MERCURY 901 MERCURY 901 SPIRIT of Management n° 18 - dossier spécial `Allemagne` - HEC-ULg IR-500 取扱説明書補足資料 第2章 契約書に書くべきこと ……………………31 Samsung NV3 User's Manual Copyright © All rights reserved.