Interfaces (IEEE option L45-O1) LMG450
222
' LMG should be set to following:
' MEASURING Menu
' Normal measuring mode, 500ms cycle time
' IF/IO (OPTIONS) Menu
' Rmote Device: COM1 RS232
' Dev.: COM1: 9600 Baud, EOS <lf>, Echo off, Protocol None
' Connect COM1 of your PC to COM1 of LMG with a 1:1 cable (all pins
' connected, no NULL modem).
DECLARE FUNCTION readans$ ()
OPEN "COM1:9600,N,8,1,ASC,CD0,CS0,DS0,OP0,RS,TB2048,RB4096" FOR RANDOM AS #1
PRINT #1, "syst:lang short" + CHR$(10); ' Change command set
PRINT #1, "actn;utrms?;itrms?" + CHR$(10); ' Request Utrms and Itrms
PRINT #1, "cont on" + CHR$(10); ' Continue output
DO
answer$ = readans$ ' Read answer from LMG
val1 = VAL(answer$) ' Calculate values
val2 = VAL(MID$(answer$, 1 + INSTR(1, answer$, ";")))
PRINT USING "Answer:& Value1: ###.###V Value2: ##.#####A"; readans$; val1; val2
LOOP UNTIL INKEY$ = CHR$(32) ' Loop, until SPACE bar pressed
PRINT #1, "cont off" + CHR$(10); ' Stop continue output
SLEEP 1
PRINT #1, "gtl" + CHR$(10); ' Go back to local mode
CLOSE #1
FUNCTION readans$
answer$ = ""
DO
a$ = INPUT$(1, 1) ' Read character from interface
IF a$ <> CHR$(10) THEN ' If it is not the EOS character
answer$ = answer$ + a$ ' add character to answer string
END IF
LOOP WHILE a$ <> CHR$(10) ' Loop until EOS is reached
readans$ = answer$ ' return answer
END FUNCTION
10.2.17 Example 2
Following you find a small example for one time data exchange via RS232 interface.
Additionally to the SCPI commands you find the same functionality in SHORT syntax.
' QBasic 1.1
' Example for reading data from a LMG95/450/500
' LMG should be set to following:
' MEASURING Menu
' Normal measuring mode, 500ms cycle time
' IF/IO (OPTIONS) Menu
' Rmote Device: COM1 RS232
' Dev.: COM1: 9600 Baud, EOS <lf>, Echo off, Protocol None
' Connect COM1 of your PC to COM1 of LMG with a 1:1 cable (all pins
' connected, no NULL modem).
DECLARE FUNCTION readans$ ()
OPEN "COM1:9600,N,8,1,ASC,CD0,CS0,DS0,OP0,RS,TB2048,RB4096" FOR RANDOM AS #1
PRINT #1, "READ:CURRENT:TRMS;:FETCH:VOLTAGE:TRMS" + CHR$(10); 'Request values
(SCPI)
‘PRINT #1, "SYST:LANG SHORT" + CHR$(10); 'Change Language to SHORT
‘PRINT #1, "INIM;ITRMS?;UTRMS?" + CHR$(10); 'Request values (SHORT)
DO
answer$ = readans$ ' Read answer from LMG
val1 = VAL(answer$) ' Calculate values
val2 = VAL(MID$(answer$, 1 + INSTR(1, answer$, ";")))
Содержание LMG450
Страница 1: ...4 Channel LMG450 Power Meter User manual Status 2009 02 17...
Страница 2: ......
Страница 4: ......
Страница 5: ......
Страница 6: ......
Страница 8: ......
Страница 10: ......
Страница 18: ......
Страница 22: ......
Страница 36: ......
Страница 76: ......
Страница 102: ......
Страница 112: ......
Страница 118: ......
Страница 124: ......
Страница 230: ......
Страница 240: ......
Страница 270: ...System design LMG450 270 14 2 Functional block diagram LMG450 Figure 47 Functional block diagram LMG450...
Страница 292: ......