| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lab::Instrument::HP3458A; |
|
2
|
|
|
|
|
|
|
#ABSTRACT: Agilent 3458A Multimeter |
|
3
|
|
|
|
|
|
|
$Lab::Instrument::HP3458A::VERSION = '3.881'; |
|
4
|
1
|
|
|
1
|
|
1748
|
use v5.20; |
|
|
1
|
|
|
|
|
3
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
22
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Lab::Instrument; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
8
|
1
|
|
|
1
|
|
8
|
use Lab::Instrument::Multimeter; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
33
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Time::HiRes qw (usleep sleep); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
5
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = ("Lab::Instrument::Multimeter"); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %fields = ( |
|
14
|
|
|
|
|
|
|
supported_connections => ['GPIB'], |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# default settings for the supported connections |
|
17
|
|
|
|
|
|
|
connection_settings => { |
|
18
|
|
|
|
|
|
|
gpib_board => 0, |
|
19
|
|
|
|
|
|
|
gpib_address => undef, |
|
20
|
|
|
|
|
|
|
}, |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
device_settings => { |
|
23
|
|
|
|
|
|
|
pl_freq => 50, |
|
24
|
|
|
|
|
|
|
}, |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
device_cache => { |
|
27
|
|
|
|
|
|
|
autozero => undef, |
|
28
|
|
|
|
|
|
|
}, |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
|
33
|
0
|
|
|
0
|
1
|
|
my $proto = shift; |
|
34
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
|
35
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
|
36
|
0
|
|
|
|
|
|
$self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); |
|
|
0
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $self; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _device_init { |
|
42
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#$self->connection()->SetTermChar("\r\n"); |
|
45
|
|
|
|
|
|
|
#$self->connection()->EnableTermChar(1); |
|
46
|
|
|
|
|
|
|
#print "hallo\n"; |
|
47
|
0
|
|
|
|
|
|
$self->write( "END 2", error_check => 1 ) |
|
48
|
|
|
|
|
|
|
; # or ERRSTR? and other queries will time out, unless using a line/message end character |
|
49
|
0
|
|
|
|
|
|
$self->write( 'TARM AUTO', error_check => 1 ); # keep measuring |
|
50
|
0
|
|
|
|
|
|
$self->write( 'TRIG AUTO', error_check => 1 ); # keep measuring |
|
51
|
0
|
|
|
|
|
|
$self->write( 'NRDGS 1,AUTO', error_check => 1 ); # keep measuring |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# |
|
55
|
|
|
|
|
|
|
# utility methods |
|
56
|
|
|
|
|
|
|
# |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub configure_voltage_dc { |
|
59
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my ( $range, $tint ) = $self->_check_args( \@_, [ 'range', 'tint' ] ); |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $range_cmd = "FUNC DCV "; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
0
|
0
|
|
|
|
if ( $range eq 'AUTO' || !defined($range) ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$range_cmd = 'ARANGE ON'; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
elsif ( $range =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ ) { |
|
69
|
0
|
|
|
|
|
|
$range_cmd = sprintf( "FUNC DCV %e", abs($range) ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
elsif ( $range !~ /^(MIN|MAX)$/ ) { |
|
72
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( error => |
|
73
|
|
|
|
|
|
|
"Range has to be set to a decimal value or 'AUTO', 'MIN' or 'MAX' in " |
|
74
|
|
|
|
|
|
|
. ( caller(0) )[3] |
|
75
|
|
|
|
|
|
|
. "\n" ); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
0
|
0
|
|
|
|
if ( !defined($tint) || $tint eq 'DEFAULT' ) { |
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$tint = 10; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
elsif ( $tint =~ /^([+]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ |
|
82
|
|
|
|
|
|
|
&& ( ( $tint >= 0 && $tint <= 1000 ) || $tint == -1 ) ) { |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Convert seconds to PLC (power line cycles) |
|
85
|
0
|
|
|
|
|
|
$tint *= $self->pl_freq(); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
elsif ( $tint =~ /^MIN$/ ) { |
|
88
|
0
|
|
|
|
|
|
$tint = 0; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
elsif ( $tint =~ /^MAX$/ ) { |
|
91
|
0
|
|
|
|
|
|
$tint = 1000; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
elsif ( $tint !~ /^(MIN|MAX)$/ ) { |
|
94
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( error => |
|
95
|
|
|
|
|
|
|
"Integration time has to be set to a positive value or 'AUTO', 'MIN' or 'MAX' in " |
|
96
|
|
|
|
|
|
|
. ( caller(0) )[3] |
|
97
|
|
|
|
|
|
|
. "\n" ); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# do it |
|
101
|
0
|
|
|
|
|
|
$self->write( $range_cmd, error_check => 1 ); |
|
102
|
0
|
|
|
|
|
|
$self->write( "NPLC ${tint}", error_check => 1 ); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#$self->write( "NPLC ${tint}", { error_check=>1 }); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub configure_voltage_dc_trigger { |
|
108
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
my ( $range, $tint, $count, $delay ) |
|
111
|
|
|
|
|
|
|
= $self->_check_args( \@_, [ 'range', 'tint', 'count', 'delay' ] ); |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
0
|
|
|
|
|
$count = 1 if !defined($count); |
|
114
|
0
|
0
|
0
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
|
|
|
0
|
|
|
|
|
|
115
|
|
|
|
|
|
|
error => "Sample count has to be an integer between 1 and 512\n" ) |
|
116
|
|
|
|
|
|
|
if ( $count !~ /^[0-9]*$/ || $count < 1 || $count > 16777215 ); |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
0
|
|
|
|
|
$delay = 0 if !defined($delay); |
|
119
|
0
|
0
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
120
|
|
|
|
|
|
|
error => "Trigger delay has to be a positive decimal value\n" ) |
|
121
|
|
|
|
|
|
|
if ( $count !~ /^([+]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ ); |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$self->configure_voltage_dc( $range, $tint ); |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
#$self->write( "PRESET NORM" ); |
|
126
|
0
|
0
|
|
|
|
|
if ( $count > 1 ) { |
|
127
|
0
|
|
|
|
|
|
$self->write( "INBUF ON", error_check => 1 ); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
else { |
|
130
|
0
|
|
|
|
|
|
$self->write( "INBUF OFF", error_check => 1 ); |
|
131
|
|
|
|
|
|
|
} |
|
132
|
0
|
|
|
|
|
|
$self->write( "TARM AUTO", error_check => 1 ); |
|
133
|
0
|
|
|
|
|
|
$self->write( "TRIG HOLD", error_check => 1 ); |
|
134
|
0
|
|
|
|
|
|
$self->write( "NRDGS $count, AUTO", error_check => 1 ); |
|
135
|
0
|
|
|
|
|
|
$self->write( "TIMER $delay", error_check => 1 ); |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#$self->write( "TRIG:DELay:AUTO OFF"); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub configure_voltage_dc_trigger_highspeed { |
|
141
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
142
|
0
|
|
0
|
|
|
|
my $range = shift || 10; # in V, or "AUTO", "MIN", "MAX" |
|
143
|
0
|
|
0
|
|
|
|
my $tint = shift |
|
144
|
|
|
|
|
|
|
|| 1.4e-6 |
|
145
|
|
|
|
|
|
|
; # integration time in sec, "DEFAULT", "MIN", "MAX". Default of 1.4e-6 is the highest possible value for 100kHz sampling. |
|
146
|
0
|
|
0
|
|
|
|
my $count = shift || 10000; |
|
147
|
0
|
|
|
|
|
|
my $delay = shift; # in seconds, 'MIN' |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
0
|
0
|
|
|
|
if ( $range eq 'AUTO' || !defined($range) ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
$range = 'AUTO'; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
elsif ( $range =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ ) { |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
#$range = sprintf("%e",abs($range)); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
elsif ( $range !~ /^(MIN|MAX)$/ ) { |
|
157
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( error => |
|
158
|
|
|
|
|
|
|
"Range has to be set to a decimal value or 'AUTO', 'MIN' or 'MAX' in " |
|
159
|
|
|
|
|
|
|
. ( caller(0) )[3] |
|
160
|
|
|
|
|
|
|
. "\n" ); |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
0
|
0
|
0
|
|
|
|
if ( $tint eq 'DEFAULT' || !defined($tint) ) { |
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
$tint = 1.4e-6; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
elsif ( $tint =~ /^([+]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ |
|
167
|
|
|
|
|
|
|
&& ( ( $tint >= 0 && $tint <= 1000 ) || $tint == -1 ) ) { |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# Convert seconds to PLC (power line cycles) |
|
170
|
|
|
|
|
|
|
#$tint*=$self->pl_freq(); |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
elsif ( $tint =~ /^MIN$/ ) { |
|
173
|
0
|
|
|
|
|
|
$tint = 0; |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
elsif ( $tint =~ /^MAX$/ ) { |
|
176
|
0
|
|
|
|
|
|
$tint = 1000; |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
elsif ( $tint !~ /^(MIN|MAX)$/ ) { |
|
179
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( error => |
|
180
|
|
|
|
|
|
|
"Integration time has to be set to a positive value or 'AUTO', 'MIN' or 'MAX' in " |
|
181
|
|
|
|
|
|
|
. ( caller(0) )[3] |
|
182
|
|
|
|
|
|
|
. "\n" ); |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
0
|
0
|
|
|
|
|
$count = 1 if !defined($count); |
|
186
|
0
|
0
|
0
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
|
|
|
0
|
|
|
|
|
|
187
|
|
|
|
|
|
|
error => "Sample count has to be an integer between 1 and 512\n" ) |
|
188
|
|
|
|
|
|
|
if ( $count !~ /^[0-9]*$/ || $count < 1 || $count > 16777215 ); |
|
189
|
|
|
|
|
|
|
|
|
190
|
0
|
0
|
|
|
|
|
$delay = 0 if !defined($delay); |
|
191
|
0
|
0
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
192
|
|
|
|
|
|
|
error => "Trigger delay has to be a positive decimal value\n" ) |
|
193
|
|
|
|
|
|
|
if ( $count !~ /^([+]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ ); |
|
194
|
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
$self->write( "PRESET FAST", error_check => 1 ); |
|
196
|
0
|
|
|
|
|
|
$self->write( "TARM HOLD", error_check => 1 ); |
|
197
|
0
|
|
|
|
|
|
$self->write( "APER " . $tint, error_check => 1 ); |
|
198
|
0
|
|
|
|
|
|
$self->write( "MFORMAT SINT", error_check => 1 ); |
|
199
|
0
|
|
|
|
|
|
$self->write( "OFORMAT SINT", error_check => 1 ); |
|
200
|
0
|
|
|
|
|
|
$self->write( "MEM FIFO", error_check => 1 ); |
|
201
|
0
|
|
|
|
|
|
$self->write( "NRDGS $count, AUTO", error_check => 1 ); |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
#$self->write( "TIMER $delay") if defined($delay); |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
} |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub triggered_read { |
|
208
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
209
|
0
|
0
|
|
|
|
|
my $args |
|
|
|
0
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
= scalar(@_) % 2 == 0 |
|
211
|
|
|
|
|
|
|
? {@_} |
|
212
|
|
|
|
|
|
|
: ( ref( $_[0] ) eq 'HASH' ? $_[0] : undef ); |
|
213
|
0
|
0
|
|
|
|
|
Lab::Exception::CorruptParameter->throw("Illegal parameter hash given!\n") |
|
214
|
|
|
|
|
|
|
if !defined($args); |
|
215
|
|
|
|
|
|
|
|
|
216
|
0
|
|
0
|
|
|
|
$args->{'timeout'} = $args->{'timeout'} || undef; |
|
217
|
|
|
|
|
|
|
|
|
218
|
0
|
|
|
|
|
|
my $value = $self->query( "TRIG SGL", $args ); |
|
219
|
|
|
|
|
|
|
|
|
220
|
0
|
|
|
|
|
|
chomp $value; |
|
221
|
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
|
my @valarray = split( "\n", $value ); |
|
223
|
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return @valarray; |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub triggered_read_raw { |
|
228
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
229
|
0
|
0
|
|
|
|
|
my $args |
|
|
|
0
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
= scalar(@_) % 2 == 0 |
|
231
|
|
|
|
|
|
|
? {@_} |
|
232
|
|
|
|
|
|
|
: ( ref( $_[0] ) eq 'HASH' ? $_[0] : undef ); |
|
233
|
0
|
0
|
|
|
|
|
Lab::Exception::CorruptParameter->throw("Illegal parameter hash given!\n") |
|
234
|
|
|
|
|
|
|
if !defined($args); |
|
235
|
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
my $read_until_length = $args->{'read_until_length'}; |
|
237
|
0
|
|
|
|
|
|
my $value = ''; |
|
238
|
0
|
|
|
|
|
|
my $fragment = undef; |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
{ |
|
241
|
1
|
|
|
1
|
|
1874
|
use bytes; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
19
|
|
|
|
0
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
$value = $self->query( "TARM SGL", $args ); |
|
243
|
0
|
|
|
|
|
|
my $tmp = length($value); |
|
244
|
0
|
|
0
|
|
|
|
while ( defined $read_until_length |
|
245
|
|
|
|
|
|
|
&& length($value) < $read_until_length ) { |
|
246
|
0
|
|
|
|
|
|
$value .= $self->read($args); |
|
247
|
|
|
|
|
|
|
} |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
|
return $value; |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub decode_SINT { |
|
254
|
1
|
|
|
1
|
|
112
|
use bytes; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
255
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
256
|
0
|
|
|
|
|
|
my $bytestring = shift; |
|
257
|
0
|
|
0
|
|
|
|
my $iscale = shift || $self->query('ISCALE?'); |
|
258
|
|
|
|
|
|
|
|
|
259
|
0
|
|
|
|
|
|
my @values = split( //, $bytestring ); |
|
260
|
0
|
|
|
|
|
|
my $ival = 0; |
|
261
|
0
|
|
|
|
|
|
my $val_revb = 0; |
|
262
|
0
|
|
|
|
|
|
my $tbyte = 0; |
|
263
|
0
|
|
|
|
|
|
my $value = 0; |
|
264
|
0
|
|
|
|
|
|
my @result_list = (); |
|
265
|
0
|
|
|
|
|
|
my $i = 0; |
|
266
|
0
|
|
|
|
|
|
for ( my $v = 0; $v < $#values; $v += 2 ) { |
|
267
|
0
|
|
|
|
|
|
$ival = unpack( 'S', join( '', $values[$v], $values[ $v + 1 ] ) ); |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
# flipping the bytes to MSB,...,LSB |
|
270
|
0
|
|
|
|
|
|
$val_revb = 0; |
|
271
|
0
|
|
|
|
|
|
for ( $i = 0; $i < 2; $i++ ) { |
|
272
|
0
|
|
|
|
|
|
$val_revb = $val_revb |
|
273
|
|
|
|
|
|
|
| ( ( $ival >> $i * 8 & 0x000000FF ) << ( ( 1 - $i ) * 8 ) ); |
|
274
|
|
|
|
|
|
|
} |
|
275
|
|
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
my $decval = 0; |
|
277
|
0
|
|
|
|
|
|
my $msb = ( $val_revb >> 15 ) & 0x0001; |
|
278
|
0
|
0
|
|
|
|
|
$decval = $msb == 0 ? 0 : -1 * ( 2**15 ); |
|
279
|
0
|
|
|
|
|
|
for ( $i = 14; $i >= 0; $i-- ) { |
|
280
|
0
|
|
|
|
|
|
$decval += ( ( ( $val_revb >> $i ) & 0x0001 ) * 2 )**$i; |
|
281
|
|
|
|
|
|
|
} |
|
282
|
0
|
|
|
|
|
|
push( @result_list, $decval * $iscale ); |
|
283
|
|
|
|
|
|
|
} |
|
284
|
0
|
|
|
|
|
|
return @result_list; |
|
285
|
|
|
|
|
|
|
} |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub set_oformat { |
|
288
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
289
|
0
|
|
|
|
|
|
my $format = shift; |
|
290
|
|
|
|
|
|
|
|
|
291
|
0
|
0
|
|
|
|
|
if ( $format !~ /^\s*(ASCII|1|SINT|2|DINT|3|SREAD|4|DREAL|5)\s*$/ ) { |
|
292
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw("Invalid OFORMAT specified."); |
|
293
|
|
|
|
|
|
|
} |
|
294
|
0
|
|
|
|
|
|
$format = $1; |
|
295
|
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
$self->write("OFORMAT $1"); |
|
297
|
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
$self->check_errors(); |
|
299
|
|
|
|
|
|
|
} |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
sub get_oformat { |
|
302
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
303
|
0
|
0
|
|
|
|
|
my $args |
|
|
|
0
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
= scalar(@_) % 2 == 0 |
|
305
|
|
|
|
|
|
|
? {@_} |
|
306
|
|
|
|
|
|
|
: ( ref( $_[0] ) eq 'HASH' ? $_[0] : undef ); |
|
307
|
0
|
0
|
|
|
|
|
Lab::Exception::CorruptParameter->throw("Illegal parameter hash given!\n") |
|
308
|
|
|
|
|
|
|
if !defined($args); |
|
309
|
|
|
|
|
|
|
|
|
310
|
0
|
0
|
0
|
|
|
|
if ( $args->{direct_read} || !defined $self->device_cache()->{oformat} ) { |
|
311
|
|
|
|
|
|
|
return $self->device_cache()->{oformat} |
|
312
|
0
|
|
|
|
|
|
= $self->query( 'OFORMAT?', $args ); |
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
else { |
|
315
|
0
|
|
|
|
|
|
return $self->device_cache()->{oformat}; |
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
sub get_autozero { |
|
320
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
return $self->device_cache()->{autozero} |
|
323
|
0
|
|
|
|
|
|
= $self->query( 'AZERO?', @_, error_check => 0 ); |
|
324
|
|
|
|
|
|
|
} |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
sub set_autozero { |
|
327
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
328
|
0
|
|
|
|
|
|
my $enable = shift; |
|
329
|
|
|
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
my $command = ""; |
|
331
|
0
|
|
|
|
|
|
my $cval = undef; |
|
332
|
|
|
|
|
|
|
|
|
333
|
0
|
0
|
|
|
|
|
if ( $enable =~ /^ONCE$/i ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
334
|
0
|
|
|
|
|
|
$command = "AZERO ONCE"; |
|
335
|
0
|
|
|
|
|
|
$cval = 0; |
|
336
|
|
|
|
|
|
|
} |
|
337
|
|
|
|
|
|
|
elsif ( $enable =~ /^(ON|1)$/i ) { |
|
338
|
0
|
|
|
|
|
|
$command = "AZERO ON"; |
|
339
|
0
|
|
|
|
|
|
$cval = 1; |
|
340
|
|
|
|
|
|
|
} |
|
341
|
|
|
|
|
|
|
elsif ( $enable =~ /^(OFF|0)$/i ) { |
|
342
|
0
|
|
|
|
|
|
$command = "AZERO OFF"; |
|
343
|
0
|
|
|
|
|
|
$cval = 0; |
|
344
|
|
|
|
|
|
|
} |
|
345
|
|
|
|
|
|
|
else { |
|
346
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( error => ( caller(0) )[3] |
|
347
|
|
|
|
|
|
|
. " can be set to 'ON'/1, 'OFF'/0 or 'ONCE'. Received '${enable}'\n" |
|
348
|
|
|
|
|
|
|
); |
|
349
|
|
|
|
|
|
|
} |
|
350
|
0
|
|
|
|
|
|
$self->write( $command, error_check => 1, @_ ); |
|
351
|
|
|
|
|
|
|
|
|
352
|
0
|
|
|
|
|
|
$self->device_cache()->{autozero} = $cval; |
|
353
|
|
|
|
|
|
|
} |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub get_voltage_dc { |
|
356
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
357
|
|
|
|
|
|
|
|
|
358
|
0
|
|
|
|
|
|
$self->write( "DCV AUTO", @_ ); |
|
359
|
0
|
|
|
|
|
|
$self->write( "TARM SGL", @_ ); |
|
360
|
0
|
|
|
|
|
|
return $self->read(@_); |
|
361
|
|
|
|
|
|
|
} |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
sub set_nplc { |
|
364
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
365
|
0
|
|
|
|
|
|
my $n = shift; |
|
366
|
|
|
|
|
|
|
|
|
367
|
0
|
|
|
|
|
|
$self->write( "NPLC $n", @_ ); |
|
368
|
|
|
|
|
|
|
} |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
sub selftest { |
|
371
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
372
|
|
|
|
|
|
|
|
|
373
|
0
|
|
|
|
|
|
$self->write( "TEST", @_ ); |
|
374
|
|
|
|
|
|
|
} |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub autocalibration { |
|
377
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
378
|
0
|
|
|
|
|
|
my $mode = shift; |
|
379
|
|
|
|
|
|
|
|
|
380
|
0
|
0
|
|
|
|
|
if ( $mode !~ /^(ALL|0|DCV|1|DIG|2|OHMS|4)$/i ) { |
|
381
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
382
|
|
|
|
|
|
|
"preset(): Illegal preset mode given: $mode\n"); |
|
383
|
|
|
|
|
|
|
} |
|
384
|
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
$self->write( "ACAL \U$mode\E", @_ ); |
|
386
|
|
|
|
|
|
|
} |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
sub reset { |
|
389
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
390
|
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
|
$self->write( "PRESET NORM", @_ ); |
|
392
|
|
|
|
|
|
|
} |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
sub set_display_state { |
|
395
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
396
|
0
|
|
|
|
|
|
my $value = shift; |
|
397
|
|
|
|
|
|
|
|
|
398
|
0
|
0
|
0
|
|
|
|
if ( $value == 1 || $value =~ /on/i ) { |
|
|
|
0
|
0
|
|
|
|
|
|
399
|
0
|
|
|
|
|
|
$self->write( "DISP ON", @_ ); |
|
400
|
|
|
|
|
|
|
} |
|
401
|
|
|
|
|
|
|
elsif ( $value == 0 || $value =~ /off/i ) { |
|
402
|
0
|
|
|
|
|
|
$self->write( "DISP OFF", @_ ); |
|
403
|
|
|
|
|
|
|
} |
|
404
|
|
|
|
|
|
|
else { |
|
405
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
406
|
|
|
|
|
|
|
"set_display_state(): Illegal parameter.\n"); |
|
407
|
|
|
|
|
|
|
} |
|
408
|
|
|
|
|
|
|
} |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
sub display_clear { |
|
411
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
412
|
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
|
$self->write( "DISP CLR", @_ ); |
|
414
|
|
|
|
|
|
|
} |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
sub set_display_text { |
|
417
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
418
|
0
|
|
|
|
|
|
my $text = shift; |
|
419
|
0
|
0
|
|
|
|
|
if ( $text |
|
420
|
|
|
|
|
|
|
!~ /^[A-Za-z0-9\ \!\#\$\%\&\'\(\)\^\\\/\@\;\:\[\]\,\.\+\-\=\<\>\?\_]*$/ |
|
421
|
|
|
|
|
|
|
) { # characters allowed by the 3458A |
|
422
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
423
|
|
|
|
|
|
|
"set_display_text(): Illegal characters in given text.\n"); |
|
424
|
|
|
|
|
|
|
} |
|
425
|
0
|
|
|
|
|
|
$self->write("DISP MSG,\"$text\""); |
|
426
|
|
|
|
|
|
|
|
|
427
|
0
|
|
|
|
|
|
$self->check_errors(); |
|
428
|
|
|
|
|
|
|
} |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub beep { |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
# It beeps! |
|
433
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
434
|
0
|
|
|
|
|
|
$self->write( "BEEP", @_ ); |
|
435
|
|
|
|
|
|
|
} |
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
sub get_status { |
|
438
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
439
|
0
|
|
|
|
|
|
my $request = shift; |
|
440
|
0
|
|
|
|
|
|
my $status = {}; |
|
441
|
|
|
|
|
|
|
( |
|
442
|
|
|
|
|
|
|
$status->{PRG_COMPLETE}, $status->{LIMIT_EXCEEDED}, |
|
443
|
|
|
|
|
|
|
$status->{SRQ_EXECUTED}, $status->{POWER_ON}, |
|
444
|
|
|
|
|
|
|
$status->{READY}, $status->{ERROR}, |
|
445
|
|
|
|
|
|
|
$status->{SRQ}, $status->{DATA} |
|
446
|
0
|
|
|
|
|
|
) = $self->connection()->serial_poll(); |
|
447
|
0
|
0
|
|
|
|
|
return $status->{$request} if defined $request; |
|
448
|
0
|
|
|
|
|
|
return $status; |
|
449
|
|
|
|
|
|
|
} |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
sub get_error { |
|
452
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
453
|
0
|
|
|
|
|
|
my $error = $self->query( "ERRSTR?", brutal => 1, @_ ); |
|
454
|
0
|
0
|
|
|
|
|
if ( $error !~ /0,\"NO ERROR\"/ ) { |
|
455
|
0
|
0
|
|
|
|
|
if ( $error =~ /^\+?([0-9]*)\,\"?([^\"].*[^\"])\"?$/m ) { |
|
456
|
0
|
|
|
|
|
|
return ( $1, $2 ); # ($code, $message) |
|
457
|
|
|
|
|
|
|
} |
|
458
|
|
|
|
|
|
|
else { |
|
459
|
0
|
|
|
|
|
|
Lab::Exception::DeviceError->throw( |
|
460
|
|
|
|
|
|
|
"Reading the error status of the device failed in " |
|
461
|
|
|
|
|
|
|
. ( caller(0) )[3] |
|
462
|
|
|
|
|
|
|
. ". Something's going wrong here.\n" ); |
|
463
|
|
|
|
|
|
|
} |
|
464
|
|
|
|
|
|
|
} |
|
465
|
|
|
|
|
|
|
else { |
|
466
|
0
|
|
|
|
|
|
return (0); |
|
467
|
|
|
|
|
|
|
} |
|
468
|
|
|
|
|
|
|
} |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
sub preset { |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
# Sets HP3458A into predefined configurations |
|
473
|
|
|
|
|
|
|
# 0 Fast |
|
474
|
|
|
|
|
|
|
# 1 Norm |
|
475
|
|
|
|
|
|
|
# 2 DIG |
|
476
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
477
|
0
|
|
|
|
|
|
my $preset = shift; |
|
478
|
0
|
0
|
|
|
|
|
if ( $preset !~ /^(FAST|0|NORM|1|DIG|2)$/i ) { |
|
479
|
0
|
|
|
|
|
|
Lab::Exception::CorruptParameter->throw( |
|
480
|
|
|
|
|
|
|
"preset(): Illegal preset mode given: $preset\n"); |
|
481
|
|
|
|
|
|
|
} |
|
482
|
|
|
|
|
|
|
|
|
483
|
0
|
|
|
|
|
|
$self->write( "PRESET \U$preset\E", @_ ); |
|
484
|
|
|
|
|
|
|
} |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
sub get_id { |
|
487
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
488
|
0
|
|
|
|
|
|
return $self->query( 'ID?', @_ ); |
|
489
|
|
|
|
|
|
|
} |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
sub trg { |
|
492
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
493
|
0
|
|
|
|
|
|
$self->write( 'TRIG SGL', @_ ); |
|
494
|
|
|
|
|
|
|
} |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
sub get_value { |
|
497
|
|
|
|
|
|
|
|
|
498
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
499
|
|
|
|
|
|
|
|
|
500
|
0
|
|
|
|
|
|
my $val = $self->read(@_); |
|
501
|
0
|
|
|
|
|
|
chomp $val; |
|
502
|
0
|
|
|
|
|
|
return $val; |
|
503
|
|
|
|
|
|
|
} |
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
1; |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
__END__ |
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=pod |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=encoding utf-8 |
|
512
|
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
=head1 NAME |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
Lab::Instrument::HP3458A - Agilent 3458A Multimeter |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=head1 VERSION |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
version 3.881 |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
use Lab::Instrument::HP3458A; |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
my $dmm=new Lab::Instrument::HP3458A({ |
|
526
|
|
|
|
|
|
|
gpib_board => 0, |
|
527
|
|
|
|
|
|
|
gpib_address => 11, |
|
528
|
|
|
|
|
|
|
}); |
|
529
|
|
|
|
|
|
|
print $dmm->get_voltage_dc(); |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
532
|
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
The Lab::Instrument::HP3458A class implements an interface to the Agilent / HP |
|
534
|
|
|
|
|
|
|
3458A digital multimeter. |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
my $hp=new(%parameters); |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=head1 METHODS |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
=head2 pl_freq |
|
543
|
|
|
|
|
|
|
Parameter: pl_freq |
|
544
|
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
$hp->pl_freq($new_freq); |
|
546
|
|
|
|
|
|
|
$npl_freq = $hp->pl_freq(); |
|
547
|
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
Get/set the power line frequency at your location (50 Hz for most countries, which is the default). This |
|
549
|
|
|
|
|
|
|
is the basis of the integration time setting (which is internally specified as a count of power |
|
550
|
|
|
|
|
|
|
line cycles, or PLCs). The integration time will be set incorrectly if this parameter is set incorrectly. |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
=head2 get_voltage_dc |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
$voltage=$hp->get_voltage_dc(); |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
Make a dc voltage measurement. This also enables autoranging. For finer control, use configure_voltage_dc() and |
|
557
|
|
|
|
|
|
|
triggered_read. |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
_head2 triggered_read |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
@values = $hp->triggered_read(); |
|
562
|
|
|
|
|
|
|
$value = $hp->triggered_read(); |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
Trigger and read value(s) using the current device setup. This expects and digests a list of values in ASCII format, |
|
565
|
|
|
|
|
|
|
as set up by configure_voltage_dc(). |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=head2 triggered_read_raw |
|
568
|
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
$result = $hp->triggered_read_raw( read_until_length => $length ); |
|
570
|
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
Trigger and read using the current device setup. This won't do any parsing and just return the answer from the device. |
|
572
|
|
|
|
|
|
|
If $read_until_length (integer) is specified, it will try to continuously read until it has gathered this amount of bytes. |
|
573
|
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
=head2 configure_voltage_dc |
|
575
|
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
$hp->configure_voltage_dc($range, $integration_time); |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
Configure range and integration time for the following DCV measurements. |
|
579
|
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
$range is a voltage or one of "AUTO", "MIN" or "MAX". |
|
581
|
|
|
|
|
|
|
$integration_time is given in seconds or one of "DEFAULT", "MIN" or "MAX". |
|
582
|
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
=head2 configure_voltage_dc_trigger |
|
584
|
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
$hp->configure_voltage_dc_trigger($range, $integration_time, |
|
586
|
|
|
|
|
|
|
$count, $delay); |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
Configures range, integration time, sample count and delay (between samples) for triggered |
|
589
|
|
|
|
|
|
|
readings. |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
$range, $integration_time: see configure_voltage_dc(). |
|
592
|
|
|
|
|
|
|
$count is the sample count per trigger (integer). |
|
593
|
|
|
|
|
|
|
$delay is the delay between the samples in seconds. |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
=head2 configure_voltage_dc_trigger_highspeed |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
$hp->configure_voltage_dc_trigger_highspeed($range, |
|
598
|
|
|
|
|
|
|
$integration_time, $count, $delay); |
|
599
|
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
Same as configure_voltage_dc_trigger, but configures the device for maximum measurement speed. |
|
601
|
|
|
|
|
|
|
Values are transferred in SINT format and can be fetched and decoded using triggered_read_raw() |
|
602
|
|
|
|
|
|
|
and decode_SINT(). |
|
603
|
|
|
|
|
|
|
This mode allows measurements of up to about 100 kSamples/second. |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
$range: see configure_voltage_dc(). |
|
606
|
|
|
|
|
|
|
$integration_time: integration time in seconds. The default is 1.4e-6. |
|
607
|
|
|
|
|
|
|
$count is the sample count per trigger (integer). |
|
608
|
|
|
|
|
|
|
$delay is the delay between the samples in seconds. |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
=head2 set_display_state |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
$hp->set_display_state($state); |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
Turn the front-panel display on/off. $state can be |
|
615
|
|
|
|
|
|
|
each of '1', '0', 'on', 'off'. |
|
616
|
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
=head2 set_display_text |
|
618
|
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
$hp->set_display_text($text); |
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
Display a message on the front panel. The multimeter will display up to 12 |
|
622
|
|
|
|
|
|
|
characters in a message; any additional characters are truncated. |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=head2 display_clear |
|
625
|
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
$hp->display_clear(); |
|
627
|
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
Clear the message displayed on the front panel. |
|
629
|
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=head2 beep |
|
631
|
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
$hp->beep(); |
|
633
|
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
Issue a single beep immediately. |
|
635
|
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=head2 get_error |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
($err_num,$err_msg)=$hp->get_error(); |
|
639
|
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
Query the multimeter's error queue. Up to 20 errors can be stored in the |
|
641
|
|
|
|
|
|
|
queue. Errors are retrieved in first-in-first out (FIFO) order. |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
=head2 check_errors |
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
$instrument->check_errors($last_command); |
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
# try |
|
648
|
|
|
|
|
|
|
eval { $instrument->check_errors($last_command) }; |
|
649
|
|
|
|
|
|
|
# catch |
|
650
|
|
|
|
|
|
|
if ( my $e = Exception::Class->caught('Lab::Exception::DeviceError')) { |
|
651
|
|
|
|
|
|
|
warn "Errors from device!"; |
|
652
|
|
|
|
|
|
|
@errors = $e->error_list(); |
|
653
|
|
|
|
|
|
|
@devtype = $e->device_class(); |
|
654
|
|
|
|
|
|
|
$command = $e->command(); |
|
655
|
|
|
|
|
|
|
} else { |
|
656
|
|
|
|
|
|
|
$e = Exception::Class->caught(); |
|
657
|
|
|
|
|
|
|
ref $e ? $e->rethrow; die $e; |
|
658
|
|
|
|
|
|
|
} |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
Uses get_error() to check the device for occured errors. Reads all present error and throws a |
|
661
|
|
|
|
|
|
|
Lab::Exception::DeviceError. The list of errors, the device class and the last issued command(s) |
|
662
|
|
|
|
|
|
|
(if the script provided them) are enclosed. |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=head2 set_nplc |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
$hp->set_nplc($number); |
|
667
|
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
Sets the integration time in units of power line cycles. |
|
669
|
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
=head2 reset |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
$hp->reset(); |
|
673
|
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
Reset the multimeter to its power-on configuration. Same as preset('NORM'). |
|
675
|
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=head2 preset |
|
677
|
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
$hp->preset($config); |
|
679
|
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
$config can be any of the following settings: |
|
681
|
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
'FAST' / 0 |
|
683
|
|
|
|
|
|
|
'NORM' / 1 |
|
684
|
|
|
|
|
|
|
'DIG' / 2 |
|
685
|
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
Choose one of several configuration presets. |
|
687
|
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=head2 selftest |
|
689
|
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
$hp->selftest(); |
|
691
|
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
Starts the internal self-test routine. |
|
693
|
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=head2 autocalibration |
|
695
|
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
$hp->autocalibration($mode); |
|
697
|
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
Starts the internal autocalibration. Warning... this procedure takes 11 minutes with the 'ALL' mode! |
|
699
|
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
$mode can be each of |
|
701
|
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
'ALL' / 0 |
|
703
|
|
|
|
|
|
|
'DCV' / 1 |
|
704
|
|
|
|
|
|
|
'AC' / 2 |
|
705
|
|
|
|
|
|
|
'OHMS' / 4 |
|
706
|
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
=head2 decode_SINT |
|
708
|
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
@values = $hp->decode_SINT( $SINT_data, <$iscale> ); |
|
710
|
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
Takes a data blob with SINT values and decodes them into a numeric list. The used $iscale parameter is |
|
712
|
|
|
|
|
|
|
read from the device by default if omitted. Make sure the device still has the same settings as used to |
|
713
|
|
|
|
|
|
|
obtain $SINT_data, or iscale will be off which leads to invalid data decoding. |
|
714
|
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=head1 CAVEATS/BUGS |
|
716
|
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
probably many |
|
718
|
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
720
|
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
=over 4 |
|
722
|
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
=item * L<Lab::Instrument> |
|
724
|
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
=item * L<Lab::Instrument::Multimeter> |
|
726
|
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
=back |
|
728
|
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
730
|
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
|
732
|
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
Copyright 2011 Andreas K. Huettel, Florian Olbrich |
|
734
|
|
|
|
|
|
|
2012 Alois Dirnaichner, Andreas K. Huettel, Florian Olbrich |
|
735
|
|
|
|
|
|
|
2013 Alois Dirnaichner, Andreas K. Huettel |
|
736
|
|
|
|
|
|
|
2015 Alois Dirnaichner |
|
737
|
|
|
|
|
|
|
2016 Simon Reinhardt |
|
738
|
|
|
|
|
|
|
2017 Andreas K. Huettel |
|
739
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
|
740
|
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
743
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
744
|
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
=cut |