| 1 | package Lab::Instrument::HP83732A; | ||
| 2 | #ABSTRACT: HP 83732A Series Synthesized Signal Generator | ||
| 3 | $Lab::Instrument::HP83732A::VERSION = '3.899'; | ||
| 4 | use v5.20; | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use Lab::Instrument; | ||
| 8 | use Time::HiRes qw (usleep); | ||
| 9 | |||
| 10 | our @ISA = ("Lab::Instrument"); | ||
| 11 | |||
| 12 | our %fields = ( | ||
| 13 | supported_connections => ['GPIB'], | ||
| 14 | |||
| 15 | # default settings for the supported connections | ||
| 16 | connection_settings => { | ||
| 17 | gpib_board => 0, | ||
| 18 | gpib_address => undef, | ||
| 19 | }, | ||
| 20 | |||
| 21 | device_settings => {}, | ||
| 22 | |||
| 23 | ); | ||
| 24 | |||
| 25 | sub new { | ||
| 26 | my $proto = shift; | ||
| 27 | my $class = ref($proto) || $proto; | ||
| 28 | my $self = $class->SUPER::new(@_); | ||
| 29 | $self->${ \( __PACKAGE__ . '::_construct' ) }(__PACKAGE__); | ||
| 30 | return $self; | ||
| 31 | } | ||
| 32 | |||
| 33 | sub id { | ||
| 34 | my $self = shift; | ||
| 35 | return $self->query('*IDN?'); | ||
| 36 | } | ||
| 37 | |||
| 38 | sub reset { | ||
| 39 | my $self = shift; | ||
| 40 | $self->write('*RST'); | ||
| 41 | } | ||
| 42 | |||
| 43 | sub set_frq { | ||
| 44 | my $self = shift; | ||
| 45 | my ($freq) = $self->_check_args( \@_, ['value'] ); | ||
| 46 | |||
| 47 | #my $freq = shift; | ||
| 48 | $self->set_cw($freq); | ||
| 49 | |||
| 50 | } | ||
| 51 | |||
| 52 | sub set_cw { | ||
| 53 | my $self = shift; | ||
| 54 | my $freq = shift; | ||
| 55 | |||
| 56 | $self->write("FREQuency:CW $freq Hz"); | ||
| 57 | } | ||
| 58 | |||
| 59 | sub get_frq { | ||
| 60 | my $self = shift; | ||
| 61 | |||
| 62 | my $freq = $self->query("FREQuency:CW?"); | ||
| 63 | |||
| 64 | return $freq; | ||
| 65 | |||
| 66 | } | ||
| 67 | |||
| 68 | sub set_power { | ||
| 69 | my $self = shift; | ||
| 70 | my ($power) = $self->_check_args( \@_, ['value'] ); | ||
| 71 | |||
| 72 | $self->write("POWer:LEVel $power DBM"); | ||
| 73 | } | ||
| 74 | |||
| 75 | sub get_power { | ||
| 76 | my $self = shift; | ||
| 77 | |||
| 78 | return $self->query("POWer:LEVel?"); | ||
| 79 | } | ||
| 80 | |||
| 81 | sub power_on { | ||
| 82 | my $self = shift; | ||
| 83 | $self->write('OUTP:STATe ON'); | ||
| 84 | } | ||
| 85 | |||
| 86 | sub power_off { | ||
| 87 | my $self = shift; | ||
| 88 | $self->write('OUTP:STATe OFF'); | ||
| 89 | } | ||
| 90 | |||
| 91 | sub selftest { | ||
| 92 | my $self = shift; | ||
| 93 | return $self->query("*TST?"); | ||
| 94 | } | ||
| 95 | |||
| 96 | sub display_on { | ||
| 97 | my $self = shift; | ||
| 98 | $self->write("DISPlay ON"); | ||
| 99 | } | ||
| 100 | |||
| 101 | sub display_off { | ||
| 102 | my $self = shift; | ||
| 103 | $self->write("DISPlay OFF"); | ||
| 104 | } | ||
| 105 | |||
| 106 | sub enable_external_am { | ||
| 107 | my $self = shift; | ||
| 108 | $self->write("AM:DEPTh MAX"); | ||
| 109 | $self->write("AM:SENSitivity 70PCT/VOLT"); | ||
| 110 | $self->write("AM:TYPE LINear"); | ||
| 111 | $self->write("AM:STATe ON"); | ||
| 112 | } | ||
| 113 | |||
| 114 | sub disable_external_am { | ||
| 115 | my $self = shift; | ||
| 116 | $self->write("AM:STATe OFF"); | ||
| 117 | } | ||
| 118 | |||
| 119 | 1; | ||
| 120 | |||
| 121 | __END__ |