《KEI 194A Programming 电路图.pdf》由会员分享,可在线阅读,更多相关《KEI 194A Programming 电路图.pdf(68页珍藏版)》请在收音机爱好者资料库上搜索。
1、IEEE-488 Programming Guide Model 194A High Speed Voltmeter Ql.987, Keithley Instruments, Inc. Instrument Division Cleveland, Ohio, U.S.A. Document Number: l94A-903-01 Rev. A RadioFans.CN 收音机爱 好者资料库 TABLE OF CONTENTS About This Programming Guide . ., . 1 Computer Programming Syntax . .: . ., . ; . 3
2、Single Channel Programming . I . 7 Dual Channel Programming . -_ _ . 11 Single and Continuous Trigger Arming . ., . 17 SRQandErrorHandling. . ;.: . .: . ._. . .I . ._ . 21 Binary DataTransfer . 29 Reading Buffer Operation . _. . ., . 37 Using Translator . ._._. . ._. . 41 Using External Sample Trigg
3、ering . _ . ., _ ., . 47 Generating Bus Time Information . _ . 55 Appendix A - Device-Dependent Commands . .;. :, .I. : . ., . A-1 Appendix B - Data Formats . B-l Appendix C - Status Words and SRQ Format I . .I . C-l Appendix D - Front Panel Modes and Equivalents IEEE-488 Commands . D-l Appendix E -
4、 Data Transmission and NRFD Hold-off Times . ; . E-l RadioFans.CN 收音机爱 好者资料库 ABOUT THIS PROGRAMMING GUIDE This programming guide is intended as a tt. however, there are some statements associated with IEEE-488 bus Ii0 that require discussion. The following provides a brief overview of some of the st
5、atements you will encounter in the various programs in this guide. Refer to the BASIC 4.0 Reference for more detailed information. OUTPUT OUTPUT allows you to send a variable or string over the bus, and it may take on one c$ several forms. A typical syntax is: In this instance, 7 specifies the inter
6、face select code, while 09 is the primary address of the instrument. FlX is a literal string that will be transmitted to the instruments when the state- ment is executed. ENTER ENTER performs the opposite-function, allowing the transmission of data from the instru- ment to the computer. Typical synt
7、ax for this statement is; Again, 7 specifies the interface select code, while 09 represents the primary address of the instrument. .A$ is a string variable into which incoming data is placed. Keep in mind that A$ must be dimensioned large enough to hold all Rpected characters. As an alternative, the
8、 ENTER statement-can directly input the data into a numeric variable, assuming that the proper instrument data format is used. SPOLL SPOLL serial polls the instrumentand places its status byte in a numeric variable as follows: Here again, 709 represents the interface select code and primary address
9、of the instrument. S is a numeric variable which will contain the decimal value of the status byte after the state- 3 ment is executed. The status byte-can then be checked by ANDing or BIXng S to determine the status of the required bits. These bits can yield certain information such as reading,over
10、flow and ready for a new command. BIT BIT can be used to detetie the bit status of numeric variables: In this example, the status of bit 5 of the variable S is placed into A. TRIGGER TRIGGER sends a GET (Group Execute Trigger) to a device as follows: A GET is one of many methods that can be used COU
11、KT-i00B,WIl In this instance, a total of 1000 bytes will be trmitted from the Model 194A totheinternal buffer. 4 STATUS SX4TUS allows access to certain computer status registers. Most often, this statement is used to either determine if aii SRQ has occurred, or dear an SRQ interrupt. Typical syntax
12、is: Here, 7 is the interface select code, and the second 7 is the status register being accessed. The value of the status register is placed in the variable S when the statement is executed. ON INTR and ENABLE INTR These two statements work together to enable interrupts and to tell the computer wher
13、e to go for next line execution. A typical ON INTR statement is: In this case, when the computer detects an IEEE-488 interrupt, it-begins executing the subroutine at line 4000. SRQ is the most often used type of interrupt for the IEEE-488 bus. Using BASIC 4.0, SRQ interrupts are enabled as follows:
14、Once enabled, an SRQ Wi cause the computer to branch to the line number specified by the ON INTR statement. Typically, an error handling subroutine will be incorporated at that point to determine the reason for the SRQ and to handle any other required tasks. 5/6 SINGLE CHANNEL PROGRAMMING PROGRAMMIN
15、G CONCEPTS ? Sending command strings to the Model 194A. ? Obtaining data and displaying iton the computer CRT PROGRAMMING CONSIDERATIONS At the very least, it will be necessary to send commands to the instrument to set it up as desired, and to request data back from the unit. The program below demon
16、strates the basic F recess for doing so. Note that if you have a dual-channel unit, you should proceed to rogTam 2. PROGRAM OPERATION Program 1 below demonstrates fundamental programming unit. Figure 1 is a flowchartof the program. techniques for a single-channel Before we can program the Model 194A
17、, we must place the unit in remote as follows: Next a prompt for the user to enter the desired command is displayed by the following pro- gram statements: Following execution of these two lines, the command suing resides in a string variable called Command! however, with other tri to trigger the uni
18、t before the unit will collect samples. Once t PB er modes, it will be necessary ose samples are stored and processed into a reading, the data is requested and displayed on the computer CRT as follows (see Figure 2 for ASCII data format): 80 ENTER 703; Readings YM PEItKReading8 PREFIX BUFFER EOIASSE
19、RTED (GO G-2, G3. GS) SUFFIX (G2, GS) WITH CF +-I A I N DCV * 1.2345 E + 0. CH2, 80050 TERMlNATOR N=NORMAL A 0 = OVERFLOW Z=ZEROED kdST TM, ToRicRLF NUMBER READING EXFCNENl I = INVALID MEASUREMENT RMS = TRMS A”G = AVERAGE NOTE: SUFFER LCCATDN SHOWS SAMPLE nnnni, IN WAVE +PK = +PEAK -PK = -PEAK DIF =
20、 CHI CH2 RAT = CH1ICH2 FORM MODE DEV I STANDARD DE”,AT,ON P.P = PEAK TO PEAK INT= INlEGRAL DC” = WAVEFORM RCL = RECALL Figure 2. ASCII Data Format Table 1. Commands That Disarm the A/D Converter Command Description I Recall setup Function $Pz? Number of samples Filter Range Rate Trigger w Delay Z 7m
21、v-l RUNNING THE PROGRAM 1. Enter the program into the computer. 2. Run the program by pressing the RUN key. The computer wti promptyou to type in your command: 9 3. Type in the desired command string and then press ENTER. Note that is not necessary to add the “X” character as it is automatically add
22、ed by the program. For example, to pro- gram the average function and select autoranging, type in FlRO and press ENTER. 4; Once the measurement is completed and the reading is processed, the data string will appear on the computer display. A typical example is: ACQUIRING A WAVEFORM USING ASCII DATA
23、TRANSFER The Model 194A can be used to capture a waveform and then send the data as a series of readings representing the individual samples. Each individual data string will represents the voltage of that-particular sample. To use the Model 194A in this manner, program the instrument for the wavefo
24、rm (FO) func- tion, and then repeatedly request readmgs until all samples have been transferred. For ex- ample, to collect 100 samples and read them into a computer, modify Program 1 as follows: 75 FUR I = 1 TU i0EI ! Loop 100 times. 35 HEYT I c , ! Loop back for next sample. When the computer promp
25、tsyou for a command, type in ONO,lOO” (include the quotes because of the comma) and then press ENTER. You should see 100 successive readings ap- pear on the display. Each reading is the numeric value of that particular sample. These samples can also be placed into a BASIC array for further processin
26、g, if required. For a larger number of samples, or for higher speed data transfer, refer to the section in this guide on binary data transfer. Program 1. Single Channel Operation 10 20 30 40 50 60 70 80 90 100 $10 10 DUAL-CHANNEL PROGRAMMING PROGRAMMING CONCEPTS ? Basic command programming of a dual
27、-channel Model 194A. ? Obtaining data fmn a dual-channel Model 194A. ? Demonstrating that both channels share a single IEEE-488 output. ? How to turn off an unused channel for maximum speed and to ensure that data comes only from the desired channel. PROGRAMMING CONSIDERATIONS Programming a dual-cha
28、nnel unit is somewhat more complex than a single-channel unit, even for the most basic measurements. In particular, there are several important aspectsto- keep in mind: 1. Before sending programming commands to the instrument, select the desired channel by sending ClX for channel 1, or C2X for chann
29、el 2. Doing so will ensure that the com- mands you send will affect the desired channel. Note that sOme commands such as data format (G), SRQ (M), and terminator (Y) affect both channels, so it is not necessary to select the channel before using them. 2. The two channels share a common IEEE-488 outp
30、ut and reading buffer. As a result, there is no way to dictate which channel has the currentoutput when both channels are run- ning simultaneously. Thus, it will be necessaryforyou use the channel suffii in the data string (Figure 2) to determine the source of the data. Alternatively, you can use th
31、e reading buffer for storage and request data later. 3. If one channel is not being used, it should be disabled by sending a trigger command for a tri er stimulus that will not occur. For example, if you are not using external trigger- ing, se* the co 9 rnmand string CXI7X to disarm channel 1, or se
32、nd C2XM( to disable channel 2. Turning off an unused channel will accomplish two things: (1) maximize throughput for the channel being used, and (2) make sure that data comes only from the channel in use. 4. Another way to keep the reading from both channels separated is to use the F command to re-c
33、alculate a reading. Even If a reading has already been calculated, you can force another calculation for the desired channel to place the result in the reading buffer. For example, send C2FlX to compute the average of the channel 2 measurement and place the results in the reading buffer. Keep in min
34、d that the other channel must not be run- ning fast enough to overwrite this data between the time it is calculated and the time it is requested. PROGRAM OPERATION Program 2 below demonstrates dual-channel programming. Figure 3 is a flowchart showing general program flow. 11 t I I ARM AND TRIGGER CH
35、ANNEL 2 I_! READING Figure 3. Dual Channel Operation Flowchart Usually, an instrument is sent a command at the start of a program to return it to some default state. In the program below, this operation is performed by sending an SDC (Stile however, since the range and function were changed, we must
36、 arm both A/D converters. First, for channel 1, we have: Again, each command string includes the channel selection command prior to the trigger command that arms the AID converter. Here again, the immediate trigger mode vZ6) is used so that no further triggering is necessary to start the AID convert
37、ers. With other trigger sources, you will be required to apply the necessary trigger stimuli to start the A/D converters after arming them. Now that both A/D converters are running and readings are being processed, it is a simple matter to set up a loop to request and display readings: This loop rep
38、eats indefinitely, with one reading per loop accessed and displayed. RUNNING THE PROGRAM 1. Enter the program into the computer. 2. Press the computer RUN key tostart the program. 3. The program will send the commands to the instrument and then request readings from the Model 194A. Note that data wi
39、ll alternate between channel 1 and channel 2 depen- ding on which channel has the most current reading. USING ONE CHANNEL In order to use only one channel, program the other channel for an unused trigger source. For example, to turn off channel 1, modify line 60 as follows: 63 OUTPUT 7B9j 6 g tCl:XT
40、TK 3 Similarly, to disable channel 2, modify line 70 to read: In both instances, the disabled channel is programmed for the external trigger mode. Thus, in order for thatchannel to remain disabled, no trigger signal can be applied to the trigger inputfor that channel. Another way to disable a channe
41、l is to use T27 which causes only one trigger; no further triggers will oCcur even with external triter input noise. SELECTING CHANNEL OUTPUT As discussed previously, you can dictate which channel has the current-output by program- ming the desired channel for a particular function (so L dCIFiX” 90
42、ENTER 7B9; ReadingB 1BW PEIMT 6 GCZFlX” 123 EMTEE 7W3; Readings 130 PEIMT Readings i4k3 GOTO 80 159 END ! Compute channel 1 reading. ! Get channel 1 reading. ! Display channel 1 reading. ! Corn ute channel 2 reading. ! Get jtl annel2 reading. ! Display channel 2 reading. ! Repeat 14 With these modif
43、ications, the computer display will alternate between channel 1 and chan- nel 2 readings. Note, however, that one channel may still overwrite the other if there is a large difference in processing speed between the two channels. Program 2. Dual-Channel Programming 10 20 30 40 50 60 70 OIM ReadlngBlS
44、Ol CLEAR 709 RErlOTE 709 0UiP”T 709;“CIXRIF:X- 0”iP”T 709i”C:XR4FiX” OUTPUT 709i”CIXT?fiX OUTPlJT 709; CZXT26X” ENTER 709,Readimp PRINT Reading* GOT” 80 TN, oincnalo” reading string Return the 194.4 to default conditions Put the 134 into renotc mode Program chl far the 320mU range and TRMS Program c
45、h2 for the 200” range and Rverags Am channci I Am channel 2 Get a reading fron the !94A Print the rcadlng ReDeat I5116 SINGLE AND CONTINUOUS TRIGGER ARMING PROGRAMMING CONCEPTS ? Sending the arming command once with continuous arming. ? Sending the arming command before each trigger with single armi
46、ng. ? Triggering the measurement with single and continuous arming. PROGRAMMING CONSIDERATIONS Before the Model 194A will take a measurement, it must be triggered with the stimulus deter- mined by the selected trigger source: immediate, input signal, external, other channel, or an IEEE-488 GET, X, or t after the command is sent, the A/D converter will be armed. Now that the A/D converters is armed, we can trigger a measurement by sending G