ds345

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package ds345 implements the IVI driver for the Stanford Research System DS345 function generator.

State Caching: Not implemented

The serial port is a DB25 DCE. The [Green-utech USB RS-232 to DB25 serial cable](https://www.amazon.com/dp/B08J2VMNFY) does work.

Index

Constants

View Source
const (
	MaxPointsWaveform     = 16300
	MinPointsWaveform     = 8
	MaxArbitraryWaveforms = 10
	WaveformQuantum       = 8
)

Variables

This section is empty.

Functions

func DefaultGPIBAddress added in v0.6.1

func DefaultGPIBAddress() int

DefaultGPIBAddress lists the default GPIB interface address.

func DefaultSerialBaudRate added in v0.6.1

func DefaultSerialBaudRate() int

DefaultSerialBaudRate returns the default baud rate for the RS-232 serial port.

func DefaultSerialDataFrame added in v0.6.1

func DefaultSerialDataFrame() string

DefaultSerialDataFrame returns the default RS-232 data frame format.

func SerialBaudRates added in v0.6.1

func SerialBaudRates() []int

SerialBaudRates lists the available baud rates for the RS-232 serial port from the fastest to the slowest.

func SerialConfig added in v0.6.0

func SerialConfig() string

SerialConfig lists whether the RS-232 serial port is configured as a DCE (Data Circuit-Terminating Equipment) or a DTE (Data Terminal Equipment). Computers running the IVI program are DTEs; therefore, use a straight through serial cable when connecting to DCEs and a null modem cable when connecting to DTEs.

func SerialDataFrames added in v0.6.1

func SerialDataFrames() []string

SerialDataFrames lists the available RS-232 data frame formats. The DS345 "always sends two stop bits, 8 data bits, and no parity, and will correctly receive data sent with eitehr one or two stop bits." per the User's Manual.

Types

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

Channel models the output channel repeated capability for the function generator output channel.

func (*Channel) Amplitude

func (ch *Channel) Amplitude() (float64, error)

Amplitude reads the difference between the maximum and minimum waveform values, i.e., the peak-to-peak voltage value.

Amplitude is the getter for the read-write IviFgenStdFunc Attribute Amplitude described in Section 5.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Channel) BurstCount

func (ch *Channel) BurstCount() (int, error)

BurstCount returns the number of waveform cycles that the function generator produces after it receives a trigger.

BurstCount is the getter for the read-write IviFgenBurst Attribute Burst Count described in Section 17.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Channel) ConfigureStandardWaveform

func (ch *Channel) ConfigureStandardWaveform(
	wave fgen.StandardWaveform,
	amp float64,
	offset float64,
	freq float64,
	phase float64,
) error

ConfigureStandardWaveform configures the attributes of the function generator that affect standard waveform generation.

ConfigureStandardWaveform is the method that implements the Configure Standard Waveform function described in Section 5.3.1 of IVI-4.3: IviFgen Class Specification.

func (*Channel) DCOffset

func (ch *Channel) DCOffset() (float64, error)

DCOffset reads the difference between the average of the maximum and minimum waveform values and the x-axis (0 volts).

DCOffset is the getter for the read-write IviFgenStdFunc Attribute DC Offset described in Section 5.2.2 of IVI-4.3: IviFgen Class Specification.

func (*Channel) DisableOutput

func (ch *Channel) DisableOutput() error

DisableOutput is a convenience function for setting the Output Enabled attribute to false.

func (*Channel) DutyCycleHigh added in v0.5.1

func (ch *Channel) DutyCycleHigh() (float64, error)

DutyCycleHigh reads the percentage of time, specified as 0-100, during one cycle for which the square wave is at its high value.

DutyCycle is the getter for the read-write IviFgenStdFunc Attribute Duty Cycle High described in Section 5.2.3 of IVI-4.3: IviFgen Class Specification.

func (*Channel) EnableOutput

func (ch *Channel) EnableOutput() error

EnableOutput is a convenience function for setting the Output Enabled attribute to true.

func (*Channel) Frequency

func (ch *Channel) Frequency() (float64, error)

Frequency reads the number of waveform cycles generated in one second (i.e., Hz). Frequency is not applicable for a DC waveform.

Frequency is the getter for the read-write IviFgenStdFunc Attribute Frequency described in Section 5.2.4 of IVI-4.3: IviFgen Class Specification.

func (*Channel) Name added in v0.10.0

func (ch *Channel) Name() string

func (*Channel) OperationMode

func (ch *Channel) OperationMode() (fgen.OperationMode, error)

OperationMode determines whether the function generator should produce a continuous or burst output on the channel. OperationMode implements the getter for the read-write IviFgenBase Attribute Operation Mode described in Section 4.2.2 of IVI-4.3: IviFgen Class Specification.

func (*Channel) OutputEnabled

func (ch *Channel) OutputEnabled() (bool, error)

OutputEnabled determines if the output channel is enabled or disabled.

OutputEnabled is the getter for the read-write IviFgenBase Attribute Output Enabled described in Section 4.2.3 of IVI-4.3: IviFgen Class Specification.

