| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lab::Instrument::SR830::AuxIn; |
|
2
|
|
|
|
|
|
|
#ABSTRACT: Aux Inputs of the Stanford Research SR830 Lock-In Amplifier |
|
3
|
|
|
|
|
|
|
$Lab::Instrument::SR830::AuxIn::VERSION = '3.880'; |
|
4
|
2
|
|
|
2
|
|
2353
|
use v5.20; |
|
|
2
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
51
|
|
|
8
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
35
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
11
|
use Data::Dumper; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
83
|
|
|
11
|
2
|
|
|
2
|
|
13
|
use Carp; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
124
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
17
|
use parent 'Lab::Instrument'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
11
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our %fields = ( |
|
17
|
|
|
|
|
|
|
channel => undef, |
|
18
|
|
|
|
|
|
|
supported_connections => [ 'GPIB', 'VISA_GPIB', 'DEBUG' ], |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
2
|
|
|
2
|
1
|
4
|
my $proto = shift; |
|
23
|
2
|
|
33
|
|
|
9
|
my $class = ref($proto) || $proto; |
|
24
|
2
|
|
|
|
|
12
|
my $self = $class->SUPER::new(@_); |
|
25
|
2
|
|
|
|
|
4
|
$self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); |
|
|
2
|
|
|
|
|
11
|
|
|
26
|
2
|
|
|
|
|
7
|
$self->empty_buffer(); |
|
27
|
2
|
|
|
|
|
11
|
my $channel = $self->channel; |
|
28
|
2
|
50
|
|
|
|
10
|
if ( not defined $channel ) { |
|
|
|
50
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
croak "need channel (1-4) in constructor for ", __PACKAGE__; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
elsif ( $channel !~ /^[1-4]$/ ) { |
|
32
|
0
|
|
|
|
|
0
|
croak "channel '$channel' is not in the range (1..4)"; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
2
|
|
|
|
|
19
|
return $self; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub empty_buffer { |
|
38
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
|
39
|
2
|
|
|
|
|
9
|
my ($times) = $self->_check_args( \@_, ['times'] ); |
|
40
|
2
|
50
|
|
|
|
6
|
if ($times) { |
|
41
|
0
|
|
|
|
|
0
|
for ( my $i = 0; $i < $times; $i++ ) { |
|
42
|
0
|
|
|
|
|
0
|
eval { $self->read( brutal => 1 ) }; |
|
|
0
|
|
|
|
|
0
|
|
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
else { |
|
46
|
2
|
|
|
|
|
16
|
while ( $self->read( brutal => 1 ) ) { |
|
47
|
0
|
|
|
|
|
0
|
print "Cleaning buffer."; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub get_value { |
|
54
|
2
|
|
|
2
|
1
|
1010
|
my $self = shift; |
|
55
|
2
|
|
|
|
|
10
|
my ($tail) = $self->_check_args( \@_, [] ); |
|
56
|
2
|
|
|
|
|
14
|
my $channel = $self->channel; |
|
57
|
2
|
|
|
|
|
11
|
return $self->query("OAUX? $channel"); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=pod |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=encoding UTF-8 |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Lab::Instrument::SR830::AuxIn - Aux Inputs of the Stanford Research SR830 Lock-In Amplifier |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
version 3.880 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use Lab::Instrument::SR830::AuxIn |
|
79
|
|
|
|
|
|
|
my $multimeter = Lab::Instrument::SR830::AuxIn->new(%options, channel => 1); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
print $multimeter->get_value(); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This class provides access to the four DC inputs of the SR830. You have to |
|
86
|
|
|
|
|
|
|
provide a C<channel> (1..4) parameter in the constructor. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
B<To use multiple virtual instruments, which use the same physical device, you have to share the connection between the virtual instruments:> |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
use Lab::Measurement; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# Create the shared connection. |
|
93
|
|
|
|
|
|
|
my $connection = Connection('LinuxGPIB', {gpib_address => 8}); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Array of instrument objects. Each element belongs to one of the four |
|
96
|
|
|
|
|
|
|
# channels. |
|
97
|
|
|
|
|
|
|
my @inputs; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
for my $channel (1..4) { |
|
100
|
|
|
|
|
|
|
$inputs[$channel] = Instrument('SR830::AuxIn', { |
|
101
|
|
|
|
|
|
|
connection => $connection, |
|
102
|
|
|
|
|
|
|
channel => $channel, |
|
103
|
|
|
|
|
|
|
}); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
for my $channel (1..4) { |
|
107
|
|
|
|
|
|
|
say "channel $channel: ", $inputs[$channel]->get_value(); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 Methods |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 get_value() |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Return the input voltage. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Copyright 2016 Simon Reinhardt |
|
121
|
|
|
|
|
|
|
2017 Andreas K. Huettel |
|
122
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
126
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |