MAX11410 is a high speed, 24-bit Delta-Sigma ADC; small example program which can be changed by modifying the Hello_MAX11410.cpp source code and repeating the compile-build-upload cycle, providing straightforward code for easy adoption.
Dependencies: MAX11410 CmdLine USBDevice
Revision 13:03fa28c2b52b, committed 2020-10-27
- Comitter:
- whismanoid
- Date:
- Tue Oct 27 00:56:21 2020 +0000
- Parent:
- 12:2a87a8b42c9c
- Commit message:
- improve response time Measure_Voltage (for MAX11410 EMC testing)
Changed in this revision
Hello_MAX11410.cpp | Show annotated file Show diff for this revision Revisions of this file |
MAX11410.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2a87a8b42c9c -r 03fa28c2b52b Hello_MAX11410.cpp --- a/Hello_MAX11410.cpp Sun Jun 07 01:15:37 2020 +0000 +++ b/Hello_MAX11410.cpp Tue Oct 27 00:56:21 2020 +0000 @@ -64,9 +64,20 @@ // - 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 "MAX11410.h" @@ -97,12 +108,36 @@ #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 @@ -183,6 +218,8 @@ // example code main function int main() { + // setup: put your setup code here, to run once + // example code: serial port banner message wait(3); // 3000ms timing delay function, platform-specific cmdLine.serial().printf("\r\nHello_MAX11410\r\n"); @@ -223,10 +260,12 @@ while (1) { + // loop: put your main code here, to run repeatedly + // CODE GENERATOR: example code: has no member function REF // CODE GENERATOR: example code for ADC: repeat-forever convert and print conversion result, one record per line // CODE GENERATOR: ResolutionBits = 24 - // CODE GENERATOR: FScode = None + // CODE GENERATOR: FScode = 0xffffff // CODE GENERATOR: NumChannels = 10 // CODE GENERATOR: banner before helloCppCodeList while(1) cmdLine.serial().printf("v_filter = 0x%2.2x\r\n", g_MAX11410_device.v_filter); @@ -235,7 +274,10 @@ cmdLine.serial().printf("v_ctrl = 0x%2.2x\r\n", g_MAX11410_device.v_ctrl); - cmdLine.serial().printf("\"AIN0_LSB\",\"AIN1_LSB\",\"AIN2_LSB\",\"AIN3_LSB\",\"AIN4_LSB\",\"AIN5_LSB\",\"AIN6_LSB\",\"AIN7_LSB\",\"AIN8_LSB\",\"AIN9_LSB\"\r\n"); + // banner for csv data columns + cmdLine.serial().printf("\"AIN0_LSB\",\"AIN1_LSB\",\"AIN2_LSB\",\"AIN3_LSB\",\"AIN4_LSB\",\"AIN5_LSB\",\"AIN6_LSB\",\"AIN7_LSB\",\"AIN8_LSB\",\"AIN9_LSB\""); + + cmdLine.serial().printf("\r\n"); while(1) { // this code repeats forever // this code repeats forever
diff -r 2a87a8b42c9c -r 03fa28c2b52b MAX11410.lib --- a/MAX11410.lib Sun Jun 07 01:15:37 2020 +0000 +++ b/MAX11410.lib Tue Oct 27 00:56:21 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/MaximIntegrated/code/MAX11410/#1b72865fa71f +https://os.mbed.com/teams/MaximIntegrated/code/MAX11410/#f94470c95dde