Maxim Integrated / MAX11131

Dependents:   MAX11131BOB_Tester MAX11131BOB_12bit_16ch_SampleSet_SPI_ADC MAX11131BOB_Serial_Tester

Embed: (wiki syntax)

« Back to documentation index

MAX11131 Class Reference

MAX11131 Class Reference

MAX11131 3Msps, Low-Power, Serial SPI 12-Bit, 16-Channel, Differential/Single-Ended Input, SAR ADC. More...

#include <MAX11131.h>

Public Types

enum  MAX11131_SCAN_enum_t {
  SCAN_0000_NOP = 0x00, SCAN_0001_Manual = 0x01, SCAN_0010_Repeat = 0x02, SCAN_0011_StandardInternalClock = 0x03,
  SCAN_0100_StandardExternalClock = 0x04, SCAN_0101_UpperInternalClock = 0x05, SCAN_0110_UpperExternalClock = 0x06, SCAN_0111_CustomInternalClock = 0x07,
  SCAN_1000_CustomExternalClock = 0x08, SCAN_1001_SampleSetExternalClock = 0x09
}
 

ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

More...
enum  MAX11131_RESET_enum_t { RESET_00_Normal = 0x00, RESET_01_ResetFIFO = 0x01, RESET_10_ResetAllRegisters = 0x02 }
 

ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved.

More...
enum  MAX11131_PM_enum_t { PM_00_Normal = 0x00, PM_01_AutoShutdown = 0x01, PM_10_AutoStandby = 0x02 }
 

ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved.

More...
enum  MAX11131_ic_t
 

IC's supported with this driver.

More...
typedef enum
MAX11131::MAX11131_SCAN_enum_t 
MAX11131_SCAN_enum_t
 ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)
typedef enum
MAX11131::MAX11131_RESET_enum_t 
MAX11131_RESET_enum_t
 ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved.
typedef enum
MAX11131::MAX11131_PM_enum_t 
MAX11131_PM_enum_t
 ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved.

Public Member Functions

 MAX11131 (SPI &spi, DigitalOut &cs_pin, DigitalOut &CNVST_pin, DigitalIn &EOC_pin, MAX11131_ic_t ic_variant)
 Constructor for MAX11131 Class.
void spi_frequency (int spi_sclk_Hz)
 set SPI SCLK frequency
int get_spi_frequency () const
 get SPI SCLK frequency
int get_spi_dataMode () const
 get SPI mode
void Init (void)
 Menu item '!' Initialize device.
void Reconfigure_SingleEnded (int channel_0_15)
 Menu item 'IS' ADC Channels AIN(channelId), AIN(channelId+1) = Both Single-Ended, Unipolar Full Scale = VREF Voltage per LSB count = VREF/4096 AIN(channelId) is a Single-Ended input using Unipolar transfer function.
void Reconfigure_DifferentialUnipolar (int channel_0_15)
 Menu item 'IU' ADC Channels AIN(channelId), AIN(channelId+1) = Differential Unipolar (AIN(channelId) > AIN(channelId+1)) Full Scale = VREF Voltage per LSB count = VREF/4096 AIN(channelId), AIN(channelId+1) are a Differential pair using Unipolar transfer function.
void Reconfigure_DifferentialBipolarFSVref (int channel_0_15)
 Menu item 'IB' ADC Channels AIN(channelId), AIN(channelId+1) = Differential Bipolar Full Scale = VREF Voltage per LSB count = VREF/4096 AIN(channelId), AIN(channelId+1) are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref AIN(channelId) voltage must always be between 0 and VREF.
void Reconfigure_DifferentialBipolarFS2Vref (int channel_0_15)
 Menu item 'IR' ADC Channels AIN(channelId), AIN(channelId+1) = Differential Bipolar Full Scale = 2 * VREF Voltage per LSB count = VREF/2048 AIN(channelId), AIN(channelId+1) are a Differential pair using Bipolar transfer function with range (+/-)Vref AIN(channelId) voltage must always be between 0 and VREF.
int16_t ScanRead (void)
 SCAN_0000_NOP.
void ReadAINcode (void)
 SCAN_0000_NOP.
int32_t TwosComplementValue (uint32_t regValue)
 Sign-Extend a right-aligned MAX11131 code into a signed 2's complement value.
double VoltageOfCode (int16_t value_u12, int channelId)
 Return the physical voltage corresponding to MAX11131 code.
int ScanManual (void)
 SCAN_0001_Manual.
int ScanRepeat (void)
 SCAN_0010_Repeat.
int ScanStandardInternalClock (void)
 SCAN_0011_StandardInternalClock.
int ScanStandardExternalClock (void)
 SCAN_0100_StandardExternalClock.
int ScanUpperInternalClock (void)
 SCAN_0101_UpperInternalClock.
int ScanUpperExternalClock (void)
 SCAN_0110_UpperExternalClock.
int ScanCustomInternalClock (void)
 SCAN_0111_CustomInternalClock.
int ScanCustomExternalClock (void)
 SCAN_1000_CustomExternalClock.
int ScanSampleSetExternalClock (void)
 SCAN_1001_SampleSetExternalClock.
void Example_ScanManual (int channelNumber_0_15, int nWords, double *pd_mean, double *pd_variance, double *pd_stddev, double *pd_Sx, double *pd_Sxx)
 Example configure and perform some measurements in ScanManual mode.

Data Fields

Callback< void(size_t, uint8_t
*, uint8_t *) 
onSPIprint )
 Function pointer void f(size_t byteCount, uint8_t mosiData[], uint8_t misoData[])
int16_t ADC_MODE_CONTROL
 shadow of write-only register ADC_MODE_CONTROL mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0
int16_t ADC_CONFIGURATION
 shadow of write-only register ADC_CONFIGURATION mosiData16 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0
int16_t UNIPOLAR
 shadow of write-only register UNIPOLAR mosiData16 0x8800..0x8FFF format: 1 0 0 0 1 UCH0/1 UCH2/3 UCH4/5 UCH6/7 UCH8/9 UCH10/11 UCH12/13 UCH14/15 PDIFF_COM x x
int16_t BIPOLAR
 shadow of write-only register BIPOLAR mosiData16 0x9000..0x97FF format: 1 0 0 1 0 BCH0/1 BCH2/3 BCH4/5 BCH6/7 BCH8/9 BCH10/11 BCH12/13 BCH14/15 x x x
int16_t RANGE
 shadow of write-only register RANGE mosiData16 0x9800..0x9FFF format: 1 0 0 1 1 RANGE0/1 RANGE2/3 RANGE4/5 RANGE6/7 RANGE8/9 RANGE10/11 RANGE12/13 RANGE14/15 x x x
int16_t CSCAN0
 shadow of write-only register CSCAN0 mosiData16 0xA000..0xA7FF format: 1 0 1 0 0 CHSCAN15 CHSCAN14 CHSCAN13 CHSCAN12 CHSCAN11 CHSCAN10 CHSCAN9 CHSCAN8 x x x
int16_t CSCAN1
 shadow of write-only register CSCAN1 mosiData16 0xA800..0xAFFF format: 1 0 1 0 1 CHSCAN7 CHSCAN6 CHSCAN5 CHSCAN4 CHSCAN3 CHSCAN2 CHSCAN1 CHSCAN0 x x x
int16_t SAMPLESET
 shadow of write-only register SAMPLESET mosiData16 0xB000..0xB7FF format: 1 0 1 1 0 SEQ_LENGTH[7:0] x x x followed by enabledChannelsPattern.
uint8_t enabledChannelsPatternLength_1_256
 unpacked SAMPLESET.SEQ_LENGTH[7:0] determines length of pattern NOTE: SAMPLESET.SEQ_LENGTH[7:0] is the number of channel entries in the pattern.
