Device::Chip::AD5691R - chip driver for AD5691R
Device::Chip::AD5691R
use Device::Chip::AD5691R; my $chip = Device::Chip::AD5691R->new; $chip->mount( Device::Chip::Adapter::...->new )->get; my $voltage = 1.23; $chip->write_dac( 4096 * $voltage / 2.5 )->get; print "Output is now set to 1.23V\n";
This Device::Chip subclass provides specific communications to an Analog Devices AD5691R attached to the computer via an I²C adapter.
The reader is presumed to be familiar with the general operation of this chip; the documentation here will not attempt to explain or define chip-specific concepts or features, only the use of this module to access them.
The I²C address of the device. Can be specified in decimal, octal or hex with leading 0 or 0x prefixes.
0
0x
The following methods documented with a trailing call to ->get return Future instances.
->get
$config = $chip->read_config->get
Returns a HASH reference containing the chip's current configuration
HASH
GAIN => 1 | 2 REF => 0 | 1 PD => "normal" | "1k" | "100k" | "hiZ"
Note that since the chip does not itself allow reading of its configuration, this method simply returns the internally-cached values. This cache is initialised to power-on defaults, and tracked by the change_config method.
change_config
$chip->change_config( %changes )->get
Changes the configuration. Any field names not mentioned will be preserved at their existing values.
$chip->write_dac( $dac, $update )->get
Writes a new value for the DAC output.
If $update is true this will use the "update" form of write command, which writes both the DAC register and the input register. If false it only writes the input register, requiring a pulse on the LDAC pin to actually change the output voltage.
$update
$chip->write_dac_voltage( $voltage )->get
Writes a new value for the DAC output immediately, converting the given voltage to the required raw value, taking into account the setting of the GAIN config bit.
GAIN
Paul Evans <leonerd@leonerd.org.uk>
To install Device::Chip::AnalogConverters, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Chip::AnalogConverters
CPAN shell
perl -MCPAN -e shell install Device::Chip::AnalogConverters
For more information on module installation, please visit the detailed CPAN module installation guide.