Module mcp3208

Module mcp3208 

Source
Expand description

The Microchip Technology Inc. MCP3208 device is a successive approximation 12-bit Analog- to-Digital (A/D) Converter with on-board sample and hold circuitry. The MCP3208 is programmable to provide four pseudo-differential input pairs or eight single-ended inputs.

Differential Nonlinearity (DNL) is specified at ±1 LSB, while Integral Nonlinearity (INL) is offered in ±1 LSB (MCP3208-B) and ±2 LSB (MCP3208-C) versions. Communication with the devices is accomplished using a simple serial interface compatible with the SPI protocol. The devices are capable of conversion rates of up to 100 ksps. The MCP3208 devices operate over a broad voltage range (2.7V - 5.5V). Low current design permits operation with typical standby and active currents of only 500 nA and 320 μA, respectively.

§Usage (sync)

use embedded_devices::devices::microchip::mcp3208::{MCP3208Sync, InputChannel};
use uom::si::electric_potential::{volt, millivolt};
use uom::si::f64::ElectricPotential;

let mut mcp3208 = MCP3208Sync::new_spi(
    spi,
    // 2.5V reference
    ElectricPotential::new::<volt>(2.5),
);

let value = mcp3208.convert(InputChannel::Single0)?;
let voltage = value.get::<millivolt>();
println!("V_in at channel 0: {:?}mV", value);

§Usage (async)

use embedded_devices::devices::microchip::mcp3208::{MCP3208Async, InputChannel};
use uom::si::electric_potential::{volt, millivolt};
use uom::si::f64::ElectricPotential;

let mut mcp3208 = MCP3208Async::new_spi(
    spi,
    // 2.5V reference
    ElectricPotential::new::<volt>(2.5),
);

let value = mcp3208.convert(InputChannel::Single0).await?;
let voltage = value.get::<millivolt>();
println!("V_in at channel 0: {:?}mV", value);

Structs§

MCP3208Async
The MCP3208 is a 12-bit ADC with on-board sample and hold circuitry. It is programmable to provide four pseudo-differential input pairs or eight single-ended inputs.
MCP3208Sync
The MCP3208 is a 12-bit ADC with on-board sample and hold circuitry. It is programmable to provide four pseudo-differential input pairs or eight single-ended inputs.

Enums§

InputChannel
The ADC input channel