uint8_t enabledChannelsPattern [256]
 unpacked shadow of write-only register SAMPLESET enabledChannelsPattern.
uint8_t SPI_MOSI_Semantic
 Diagnostic: what is the meaning of SPI Master Out data.
uint16_t NumWords
 number of ScanRead() words needed to retrieve all measurements.
uint8_t isExternalClock
 Is the currently configured mode external or internal clock. 1:External Clock 0:Internal Clock.
uint8_t ScanMode
 unpacked ADC_MODE_CONTROL.SCAN[3:0] Scan Mode MAX11131_SCAN_enum_t
uint8_t channelNumber_0_15
 unpacked ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select
uint8_t PowerManagement_0_2
 unpacked ADC_MODE_CONTROL.PM[1:0] Power Management MAX11131_PM_enum_t
uint8_t chan_id_0_1
 unpacked ADC_MODE_CONTROL.CHAN_ID
uint8_t average_0_4_8_16_32
 unpacked ADC_CONFIGURATION.AVG and ADC_CONFIGURATION.NAVG[1:0] may be 0, 4, 8, 16, or 32
uint8_t nscan_4_8_12_16
 unpacked ADC_CONFIGURATION.NSCAN[1:0] may be 4, 8, 12, or 16
uint8_t swcnv_0_1
 unpacked ADC_MODE_CONTROL.SWCNV
int16_t enabledChannelsMask
 unpacked CSCAN0 and CSCAN1
uint16_t AINcode [16]
 Each channel's most recent value in LSBs.
int16_t RAW_misoData16 [256]
 SPI master-in slave-out data.
double VRef
 reference voltage, in Volts

Detailed Description

MAX11131 3Msps, Low-Power, Serial SPI 12-Bit, 16-Channel, Differential/Single-Ended Input, SAR ADC.

Datasheet: https://www.maximintegrated.com/MAX11131

 // example code includes
 // standard include for target platform -- Platform_Include_Boilerplate
 #include "mbed.h"
 // Platforms:
 //   - MAX32625MBED
 //      - supports mbed-os-5.11, requires USBDevice library
 //      - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/
 //      - remove max32630fthr library (if present)
 //      - remove MAX32620FTHR library (if present)
 //   - MAX32600MBED
 //      - Please note the last supported version is Mbed OS 6.3.
 //      - remove max32630fthr library (if present)
 //      - remove MAX32620FTHR library (if present)
 //      - Windows 10 note:  Don't connect HDK until you are ready to load new firmware into the board.
 //   - NUCLEO_F446RE
 //      - remove USBDevice library
 //      - remove max32630fthr library (if present)
 //      - remove MAX32620FTHR library (if present)
 //   - NUCLEO_F401RE
 //      - remove USBDevice library
 //      - remove max32630fthr library (if present)
 //      - remove MAX32620FTHR library (if present)
 //   - MAX32630FTHR
 //      - #include "max32630fthr.h"
 //      - add http://developer.mbed.org/teams/MaximIntegrated/code/max32630fthr/
 //      - remove MAX32620FTHR library (if present)
 //   - MAX32620FTHR
 //      - #include "MAX32620FTHR.h"
 //      - remove max32630fthr library (if present)
 //      - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
 //      - not tested yet
 //   - MAX32625PICO
 //      - #include "max32625pico.h"
 //      - add https://os.mbed.com/users/switches/code/max32625pico/
 //      - remove max32630fthr library (if present)
 //      - remove MAX32620FTHR library (if present)
 //      - not tested yet
 //      - see https://os.mbed.com/users/switches/code/max32625pico/
 //      - see https://os.mbed.com/users/switches/code/PICO_board_demo/
 //      - see https://os.mbed.com/users/switches/code/PICO_USB_I2C_SPI/
 //      - see https://os.mbed.com/users/switches/code/SerialInterface/
 //      - Note: To load the MAX32625PICO firmware, hold the button while
 //        connecting the USB cable, then copy firmware bin file
 //        to the MAINTENANCE drive.
 //      - see https://os.mbed.com/platforms/MAX32625PICO/
 //      - see https://os.mbed.com/teams/MaximIntegrated/wiki/MAX32625PICO-Firmware-Updates
 //
 // end Platform_Include_Boilerplate
 #include "MAX11131.h"

 // example code board support
 //MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
 //DigitalOut rLED(LED1);
 //DigitalOut gLED(LED2);
 //DigitalOut bLED(LED3);
 //
 // Arduino "shield" connector port definitions (MAX32625MBED shown)
 #if defined(TARGET_MAX32625MBED)
 #define A0 AIN_0
 #define A1 AIN_1
 #define A2 AIN_2
 #define A3 AIN_3
 #define D0 P0_0
 #define D1 P0_1
 #define D2 P0_2
 #define D3 P0_3
 #define D4 P0_4
 #define D5 P0_5
 #define D6 P0_6
 #define D7 P0_7
 #define D8 P1_4
 #define D9 P1_5
 #define D10 P1_3
 #define D11 P1_1
 #define D12 P1_2
 #define D13 P1_0
 #elif defined(TARGET_MAX32625PICO)
 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
 #define A0 AIN_1
 #define A1 AIN_2
 // #define A2 AIN_3
 // #define A3 AIN_0
 #define D0 P0_0
 #define D1 P0_1
 #define D2 P0_2
 #define D3 P0_3
 #define D4 P1_7
 #define D5 P1_6
 #define D6 P4_4
 #define D7 P4_5
 #define D8 P4_6
 #define D9 P4_7
 #define D10 P0_7
 #define D11 P0_6
 #define D12 P0_5
 #define D13 P0_4
 #endif

 // example code declare SPI interface (GPIO controlled CS)
 #if defined(TARGET_MAX32625MBED)
 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
 #elif defined(TARGET_MAX32625PICO)
 #warning "TARGET_MAX32625PICO not previously tested; need to define pins..."
 SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625PICO: pin P0_5 P0_6 P0_4
 DigitalOut spi_cs(SPI0_SS); // TARGET_MAX32625PICO: pin P0_7
 #elif defined(TARGET_MAX32600MBED)
 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
 // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut
 // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel)
 //
 // TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses.
 SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_NUCLEO_F446RE: Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10
 //
 #else
 SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10
 #endif

 // example code declare GPIO interface pins
 DigitalOut CNVST_pin(D9); // Digital Trigger Input to MAX11131 device
 // AnalogOut REF_plus_pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX11131 device
 // AnalogOut REF_minus_slash_AIN15_pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX11131 device
 DigitalIn EOC_pin(D2); // Digital Event Output from MAX11131 device
 // example code declare device instance
 MAX11131 g_MAX11131_device(spi, spi_cs, CNVST_pin, EOC_pin, MAX11131::MAX11131_IC);

 //--------------------------------------------------
 // Declare the Serial driver
 // default baud rate settings are 9600 8N1
 // install device driver from http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
 // see docs https://docs.mbed.com/docs/mbed-os-handbook/en/5.5/getting_started/what_need/
 //--------------------------------------------------
 #if defined(TARGET_MAX32630)
     #include "USBSerial.h"
 // Hardware serial port over DAPLink
 // The default baud rate for the DapLink UART is 9600
 //Serial DAPLINKserial(P2_1, P2_0);     // tx, rx
 //    #define HAS_DAPLINK_SERIAL 1
 // Virtual serial port over USB
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
 //--------------------------------------------------
 #elif defined(TARGET_MAX32625MBED)
     #include "USBSerial.h"
 // Hardware serial port over DAPLink
 // The default baud rate for the DapLink UART is 9600
 //Serial DAPLINKserial(P2_1, P2_0);     // tx, rx
 //    #define HAS_DAPLINK_SERIAL 1
 // Virtual serial port over USB
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
 //--------------------------------------------------
 #elif defined(TARGET_MAX32600)
     #include "USBSerial.h"
 // Hardware serial port over DAPLink
 // The default baud rate for the DapLink UART is 9600
 Serial DAPLINKserial(P1_1, P1_0);     // tx, rx
     #define HAS_DAPLINK_SERIAL 1
 // Virtual serial port over USB
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
 //--------------------------------------------------
 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
 Serial serial(SERIAL_TX, SERIAL_RX);     // tx, rx
 //--------------------------------------------------
 #else
 #if defined(SERIAL_TX)
 #warning "target not previously tested; guess serial pins are SERIAL_TX, SERIAL_RX..."
 Serial serial(SERIAL_TX, SERIAL_RX);     // tx, rx
 #elif defined(USBTX)
 #warning "target not previously tested; guess serial pins are USBTX, USBRX..."
 Serial serial(USBTX, USBRX);     // tx, rx
 #elif defined(UART_TX)
 #warning "target not previously tested; guess serial pins are UART_TX, UART_RX..."
 Serial serial(UART_TX, UART_RX);     // tx, rx
 #else
 #warning "target not previously tested; need to define serial pins..."
 #endif
 #endif
 //
 #include "CmdLine.h"
 CmdLine cmdLine(serial, "serial");

 // example code main function
 int main()
 {
     // setup: put your setup code here, to run once

     g_MAX11131_device.Init();

     while (1)
     {
         // loop: put your main code here, to run repeatedly

         // banner for csv data columns
         while(1) { // this code repeats forever
             // this code repeats forever
             // Measure ADC channels in sequence from AIN0 to channelNumber_0_15.
             // @param[in] g_MAX11131_device.channelNumber_0_15: AIN Channel Number
             // @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
             // @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
             int channelId_0_15 = 15;
             g_MAX11131_device.channelNumber_0_15 = channelId_0_15;
             g_MAX11131_device.PowerManagement_0_2 = 0;
             g_MAX11131_device.chan_id_0_1 = 1;
             g_MAX11131_device.NumWords = g_MAX11131_device.ScanStandardExternalClock();

             // Read raw ADC codes from device into AINcode[] and RAW_misoData16[]
             // @pre one of the MAX11311_Scan functions was called, setting g_MAX11131_device.NumWords
             g_MAX11131_device.ReadAINcode();
             // @post RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
             // @post AINcode[NUM_CHANNELS] contains the latest readings in LSBs

             // wait(3.0);
             // Use Arduino Serial Plotter to view output: Tools | Serial Plotter
             cmdLine.serial().printf("%d", g_MAX11131_device.AINcode[0]);
             for (int index = 1; index <= channelId_0_15; index++) {
                 cmdLine.serial().printf(",%d", g_MAX11131_device.AINcode[index]);
             }
             cmdLine.serial().printf("\r\n");

         } // this code repeats forever
     }
 }

Definition at line 1287 of file MAX11131.h.


Member Typedef Documentation

ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved.

ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved.

ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)


Member Enumeration Documentation

IC's supported with this driver.

MAX11131

Definition at line 1324 of file MAX11131.h.

ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved.

Enumerator:
PM_00_Normal 

0b00

PM_01_AutoShutdown 

0b01

PM_10_AutoStandby 

0b10

Definition at line 1314 of file MAX11131.h.

ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved.

Enumerator:
RESET_00_Normal 

0b00

RESET_01_ResetFIFO 

0b01

RESET_10_ResetAllRegisters 

0b10

Definition at line 1306 of file MAX11131.h.

ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

Enumerator:
SCAN_0000_NOP 

0b0000

SCAN_0001_Manual 

0b0001

SCAN_0010_Repeat 

0b0010

SCAN_0011_StandardInternalClock 

0b0011

SCAN_0100_StandardExternalClock 

0b0100

SCAN_0101_UpperInternalClock 

0b0101

SCAN_0110_UpperExternalClock 

0b0110

SCAN_0111_CustomInternalClock 

0b0111

SCAN_1000_CustomExternalClock 

0b1000

SCAN_1001_SampleSetExternalClock 

0b1001

Definition at line 1291 of file MAX11131.h.


Constructor & Destructor Documentation

MAX11131 ( SPI &  spi,
DigitalOut &  cs_pin,
DigitalOut &  CNVST_pin,
DigitalIn &  EOC_pin,
MAX11131_ic_t  ic_variant 
)

Constructor for MAX11131 Class.

Requires an existing SPI object as well as a DigitalOut object. The DigitalOut object is used for a chip enable signal

On Entry:

Parameters:
[in]spi- pointer to existing SPI object
[in]cs_pin- pointer to a DigitalOut pin object
[in]CNVST_pin- pointer to a DigitalOut pin object
[in]EOC_pin- pointer to a DigitalIn pin object
[in]ic_variant- which type of MAX11131 is used

On Exit:

Returns:
None

Definition at line 93 of file MAX11131.cpp.


Member Function Documentation

void Example_ScanManual ( int  channelNumber_0_15,
int  nWords,
double *  pd_mean,
double *  pd_variance,
double *  pd_stddev,
double *  pd_Sx,
double *  pd_Sxx 
)

Example configure and perform some measurements in ScanManual mode.

Parameters:
[out]pd_mean= address for double mean (avearge)
[out]pd_variance= address for double variance (variance)
[out]pd_stddev= address for double stddev (standard deviation)
[out]pd_Sx= address for double Sx (sum of all X)
[out]pd_Sxx= address for double Sxx (sum of squares of each X)

Definition at line 3402 of file MAX11131.cpp.

int get_spi_dataMode (  ) const

get SPI mode

Definition at line 1377 of file MAX11131.h.

int get_spi_frequency (  ) const

get SPI SCLK frequency

Definition at line 1374 of file MAX11131.h.

void Init ( void   )

Menu item '!' Initialize device.

TODO1: #170 MAX11131 Self Test for Test Fixture Firmware test group ____ // Verify function ____ (enabled by default)

test group DACCodeOfVoltage // Verify function DACCodeOfVoltage (enabled by default) test group DACCodeOfVoltage tinyTester.blink_time_msec = 20 // quickly speed through the software verification test group DACCodeOfVoltage tinyTester.print("VRef = 2.500 MAX5171 14-bit LSB = 0.00015V") test group DACCodeOfVoltage VRef = 2.500 test group DACCodeOfVoltage tinyTester.err_threshold = 0.00015259720441921504 // 14-bit LSB (2.500/16383)

test group DACCodeOfVoltage DACCodeOfVoltage(2.499847412109375) expect 0x3FFF

test group CODE_LOAD // Verify function CODE_LOAD (enabled by default) test group CODE_LOAD tinyTester.blink_time_msec = 75 // default 75 resume hardware self test test group CODE_LOAD tinyTester.settle_time_msec = 250 test Init() test VRef expect 2.500 // Nominal Full-Scale Voltage Reference

tinyTester.err_threshold = 0.030; // 30mV test group CODE_LOAD tinyTester.err_threshold = 0.030 test group CODE_LOAD tinyTester.DigitalIn_Read_Expect_WarnOnly(UPO_pin, "UPO", 1, "UPO_pin is high after MAX5171 UPO_HIGH command") test group CODE_LOAD tinyTester.AnalogIn0_Read_Expect_voltageV(1.2500)

TODO1: #170 MAX11131 Self Test for Test Fixture Firmware test group ____ // Verify function ____ (enabled by default) test group ____ // Verify function ____ (enabled by default) MAX11131BOB self-test functions ~ SelfTest_FAIL(cmdLine); ~ cmdLine.serial().printf("test program not implemented yet"); int16_t value_u12; int channelId; double voltageV = 0.5;

cmdLine.serial().printf(" 0.0: MAX11131.Init()"); g_MAX11131_device.Init();

Device Testing: ADC commands, verify with on-board ADC and SPI framing

cmdLine.serial().printf(" MOSI <-- 1000_0000_0000_0000 ADC_CONFIGURATION REFSEL=0 SPM[1:0]=0 ECHO=0");

cmdLine.serial().printf( " MOSI <-- 0010_0111_1010_0100 ADC_MODE_CONTROL Scan_0100_StandardExt CHSEL=15 RESET=1 CHANID=1");

test SPIoutputCS(0) SPIread16bits() expect 0x0000 SPIread16bits() expect 0x0000 mask 0xF000 test SPIread16bits() expect 0x1000 mask 0xF000 test SPIread16bits() expect 0x2000 mask 0xF000 test SPIread16bits() expect 0x3000 mask 0xF000 test SPIread16bits() expect 0x4000 mask 0xF000 test SPIread16bits() expect 0x5000 mask 0xF000 test SPIread16bits() expect 0x6000 mask 0xF000 test SPIread16bits() expect 0x7000 mask 0xF000 test SPIread16bits() expect 0x8000 mask 0xF000 test SPIread16bits() expect 0x9000 mask 0xF000 test SPIread16bits() expect 0xA000 mask 0xF000 test SPIread16bits() expect 0xB000 mask 0xF000 test SPIread16bits() expect 0xC000 mask 0xF000 test SPIread16bits() expect 0xD000 mask 0xF000 test SPIread16bits() expect 0xE000 mask 0xF000 test SPIread16bits() expect 0xF000 mask 0xF000 test SPIoutputCS(1)

for (int channelIndex = 0; channelIndex < 16; channelIndex++) { ~ cmdLine.serial().printf(" MISO --> expect 0000_xxxx_xxxx_xxxx"); g_MAX11131_device.SPIoutputCS(0); // drive CS low g_MAX11131_device.RAW_misoData16[channelIndex] = g_MAX11131_device.SPIread16bits(); g_MAX11131_device.SPIoutputCS(1); // drive CS high int expect_channelId = channelIndex; int actual_channelId = (g_MAX11131_device.RAW_misoData16[channelIndex] >> 12) & 0x000F; if (actual_channelId != expect_channelId) { tinyTester.FAIL(); cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); cmdLine.serial().printf(" but got 0x%1.1xxxx", actual_channelId); } else { tinyTester.PASS(); cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); } } test tinyTester.print("NumWords=16") test NumWords=16 test tinyTester.print("ReadAINcode()") test ReadAINcode() test tinyTester.print("TODO: expect RAW_misoData16[0..15]>>12&0x000F == 0..15 channelId") test RAW_misoData16[0] expect 0x0000 mask 0xF000 test RAW_misoData16[1] expect 0x1000 mask 0xF000 test RAW_misoData16[2] expect 0x2000 mask 0xF000 test RAW_misoData16[3] expect 0x3000 mask 0xF000

MAX11131 SelfTest: MAX11131 Supports Internal Clock Modes (CNVST, EOC) cmdLine.serial().printf(" "); cmdLine.serial().printf( " 1.1: Test Scan_0011_StandardInt -- verify Internal Clock signals (CNVST, EOC)");

tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect tinyTester.DigitalIn_Read_Expect_WarnOnly(EOCb_pin, "EOC", 1, "initial value before sending commands");

Send MOSI data Expect MISO data Description 1000_0000_0000_0000 xxxx_xxxx_xxxx_xxxx ADC_CONFIGURATION REFSEL=0 SPM[1:0]=0 ECHO=0 No Averaging 0001_1001_1010_0000 xxxx_xxxx_xxxx_xxxx ADC_MODE_CONTROL Scan_0011_StandardInt CHSEL=3 RESET=1 SWCNV=0 0000_0000_0000_0000 0000_xxxx_xxxx_xxxx Channel ID tag = AIN0 expect high nybble 0 0000_0000_0000_0000 0001_xxxx_xxxx_xxxx Channel ID tag = AIN1 expect high nybble 1 0000_0000_0000_0000 0010_xxxx_xxxx_xxxx Channel ID tag = AIN2 expect high nybble 2 0000_0000_0000_0000 0011_xxxx_xxxx_xxxx Channel ID tag = AIN3 expect high nybble 3

cmdLine.serial().printf(" MOSI <-- 1000_0000_0000_0000 ADC_CONFIGURATION REFSEL=0 SPM[1:0]=0 ECHO=0");

cmdLine.serial().printf( " MOSI <-- 0001_1001_1010_0000 ADC_MODE_CONTROL Scan_0011_StandardInt CHSEL=3 RESET=1 SWCNV=0");

for (int channelIndex = 0; channelIndex < 4; channelIndex++) { ~ cmdLine.serial().printf(" MISO --> expect 0000_xxxx_xxxx_xxxx"); ~ wait_ms(200); // delay g_MAX11131_device.CNVSToutputPulseLow(); ~ g_MAX11131_device.CNVSToutputValue(0); ~ wait_ms(100); // delay ~ g_MAX11131_device.CNVSToutputValue(1); g_MAX11131_device.EOCinputWaitUntilLow(); // infinite wait hazard, need to fail if timeout exceeded tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect tinyTester.DigitalIn_Read_Expect_WarnOnly(EOCb_pin, "EOC", 0, "after CNVST pulse"); g_MAX11131_device.SPIoutputCS(0); // drive CS low g_MAX11131_device.RAW_misoData16[channelIndex] = g_MAX11131_device.SPIread16bits(); g_MAX11131_device.SPIoutputCS(1); // drive CS high tinyTester.DigitalIn_Read_Expect_WarnOnly replaces SelfTest_MAX11131_EOC_expect tinyTester.DigitalIn_Read_Expect_WarnOnly(EOCb_pin, "EOC", 1, "after SPI read"); int expect_channelId = channelIndex; int actual_channelId = (g_MAX11131_device.RAW_misoData16[channelIndex] >> 12) & 0x000F; if (actual_channelId != expect_channelId) { tinyTester.FAIL(); cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); cmdLine.serial().printf(" but got 0x%1.1xxxx", actual_channelId); } else { tinyTester.PASS(); cmdLine.serial().printf("MISO --> 0x%4.4x", (g_MAX11131_device.RAW_misoData16[channelIndex] & 0xFFFF)); cmdLine.serial().printf(" expect 0x%1.1xxxx (channel ID %d)", expect_channelId, expect_channelId); } }

MAX11131 SelfTest: Test Fixture: MAX541ACPA+ to MAX32625MBED.AIN0/AIN4 Test Fixture: MAX541 connected to spi2 SPI spi2_max541(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi2 TARGET_MAX32635MBED: P2_5 P2_6 P2_4 Arduino 2x3-pin header; microSD DigitalOut spi2_max541_cs(SPI2_SS); // TARGET_MAX32635MBED: P2_7 Arduino 2x3-pin header Test Fixture: MAX541 spi2 init cmdLine.serial().printf(" "); cmdLine.serial().printf(" 2.0: Test Fixture: MAX541 connected to spi2 (P2.4 P2.5 P2.7)?"); test tinyTester.print("_______") bool SelfTest_has_max541 = false; Check actual MAX541 reference voltage cmdLine.serial().printf(" Test Fixture: MAX541 midscale voltage measure with MAX32625MBED AIN0/4"); max541.Set_Code(0x8000); // we don't know the fullscale voltage yet, so set code to midscale tinyTester.Wait_Output_Settling(); // wait for MAX541 to settle

double max541_midscale_V = analogInPin_fullScaleVoltage[4] * analogIn4.read(); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V const int average_count = 100; const double average_K = 0.25; for (int count = 0; count < average_count; count++) { double measurement_V = analogInPin_fullScaleVoltage[4] * analogIn4.read(); // TARGET_MAX32630 J1.5 AIN_4 = AIN0 / 5.0 fullscale is 6.0V max541_midscale_V = ((1 - average_K) * max541_midscale_V) + (average_K * measurement_V); } if (max541_midscale_V > 1.0f) { max541.VRef = 2.0 * max541_midscale_V; cmdLine.serial().printf(" Test Fixture: MAX541 midscale = %1.3fV, so fullscale = %1.3fV", max541_midscale_V, max541.VRef); Detect whether MAX541 is really connected to MAX32625MBED.AIN0/AIN4 voltageV = 1.0f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { voltageV = 0.0f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { voltageV = 2.7f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { voltageV = 1.65f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { voltageV = 2.0f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { voltageV = 0.25f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { voltageV = 0.5f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541) { voltageV = 1.0f; SelfTest_has_max541 = SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } if (SelfTest_has_max541 == false) { don't fail just because we're missing the test fixture... cmdLine.serial().printf(" Test Fixture: MAX541 not present"); ~ g_SelfTest_nFail--; }

TODO1: MAX11131 SelfTest: if Test Fixture: drive MAX541, compare MAX32625MBED.AIN0/AIN4 and MAX11131 AIN0 indirectly verify the reference voltage by reading a known input voltage if (SelfTest_has_max541) { cmdLine.serial().printf(" "); cmdLine.serial().printf(" 2.1: TODO1: Check MAX11131 reference voltage using Scan_0001_Manual"); test tinyTester.print("_______") voltageV = 1.0f; SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); cmdLine.serial().printf(" MAX11131.Init()"); g_MAX11131_device.Init(); 1 ScanManual ch=0 pm=0 id=1 g_MAX11131_device.channelNumber_0_15 = 0; g_MAX11131_device.PowerManagement_0_2 = 0; g_MAX11131_device.chan_id_0_1 = 1; cmdLine.serial().printf(" MAX11131.channelNumber_0_15=%d", g_MAX11131_device.channelNumber_0_15); cmdLine.serial().printf(" MAX11131.PowerManagement_0_2=%d", g_MAX11131_device.PowerManagement_0_2); cmdLine.serial().printf(" MAX11131.chan_id_0_1=%d", g_MAX11131_device.chan_id_0_1); g_MAX11131_device.NumWords = g_MAX11131_device.ScanManual(); cmdLine.serial().printf(" MAX11131.ScanManual -- NumWords = %d", g_MAX11131_device.NumWords); g_MAX11131_device.NumWords = g_MAX11131_device.ScanManual(); g_MAX11131_device.ReadAINcode(); cmdLine.serial().printf(" MAX11131.ReadAINcode"); AINcode_print_value_externalClock(cmdLine, g_MAX11131_device.NumWords);

2.1: TODO1: Check MAX11131 reference voltage -- why we read 0xffff 2.4999V here?

cmdLine.serial().printf(" MAX11131.ScanManual -- NumWords = %d", g_MAX11131_device.NumWords); Read raw ADC codes from device into AINcode[] and RAW_misoData16[]

Precondition:
one of the MAX11311_Scan functions was called, setting g_MAX11131_device.NumWords g_MAX11131_device.ReadAINcode(); cmdLine.serial().printf(" MAX11131.ReadAINcode"); AINcode_print_value_externalClock(cmdLine, g_MAX11131_device.NumWords);

2.1: TODO1: Check MAX11131 reference voltage -- why we read 0xffff 2.4999V here?

compare with mbed/Arduino AIN0-AIN3 MAX32625MBED.AIN4 = MAX11131.AIN0 channelId = 0; value_u12 = g_MAX11131_device.AINcode[channelId]; voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId);

tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.100; tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV);

}

if (SelfTest_has_max541) { voltageV = 1.0f; SelfTest_MAX541_Voltage(cmdLine, max541, voltageV); } cmdLine.serial().printf(" "); cmdLine.serial().printf(" 3.1: Test Scan_0001_Manual"); test tinyTester.print("_______") cmdLine.serial().printf(" MAX11131.Init()"); g_MAX11131_device.Init(); 1 ScanManual ch=0 pm=0 id=1 g_MAX11131_device.channelNumber_0_15 = 0; g_MAX11131_device.PowerManagement_0_2 = 0; g_MAX11131_device.chan_id_0_1 = 1; cmdLine.serial().printf(" MAX11131.channelNumber_0_15=%d", g_MAX11131_device.channelNumber_0_15); test tinyTester.print("_______") cmdLine.serial().printf(" MAX11131.PowerManagement_0_2=%d", g_MAX11131_device.PowerManagement_0_2); test tinyTester.print("_______") cmdLine.serial().printf(" MAX11131.chan_id_0_1=%d", g_MAX11131_device.chan_id_0_1); test tinyTester.print("_______") g_MAX11131_device.NumWords = g_MAX11131_device.ScanManual(); cmdLine.serial().printf(" MAX11131.ScanManual -- NumWords = %d", g_MAX11131_device.NumWords); test tinyTester.print("_______") Read raw ADC codes from device into AINcode[] and RAW_misoData16[]

Precondition:
one of the MAX11311_Scan functions was called, setting g_MAX11131_device.NumWords g_MAX11131_device.ReadAINcode(); cmdLine.serial().printf(" MAX11131.ReadAINcode"); test tinyTester.print("_______") AINcode_print_value_externalClock(cmdLine, g_MAX11131_device.NumWords); compare with mbed/Arduino AIN0-AIN3 MAX32625MBED.AIN4 = MAX11131.AIN0 channelId = 0; value_u12 = g_MAX11131_device.AINcode[channelId]; voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId);

tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.100; tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV);

cmdLine.serial().printf(" "); cmdLine.serial().printf(" 3.4: Test Scan_0100_StandardExternalClock"); test tinyTester.print("_______") cmdLine.serial().printf(" MAX11131.Init()"); g_MAX11131_device.Init(); MAX11131 > 4 ScanStandardExternalClock ch=9 pm=0 id=1 ScanRead_nWords_chanID nWords=10 ch=0 xu=2964 = 0x0b94 = 1.8091V ch=1 xu=2227 = 0x08b3 = 1.3593V ch=2 xu=1570 = 0x0622 = 0.9583V ch=3 xu=865 = 0x0361 = 0.5280V ch=4 xu=630 = 0x0276 = 0.3845V ch=5 xu=594 = 0x0252 = 0.3625V ch=6 xu=461 = 0x01cd = 0.2814V ch=7 xu=364 = 0x016c = 0.2222V ch=8 xu=480 = 0x01e0 = 0.2930V ch=9 xu=616 = 0x0268 = 0.3760V g_MAX11131_device.channelNumber_0_15 = 9; g_MAX11131_device.PowerManagement_0_2 = 0; g_MAX11131_device.chan_id_0_1 = 1; cmdLine.serial().printf(" MAX11131.channelNumber_0_15=%d", g_MAX11131_device.channelNumber_0_15); test tinyTester.print("_______") cmdLine.serial().printf(" MAX11131.PowerManagement_0_2=%d", g_MAX11131_device.PowerManagement_0_2); test tinyTester.print("_______") cmdLine.serial().printf(" MAX11131.chan_id_0_1=%d", g_MAX11131_device.chan_id_0_1); test tinyTester.print("_______") g_MAX11131_device.NumWords = g_MAX11131_device.ScanStandardExternalClock(); cmdLine.serial().printf(" MAX11131.ScanStandardExternalClock -- NumWords = %d", g_MAX11131_device.NumWords); test tinyTester.print("_______") Read raw ADC codes from device into AINcode[] and RAW_misoData16[]

