MAX11410 high speed 24-bit Delta-Sigma ADC
Dependents: MAX11410BOB_24bit_ADC MAX11410BOB_Serial_Tester
Diff: MAX11410.cpp
- Revision:
- 14:b49eecf7e4d8
- Parent:
- 13:df96a784cda6
- Child:
- 15:d5781c8fc002
--- a/MAX11410.cpp Thu Feb 20 10:45:05 2020 +0000 +++ b/MAX11410.cpp Tue Mar 10 01:56:56 2020 -0700 @@ -473,6 +473,8 @@ // @pre VRef = Voltage of REF input, in Volts // @param[in] value_u24: raw 24-bit MAX11410 code (right justified). // @return physical voltage corresponding to MAX11410 code. +// +// @test Configure_CTRL_REF(2) expect 1 These tests require REF2 = 2.500V // @test group UNIPOLAR VoltageOfCode_Unipolar(0xFFFFFF) expect 2.500 within 0.030 Full Scale // @test group UNIPOLAR VoltageOfCode_Unipolar(0xFFFFFE) expect 2.500 Full Scale // @test group UNIPOLAR VoltageOfCode_Unipolar(0xCCCCCC) expect 2.000 Two Volts @@ -525,6 +527,8 @@ // @pre VRef = Voltage of REF input, in Volts // @param[in] value_u24: raw 24-bit MAX11410 code (right justified). // @return physical voltage corresponding to MAX11410 code. +// +// @test Configure_CTRL_REF(2) expect 1 These tests require REF2 = 2.500V // @test group BIPOB VoltageOfCode_Bipolar_OffsetBinary(0xFFFFFF) expect 2.5 within 0.030 Full Scale // @test group BIPOB VoltageOfCode_Bipolar_OffsetBinary(0xFFFFFE) expect 2.5 Full Scale // @test group BIPOB VoltageOfCode_Bipolar_OffsetBinary(0xC00000) expect 1.25 Mid Scale @@ -577,6 +581,8 @@ // @pre VRef = Voltage of REF input, in Volts // @param[in] value_u24: raw 24-bit MAX11410 code (right justified). // @return physical voltage corresponding to MAX11410 code. +// +// @test Configure_CTRL_REF(2) expect 1 These tests require REF2 = 2.500V // @test group BIP2C VoltageOfCode_Bipolar_2sComplement(0x7FFFFF) expect 2.500 within 0.030 Full Scale // @test group BIP2C VoltageOfCode_Bipolar_2sComplement(0x7FFFFE) expect 2.500 Full Scale // @test group BIP2C VoltageOfCode_Bipolar_2sComplement(0x666666) expect 2.000 Two Volts @@ -1228,6 +1234,32 @@ } //---------------------------------------- +// Menu item 'XR' +// +// CTRL select reference, without changing the other fields. +// +// @pre ctrl = shadow of CTRL register +// @param[in] ref_sel = reference selection, default=MAX11410::REF_SEL_enum_t::REF_SEL_001_REF1P_REF1N +// +// @return 1 on success; 0 on failure +uint8_t MAX11410::Configure_CTRL_REF(uint8_t ref_sel) +{ + + //---------------------------------------- + // shadow of register CMD_r000_1001_dddd_dddd_CTRL + ctrl = (ctrl & ((~ 7) << 0)) + | (((uint8_t)ref_sel & 7) << 0); + + //---------------------------------------- + // write8 0x09 CTRL + RegWrite(CMD_r000_1001_dddd_dddd_CTRL, ctrl); + + //---------------------------------------- + // success + return 1; +} + +//---------------------------------------- // Menu item 'XS' // // SOURCE Configure voltage bias source, current source, burnout mode