func (*Channel) OutputImpedance

func (ch *Channel) OutputImpedance() (float64, error)

OutputImpedance return the output channel's impedance in ohms.

OutputImpedance is the getter for the read-write IviFgenBase Attribute Output Impedance described in Section 4.2.4 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetAmplitude

func (ch *Channel) SetAmplitude(amp float64) error

SetAmplitude specifies the difference between the maximum and minimum waveform values, i.e., the peak-to-peak voltage value.

SetAmplitude is the setter for the read-write IviFgenStdFunc Attribute Amplitude described in Section 5.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetBurstCount

func (ch *Channel) SetBurstCount(count int) error

SetBurstCount sets the number of waveform cycles that the function generator produces after it receives a trigger.

SetBurstCount is the setter for the read-write IviFgenBurst Attribute Burst Count described in Section 17.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetDCOffset

func (ch *Channel) SetDCOffset(amp float64) error

SetDCOffset sets the difference between the average of the maximum and minimum waveform values and the x-axis (0 volts).

SetDCOffset is the setter for the read-write IviFgenStdFunc Attribute DC Offset described in Section 5.2.2 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetDutyCycleHigh added in v0.5.1

func (ch *Channel) SetDutyCycleHigh(duty float64) error

SetDutyCycleHigh sets the percentage of time, specified as 0-100, during one cycle for which the square wave is at its high value.

SetDutyCycle is the setter for the read-write IviFgenStdFunc Attribute Duty Cycle High described in Section 5.2.3 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetFrequency

func (ch *Channel) SetFrequency(freq float64) error

SetFrequency sets the number of waveform cycles generated in one second (i.e., Hz). Frequency is not applicable for a DC waveform.

SetFrequency is the setter for the read-write IviFgenStdFunc Attribute Frequency described in Section 5.2.4 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetOperationMode

func (ch *Channel) SetOperationMode(mode fgen.OperationMode) error

SetOperationMode specifies whether the function generator should produce a continuous or burst output on the channel.

SetOperationMode implements the setter for the read-write IviFgenBase Attribute Operation Mode described in Section 4.2.2 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetOutputEnabled

func (ch *Channel) SetOutputEnabled(_ bool) error

SetOutputEnabled sets the output channel to enabled or disabled.

SetOutputEnabled is the setter for the read-write IviFgenBase Attribute Output Enabled described in Section 4.2.3 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetOutputImpedance

func (ch *Channel) SetOutputImpedance(impedance float64) error

SetOutputImpedance sets the output channel's impedance in ohms.

SetOutputImpedance is the setter for the read-write IviFgenBase Attribute Output Impedance described in Section 4.2.4 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetStandardWaveform

func (ch *Channel) SetStandardWaveform(wave fgen.StandardWaveform) error

SetStandardWaveform specifies which standard waveform the function generator produces.

SetStandardWaveform is the setter for the read-write IviFgenStdFunc Attribute Waveform described in Section 5.2.6 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetStartPhase added in v0.5.1

func (ch *Channel) SetStartPhase(freq float64) error

SetStartPhase writes the start phase of the standard waveform the function generator produces. When the Waveform attribute is set to Waveform DC, this attribute does not affect signal output. The units are degrees.

SetStartPhase is the setter for the read-write IviFgenStdFunc Attribute Start Phase described in Section 5.2.5 of IVI-4.3: IviFgen Class Specification.

func (*Channel) SetStartTriggerDelay added in v0.10.0

func (ch *Channel) SetStartTriggerDelay(_ time.Duration) error

func (*Channel) SetStartTriggerSlope added in v0.10.0

func (ch *Channel) SetStartTriggerSlope(slope fgen.TriggerSlope) error

func (*Channel) SetStartTriggerSource added in v0.10.0

func (ch *Channel) SetStartTriggerSource(src fgen.TriggerSource) error

func (*Channel) SetStartTriggerThreshold added in v0.10.0

func (ch *Channel) SetStartTriggerThreshold(threshold float64) error

func (*Channel) SetTriggerSource

func (ch *Channel) SetTriggerSource(src fgen.OldTriggerSource) error

SetTriggerSource specifies the trigger srouce.

SetTriggerSource is the setter for the read-write IviFgenTrigger Attribute Trigger Source described in Section 9.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Channel) StandardWaveform

func (ch *Channel) StandardWaveform() (fgen.StandardWaveform, error)

StandardWaveform determines if one of the IVI Standard Waveforms is being output by the function generator. If not, an error is returned.

StandardWaveform is the getter for the read-write IviFgenStdFunc Attribute Waveform described in Section 5.2.6 of IVI-4.3: IviFgen Class Specification.

func (*Channel) StartPhase added in v0.5.1

func (ch *Channel) StartPhase() (float64, error)

StartPhase reads the start phase of the standard waveform the function generator produces. When the Waveform attribute is set to Waveform DC, this attribute does not affect signal output. The units are degrees.

StartPhase is the getter for the read-write IviFgenStdFunc Attribute Start Phase described in Section 5.2.5 of IVI-4.3: IviFgen Class Specification.

func (*Channel) StartTriggerConfigure added in v0.10.0

func (ch *Channel) StartTriggerConfigure(source fgen.TriggerSource, slope fgen.TriggerSlope) error

func (*Channel) StartTriggerDelay added in v0.10.0

func (ch *Channel) StartTriggerDelay() (time.Duration, error)

func (*Channel) StartTriggerSlope added in v0.10.0

func (ch *Channel) StartTriggerSlope() (fgen.TriggerSlope, error)

func (*Channel) StartTriggerSource added in v0.10.0

func (ch *Channel) StartTriggerSource() (fgen.TriggerSource, error)

func (*Channel) StartTriggerThreshold added in v0.10.0

func (ch *Channel) StartTriggerThreshold() (float64, error)

func (*Channel) TriggerSource

func (ch *Channel) TriggerSource() (fgen.OldTriggerSource, error)

TriggerSource determines the trigger srouce. TriggerSource is the getter for the read-write IviFgenTrigger Attribute Trigger Source described in Section 9.2.1 of IVI-4.3: IviFgen Class Specification.

type Driver added in v0.9.0

type Driver struct {
	Channels []Channel
	ivi.Inherent
	// contains filtered or unexported fields
}

Driver provides the IVI driver for a SRS DS345 function generator.

func New

func New(inst ivi.Instrument, reset bool) (*Driver, error)

New creates a new DS345 IVI Instrument.

func (*Driver) AbortGeneration added in v0.9.0

func (d *Driver) AbortGeneration() error

AbortGeneration aborts a previously initiated signal generation. Since the DS345 constantly generates a signal and the output cannot be aborted, this function does nothing and returns no error.

AbortGeneration implements the IviFgenBase function described in Section 4.3.1 of IVI-4.3: IviFgen Class Specification.

func (*Driver) ArbWfmMaxSize added in v0.10.0

func (d *Driver) ArbWfmMaxSize() int

func (*Driver) ArbWfmMinSize added in v0.10.0

func (d *Driver) ArbWfmMinSize() int

func (*Driver) ArbWfmNumberWaveformsMax added in v0.10.0

func (d *Driver) ArbWfmNumberWaveformsMax() int

func (*Driver) ArbWfmQuantum added in v0.10.0

func (d *Driver) ArbWfmQuantum() int

func (*Driver) InitiateGeneration added in v0.10.0

func (d *Driver) InitiateGeneration() error

InitiateGeneration initiates signal generation. Since the DS345 constantly generates a signal and the output cannot be disabled, this function does nothing and returns no error.

InitiateGeneration implements the IviFgenBase function described in Section 4.3.8 of IVI-4.3: IviFgen Class Specification.

func (*Driver) InternalTriggerRate added in v0.10.0

func (d *Driver) InternalTriggerRate() (float64, error)

InternalTriggerRate determines the rate at which the function generator's internal trigger source produces a trigger in triggers per second. The DS345 rounds the trigger rate to two significant digits and may range from 0.001 Hz to 10 kHz.

InternalTriggerRate is the getter for the read-write IviFgenInternalTrigger Attribute Internal Trigger Rate described in Section 15.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Driver) OutputCount added in v0.9.0

func (d *Driver) OutputCount() int

OutputCount returns the number of available output channels.

OutputCount is the getter for the read-only IviFgenBase Attribute Output Count described in Section 4.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Driver) OutputMode added in v0.10.0

func (d *Driver) OutputMode() (fgen.OutputMode, error)

OutputMode returns the determines how the function generator produces waveforms. This attribute determines which extension group’s functions and attributes are used to configure the waveform the function generator produces.

OutputMode is the getter for the read-only IviFgenBase Attribute Output Mode described in Section 4.2.5 of IVI-4.3: IviFgen Class Specification.

func (*Driver) ReferenceClockSource added in v0.10.0

func (d *Driver) ReferenceClockSource() (fgen.ClockSource, error)

func (*Driver) SetInternalTriggerRate added in v0.10.0

func (d *Driver) SetInternalTriggerRate(rate float64) error

SetInternalTriggerRate specifies the rate at which the function generator's internal trigger source produces a trigger in triggers per second. The DS345 rounds the trigger rate to two significant digits and may range from 0.001 Hz to 10 kHz.

SetInternalTriggerRate is the setter for the read-write IviFgenInternalTrigger Attribute Internal Trigger Rate described in Section 15.2.1 of IVI-4.3: IviFgen Class Specification.

func (*Driver) SetOutputMode added in v0.10.0

func (d *Driver) SetOutputMode(outputMode fgen.OutputMode) error

SetOutputMode sets how the function generator produces waveforms. This attribute determines which extension group’s functions and attributes are used to configure the waveform the function generator produces.

OutputMode is the setter for the read-only IviFgenBase Attribute Output Mode described in Section 4.2.5 of IVI-4.3: IviFgen Class Specification.

func (*Driver) SetReferenceClockSource added in v0.10.0

func (d *Driver) SetReferenceClockSource(src fgen.ClockSource) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL