|
21SCPI Programming FundamentalsSCPI Language BasicsBlock Program DataSome parameters consist of a block of data. There are a few standard types of block data. Arbitrary blocks of programdata can also be used.Writing Multiple Commands on the Same LineMultiple commands can be written on the same line, reducing your code space requirement. To do this:• Commands must be separated with a semicolon (;)• If the commands are in different subsystems, the key word for the new subsystem must be preceded by a colon (:)• If the commands are in the same subsystem, the full hierarchy of the command key words need not be included. Thesecond command can start at the same key word level as the command that was just executed.SCPI Termination and Separator Syntax ExamplesThe following are some examples of valid and invalid commands. The examples are created from a theoretical instrumentwith the simple set of commands indicated below:[:SENSe]:POWer[:RF]:ATTenuation 40dB:TRIGger[:SEQuence]:EXTernal[1]:SLOPe POSitiveType Description An array of rational numbers corresponding to displayed trace data. See the description of the FORMat:DATAcommand in the "Programming the Analyzer" chapter of any X-Series Users and Programmers Reference or onlineHelp file for information about available data formats.A SCPI command often refers to a block of current trace data with a variable name such as: Trace1, Trace2, or trace3,depending on which trace is being accessed. A block of data bytes. The first information sent in the block is an ASCII header beginning with #. The block isterminated with a semi-colon. The header can be used to determine how many bytes are in the data block. There areno units.A data query returns each block of data in the following format:#DNNN;where #DNNN is the header. To parse this data:1. Read two characters (#D), where D tells you how many N characters follow the D character,2. Read D characters, and convert to an integer that specifies the number of data bytes in the block,3. Read NNN bytes into a real array.Example: Header value = #512320• The first numeric character/digit (5) tells you how many additional digits there are in the header.• The 12320 means that 12,320 data bytes follow the header.• Divide the number of data bytes by the bytes/data point of the current data format, which is 8 for REAL,64.Thus, in this example, there are 12320/8 = 1540 data points in this block.
PreviousNext |