Precondition:
one of the MAX11311_Scan functions was called, setting g_MAX11131_device.NumWords g_MAX11131_device.ReadAINcode(); cmdLine.serial().printf(" MAX11131.ReadAINcode"); test tinyTester.print("_______")
Postcondition:
RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
AINcode[NUM_CHANNELS] contains the latest readings in LSBs expect g_MAX11131_device.NumWords == g_MAX11131_device.channelNumber_0_15 + 1; expect RAW_misoData16[index] msnybble 0,1,2,3,... AINcode_print_value_externalClock(cmdLine, g_MAX11131_device.NumWords); compare with mbed/Arduino AIN0-AIN3 MAX32625MBED.AIN4 = MAX11131.AIN0 channelId = 0; value_u12 = g_MAX11131_device.AINcode[channelId]; voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId); tinyTester.Wait_Output_Settling replaces wait_ms tinyTester.Wait_Output_Settling(); tinyTester.AnalogIn0_Read_Expect_voltageV replaces SelfTest_AnalogInput_Expect_ch_V tinyTester.err_threshold = 0.100; tinyTester.AnalogIn0_Read_Expect_voltageV(voltageV); compare MAX32625MBED.AIN5 = MAX11131.AIN1 channelId = 1; value_u12 = g_MAX11131_device.AINcode[channelId]; voltageV = g_MAX11131_device.VoltageOfCode(value_u12, channelId); SelfTest_AnalogInput_Expect_ch_V(cmdLine, 5, voltageV, 0.100);

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

< mosiData16 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0

< mosiData16 0x8800..0x8FFF format: 1 0 0 0 1 UCH0/1 UCH2/3 UCH4/5 UCH6/7 UCH8/9 UCH10/11 UCH12/13 UCH14/15 PDIFF_COM x x

< mosiData16 0x9000..0x97FF format: 1 0 0 1 0 BCH0/1 BCH2/3 BCH4/5 BCH6/7 BCH8/9 BCH10/11 BCH12/13 BCH14/15 x x x

< mosiData16 0x9800..0x9FFF format: 1 0 0 1 1 RANGE0/1 RANGE2/3 RANGE4/5 RANGE6/7 RANGE8/9 RANGE10/11 RANGE12/13 RANGE14/15 x x x

< mosiData16 0xA000..0xA7FF format: 1 0 1 0 0 CHSCAN15 CHSCAN14 CHSCAN13 CHSCAN12 CHSCAN11 CHSCAN10 CHSCAN9 CHSCAN8 x x x

< mosiData16 0xA800..0xAFFF format: 1 0 1 0 1 CHSCAN7 CHSCAN6 CHSCAN5 CHSCAN4 CHSCAN3 CHSCAN2 CHSCAN1 CHSCAN0 x x x

< mosiData16 0xB000..0xB7FF format: 1 0 1 1 0 SEQ_LENGTH[7:0] x x x

Definition at line 1100 of file MAX11131.cpp.

void ReadAINcode ( void   )

SCAN_0000_NOP.

Read raw ADC codes from device into AINcode[] and RAW_misoData16[]. If internal clock mode with SWCNV=0, measurements will be triggered using CNVST pin.

Precondition:
one of the Scan functions was called, setting g_MAX11131_device.NumWords
Parameters:
[in]g_MAX11131_device.NumWords,:number of words to be read from the FIFO
Postcondition:
g_MAX11131_device.RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
g_MAX11131_device.AINcode[NUM_CHANNELS] contains the latest readings in LSBs

Definition at line 2024 of file MAX11131.cpp.

void Reconfigure_DifferentialBipolarFS2Vref ( int  channel_0_15 )

Menu item 'IR' ADC Channels AIN(channelId), AIN(channelId+1) = Differential Bipolar Full Scale = 2 * VREF Voltage per LSB count = VREF/2048 AIN(channelId), AIN(channelId+1) are a Differential pair using Bipolar transfer function with range (+/-)Vref AIN(channelId) voltage must always be between 0 and VREF.

AIN(channelId+1) voltage must always be between 0 and VREF.

Definition at line 1960 of file MAX11131.cpp.

void Reconfigure_DifferentialBipolarFSVref ( int  channel_0_15 )

Menu item 'IB' ADC Channels AIN(channelId), AIN(channelId+1) = Differential Bipolar Full Scale = VREF Voltage per LSB count = VREF/4096 AIN(channelId), AIN(channelId+1) are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref AIN(channelId) voltage must always be between 0 and VREF.

AIN(channelId+1) voltage must always be between 0 and VREF.

Definition at line 1923 of file MAX11131.cpp.

void Reconfigure_DifferentialUnipolar ( int  channel_0_15 )

Menu item 'IU' ADC Channels AIN(channelId), AIN(channelId+1) = Differential Unipolar (AIN(channelId) > AIN(channelId+1)) Full Scale = VREF Voltage per LSB count = VREF/4096 AIN(channelId), AIN(channelId+1) are a Differential pair using Unipolar transfer function.

AIN(channelId) voltage must always be between 0 and VREF. AIN(channelId+1) voltage must always be between 0 and VREF.

Definition at line 1885 of file MAX11131.cpp.

void Reconfigure_SingleEnded ( int  channel_0_15 )

Menu item 'IS' ADC Channels AIN(channelId), AIN(channelId+1) = Both Single-Ended, Unipolar Full Scale = VREF Voltage per LSB count = VREF/4096 AIN(channelId) is a Single-Ended input using Unipolar transfer function.

AIN(channelId+1) is a Single-Ended input using Unipolar transfer function. If PDIFF_COM_1, both are Pseudo-Differential with REF- as common. AIN(channelId) voltage must always be between 0 and VREF. AIN(channelId+1) voltage must always be between 0 and VREF.

Definition at line 1848 of file MAX11131.cpp.

int ScanCustomExternalClock ( void   )

SCAN_1000_CustomExternalClock.

Measure selected ADC channels in sequence from AIN0 to AIN15, using only the channels enabled by enabledChannelsMask. Bit 0x0001 enables AIN0. Bit 0x0002 enables AIN1. Bit 0x0004 enables AIN2. Bit 0x0008 enables AIN3. Bit 0x0010 enables AIN4. Bit 0x0020 enables AIN5. Bit 0x0040 enables AIN6. Bit 0x0080 enables AIN7. Bit 0x0100 enables AIN8. Bit 0x0200 enables AIN9. Bit 0x0400 enables AIN10. Bit 0x0800 enables AIN11. Bit 0x1000 enables AIN12. Bit 0x2000 enables AIN13. Bit 0x4000 enables AIN14. Bit 0x8000 enables AIN15. External clock mode.

Parameters:
[in]g_MAX11131_device.enabledChannelsMask,:Bitmap of AIN Channels to scan.
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.chan_id_0_1,:ADC_MODE_CONTROL.CHAN_ID
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For external clock modes, the data format depends on CHAN_ID. when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

< mosiData16 0xA000..0xA7FF format: 1 0 1 0 0 CHSCAN15 CHSCAN14 CHSCAN13 CHSCAN12 CHSCAN11 CHSCAN10 CHSCAN9 CHSCAN8 x x x

< mosiData16 0xA800..0xAFFF format: 1 0 1 0 1 CHSCAN7 CHSCAN6 CHSCAN5 CHSCAN4 CHSCAN3 CHSCAN2 CHSCAN1 CHSCAN0 x x x

Definition at line 3134 of file MAX11131.cpp.

int ScanCustomInternalClock ( void   )

SCAN_0111_CustomInternalClock.

