Re: Varför finns programmerbara labbagg?
Postat: 27 februari 2011, 20:44:10
National Instruments - Labview används nog oftast...
Svenskt forum för elektroniksnack.
https://elektronikforumet.com/forum/
Kod: Markera allt
10 !
20 ! This program sets the output voltages and currents for
30 ! three outputs. This program also shows how to use "state
40 ! storage" to store the instrument configuration in memory.
50 !
60 ASSIGN @Psup TO 705 ! Assign I/O path to address 705
70 CLEAR 7 ! Clear interface - send "device clear"
80 OUTPUT @Psup;"*RST;*CLS" ! Reset and clear the power supply
90 OUTPUT @Psup;"*OPC" ! Verify reset command has executed
100 !
110 OUTPUT @Psup;"APPL P6V, 5.0, 1.0" ! Set 5.0 volts/1.0 amp to +6V output
120 OUTPUT @Psup;"APPL P25V, 15.0, 1.0" ! Set 15.0 volts/1.0 amp to +25V output
130 OUTPUT @Psup;"APPL N25V, -10.0, 0.8"! Set -10.0 volts/0.8 amps to -25V output
140 !
150 OUTPUT @Psup;"OUTP ON" ! Enable the outputs
160 !
170 OUTPUT @Psup;"*SAV 1" ! Store a state in memory location 1"
180 !
190 ! Use the "*RCL 1" command to recall the stored state
200 !
210 END
Kod: Markera allt
10 REAL Aver,Min_rdg,Max_rdg
20 INTEGER Val,Hpib,Mask,Task
30 ASSIGN @Dmm TO 722
40 CLEAR 7 ! Clear HP-IB and dmm
50 OUTPUT @Dmm; "*RST" ! Reset dmm
60 OUTPUT @Dmm; "*CLS" ! Clear dmm status registers
70 OUTPUT @Dmm; "*ESE 1" ! Enable "operation complete" bit to set
! "standard event" bit in status byte
80 OUTPUT @Dmm; "*SRE 32" ! Enable "standard event" bit in status byte
! to pull the IEEE-488 SRQ line
90 OUTPUT @Dmm; "*OPC?" ! Assure synchronization
100 ENTER @Dmm; Val
110 !
120 ! Configure the multimeter to make measurements
130 !
140 OUTPUT @Dmm; "CONF:VOLT:DC 10" ! Set dmm to 10 volt dc range
150 OUTPUT @Dmm; "VOLT:DC:NPLC 10" ! Set the integration time to 10 PLCs
160 OUTPUT @Dmm; "TRIG:COUN 100" ! Dmm will accept 100 triggers
170 OUTPUT @Dmm; "CALC:FUNC AVER;STAT ON" ! Select min-max and enable math
180 OUTPUT @Dmm; "INIT" ! Place dmm in "wait-for-trigger" state
190 OUTPUT @Dmm; "*OPC" ! Set "operation complete" bit in standard event
! registers when measurement is complete
200 !
210 Hpib=7
220 ON INTR Hpib GOSUB Read_data
230 Mask=2 ! Bit 1 is SRQ
240 ENABLE INTR Hpib;Mask ! Enable SRQ to interrupt the program
250 !
260 ! Execute other tasks while waiting for data
270 !
280 Task=1
290 WHILE Task=1
300 DISP "Taking Readings"
310 WAIT .5
320 DISP ""
330 WAIT .5
340 END WHILE
350 DISP "AVE = ";Aver; " MIN = ";Min_rdg; " MAX = ";Max_rdg
360 STOP
370 !
380 Read_data: !
390 OUTPUT @Dmm; "CALC:AVER:AVER?;MIN?;MAX?" ! Read the average, min, and max
400 ENTER @Dmm; Aver, Min_rdg, Max_rdg
410 OUTPUT @Dmm; "*CLS" ! Clear dmm status registers
420 Task=0
430 RETURN
440 END