Lab::Instrument::HP33120A - HP 33120A 15MHz function/arbitrary waveform generator
version 3.682
use Lab::Instrument::HP33120A; my $g = new Lab::Instrument::HP33120A ( connection_type => 'LinuxGPIB', gpib_address => 10 ); $g->set_frequency('3.78kHz'); $g->set_shape('square'); ...
$g = new Lab::Instrument::HP33120A->(%options);
options: gpib_board => 0, gpib_address => 10, connection_type => 'LinuxGPIB', no_cache => 1, # turn off cache
$id = $g->get_id();
reads the *IDN? string from device
%status = $g->get_status();
return a hash with status bits { ERROR => .., DATA=> ..
$errmsg = $g->get_error();
Fetch the first error in the error queue. Returns ($code,$message); code == 0 means 'no error'
$g->reset();
reset the function generator (*RST, *CLS)
$slope = $g->get_trigger_slope();
fetch the trigger slope, returns POS or NEG
$g->set_trigger_slope($slope);
set the slope of the signal used to trigger $slope = 'POS','+' or 'NEG','-'
$g->wait_complete();
Wait for operations to be completed
TODO: probably need to revise, with a *OPC? checking loop
$g->trigger();
Send a bus trigger to the function generator, wait until trigger complete.
$src = $g->get_trigger_source();
fetch the 'trigger source' from the function generator. Possible values are 'IMM', 'BUS' or 'EXT'. IMM => immediate self-triggering; BUS => gpib/serial trigger input, such as *TRG; EXT => external trigger input.
$g->set_trigger_source($src);
Set the trigger source for the function generator. Possible values are 'IMM' (immediate, i.e., internal free-running self-trigger) 'BUS' GPIB *TRG type triggering; 'EXT' trigger from external input.
$g->set_display(BOOL);
turn the display off (BOOL = false) or on (BOOL = true)
$display_on = $g->get_display();
get the state of the display (boolean)
$g->set_text("text to show");
display text on the function generator, in the place of the usual voltage/frequency/etc. Text is truncated at 11 chars, comma, semicolon, period are combined with char, so not counted in length
$mytext = $g->get_text();
fetches the text shown on the display with set_text
$g->clear_text();
remove the text from the display
$g->beep();
Cause the function generator to 'beep'
$sync = $g->get_sync();
fetch boolean value indicating whether 'sync' output on the front panel is enabled
$g->set_sync($sync);
enable or disable SYNC output on front panel. $sync is a boolean (1/true/yes/on) => sync output enabled
$g->save_setup($n);
save function generator setup to internal non-volatile memory. $n = 0..3.
NOTE: $n=0 is overwritten by the 'current setup' when the generator is turned off.
$g->recall_setup($n);
restore function generator configuration from internal non-volatile memory. $n=0..3
$g->delete_setup($n);
delete one of the internal non-volatile setups $n=0..3
$zload = $g->get_load();
fetch the output load impedance of the generator. Possible values are '50' and 'INF'. This does NOT make any physical changes in the generator, but affects the internal calculation of amplitudes.
$g->set_load($z);
Tell the function generator what load impedance the output is being terminated to, so that other characteristics can be correctly calculated. Possible values are '50', 'INF', 'MIN', 'MAX' (can also use '50ohm', '0.05kohm', etc)
$shape = $g->get_shape();
returns the waveform shape = SIN|SQU|TRI|RAMP|USER
$g=>set_shape($shape);
Sets the output function shape = SIN|SQU|TRI|RAMP|USER USER = arbitary waveform, separately selected
$f = $g->get_frequency();
reads the function generator frequency, in Hz
$g->set_frequency($f);
sets the function generator frequency in Hz. The frequency limits are 10mHz to 15MHz . The frequency can be specified as a simple number (in Hz), MIN, MAX or a string in standard IEEE488-2 NRf format. NOTE: if you use the Hz unit, the standard is to interpret mHz as megahertz.
set_frequency(10) 10Hz
set_frequency('0.01kHz') 10Hz
set_frequency('1mHz') 1E6 Hz
set_frequency('10m') 10e-3 Hz (note, without Hz, `m' means `milli')
The upper frequency limit depends on the function shape
$dc = $g->get_duty_cycle()'
fetch the duty cycle, in percent; only relevent for square waves
$g->set_duty_cycle(percent);
sets the square wave duty cycle, in percent. The available range depends on frequency, so percent = 20..80 for <= 5MHz and percent = 40..60 for higher frequencies
$vamp = $g->get_amplitude();
fetch the function amplitude, default is amplitude in volts peak-to-peak (Vpp), but depending on the units setting [see get_vunit()], so might be Vrms or dBm.
$g->set_amplitude($vamp);
sets the function amplitude, in units from the set_vunit() call, defaults to Vpp.
The amplitude can be either a number, or string with magnitude (and optionally, units), MAX or MIN.
Examples: `100uV', `50mV', `123E-3', `20dBm', `5.5E1dBmV'.
NOTE: attaching units with $vamp does not change vunit, so if vunit=`VPP' and you set $vamp=`5.5e1dBmV', you'll get 55mVpp.
The minimum and maximum amplitudes depend on the output load selection, the function shape, and the DC offset.
Max output voltage is +-20V into a high-Z load, +-10V into 50 ohm load.
TODO: automatically adjust units based on input text: 4Vpp, 3.5Vrms, 7.3dbm ...
Since limits are rather hard to determine, you should check for errors after setting.
$unit = $g->get_vunit()
Fetch the units that are being used to specify the output amplitude Possible values are VPP, VRMS, DBM, or DEF (default, VPP)
$g->set_vunit($unit);
Set the way that amplitudes are specified. Possible values are Vpp, Vrms, dBm or DEF (default = Vpp)
$voff = $g->get_offset();
Get the DC offset in volts (not affected by vunit)
$g->set_offset($voff);
Set the DC offset, either as a number (volts), as a string '100mV', '0.01kV' '1e3u', MIN or MAX. The specification of the DC offset is not affected by the selection of vunit.
Note that the DC offset is limited in combination with the output load, amplitude, and function shape.
@list = $g->get_waveform_list();
Get a list of the available 'user' waveforms. Five of these are built-in, up to four are user-storable in non-volatile memory, and possibly VOLATILE for a waveform in volatile memory
The names of the five built-in arbitrary waveforms are: SINC, NEG_RAMP, EXP_RISE, EXP_FALL, and CARDIAC.
$wname = $g->get_user_waveform();
Fetches the name of the currently selected 'user' waveform.
$g->set_user_waveform($wname);
Sets the name of the current 'user' waveform. This should be a name from the $g->get_waveform_list() set of nonvolatile waveforms, or 'VOLATILE'.
$g->load_waveform(...);
store waveform as 'volatile' data (can be used by selecting 'volatile' user waveform) perhaps for persistant storage.
load_waveform(v1,v2,v3...) voltages |v(j)| <= 1
load_waveform(d1,d2,d3...) DAC values |d(j)| < 2048
load_waveform(\@array) voltages or DAC values
load_waveform(waveform=>[voltage array ref]);
load_waveform(dac=>[DAC array ref]);
number of data points 8..16000
In the first three cases above, where it is not specified "voltage" or "DAC" values, it is assumed to be voltages if the quantities are within the range -1..+1, and otherwise assumed to be DAC values.
$vavg = $g->get_waveform_average($name);
calculates and returns the 'average voltage' of waveform $name (nonvolatile stored waveform, or VOLATILE)
$vcr = $g->get_waveform_crestfactor($name);
calculates and returns the voltage 'crest factor' (ratio of Vpeak/Vrms) for the waveform stored in $name.
$npts = $g->get_waveform_points($name) Returns the number of points in the waveform $name
$vpp = $g->get_waveform_peak2peak($name);
calculates and returns the peak-to-peak voltage of waveform $name
$g->store_waveform($name);
Stores the waveform in VOLATILE to non-volatile memory as $name. Note that $name cannot be one of the 'hard-coded' names, is a maximum of 8 characters in length, must start with a-z, and contain only alphanumeric and underscore (_) characters. All names are converted to uppercase.
There is memory for 4 user waveforms to be stored, after which some must be deleted to allow further storage.
$g->delete_waveform($name);
Delete one of the non-volatile user waveforms (or VOLATILE). Note that the 5 'built-in' user waveforms cannot be deleted.
$n = $g->get_waveform_free();
returns the number of 'free' user waveform storage areas (0..4) that can be used for $g->store_waveform
$mod = $g->get_modulation();
Fetch the type of modulation being used: NONE,AM,FM,BURST,FSK,SWEEP
$g->set_modulation($mod);
Set the type of modulation to use: NONE,AM,FM,BURST,FSK,SWEEP if $mod='' or 'off', selects NONE.
$g->set_am_depth(percent);
set AM modulation depth percent: 0..120, MIN, MAX
$depth = $g->get_am_depth();
get the AM modulation depth, in percent
$shape = $g->get_am_shape();
gets the waveform used for AM modulation returns $shape = (SIN|SQU|TRI|RAMP|NOIS|USER)
$g->set_am_shape($shape);
sets the waveform used for AM modulation $shape = (SIN|SQU|TRI|RAMP|NOIS|USER)
$freq = $g->get_am_frequency();
get the frequency of the AM modulation
$g->set_am_frequency($f);
sets the frequency of AM modulation $f = value in Hz, 10mHz..20kHz, MIN, MAX
Note that $f can be a string, with suffixes, and that 'mHz' suffix -> MEGAHz 'm' suffix with no 'Hz' -> millihertz
$source = $g->get_am_source();
get the source of the AM modulation signal: BOTH|EXT
$g->set_am_source(BOTH|EXT);
set the source of the AM modulation; BOTH = internal+external EXT = external only. INT = translated to BOTH
$dev = $g->get_fm_deviation();
fetch the FM modulation deviation, in Hz
$g->set_fm_deviation($dev);
Set the FM modulation deviation in Hz. $dev can be a simple number, in Hz, or a string with suffixes, or MIN or MAX.
Ex: $dev='10.3kHz' $dev='1.2MHZ' $dev='200m' NOTE: MHZ -> megahertz (case independent). A simple 'm' suffix => millihertz
dev range 10mHz .. 7.5MHz carrier frequency must be >= deviation frequency carrier + deviation < peak frequency for carrier waveform + 100kHz So: 15.1MHz for sine and square 200kHz for triangle and ramp 5.1MHz for 'user' waveforms
$shape = $g->get_fm_shape();
gets the waveform used for FM modulation returns $shape = (SIN|SQU|TRI|RAMP|NOIS|USER)
$g->set_fm_shape($shape);
sets the waveform used for FM modulation $shape = (SIN|SQU|TRI|RAMP|NOIS|USER)
NOTE: NOISE and DC cannot be used as FM carrier
$freq = $g->get_fm_frequency();
get the frequency of the FM modulation, in Hz
$g->set_fm_frequency($f);
sets the frequency of AM modulation $f = value in Hz, 10mHz..10kHz, MIN, MAX
Note that $f can be a string with the usual suffixes, but XmHz -> X megahz Xm-> X millihz
$ncyc = $g->get_burst_cycles();
Fetch the number of cycles in burst modulation
$g->set_burst_cycles($ncyc);
Set the number of cycles in burst modulation. $ncyc is an integer 1..50,000 or MIN or MAX or INF
For SIN, SQU, or USER waveform shapes, the minumim number of cycles is related to the carrier frequency. <= 1MHz min 1 cycle 1..2MHz min 2 cycles 2..3MHz min 3 cycles 3..4MHz min 4 cycles 4..5MHz min 5 cycles
For carrier frequency <= 100Hz, cycles <= 500sec * carrier freq
$ph = $g->get_burst_phase();
Fetches the starting phase of the burst, in degrees, when bursts are triggered.
$g->set_burst_phase($ph);
Sets the starting phase of burst, in degrees (or MIN or MAX) from -360 to 360 in 0.001 degree increments.
phase examples: 30.1, '20deg', 'min', 'max'
$rate = $g->get_burst_rate();
Fetch the burst rate (in Hz) for internally triggered bursts
$g->set_burst_rate($rate);
Set the burst rate (in Hz) for internally triggered bursts. $rate can be a simple number, or a string with the usual suffixes. Note that 'mHz' (case independent) -> megahertz while 'm' -> millihertz. Rate 10mHz .. 50kHz or MIN or MAX
If the burst rate is too large for the carrier frequency and burst count, the function generator will (silently) adjust to continually retrigger.
$source = $g->get_burst_source();
Fetch the source of the burst modulation: INT or EXT
$g->set_burst_source($source);
Set the source of burst modulation: $source = 'INT' or 'EXT'. If source is external, burst cycle count, rate, are ignored.
$freq = $g->get_fsk_frequency();
get the FSK 'hop' frequency, in Hz
$g->set_fsk_frequency($f);
sets the FSK 'hop' frequency $f = value in Hz, 10mHz..15MHz, MIN, MAX (max freq 100kHz for TRIANGLE and RAMP shapes)
$rate = $g->get_fsk_rate();
Fetch the rate at which fsk shifts between frequencies (in Hz) for internally triggered modulation.
$g->set_fsk_rate($rate);
Set the rate for fsk shifting between frequencies (in Hz) for internally triggered modulation.
$rate can be a simple number, or a string with the usual suffixes. Note that 'mHz' (case independent) -> megahertz while 'm' -> millihertz. Rate 10mHz .. 50kHz or MIN or MAX
$source = $g->get_fsk_source();
Fetch the source of the FSK modulation: INT or EXT
$g->set_fsk_source($source);
Set the source of FSK modulation: $source = 'INT' or 'EXT'. If source is external, FSK rate is ignored.
$g->get_sweep_start_frequency();
Fetch the starting frequency of the sweep, in Hz
$g->get_sweep_stop_frequency();
Fetch the stopping frequency of the sweep, in Hz
$g->set_sweep_start_frequency($f);
sets the frequency sweep starting frequency $f = value in Hz, 10mHz..15MHz, MIN, MAX
if fstart>fstop, sweep decreases in frequency; if fstart<fstop, sweep increases in frequency.
$g->set_sweep_stop_frequency($f);
sets the frequency sweep stopping frequency $f = value in Hz, 10mHz..15MHz, MIN, MAX
$spc = $g->get_sweep_spacing();
Fetches the sweep 'spacing', returns 'LIN' or 'LOG' for linear or logarithmic spacing.
$g->set_sweep_spacing($spc);
Sets sweep to either LIN or LOG spacing
$time = $g->get_sweep_time();
Fetch the time (in seconds) to sweep from starting to stopping frequency.
$g->set_sweep_time($time);
Sets the time to sweep between starting and stopping frequencies. The number of frequencies steps is internally calculated by the function generator.
$time can be a simple number (in seconds) or a string with suffices such as "5ms" "0.03ks", or MIN or MAX. The range of sweep times is 1ms .. 500s
This software is copyright (c) 2019 by the Lab::Measurement team; in detail:
Copyright 2016 Charles Lane, Simon Reinhardt 2017 Andreas K. Huettel
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Lab::Measurement, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lab::Measurement
CPAN shell
perl -MCPAN -e shell install Lab::Measurement
For more information on module installation, please visit the detailed CPAN module installation guide.