/Arduino_MCP3x6x_Library

Library to support Microchip MPC3x6x 16/24bit analog to digital converters.

Primary LanguageC++MIT LicenseMIT

Arduino MCP3x6x Library build

Supports Microchip 16bit MCP3461/MCP3462/MCP3464/ and 24bit MCP3561/MCP3562/MCP3564/ Analog Digital Converters.

Supported Boards

This project is set up to be build with different MCUs, but I am not able the test each of them. Personally I use the SAMD21, so this should be the most stable code.

Introduction

This lib does not (yet) support all features of these ADCs, but should help to get you started. Depending on which constructor is called the ADC will be configuerd in two different mode:

Mux Mode

MCP3x6x(const uint8_t pinCS = SS,SPIClass *theSPI = &SPI,
const uint8_t pinMOSI = MOSI, const uint8_t pinMISO = MISO, const uint8_t pinCLK = SCK)

Scan Mode

MCP3x6x(const uint8_t pinIRQ, const uint8_t pinMCLK, const uint8_t pinCS = SS, SPIClass *theSPI = &SPI,
const uint8_t pinMOSI = MOSI, const uint8_t pinMISO = MISO, const uint8_t pinCLK = SCK)

So scan mode requieres two additional pins, pinIQR for the conversion interrupt flag and pinMCLK (which is not implemented at all).

Both constructors fall back to default definitions which are common in the Arduino world. So if no pins is explicit specified the default SPI pinout will be used. Therefor it boils down to something simple as MCP3561 mcp(2, 3, 10); or even MCP3561 mcp(10);.

Please take a look at the examples how to configure these different modes.

Further documentation is available here.


see also: