2.7V 4-Channel 12-Bit A/D Converters with SPI™ Serial Interface

Embed: (wiki syntax)

« Back to documentation index

MCP3204 Class Reference

MCP3204 Class Reference

Interface to the 4-Channel 12-Bit A/D Converters with SPI interface. More...

#include <MCP3204.h>

Public Member Functions

 MCP3204 (SPI &spi, PinName nCs)
 Create an instance of the MCP3204 connected via specfied SPI instance.
 MCP3204 (PinName mosi, PinName miso, PinName sck, PinName nCs)
 Create an instance of the MCP4261 connected with SPI pins.
int sgl (char channel)
 Read from single channel.
int diff (char channel)
 Read from differential channel.

Detailed Description

Interface to the 4-Channel 12-Bit A/D Converters with SPI interface.

Using the driver:

  • remenber to setup SPI in main routine or use pins instance.

Defaults in this driver on start up:

  • Datasheet start up

Definition at line 51 of file MCP3204.h.


Constructor & Destructor Documentation

MCP3204 ( SPI &  spi,
PinName  nCs 
)

Create an instance of the MCP3204 connected via specfied SPI instance.

Parameters:
spiThe mbed SPI instance (make in main routine)
nCsThe SPI chip select pin.

Definition at line 30 of file MCP3204.cpp.

MCP3204 ( PinName  mosi,
PinName  miso,
PinName  sck,
PinName  nCs 
)

Create an instance of the MCP4261 connected with SPI pins.

Parameters:
mosiThe SPI Master Output, Slave Input pin.
misoThe SPI Master Input, Slave Output pin.
sckThe SPI Serial Clock pin.
nCsThe SPI chip select pin.

Definition at line 36 of file MCP3204.cpp.


Member Function Documentation

int diff ( char  channel )

Read from differential channel.

use defines to simplify use of function ( CH0, CH1, CH2, CH3)

Parameters:
channelThe channel to receive the 12 bits value from.

Definition at line 47 of file MCP3204.cpp.

int sgl ( char  channel )

Read from single channel.

use defines to simplify use of function ( CH0, CH1, CH2, CH3)

Parameters:
channelThe channel to receive the 12 bits value from.

Definition at line 42 of file MCP3204.cpp.