Measure selected ADC channels in sequence from AIN0 to AIN15, using only the channels enabled by enabledChannelsMask. Bit 0x0001 enables AIN0. Bit 0x0002 enables AIN1. Bit 0x0004 enables AIN2. Bit 0x0008 enables AIN3. Bit 0x0010 enables AIN4. Bit 0x0020 enables AIN5. Bit 0x0040 enables AIN6. Bit 0x0080 enables AIN7. Bit 0x0100 enables AIN8. Bit 0x0200 enables AIN9. Bit 0x0400 enables AIN10. Bit 0x0800 enables AIN11. Bit 0x1000 enables AIN12. Bit 0x2000 enables AIN13. Bit 0x4000 enables AIN14. Bit 0x8000 enables AIN15. Internal clock mode.

Parameters:
[in]g_MAX11131_device.enabledChannelsMask,:Bitmap of AIN Channels to scan.
[in]g_MAX11131_device.average_0_4_8_16_32,:Number of samples averaged per ScanRead() word. average_0_4_8_16_32=0 to disable averaging.
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.swcnv_0_1,:ADC_MODE_CONTROL.SWCNV SWCNV=0: trigger measurement by driving CNVST pin low. Minimum active-low pulse duration of 5ns. (AIN14 is not available) SWCNV=1: trigger measurement on SPI CS rising edge. CS must be held low for minimum of 17 SCLK cycles. CNVST pin is not used. (AIN14 is available)
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For internal clock modes, the data format always includes the channel address. misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

< mosiData16 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0

< mosiData16 0xA000..0xA7FF format: 1 0 1 0 0 CHSCAN15 CHSCAN14 CHSCAN13 CHSCAN12 CHSCAN11 CHSCAN10 CHSCAN9 CHSCAN8 x x x

< mosiData16 0xA800..0xAFFF format: 1 0 1 0 1 CHSCAN7 CHSCAN6 CHSCAN5 CHSCAN4 CHSCAN3 CHSCAN2 CHSCAN1 CHSCAN0 x x x

Definition at line 2938 of file MAX11131.cpp.

int ScanManual ( void   )

SCAN_0001_Manual.

Measure ADC channel channelNumber_0_15 once. External clock mode.

Parameters:
[in]g_MAX11131_device.channelNumber_0_15,:AIN Channel Number
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.chan_id_0_1,:ADC_MODE_CONTROL.CHAN_ID
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For external clock modes, the data format depends on CHAN_ID. when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

Definition at line 2194 of file MAX11131.cpp.

int16_t ScanRead ( void   )

SCAN_0000_NOP.

Shift 16 bits out of ADC, without changing configuration. Note:

Returns:
data format depends on CHAN_ID bit: "CH[3:0] DATA[11:0]" when CHAN_ID = 1, or "0 DATA[11:0] x x x" when CHAN_ID = 0.

Definition at line 1996 of file MAX11131.cpp.

int ScanRepeat ( void   )

SCAN_0010_Repeat.

Measure ADC channel channelNumber_0_15 repeatedly with averaging. Internal clock mode.

Parameters:
[in]g_MAX11131_device.channelNumber_0_15,:AIN Channel Number
[in]g_MAX11131_device.average_0_4_8_16_32,:Number of samples averaged per ScanRead() word. average_0_4_8_16_32=0 to disable averaging.
[in]g_MAX11131_device.nscan_4_8_12_16,:Number of ScanRead() words to report.
[in]g_MAX11131_device.swcnv_0_1,:ADC_MODE_CONTROL.SWCNV SWCNV=0: trigger measurement by driving CNVST pin low. Minimum active-low pulse duration of 5ns. (AIN14 is not available) SWCNV=1: trigger measurement on SPI CS rising edge. CS must be held low for minimum of 17 SCLK cycles. CNVST pin is not used. (AIN14 is available)
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For internal clock modes, the data format always includes the channel address. misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

< mosiData16 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0

Definition at line 2290 of file MAX11131.cpp.

int ScanSampleSetExternalClock ( void   )

SCAN_1001_SampleSetExternalClock.

Measure ADC channels in an arbitrary pattern. Channels can be visited in any order, with repetition allowed. External clock mode.

Precondition:
g_MAX11131_device.enabledChannelsPatternLength_1_256: number of channel selections
g_MAX11131_device.enabledChannelsPattern: array containing channel selection pattern In the array, one channel select per byte. In the SPI interface, immediately after SAMPLESET register is written, each byte encodes two channelNumber selections. The high 4 bits encode the first channelNumber. (((enabledChannelsPattern[0]) & 0x0F) << 4) | ((enabledChannelsPattern[1]) & 0x0F) If it is an odd number of channels, additional nybbles will be ignored. CS will be asserted low during the entire SAMPLESET pattern selection.
Parameters:
[in]g_MAX11131_device.enabledChannelsPattern,:array of channel select, one channel per byte
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.chan_id_0_1,:ADC_MODE_CONTROL.CHAN_ID
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For external clock modes, the data format depends on CHAN_ID. when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

< mosiData16 0xB000..0xB7FF format: 1 0 1 1 0 SEQ_LENGTH[7:0] x x x

Definition at line 3274 of file MAX11131.cpp.

int ScanStandardExternalClock ( void   )

SCAN_0100_StandardExternalClock.

Measure ADC channels in sequence from AIN0 to channelNumber_0_15. External clock mode.

Parameters:
[in]g_MAX11131_device.channelNumber_0_15,:AIN Channel Number
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.chan_id_0_1,:ADC_MODE_CONTROL.CHAN_ID
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For external clock modes, the data format depends on CHAN_ID. when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

Definition at line 2593 of file MAX11131.cpp.

int ScanStandardInternalClock ( void   )

SCAN_0011_StandardInternalClock.

Measure ADC channels in sequence from AIN0 to channelNumber_0_15. Internal clock mode.

Parameters:
[in]g_MAX11131_device.channelNumber_0_15,:AIN Channel Number
[in]g_MAX11131_device.average_0_4_8_16_32,:Number of samples averaged per ScanRead() word. average_0_4_8_16_32=0 to disable averaging.
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.swcnv_0_1,:ADC_MODE_CONTROL.SWCNV SWCNV=0: trigger measurement by driving CNVST pin low. Minimum active-low pulse duration of 5ns. (AIN14 is not available) SWCNV=1: trigger measurement on SPI CS rising edge. CS must be held low for minimum of 17 SCLK cycles. CNVST pin is not used. (AIN14 is available)
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For internal clock modes, the data format always includes the channel address. misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

< mosiData16 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0

Definition at line 2455 of file MAX11131.cpp.

int ScanUpperExternalClock ( void   )

SCAN_0110_UpperExternalClock.

Measure ADC channels in sequence from channelNumber_0_15 to AIN15. External clock mode.

Parameters:
[in]g_MAX11131_device.channelNumber_0_15,:AIN Channel Number
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.chan_id_0_1,:ADC_MODE_CONTROL.CHAN_ID
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For external clock modes, the data format depends on CHAN_ID. when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

Definition at line 2826 of file MAX11131.cpp.

int ScanUpperInternalClock ( void   )

SCAN_0101_UpperInternalClock.

Measure ADC channels in sequence from channelNumber_0_15 to AIN15. Internal clock mode.

Parameters:
[in]g_MAX11131_device.channelNumber_0_15,:AIN Channel Number
[in]g_MAX11131_device.average_0_4_8_16_32,:Number of samples averaged per ScanRead() word. average_0_4_8_16_32=0 to disable averaging.
[in]g_MAX11131_device.PowerManagement_0_2,:0=Normal, 1=AutoShutdown, 2=AutoStandby
[in]g_MAX11131_device.swcnv_0_1,:ADC_MODE_CONTROL.SWCNV SWCNV=0: trigger measurement by driving CNVST pin low. Minimum active-low pulse duration of 5ns. (AIN14 is not available) SWCNV=1: trigger measurement on SPI CS rising edge. CS must be held low for minimum of 17 SCLK cycles. CNVST pin is not used. (AIN14 is available)
Returns:
number of ScanRead() words needed to retrieve the data.
Postcondition:
NumWords = number of words to be read from the FIFO For internal clock modes, the data format always includes the channel address. misoData16 = CH[3:0] DATA[11:0]

< mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

< ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)

< ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select AIN0..AIN15

< ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved

< ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved

< ADC_MODE_CONTROL.CHAN_ID

< ADC_MODE_CONTROL.SWCNV

< mosiData16 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0

Definition at line 2688 of file MAX11131.cpp.

void spi_frequency ( int  spi_sclk_Hz )

set SPI SCLK frequency

Definition at line 155 of file MAX11131.cpp.

int32_t TwosComplementValue ( uint32_t  regValue )

Sign-Extend a right-aligned MAX11131 code into a signed 2's complement value.

Supports the bipolar transfer functions.

Parameters:
[in]value_u12,:raw 12-bit MAX11131 code (right justified).
Returns:
sign-extended 2's complement value.

Definition at line 2122 of file MAX11131.cpp.

double VoltageOfCode ( int16_t  value_u12,
int  channelId 
)

Return the physical voltage corresponding to MAX11131 code.

Does not perform any offset or gain correction.

Precondition:
g_MAX11131_device.VRef = Voltage of REF input, in Volts
Parameters:
[in]value_u12,:raw 12-bit MAX11131 code (right justified).
[in]channelId,:AIN channel number.
Returns:
physical voltage corresponding to MAX11131 code.

Definition at line 2145 of file MAX11131.cpp.


Field Documentation

shadow of write-only register ADC_CONFIGURATION mosiData16 0x8000..0x87FF format: 1 0 0 0 0 REFSEL AVGON NAVG[1:0] NSCAN[1:0] SPM[1:0] ECHO 0 0

Definition at line 1388 of file MAX11131.h.

shadow of write-only register ADC_MODE_CONTROL mosiData16 0x0000..0x7FFF format: 0 SCAN[3:0] CHSEL[3:0] RESET[1:0] PM[1:0] CHAN_ID SWCNV 0

Definition at line 1384 of file MAX11131.h.

uint16_t AINcode[16]

Each channel's most recent value in LSBs.

Updated by ReadAINcode function. Use VoltageOfCode function to convert LSBs to physical voltage.

Definition at line 1465 of file MAX11131.h.

unpacked ADC_CONFIGURATION.AVG and ADC_CONFIGURATION.NAVG[1:0] may be 0, 4, 8, 16, or 32

Definition at line 1451 of file MAX11131.h.

int16_t BIPOLAR

shadow of write-only register BIPOLAR mosiData16 0x9000..0x97FF format: 1 0 0 1 0 BCH0/1 BCH2/3 BCH4/5 BCH6/7 BCH8/9 BCH10/11 BCH12/13 BCH14/15 x x x

Definition at line 1396 of file MAX11131.h.

uint8_t chan_id_0_1

unpacked ADC_MODE_CONTROL.CHAN_ID

Definition at line 1448 of file MAX11131.h.

unpacked ADC_MODE_CONTROL.CHSEL[3:0] Analog Input Channel Select

Definition at line 1442 of file MAX11131.h.

int16_t CSCAN0

shadow of write-only register CSCAN0 mosiData16 0xA000..0xA7FF format: 1 0 1 0 0 CHSCAN15 CHSCAN14 CHSCAN13 CHSCAN12 CHSCAN11 CHSCAN10 CHSCAN9 CHSCAN8 x x x

Definition at line 1404 of file MAX11131.h.

int16_t CSCAN1

shadow of write-only register CSCAN1 mosiData16 0xA800..0xAFFF format: 1 0 1 0 1 CHSCAN7 CHSCAN6 CHSCAN5 CHSCAN4 CHSCAN3 CHSCAN2 CHSCAN1 CHSCAN0 x x x

Definition at line 1408 of file MAX11131.h.

unpacked CSCAN0 and CSCAN1

Definition at line 1460 of file MAX11131.h.

uint8_t enabledChannelsPattern[256]

unpacked shadow of write-only register SAMPLESET enabledChannelsPattern.

Array Length = enabledChannelsPatternLength_1_256. Each entry is a channel number between 0 and 15.

Definition at line 1426 of file MAX11131.h.

unpacked SAMPLESET.SEQ_LENGTH[7:0] determines length of pattern NOTE: SAMPLESET.SEQ_LENGTH[7:0] is the number of channel entries in the pattern.

NOTE: Each channel entry is 4 bits. The first 4 bits are the first channel in the sequence. NOTE: Channels can be repeated in any arbitrary order. NOTE: The channel entry pattern is sent immediately after writing SAMPLESET.

Definition at line 1421 of file MAX11131.h.

uint8_t isExternalClock

Is the currently configured mode external or internal clock. 1:External Clock 0:Internal Clock.

Definition at line 1436 of file MAX11131.h.

uint8_t nscan_4_8_12_16

unpacked ADC_CONFIGURATION.NSCAN[1:0] may be 4, 8, 12, or 16

Definition at line 1454 of file MAX11131.h.

uint16_t NumWords

number of ScanRead() words needed to retrieve all measurements.

Definition at line 1433 of file MAX11131.h.

Callback<void(size_t, uint8_t*, uint8_t*) onSPIprint)

Function pointer void f(size_t byteCount, uint8_t mosiData[], uint8_t misoData[])

optional onSPIprint SPI diagnostic function

Definition at line 1368 of file MAX11131.h.

unpacked ADC_MODE_CONTROL.PM[1:0] Power Management MAX11131_PM_enum_t

Definition at line 1445 of file MAX11131.h.

int16_t RANGE

shadow of write-only register RANGE mosiData16 0x9800..0x9FFF format: 1 0 0 1 1 RANGE0/1 RANGE2/3 RANGE4/5 RANGE6/7 RANGE8/9 RANGE10/11 RANGE12/13 RANGE14/15 x x x

Definition at line 1400 of file MAX11131.h.

int16_t RAW_misoData16[256]

SPI master-in slave-out data.

Updated by ReadAINcode function. SampleSet mode allows up to 256 channel entry selections.

Definition at line 1470 of file MAX11131.h.

int16_t SAMPLESET

shadow of write-only register SAMPLESET mosiData16 0xB000..0xB7FF format: 1 0 1 1 0 SEQ_LENGTH[7:0] x x x followed by enabledChannelsPattern.

NOTE: Send the sampleset pattern, with 4 entries packed into each 16-bit SPI word. Pad unused entries with 0. NOTE: Keep CS low during the entire enabledChannelsPattern entry.

Definition at line 1414 of file MAX11131.h.

uint8_t ScanMode

unpacked ADC_MODE_CONTROL.SCAN[3:0] Scan Mode MAX11131_SCAN_enum_t

Definition at line 1439 of file MAX11131.h.

Diagnostic: what is the meaning of SPI Master Out data.

0:Nothing 1:regWrite 2:sampleSetPattern

Definition at line 1430 of file MAX11131.h.

uint8_t swcnv_0_1

unpacked ADC_MODE_CONTROL.SWCNV

Definition at line 1457 of file MAX11131.h.

int16_t UNIPOLAR

shadow of write-only register UNIPOLAR mosiData16 0x8800..0x8FFF format: 1 0 0 0 1 UCH0/1 UCH2/3 UCH4/5 UCH6/7 UCH8/9 UCH10/11 UCH12/13 UCH14/15 PDIFF_COM x x

Definition at line 1392 of file MAX11131.h.

double VRef

reference voltage, in Volts

Definition at line 1473 of file MAX11131.h.