Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester CmdLine MAX541 USBDevice
Revision 93:6b22269935a6, committed 2020-03-04
- Comitter:
- whismanoid
- Date:
- Wed Mar 04 10:03:12 2020 +0000
- Parent:
- 92:ce099f7cfd4b
- Commit message:
- ADCVoltageOfCode_16bit; fix typo Write_AGain 0x2000=1V/V not 1VV/V; onButton2FallingEdge call optional Configure_Demo(); blue LED on
Changed in this revision
diff -r ce099f7cfd4b -r 6b22269935a6 MAX11043/MAX11043.cpp --- a/MAX11043/MAX11043.cpp Mon Mar 02 23:00:51 2020 +0000 +++ b/MAX11043/MAX11043.cpp Wed Mar 04 10:03:12 2020 +0000 @@ -779,6 +779,106 @@ } //---------------------------------------- +// Return the physical voltage corresponding to conversion result +// (conversion format is Bipolar mode, 2's complement) +// Does not perform any offset or gain correction. +// +// @pre CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT is 0: 16-bit mode is configured +// @pre VRef = Voltage of REF input, in Volts +// @param[in] value_u24: raw 24-bit MAX11043 code (right justified). +// @return physical voltage corresponding to MAX11043 code. +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x7FFF) expect 2.500 within 0.030 Full Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x7FFF) expect 2.500 Full Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x6666) expect 2.000 Two Volts +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x6000) expect 1.875 75% Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x4000) expect 1.250 Mid Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x3333) expect 1.000 One Volt +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x2000) expect 0.625 25% Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x051e) expect 0.100 100mV +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.00000894069671 Three LSB +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.00000596046447 Two LSB +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.0000029802326 One LSB +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.0 Zero Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000029802326 Negative One LSB +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000059604644 Negative Two LSB +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000089406967 Negative Three LSB +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFAE1) expect -0.100 Negative 100mV +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xE000) expect -0.625 Negative 25% Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xCCCC) expect -1.000 Negative One Volt +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xC000) expect -1.250 Negative Mid Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0xA000) expect -1.875 Negative 75% Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x9999) expect -2.000 Negative Two Volts +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x8000) expect -2.500 Negative Full Scale +// @test group BIP2C16 ADCVoltageOfCode_16bit(0x8000) expect -2.500 Negative Full Scale +// +double MAX11043::ADCVoltageOfCode_16bit(uint32_t value_u16) +{ + + //---------------------------------------- + // Linear map min and max endpoints + double MaxScaleVoltage = 2 * VRef; // voltage of maximum code 0x7fff + double MinScaleVoltage = 0; // voltage of minimum code 0x8000 + const int32_t FULL_SCALE_CODE_16BIT_2S_COMPLEMENT = 0x7fff; + const int32_t SIGN_BIT_16BIT_2S_COMPLEMENT = 0x8000; + if (value_u16 >= SIGN_BIT_16BIT_2S_COMPLEMENT) { value_u16 = value_u16 - (2 * SIGN_BIT_16BIT_2S_COMPLEMENT); } + const int32_t MaxCode = FULL_SCALE_CODE_16BIT_2S_COMPLEMENT; + const int32_t CodeSpan = 0x10000; + const int32_t MinCode = 0; + double codeFraction = ((double)((int32_t)value_u16) - MinCode) / CodeSpan; + return (MinScaleVoltage + ((MaxScaleVoltage - MinScaleVoltage) * codeFraction)); // / pgaGain; +} + +//---------------------------------------- +// Return the physical voltage corresponding to conversion result +// (conversion format is Bipolar mode, 2's complement) +// Does not perform any offset or gain correction. +// +// @pre CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT is 1: 24-bit mode is configured +// @pre VRef = Voltage of REF input, in Volts +// @param[in] value_u24: raw 24-bit MAX11043 code (right justified). +// @return physical voltage corresponding to MAX11043 code. +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x7FFFFF) expect 2.500 within 0.030 Full Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x7FFFFE) expect 2.500 Full Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x666666) expect 2.000 Two Volts +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x600000) expect 1.875 75% Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x400000) expect 1.250 Mid Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x333333) expect 1.000 One Volt +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x200000) expect 0.625 25% Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x051eb8) expect 0.100 100mV +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000003) expect 0.00000894069671 Three LSB +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000002) expect 0.00000596046447 Two LSB +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000001) expect 0.0000029802326 One LSB +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000000) expect 0.0 Zero Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFF) expect -0.0000029802326 Negative One LSB +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFE) expect -0.0000059604644 Negative Two LSB +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFD) expect -0.0000089406967 Negative Three LSB +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFAE148) expect -0.100 Negative 100mV +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xE00000) expect -0.625 Negative 25% Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xCCCCCD) expect -1.000 Negative One Volt +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xC00000) expect -1.250 Negative Mid Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0xA00000) expect -1.875 Negative 75% Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x99999A) expect -2.000 Negative Two Volts +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x800001) expect -2.500 Negative Full Scale +// @test group BIP2C24 ADCVoltageOfCode_24bit(0x800000) expect -2.500 Negative Full Scale +// +double MAX11043::ADCVoltageOfCode_24bit(uint32_t value_u24) +{ + + //---------------------------------------- + // Linear map min and max endpoints + double MaxScaleVoltage = 2 * VRef; // voltage of maximum code 0x7fffff + double MinScaleVoltage = 0; // voltage of minimum code 0x800000 + const int32_t FULL_SCALE_CODE_24BIT_2S_COMPLEMENT = 0x7fffff; + const int32_t SIGN_BIT_24BIT_2S_COMPLEMENT = 0x800000; + if (value_u24 >= SIGN_BIT_24BIT_2S_COMPLEMENT) { value_u24 = value_u24 - (2 * SIGN_BIT_24BIT_2S_COMPLEMENT); } + const int32_t MaxCode = FULL_SCALE_CODE_24BIT_2S_COMPLEMENT; + const int32_t CodeSpan = 0x1000000; + const int32_t MinCode = 0; + double codeFraction = ((double)((int32_t)value_u24) - MinCode) / CodeSpan; + return (MinScaleVoltage + ((MaxScaleVoltage - MinScaleVoltage) * codeFraction)); // / pgaGain; +} + +//---------------------------------------- // Write a MAX11043 register. // // CMDOP_1aaa_aaaa_ReadRegister bit is cleared 0 indicating a write operation. @@ -946,10 +1046,10 @@ // @return 1 on success; 0 on failure uint8_t MAX11043::RegRead(MAX11043_CMD_enum_t commandByte, uint32_t* ptrRegData) { -#define SIGN_EXTEND_INT16_VALUE(x) (((x)&(0x8000))?((x)-65536):(x)) //---------------------------------------- // switch based on register address szie RegSize(regAddress) + #define SIGN_EXTEND_INT16_VALUE(x) (((x)&(0x8000))?((x)-65536):(x)) //commandByte = (MAX11043_CMD_enum_t)((commandByte &~ CMDOP_0aaa_aa10_ReadRegister) & 0xFF); switch(RegSize(commandByte)) { @@ -1554,7 +1654,7 @@ // Menu item 'GA' // Write AGain register // -// @param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000 +// @param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000 // // @return 1 on success; 0 on failure uint8_t MAX11043::Write_AGain(uint32_t gain)
diff -r ce099f7cfd4b -r 6b22269935a6 MAX11043/MAX11043.h --- a/MAX11043/MAX11043.h Mon Mar 02 23:00:51 2020 +0000 +++ b/MAX11043/MAX11043.h Wed Mar 04 10:03:12 2020 +0000 @@ -759,6 +759,76 @@ /// @return 1 on success; 0 on failure uint8_t Init(void); + //---------------------------------------- + /// Return the physical voltage corresponding to conversion result + /// (conversion format is Bipolar mode, 2's complement) + /// Does not perform any offset or gain correction. + /// + /// @pre CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT is 0: 16-bit mode is configured + /// @pre g_MAX11043_device.VRef = Voltage of REF input, in Volts + /// @param[in] value_u24: raw 24-bit MAX11043 code (right justified). + /// @return physical voltage corresponding to MAX11043 code. + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x7FFF) expect 2.500 within 0.030 Full Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x7FFF) expect 2.500 Full Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x6666) expect 2.000 Two Volts + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x6000) expect 1.875 75% Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x4000) expect 1.250 Mid Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x3333) expect 1.000 One Volt + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x2000) expect 0.625 25% Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x051e) expect 0.100 100mV + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.00000894069671 Three LSB + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.00000596046447 Two LSB + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.0000029802326 One LSB + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.0 Zero Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000029802326 Negative One LSB + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000059604644 Negative Two LSB + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000089406967 Negative Three LSB + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xFAE1) expect -0.100 Negative 100mV + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xE000) expect -0.625 Negative 25% Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xCCCC) expect -1.000 Negative One Volt + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xC000) expect -1.250 Negative Mid Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0xA000) expect -1.875 Negative 75% Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x9999) expect -2.000 Negative Two Volts + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x8000) expect -2.500 Negative Full Scale + /// @test group BIP2C16 ADCVoltageOfCode_16bit(0x8000) expect -2.500 Negative Full Scale + /// + double ADCVoltageOfCode_16bit(uint32_t value_u16); + + //---------------------------------------- + /// Return the physical voltage corresponding to conversion result + /// (conversion format is Bipolar mode, 2's complement) + /// Does not perform any offset or gain correction. + /// + /// @pre CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT is 1: 24-bit mode is configured + /// @pre g_MAX11043_device.VRef = Voltage of REF input, in Volts + /// @param[in] value_u24: raw 24-bit MAX11043 code (right justified). + /// @return physical voltage corresponding to MAX11043 code. + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x7FFFFF) expect 2.500 within 0.030 Full Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x7FFFFE) expect 2.500 Full Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x666666) expect 2.000 Two Volts + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x600000) expect 1.875 75% Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x400000) expect 1.250 Mid Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x333333) expect 1.000 One Volt + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x200000) expect 0.625 25% Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x051eb8) expect 0.100 100mV + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000003) expect 0.00000894069671 Three LSB + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000002) expect 0.00000596046447 Two LSB + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000001) expect 0.0000029802326 One LSB + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x000000) expect 0.0 Zero Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFF) expect -0.0000029802326 Negative One LSB + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFE) expect -0.0000059604644 Negative Two LSB + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFD) expect -0.0000089406967 Negative Three LSB + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xFAE148) expect -0.100 Negative 100mV + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xE00000) expect -0.625 Negative 25% Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xCCCCCD) expect -1.000 Negative One Volt + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xC00000) expect -1.250 Negative Mid Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0xA00000) expect -1.875 Negative 75% Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x99999A) expect -2.000 Negative Two Volts + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x800001) expect -2.500 Negative Full Scale + /// @test group BIP2C24 ADCVoltageOfCode_24bit(0x800000) expect -2.500 Negative Full Scale + /// + double ADCVoltageOfCode_24bit(uint32_t value_u24); + // CODE GENERATOR: looks like this is a register access function because 'regAdd' // CODE GENERATOR: looks like this is a 'write' register access function //---------------------------------------- @@ -881,7 +951,7 @@ /// Menu item 'GA' /// Write AGain register /// - /// @param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000 + /// @param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000 /// /// @return 1 on success; 0 on failure uint8_t Write_AGain(uint32_t gain);
diff -r ce099f7cfd4b -r 6b22269935a6 Test_Main_MAX11043.cpp --- a/Test_Main_MAX11043.cpp Mon Mar 02 23:00:51 2020 +0000 +++ b/Test_Main_MAX11043.cpp Wed Mar 04 10:03:12 2020 +0000 @@ -1834,6 +1834,22 @@ #endif //-------------------------------------------------- +// functions tested by SelfTest() +extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); +extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + +//-------------------------------------------------- +// optional self-test groups for function SelfTest() +// enable by changing the #define value from 0 to 1 +#ifndef MAX11043_SELFTEST_BIP2C16 +#define MAX11043_SELFTEST_BIP2C16 1 +#endif + +#ifndef MAX11043_SELFTEST_BIP2C24 +#define MAX11043_SELFTEST_BIP2C24 1 +#endif + +//-------------------------------------------------- // When user presses button BUTTON1, perform self test #if HAS_BUTTON1_DEMO_INTERRUPT void onButton1FallingEdge(void) @@ -1849,49 +1865,9 @@ void onButton2FallingEdge(void) { // TBD demo configuration -#if 1 + // CODE GENERATOR: example code: member function Configure_Demo g_MAX11043_device.Configure_Demo(); -#else - // MAX11043 Demo Configuration - //g_MAX11043_device.RegWrite(MAX11043_CMD_enum_t commandByte, uint32_t regData); - // - // *Config=0x6000 (POR default, slowest conversion rate 1:6 = 9us) - g_MAX11043_device.RegWrite(MAX11043::CMD_0010_0000_d16_Wr08_Configuration, 0x6000); - // - // *ConfigA=0x0018 (Bypass PGA and filters, Gain=1V/V) - g_MAX11043_device.RegWrite(MAX11043::CMD_0011_0000_d16_Wr0C_ConfigA, 0x0018); - // - // *AGain=0x1000 (0.5) (default is 0x2000=1.0) - g_MAX11043_device.RegWrite(MAX11043::CMD_0100_0100_d16_Wr11_AGain, 0x1000); - // - // *ConfigB=0x0018 (Bypass PGA and filters, Gain=1V/V) - g_MAX11043_device.RegWrite(MAX11043::CMD_0011_0100_d16_Wr0D_ConfigB, 0x0018); - // - // *BGain=0x1000 (0.5) (default is 0x2000=1.0) - g_MAX11043_device.RegWrite(MAX11043::CMD_0100_1000_d16_Wr12_BGain, 0x1000); - // - // *ConfigC=0x0018 (Bypass PGA and filters, Gain=1V/V) - g_MAX11043_device.RegWrite(MAX11043::CMD_0011_1000_d16_Wr0E_ConfigC, 0x0018); - // - // *CGain=0x1000 (0.5) (default is 0x2000=1.0) - g_MAX11043_device.RegWrite(MAX11043::CMD_0100_1100_d16_Wr13_CGain, 0x1000); - // - // *ConfigD=0x0018 (Bypass PGA and filters, Gain=1V/V) - g_MAX11043_device.RegWrite(MAX11043::CMD_0011_1100_d16_Wr0F_ConfigD, 0x0018); - // - // *DGain=0x1000 (0.5) (default is 0x2000=1.0) - g_MAX11043_device.RegWrite(MAX11043::CMD_0101_0000_d16_Wr14_DGain, 0x1000); - // - // *DacHDacL=0xFF00 - g_MAX11043_device.RegWrite(MAX11043::CMD_0010_1100_d16_Wr0B_DACHDACL, 0xFF00); - // - // *DacStep=0x0001 - g_MAX11043_device.RegWrite(MAX11043::CMD_0010_1000_d16_Wr0A_DACStep, 0x0001); - // - // *Dac=0x0ccc - g_MAX11043_device.RegWrite(MAX11043::CMD_0010_0100_d16_Wr09_DAC, 0x0ccc); - // -#endif + // TODO diagnostic LED led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON; // diagnostic rbg led BLUE } @@ -1925,6 +1901,330 @@ // CODE GENERATOR: generate SelfTest based on function docstrings @test lines + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x7FFF) expect 2.500 within 0.030 Full Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x7FFF), 2.500); // Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.err_threshold = 0.030; // within 0.030 + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x7FFF, 2.500); // Full Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x7FFF) expect 2.500 Full Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x7FFF), 2.500); // Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x7FFF, 2.500); // Full Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x6666) expect 2.000 Two Volts +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Two Volts + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x6666), 2.000); // Two Volts + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x6666, 2.000); // Two Volts +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x6000) expect 1.875 75% Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit 75% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x6000), 1.875); // 75% Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x6000, 1.875); // 75% Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x4000) expect 1.250 Mid Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Mid Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x4000), 1.250); // Mid Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x4000, 1.250); // Mid Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x3333) expect 1.000 One Volt +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit One Volt + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x3333), 1.000); // One Volt + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x3333, 1.000); // One Volt +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x2000) expect 0.625 25% Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit 25% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x2000), 0.625); // 25% Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x2000, 0.625); // 25% Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x051e) expect 0.100 100mV +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit 100mV + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x051e), 0.100); // 100mV + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x051e, 0.100); // 100mV +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.00000894069671 Three LSB +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Three LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x0000), 0.00000894069671); // Three LSB + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x0000, 0.00000894069671); // Three LSB +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.00000596046447 Two LSB +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Two LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x0000), 0.00000596046447); // Two LSB + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x0000, 0.00000596046447); // Two LSB +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.0000029802326 One LSB +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit One LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x0000), 0.0000029802326); // One LSB + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x0000, 0.0000029802326); // One LSB +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x0000) expect 0.0 Zero Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Zero Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x0000), 0.0); // Zero Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x0000, 0.0); // Zero Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000029802326 Negative One LSB +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative One LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xFFFF), -0.0000029802326); // Negative One LSB + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xFFFF, -0.0000029802326); // Negative One LSB +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000059604644 Negative Two LSB +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative Two LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xFFFF), -0.0000059604644); // Negative Two LSB + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xFFFF, -0.0000059604644); // Negative Two LSB +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xFFFF) expect -0.0000089406967 Negative Three LSB +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative Three LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xFFFF), -0.0000089406967); // Negative Three LSB + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xFFFF, -0.0000089406967); // Negative Three LSB +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xFAE1) expect -0.100 Negative 100mV +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative 100mV + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xFAE1), -0.100); // Negative 100mV + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xFAE1, -0.100); // Negative 100mV +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xE000) expect -0.625 Negative 25% Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative 25% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xE000), -0.625); // Negative 25% Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xE000, -0.625); // Negative 25% Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xCCCC) expect -1.000 Negative One Volt +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative One Volt + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xCCCC), -1.000); // Negative One Volt + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xCCCC, -1.000); // Negative One Volt +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xC000) expect -1.250 Negative Mid Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative Mid Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xC000), -1.250); // Negative Mid Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xC000, -1.250); // Negative Mid Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0xA000) expect -1.875 Negative 75% Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative 75% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0xA000), -1.875); // Negative 75% Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0xA000, -1.875); // Negative 75% Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x9999) expect -2.000 Negative Two Volts +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative Two Volts + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x9999), -2.000); // Negative Two Volts + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x9999, -2.000); // Negative Two Volts +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x8000) expect -2.500 Negative Full Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x8000), -2.500); // Negative Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x8000, -2.500); // Negative Full Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_16bit @test group BIP2C16 ADCVoltageOfCode_16bit(0x8000) expect -2.500 Negative Full Scale +#if MAX11043_SELFTEST_BIP2C16 // group BIP2C16 ADCVoltageOfCode_16bit Negative Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_16bit(0x8000), -2.500); // Negative Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_16bit", fn_MAX11043_ADCVoltageOfCode_16bit, 0x8000, -2.500); // Negative Full Scale +#endif // MAX11043_SELFTEST_BIP2C16 // group BIP2C16 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x7FFFFF) expect 2.500 within 0.030 Full Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x7FFFFF), 2.500); // Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.err_threshold = 0.030; // within 0.030 + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x7FFFFF, 2.500); // Full Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x7FFFFE) expect 2.500 Full Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x7FFFFE), 2.500); // Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x7FFFFE, 2.500); // Full Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x666666) expect 2.000 Two Volts +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Two Volts + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x666666), 2.000); // Two Volts + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x666666, 2.000); // Two Volts +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x600000) expect 1.875 75% Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit 75% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x600000), 1.875); // 75% Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x600000, 1.875); // 75% Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x400000) expect 1.250 Mid Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Mid Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x400000), 1.250); // Mid Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x400000, 1.250); // Mid Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x333333) expect 1.000 One Volt +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit One Volt + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x333333), 1.000); // One Volt + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x333333, 1.000); // One Volt +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x200000) expect 0.625 25% Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit 25% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x200000), 0.625); // 25% Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x200000, 0.625); // 25% Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x051eb8) expect 0.100 100mV +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit 100mV + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x051eb8), 0.100); // 100mV + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x051eb8, 0.100); // 100mV +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x000003) expect 0.00000894069671 Three LSB +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Three LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x000003), 0.00000894069671); // Three LSB + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x000003, 0.00000894069671); // Three LSB +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x000002) expect 0.00000596046447 Two LSB +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Two LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x000002), 0.00000596046447); // Two LSB + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x000002, 0.00000596046447); // Two LSB +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x000001) expect 0.0000029802326 One LSB +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit One LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x000001), 0.0000029802326); // One LSB + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x000001, 0.0000029802326); // One LSB +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x000000) expect 0.0 Zero Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Zero Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x000000), 0.0); // Zero Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x000000, 0.0); // Zero Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFF) expect -0.0000029802326 Negative One LSB +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative One LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xFFFFFF), -0.0000029802326); // Negative One LSB + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xFFFFFF, -0.0000029802326); // Negative One LSB +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFE) expect -0.0000059604644 Negative Two LSB +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative Two LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xFFFFFE), -0.0000059604644); // Negative Two LSB + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xFFFFFE, -0.0000059604644); // Negative Two LSB +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xFFFFFD) expect -0.0000089406967 Negative Three LSB +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative Three LSB + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xFFFFFD), -0.0000089406967); // Negative Three LSB + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xFFFFFD, -0.0000089406967); // Negative Three LSB +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xFAE148) expect -0.100 Negative 100mV +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative 100mV + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xFAE148), -0.100); // Negative 100mV + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xFAE148, -0.100); // Negative 100mV +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xE00000) expect -0.625 Negative 25% Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative 25% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xE00000), -0.625); // Negative 25% Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xE00000, -0.625); // Negative 25% Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xCCCCCD) expect -1.000 Negative One Volt +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative One Volt + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xCCCCCD), -1.000); // Negative One Volt + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xCCCCCD, -1.000); // Negative One Volt +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xC00000) expect -1.250 Negative Mid Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative Mid Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xC00000), -1.250); // Negative Mid Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xC00000, -1.250); // Negative Mid Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0xA00000) expect -1.875 Negative 75% Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative 75% Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0xA00000), -1.875); // Negative 75% Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0xA00000, -1.875); // Negative 75% Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x99999A) expect -2.000 Negative Two Volts +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative Two Volts + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x99999A), -2.000); // Negative Two Volts + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x99999A, -2.000); // Negative Two Volts +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x800001) expect -2.500 Negative Full Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x800001), -2.500); // Negative Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x800001, -2.500); // Negative Full Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + + // CODE GENERATOR: SelfTest ADCVoltageOfCode_24bit @test group BIP2C24 ADCVoltageOfCode_24bit(0x800000) expect -2.500 Negative Full Scale +#if MAX11043_SELFTEST_BIP2C24 // group BIP2C24 ADCVoltageOfCode_24bit Negative Full Scale + // ASSERT_EQ(g_MAX11043_device.ADCVoltageOfCode_24bit(0x800000), -2.500); // Negative Full Scale + extern double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24); + tinyTester.FunctionCall_Expect("MAX11043.ADCVoltageOfCode_24bit", fn_MAX11043_ADCVoltageOfCode_24bit, 0x800000, -2.500); // Negative Full Scale +#endif // MAX11043_SELFTEST_BIP2C24 // group BIP2C24 + // #if INJECT_SELFTEST_FAIL // Test of the pass/fail report mechanism @@ -1936,6 +2236,22 @@ tinyTester.Report_Summary(); } +//-------------------------------------------------- +// selftest: define function under test +// double MAX11043::ADCVoltageOfCode_16bit(uint32_t value_u16) +double fn_MAX11043_ADCVoltageOfCode_16bit(uint32_t value_u16) +{ + return g_MAX11043_device.ADCVoltageOfCode_16bit(value_u16); +} + +//-------------------------------------------------- +// selftest: define function under test +// double MAX11043::ADCVoltageOfCode_24bit(uint32_t value_u24) +double fn_MAX11043_ADCVoltageOfCode_24bit(uint32_t value_u24) +{ + return g_MAX11043_device.ADCVoltageOfCode_24bit(value_u24); +} + //-------------------------------------------------- inline void print_command_prompt()
diff -r ce099f7cfd4b -r 6b22269935a6 Test_Menu_MAX11043.cpp --- a/Test_Menu_MAX11043.cpp Mon Mar 02 23:00:51 2020 +0000 +++ b/Test_Menu_MAX11043.cpp Wed Mar 04 10:03:12 2020 +0000 @@ -386,7 +386,7 @@ // CODE GENERATOR: CommandParamIn 'uint32_t gain' // CODE GENERATOR: CommandReturnType 'uint8_t' // CODE GENERATOR: CommandPre '' -// CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' +// CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000' // CODE GENERATOR: CommandDocParamOut '' // CODE GENERATOR: CommandPost '' // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' @@ -803,6 +803,7 @@ (adcd_MAX_SEEN & 0xFFFF), (adcd_MAX_SEEN ) ); + cmdLine.serial().printf("\r\n"); } if (ch == 'D' || ch == 'd' || ch == 'F' || ch == 'f' || ch == 'R' || ch == 'r') { continue; @@ -810,11 +811,11 @@ if (ch == 'X' || ch == 'x' || ch == '\x03') { break; } - cmdLine.serial().printf(" (ignored \\x%2.2x) ", (int)ch); + cmdLine.serial().printf(" (ignored \\x%2.2x)\r\nD:Display F:Fake R:Reset X:Exit\r\n", (int)ch); } // Stop the test Read4Command_Thread_event_flags.clear(MYTIMEREVENTFLAG_ENABLE_SPI); - wait_us(100); + wait_us(200); //~ cmdLine.serial().set_blocking(serial_is_blocking); cmdLine.serial().printf(" Stopped.\r\n"); g_MAX11043_device.onSPIprint = saved_onSPIprint_handler; @@ -1172,7 +1173,7 @@ // CODE GENERATOR: CommandParamIn 'uint32_t gain' // CODE GENERATOR: CommandReturnType 'uint8_t' // CODE GENERATOR: CommandPre '' -// CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' +// CODE GENERATOR: CommandDocParamIn '@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000' // CODE GENERATOR: CommandDocParamOut '' // CODE GENERATOR: CommandPost '' // CODE GENERATOR: CommandReturn '@return 1 on success; 0 on failure' @@ -1186,13 +1187,13 @@ // CommandParamIn='uint32_t gain' // CommandReturnType='uint8_t' // @Pre='' - // @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' + // @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000' // @Param[out]='' // @Post='' // displayPost='' // @Return='@return 1 on success; 0 on failure' // parse argument list - // argname default_argvalue numeric literal specified in CommandDocParamIn @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1VV/V, 0x4000=2V/V, default=0x2000' + // argname default_argvalue numeric literal specified in CommandDocParamIn @Param[in]='@param[in] gain 2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000' // parse argument uint32_t gain uint32_t gain = (uint32_t)0x2000; // --- g_MAX11043_device.__WARNING_no_match_for_argname_gain_in_MAX11043_device_t__; // default to global property value if (cmdLine.parse_uint32_dec("gain", gain))