《FLUKE pm33xx_scpiumeng0200 电路图.pdf》由会员分享,可在线阅读,更多相关《FLUKE pm33xx_scpiumeng0200 电路图.pdf(297页珍藏版)》请在收音机爱好者资料库上搜索。
1、I $XWRUDQJLQJ LEFT$(response$, IBCNT%)Prints the ident string CALL Send (0, 8, *OPT?, 1)Requests for options CALL Receive (0, 8, response$, 256)Reads the options string PRINT Options: ; LEFT$(response$, IBCNT%) Prints the options string 2.2.3How to switch between digital and analog mode After power
2、on, a CombiScope instrument can be either in the digital or analog mode. After a *RST command the digital mode is selected. The INSTrument sub- system allows you to switch between the two modes. This can be done by speci- fying a predefined name (DIGital, ANALog) or the corresponding number (1 = dig
3、ital, 2 = analog). PROGRAM EXAMPLE: * Initialize and change the operating mode of the CombiScope instrument: * CALL Send (0, 8, INSTrument ANALog, 1)Switches to analog mode CALL Send (0, 8, INSTrument:NSELect 1, 1) Switches back to digital mode GETTING STARTED WITH SCPI PROGRAMMING2 - 5 2.3Error Rep
4、orting Instrument errors are usually caused by programming or setting errors. They are reported by the instrument during the execution of each command. To make sure that a program is running properly, you must query the instrument for possible er- rors after every functional command. This is done by
5、 sending the SYSTem:ERRor? query or the STATus:QUEue? query to the instrument, followed by reading the response message. However, through this practice the same error reporting statements must be repeated after sending each SCPI command. This is not always practical. Therefore, one of the following
6、approaches is advised: 1) Send the SYSTem:ERRor? or STATus:QUEue? query and read the instrument response message after every group of commands that functionally belong to each other. 2) Program an error-reporting routine and call this routine after each command or group of commands. For an example o
7、f an error-reporting routine, refer to section 3.14.4.1. 3) Program an error-reporting routine and use the Service Request (SRQ) Generation mechanism to interrupt the execution of the program and to execute the error-reporting routine. Therefore, refer to section 3.14.4.2. PROGRAM EXAMPLE: * Read er
8、ror message: * er$ = SPACE$(60) CALL Send(0, 8, SYSTem:ERRor?, 1)Requests for error CALL Receive(0, 8, er$, 256)Reads error message PRINT Response to error query = ; PRINT LEFT$(er$, IBCNT%-1)Displays error message 2 - 6GETTING STARTED WITH SCPI PROGRAMMING 2.4Acquiring Traces Trace acquisitions are
9、 started via the INITiate commands. A single acquisition is done by sending a single INITiate command. Continuous acquisitions are done by sending the INITiate:CONTinuous ON command. The TRACe? query allows you to acquire a trace of signal samples from one of the following sources: An input channel,
10、 e.g., CH2 (input channel 2). A trace area in a memory register, e.g., M2_3 (Memory register 2, trace 3). The number of trace samples (acquisition length) can be specified using the TRACe:POINts command. If your instrument has standard memory, you can specify 512, 2048, 4096, or 8192 trace samples.
11、If your instrument has extended memory, you can specify 512, 8192, 16384, or 32768 trace samples. A TRACe:POINts command specifies the acquisition length for all channels and memory registers. Example: Send - TRACe:POINts CH1,8192 Selects 8192 sample points for all traces The number of trace sample
12、bits can be specified using the FORMat command. This gives you the possibility to define samples of 8 bits (1 byte) or 16 bits (2 bytes). A FORMat command specifies the number of sample bits for all channels and memory registers. Example: Send - FORMat INT,16Formats 16-bits samples The format of the
13、 trace response data is as follows: Note:If f=8 decimal, each trace sample is one byte (8 bits). If f=16 decimal, each trace sample is two bytes (16 bits), i.e., most significant byte (msb) + least significant byte (lsb). Example: # n x . . x f b . . . . . b s NewLine code (10 decimal) checksum byte
14、 over all trace bytes trace sample data bytes (see Note) trace data format byte (see Note) number of trace bytes (fbb.bbs) number of digits of x.x # 4 1 0 2 6 . . . trace sample 512 trace sample 1 decimal 16 number of trace bytes (N) number of digits of N GETTING STARTED WITH SCPI PROGRAMMING2 - 7 2
15、.4.1How to acquire a single shot trace In the program example, a single shot trace acquisition of 8192 8-bit samples is done with a probe connected to input channel 1. The trace sample bytes are read from the GPIB as string characters. The number of response bytes and the number of samples are print
16、ed. The TRIGger:SOURce command is used to specify input channel 1 as a trigger source. The TRIGger:LEVel command is used to reset the trigger level to e.g., 0.1 volts. PREPARATIONS: Connect a probe to channel 1. After start up of the program you will be asked to trigger the acquisition with the open
17、 end of the probe, i.e., touch the probe or strike the probe on the table. PROGRAM EXAMPLE: * Acquire a single shot trace: * DIM tracebuf AS STRING * 16500 CALL Send(0, 8, FORMat INTeger,8, 1)Formats 8-bits sample CALL Send(0, 8, TRACe:POINts CH1,8192, 1)Formats 8192 sample points CALL Send(0, 8, TR
18、IGger:SOURce INTernal1, 1) Trigger-source = channel 1 CALL Send(0, 8, TRIGger:LEVel 0.1, 1)Trigger-level = 0.1 CALL Send(0, 8, INITiate, 1)Single shot initiation PRINT Trigger the CombiScope instrument by touching the probe tip. PRINT Press any key when finished. WHILE INKEY$ = : WEND CALL Send(0, 8
19、, *WAI, 1)Waits for previous commands to finish CALL Send(0, 8, TRACe? CH1, 1)Queries for channel 1 trace CALL Receive(0, 8, tracebuf$, 256)Reads channel 1 trace The contents of the tracebuf$ string is as follows: # 4 8194 . nr.of.digits = VAL(MID$(tracebuf$, 2, 1) nr.of.bytes = VAL(MID$(tracebuf$,
20、3, nr.of.digits) - 2 sample.length = ASC(MID$(tracebuf$, 3 + nr.of.digits, 1) / 8 nr.of.samples = nr.of.bytes / sample.length PRINT Number of bytes received =; IBCNT%IBCNT% = number of bytes PRINT Number of trace samples =; nr.of.samples Note:Refer to section 3.4.3 Conversion of trace data about how
21、 to convert this string data. 2 - 8GETTING STARTED WITH SCPI PROGRAMMING 2.4.2How to acquire repetitive traces In the program example, 5 trace acquisitions of 512 16-bit samples are done via a probe connected to channel 2. The trace sample bytes are read from the GPIB as string characters and writte
22、n to the file TRACE5.DAT on the hard disk. PREPARATIONS: Connect a probe from the Probe Adjust signal to channel 2. PROGRAM EXAMPLE: * Acquire 5 sequential traces and store in file TRACE5.DAT: * DIM tracebuf AS STRING * 1050 CALL Send(0, 8, *RST, 1)Resets the instrument After *RST a trace acquisitio
23、n is defined at 512 samples of 16 bits (2 bytes). CALL Send(0, 8, CONFigure:AC (2), 1)Configures channel 2 CALL Send(0, 8, SENSe:FUNCtion XTIMe:VOLTage2, 1)Switches channel 2 on OPEN O,#1,TRACE5.DATOpens file TRACE5.DAT FOR i=1 TO 5 CALL Send(0, 8, INITiate, 1)Single initiation CALL Send(0, 8, *WAI;
24、TRACe? CH2, 1)Queries for channel 2 trace Notice the *WAI; before TRACe?. The *WAI command takes care that the TRACe? CH2 command is executed when the INITiate command is finished. CALL Receive(0, 8, tracebuf$, 256)Reads channel 2 trace PRINT #1, Trace buffer:; iWrites trace header to file PRINT #1,
25、 LEFT$(tracebuf$, IBCNT%)Writes trace buffer to file NEXT i CLOSECloses file TRACE5.DAT Note:Refer to section 3.4.3 Conversion of trace data about how to convert this string data. GETTING STARTED WITH SCPI PROGRAMMING2 - 9 2.5Measuring Signal Characteristics The measurement instructions allow you to
26、 make a complete measurement. This includes the configuration of the instrument, the initiation of the trigger system, and the fetching of the acquisition data. The measurement instructions can be used at different levels, varying in processing time. The highest level is the most easy to use, but ta
27、kes more time to complete than the lowest level. The following levels of measurement instructions can be used: The highest level:MEASure? (easy to use) The middle level:CONFigure + READ?(equivalent to MEASure?) (gives more programming flexibility) The lowest level:INITiate + FETCh?(equivalent to REA
28、D?) (to acquire more signal characteristics) The following table shows which measurement tasks are executed by the measurement instructions: MEASure?CONFigureREAD?INITiateFETCh? Configures the instrument:YESYES Initiates the trigger system:YESYESYES Fetches the acquired data:YESYESYES 2 - 10GETTING
29、STARTED WITH SCPI PROGRAMMING 2.5.1How to make a single shot measurement The MEASure? query allows you to make a single-shot measurement, and the FETCh? query allows you to fetch more signal characteristics. PROGRAM EXAMPLE: * Measure and print the AC-RMS, peak to peak, and amplitude of the signal o
30、n channel 1. * response$ = SPACE$(30) CALL Send (0, 8, MEASure:AC? (1), 1)Measures the AC-RMS value CALL Receive (0, 8, response$, 256)Reads the AC-RMS value PRINT AC-RMS value : ; LEFT$(response$, IBCNT% -1) CALL Send (0, 8, FETCh:PTPeak?, 1)Fetches the Peak-To-Peak value CALL Receive (0, 8, respon
31、se$, 256)Reads the PTP value PRINT Peak-To-Peak value: ; LEFT$(response$, IBCNT% - 1) CALL Send (0, 8, FETCh:AMPLitude?, 1)Fetches the amplitude value CALL Receive (0, 8, response$, 256)Reads the amplitude value PRINT Amplitude value : ; LEFT$(response$, IBCNT% - 1) 2.5.2How to make repeated measure
32、ments The measurement instructions allow you to make repeated measurements. The CONFigure command allows you to configure the instrument, the READ? query allows you to make a measurement, and the FETCh? query allows you to fetch more signal characteristics. PROGRAM EXAMPLE: * Measure and print 5x th
33、e AC-RMS, peak to peak, and amplitude of the signal on channel 1. * response$ = SPACE$(30) CALL Send (0, 8, CONFigure:AC (1), 1)Configures for AC-RMS FOR i = 1 TO 5Performs 5 measurements CALL Send (0, 8, READ:AC?, 1)Initiates AC-RMS reading CALL Receive (0, 8, response$, 256)Reads the AC-RMS value
34、PRINT AC-RMS: ; LEFT$(response$, IBCNT%-1); CALL Send (0, 8, FETCh:PTPeak?, 1)Fetches the Peak-To-Peak value CALL Receive (0, 8, response$, 256)Reads the PTP value PRINT / Peak-To-Peak: ; LEFT$(response$, IBCNT%-1); CALL Send (0, 8, FETCh:AMPLitude?, 1)Fetches the amplitude value CALL Receive (0, 8,
35、 response$, 256)Reads the amplitude value PRINT / Amplitude: ; LEFT$(response$, IBCNT%-1) NEXT i USING THE COMBISCOPE INSTRUMENTS3 - 1 3 USING THE COMBISCOPE INSTRUMENTS 3.1Introduction This chapter explains how to access the functions of the CombiScope instruments family in a remote programming env
36、ironment. For that purpose, the CombiScope instrument is equipped with an IEEE-488 compatible GPIB interface and implements a full SCPI compatible command set which provides an extensive range of remote control facilities. Traditionally, there was no standard for the remote operation of instruments.
37、 A wide range of different command sets existed. Each set had its own terminology and trade-offs, based upon the implementations and corresponding limitations of the instrument. Similar functions in different instruments were controlled by different commands. And, vice versa, identical commands coul
38、d easily exist in another instrument to control a different function. With new technologies and increasing complexity, other programming concepts were introduced. This caused programs with identical functions to look different when written for another instrument. The remote control of instruments be
39、came a cumbersome process, which required a high learning curve for each new instrument and each additional instrument. The time and costs to create and maintain application programs were unnecessarily high due to the lack of standardization. With the introduction of the Standard Commands for Progra
40、mmable Instruments, commonly called SCPI, a lot of progress has been made in this area. The development time of an application program for SCPI-compatible instruments, like the CombiScope instrument, is considerably reduced. This is mainly achieved by the consistent programming environment for instr
41、ument control and data usage across all types of instruments that, regardless of the manufacturer, is provided by SCPI. The standardized commands allow the same functions in different types of instruments to be controlled by the same commands. For example, the query MEASure:FREQuency? acquires the f
42、requency characteristic of the input signal, regardless of whether the instrument is a frequency counter, an oscilloscope, or any other measuring instrument. 3 - 2USING THE COMBISCOPE INSTRUMENTS As the example already shows, the commands are easy to learn and self- explanatory to both novice and ex
43、pert users. The learning curve is considerably decreased for new instruments or instrument functions with which the programmer is not familiar. Efficiency is not only gained when creating or debugging new application programs. The easily understandable programs greatly simplify maintenance and modif
44、ication of existing application programs that have been written by other persons or for other instrument functions. All major CombiScope instrument functions are controlled by standard SCPI commands. Although the functionality provided is the same, the way the oscilloscope is controlled via the remo
45、te interface differs in some aspects from the front panel operation. This is because the local front panel operation is designed to allow you to take maximum advantage of the interactive communication possibilities offered by the display screen. This allows for additional information and guidance du
46、ring the process of local operation. The remote command set is based upon an instrument model that is easy to understand. This model provides a structured survey of the implemented instrument functions and serves as a guide towards the commands that control these functions. This other view allows fo
47、r optimal and easy access of the instrument functions when operated from the remote interface. Additionally, a measurement instruction set allows for easy programming of measurement tasks for a wide variety of signal characteristics. USING THE COMBISCOPE INSTRUMENTS3 - 3 3.2Fundamental Programming C
48、oncepts The remote operation of your CombiScope instrument can be accessed using different programming concepts. The concept to be chosen depends upon the application of the instrument in the remote programming environment. Each of the four concepts has it own benefits and trade-offs. 1) Using measu
49、rement instructions Advantage:Easy to program. No instrument knowledge required to make measurements. So, you can start programming quickly and get measurement results rightaway. Trade-off:A measurement takes some time to complete, because the instrument automatically searches for optimal settings. Example:MEASure:FREQuency?Measures the frequency of the signal at channel 1. 2) Single function programming using the instrument model Advantage:Allows you to program individual functions separately through single