Example host software for the Maxim Integrated MAX5171 14-bit Force/Sense DAC. Hosted on the MAX32625MBED.
Dependencies: MAX5171
Hello_MAX5171.cpp@5:965408a612dd, 2020-05-15 (annotated)
- Committer:
- whismanoid
- Date:
- Fri May 15 08:25:05 2020 +0000
- Revision:
- 5:965408a612dd
- Parent:
- 4:c6e15fe3ea9d
Step through several test points in sequence
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
whismanoid | 5:965408a612dd | 1 | // /******************************************************************************* |
whismanoid | 4:c6e15fe3ea9d | 2 | // * Copyright (C) 2020 Maxim Integrated Products, Inc., All Rights Reserved. |
whismanoid | 4:c6e15fe3ea9d | 3 | // * |
whismanoid | 4:c6e15fe3ea9d | 4 | // * Permission is hereby granted, free of charge, to any person obtaining a |
whismanoid | 4:c6e15fe3ea9d | 5 | // * copy of this software and associated documentation files (the "Software"), |
whismanoid | 4:c6e15fe3ea9d | 6 | // * to deal in the Software without restriction, including without limitation |
whismanoid | 4:c6e15fe3ea9d | 7 | // * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
whismanoid | 4:c6e15fe3ea9d | 8 | // * and/or sell copies of the Software, and to permit persons to whom the |
whismanoid | 4:c6e15fe3ea9d | 9 | // * Software is furnished to do so, subject to the following conditions: |
whismanoid | 4:c6e15fe3ea9d | 10 | // * |
whismanoid | 4:c6e15fe3ea9d | 11 | // * The above copyright notice and this permission notice shall be included |
whismanoid | 4:c6e15fe3ea9d | 12 | // * in all copies or substantial portions of the Software. |
whismanoid | 4:c6e15fe3ea9d | 13 | // * |
whismanoid | 4:c6e15fe3ea9d | 14 | // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
whismanoid | 4:c6e15fe3ea9d | 15 | // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
whismanoid | 4:c6e15fe3ea9d | 16 | // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
whismanoid | 4:c6e15fe3ea9d | 17 | // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
whismanoid | 4:c6e15fe3ea9d | 18 | // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
whismanoid | 4:c6e15fe3ea9d | 19 | // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
whismanoid | 4:c6e15fe3ea9d | 20 | // * OTHER DEALINGS IN THE SOFTWARE. |
whismanoid | 4:c6e15fe3ea9d | 21 | // * |
whismanoid | 4:c6e15fe3ea9d | 22 | // * Except as contained in this notice, the name of Maxim Integrated |
whismanoid | 4:c6e15fe3ea9d | 23 | // * Products, Inc. shall not be used except as stated in the Maxim Integrated |
whismanoid | 4:c6e15fe3ea9d | 24 | // * Products, Inc. Branding Policy. |
whismanoid | 4:c6e15fe3ea9d | 25 | // * |
whismanoid | 4:c6e15fe3ea9d | 26 | // * The mere transfer of this software does not imply any licenses |
whismanoid | 4:c6e15fe3ea9d | 27 | // * of trade secrets, proprietary technology, copyrights, patents, |
whismanoid | 4:c6e15fe3ea9d | 28 | // * trademarks, maskwork rights, or any other form of intellectual |
whismanoid | 4:c6e15fe3ea9d | 29 | // * property whatsoever. Maxim Integrated Products, Inc. retains all |
whismanoid | 4:c6e15fe3ea9d | 30 | // * ownership rights. |
whismanoid | 4:c6e15fe3ea9d | 31 | // ******************************************************************************* |
whismanoid | 4:c6e15fe3ea9d | 32 | // */ |
whismanoid | 4:c6e15fe3ea9d | 33 | // example code includes |
whismanoid | 4:c6e15fe3ea9d | 34 | // standard include for target platform -- Platform_Include_Boilerplate |
whismanoid | 4:c6e15fe3ea9d | 35 | #include "mbed.h" |
whismanoid | 4:c6e15fe3ea9d | 36 | // Platforms: |
whismanoid | 4:c6e15fe3ea9d | 37 | // - MAX32625MBED |
whismanoid | 4:c6e15fe3ea9d | 38 | // - supports mbed-os-5.11, requires USBDevice library |
whismanoid | 4:c6e15fe3ea9d | 39 | // - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/ |
whismanoid | 4:c6e15fe3ea9d | 40 | // - remove max32630fthr library (if present) |
whismanoid | 4:c6e15fe3ea9d | 41 | // - remove MAX32620FTHR library (if present) |
whismanoid | 4:c6e15fe3ea9d | 42 | // - MAX32600MBED |
whismanoid | 4:c6e15fe3ea9d | 43 | // - remove max32630fthr library (if present) |
whismanoid | 4:c6e15fe3ea9d | 44 | // - remove MAX32620FTHR library (if present) |
whismanoid | 4:c6e15fe3ea9d | 45 | // - Windows 10 note: Don't connect HDK until you are ready to load new firmware into the board. |
whismanoid | 4:c6e15fe3ea9d | 46 | // - NUCLEO_F446RE |
whismanoid | 4:c6e15fe3ea9d | 47 | // - remove USBDevice library |
whismanoid | 4:c6e15fe3ea9d | 48 | // - remove max32630fthr library (if present) |
whismanoid | 4:c6e15fe3ea9d | 49 | // - remove MAX32620FTHR library (if present) |
whismanoid | 4:c6e15fe3ea9d | 50 | // - NUCLEO_F401RE |
whismanoid | 4:c6e15fe3ea9d | 51 | // - remove USBDevice library |
whismanoid | 4:c6e15fe3ea9d | 52 | // - remove max32630fthr library (if present) |
whismanoid | 4:c6e15fe3ea9d | 53 | // - remove MAX32620FTHR library (if present) |
whismanoid | 4:c6e15fe3ea9d | 54 | // - MAX32630FTHR |
whismanoid | 4:c6e15fe3ea9d | 55 | // - #include "max32630fthr.h" |
whismanoid | 4:c6e15fe3ea9d | 56 | // - add http://os.mbed.org/teams/MaximIntegrated/code/max32630fthr/ |
whismanoid | 4:c6e15fe3ea9d | 57 | // - remove MAX32620FTHR library (if present) |
whismanoid | 4:c6e15fe3ea9d | 58 | // - MAX32620FTHR |
whismanoid | 4:c6e15fe3ea9d | 59 | // - #include "MAX32620FTHR.h" |
whismanoid | 4:c6e15fe3ea9d | 60 | // - remove max32630fthr library (if present) |
whismanoid | 4:c6e15fe3ea9d | 61 | // - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/ |
whismanoid | 4:c6e15fe3ea9d | 62 | // - not tested yet |
whismanoid | 4:c6e15fe3ea9d | 63 | // - MAX32625PICO |
whismanoid | 4:c6e15fe3ea9d | 64 | // - remove max32630fthr library (if present) |
whismanoid | 4:c6e15fe3ea9d | 65 | // - remove MAX32620FTHR library (if present) |
whismanoid | 4:c6e15fe3ea9d | 66 | // - not tested yet |
whismanoid | 4:c6e15fe3ea9d | 67 | // |
whismanoid | 4:c6e15fe3ea9d | 68 | // end Platform_Include_Boilerplate |
whismanoid | 4:c6e15fe3ea9d | 69 | #include "MAX5171.h" |
whismanoid | 4:c6e15fe3ea9d | 70 | |
whismanoid | 4:c6e15fe3ea9d | 71 | // example code board support |
whismanoid | 4:c6e15fe3ea9d | 72 | //MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
whismanoid | 4:c6e15fe3ea9d | 73 | //DigitalOut rLED(LED1); |
whismanoid | 4:c6e15fe3ea9d | 74 | //DigitalOut gLED(LED2); |
whismanoid | 4:c6e15fe3ea9d | 75 | //DigitalOut bLED(LED3); |
whismanoid | 4:c6e15fe3ea9d | 76 | // |
whismanoid | 4:c6e15fe3ea9d | 77 | // Arduino "shield" connector port definitions (MAX32625MBED shown) |
whismanoid | 4:c6e15fe3ea9d | 78 | #if defined(TARGET_MAX32625MBED) |
whismanoid | 4:c6e15fe3ea9d | 79 | #define A0 AIN_0 |
whismanoid | 4:c6e15fe3ea9d | 80 | #define A1 AIN_1 |
whismanoid | 4:c6e15fe3ea9d | 81 | #define A2 AIN_2 |
whismanoid | 4:c6e15fe3ea9d | 82 | #define A3 AIN_3 |
whismanoid | 4:c6e15fe3ea9d | 83 | #define D0 P0_0 |
whismanoid | 4:c6e15fe3ea9d | 84 | #define D1 P0_1 |
whismanoid | 4:c6e15fe3ea9d | 85 | #define D2 P0_2 |
whismanoid | 4:c6e15fe3ea9d | 86 | #define D3 P0_3 |
whismanoid | 4:c6e15fe3ea9d | 87 | #define D4 P0_4 |
whismanoid | 4:c6e15fe3ea9d | 88 | #define D5 P0_5 |
whismanoid | 4:c6e15fe3ea9d | 89 | #define D6 P0_6 |
whismanoid | 4:c6e15fe3ea9d | 90 | #define D7 P0_7 |
whismanoid | 4:c6e15fe3ea9d | 91 | #define D8 P1_4 |
whismanoid | 4:c6e15fe3ea9d | 92 | #define D9 P1_5 |
whismanoid | 4:c6e15fe3ea9d | 93 | #define D10 P1_3 |
whismanoid | 4:c6e15fe3ea9d | 94 | #define D11 P1_1 |
whismanoid | 4:c6e15fe3ea9d | 95 | #define D12 P1_2 |
whismanoid | 4:c6e15fe3ea9d | 96 | #define D13 P1_0 |
whismanoid | 4:c6e15fe3ea9d | 97 | #endif |
whismanoid | 4:c6e15fe3ea9d | 98 | |
whismanoid | 4:c6e15fe3ea9d | 99 | // example code declare SPI interface (GPIO controlled CS) |
whismanoid | 4:c6e15fe3ea9d | 100 | #if defined(TARGET_MAX32625MBED) |
whismanoid | 4:c6e15fe3ea9d | 101 | 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 |
whismanoid | 4:c6e15fe3ea9d | 102 | DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10 |
whismanoid | 4:c6e15fe3ea9d | 103 | #elif defined(TARGET_MAX32600MBED) |
whismanoid | 4:c6e15fe3ea9d | 104 | SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13 |
whismanoid | 4:c6e15fe3ea9d | 105 | DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10 |
whismanoid | 4:c6e15fe3ea9d | 106 | #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE) |
whismanoid | 4:c6e15fe3ea9d | 107 | // TODO1: avoid resource conflict between P5_0, P5_1, P5_2 SPI and DigitalInOut |
whismanoid | 4:c6e15fe3ea9d | 108 | // void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) |
whismanoid | 4:c6e15fe3ea9d | 109 | // |
whismanoid | 4:c6e15fe3ea9d | 110 | // TODO1: NUCLEO_F446RE SPI not working; CS and MOSI data looks OK but no SCLK clock pulses. |
whismanoid | 4:c6e15fe3ea9d | 111 | SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); // mosi, miso, sclk spi1 TARGET_NUCLEO_F446RE: Arduino 10-pin header D11 D12 D13 |
whismanoid | 4:c6e15fe3ea9d | 112 | DigitalOut spi_cs(SPI_CS); // TARGET_NUCLEO_F446RE: PB_6 Arduino 10-pin header D10 |
whismanoid | 4:c6e15fe3ea9d | 113 | // |
whismanoid | 4:c6e15fe3ea9d | 114 | #else |
whismanoid | 4:c6e15fe3ea9d | 115 | SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13 |
whismanoid | 4:c6e15fe3ea9d | 116 | DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10 |
whismanoid | 4:c6e15fe3ea9d | 117 | #endif |
whismanoid | 4:c6e15fe3ea9d | 118 | |
whismanoid | 4:c6e15fe3ea9d | 119 | // example code declare GPIO interface pins |
whismanoid | 4:c6e15fe3ea9d | 120 | // AnalogOut FB_pin(Px_x_PortName_To_Be_Determined); // Analog Input to MAX5171 device |
whismanoid | 4:c6e15fe3ea9d | 121 | DigitalOut RS_pin(D9); // Digital Configuration Input to MAX5171 device |
whismanoid | 4:c6e15fe3ea9d | 122 | DigitalOut PDLb_pin(D8); // Digital Configuration Input to MAX5171 device |
whismanoid | 4:c6e15fe3ea9d | 123 | DigitalOut CLRb_pin(D7); // Digital Configuration Input to MAX5171 device |
whismanoid | 4:c6e15fe3ea9d | 124 | DigitalOut SHDN_pin(D6); // Digital Configuration Input to MAX5171 device |
whismanoid | 4:c6e15fe3ea9d | 125 | // AnalogIn OUT_pin(A0); // Analog Output from MAX5171 device |
whismanoid | 4:c6e15fe3ea9d | 126 | DigitalIn UPO_pin(D5); // Digital General-Purpose Output from MAX5171 device |
whismanoid | 4:c6e15fe3ea9d | 127 | // example code declare device instance |
whismanoid | 4:c6e15fe3ea9d | 128 | MAX5171 g_MAX5171_device(spi, spi_cs, RS_pin, PDLb_pin, CLRb_pin, SHDN_pin, UPO_pin, MAX5171::MAX5171_IC); |
whismanoid | 4:c6e15fe3ea9d | 129 | |
whismanoid | 4:c6e15fe3ea9d | 130 | // example code main function |
whismanoid | 4:c6e15fe3ea9d | 131 | int main() |
whismanoid | 4:c6e15fe3ea9d | 132 | { |
whismanoid | 4:c6e15fe3ea9d | 133 | g_MAX5171_device.Init(); |
whismanoid | 4:c6e15fe3ea9d | 134 | |
whismanoid | 4:c6e15fe3ea9d | 135 | while (1) |
whismanoid | 4:c6e15fe3ea9d | 136 | { |
whismanoid | 4:c6e15fe3ea9d | 137 | uint16_t code; |
whismanoid | 4:c6e15fe3ea9d | 138 | // |
whismanoid | 4:c6e15fe3ea9d | 139 | // example #1 |
whismanoid | 5:965408a612dd | 140 | code = 0x3fff; // 100.0% of full scale REF(2.50V) = 2.50V (FB=1-2:FORCE_BIP/SENSE_BIP: 2.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 5.00V) |
whismanoid | 4:c6e15fe3ea9d | 141 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 4:c6e15fe3ea9d | 142 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 4:c6e15fe3ea9d | 143 | // |
whismanoid | 4:c6e15fe3ea9d | 144 | // example #2 |
whismanoid | 5:965408a612dd | 145 | code = 0x3998; // 90.0% of full scale REF(2.50V) = 2.25V (FB=1-2:FORCE_BIP/SENSE_BIP: 2.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 4.50V) |
whismanoid | 4:c6e15fe3ea9d | 146 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 4:c6e15fe3ea9d | 147 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 4:c6e15fe3ea9d | 148 | // |
whismanoid | 4:c6e15fe3ea9d | 149 | // example #3 |
whismanoid | 5:965408a612dd | 150 | code = 0x3332; // 80.0% of full scale REF(2.50V) = 2.00V (FB=1-2:FORCE_BIP/SENSE_BIP: 1.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 4.00V) |
whismanoid | 4:c6e15fe3ea9d | 151 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 4:c6e15fe3ea9d | 152 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 4:c6e15fe3ea9d | 153 | // |
whismanoid | 4:c6e15fe3ea9d | 154 | // example #4 |
whismanoid | 5:965408a612dd | 155 | code = 0x2ccc; // 70.0% of full scale REF(2.50V) = 1.75V (FB=1-2:FORCE_BIP/SENSE_BIP: 1.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 3.50V) |
whismanoid | 4:c6e15fe3ea9d | 156 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 4:c6e15fe3ea9d | 157 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 4:c6e15fe3ea9d | 158 | // |
whismanoid | 4:c6e15fe3ea9d | 159 | // example #5 |
whismanoid | 5:965408a612dd | 160 | code = 0x2665; // 60.0% of full scale REF(2.50V) = 1.50V (FB=1-2:FORCE_BIP/SENSE_BIP: 0.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 3.00V) |
whismanoid | 5:965408a612dd | 161 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 162 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 163 | // |
whismanoid | 5:965408a612dd | 164 | // example #6 |
whismanoid | 5:965408a612dd | 165 | code = 0x1fff; // 50.0% of full scale REF(2.50V) = 1.25V (FB=1-2:FORCE_BIP/SENSE_BIP: 0.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 2.50V) |
whismanoid | 5:965408a612dd | 166 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 167 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 168 | // |
whismanoid | 5:965408a612dd | 169 | // example #7 |
whismanoid | 5:965408a612dd | 170 | code = 0x1999; // 40.0% of full scale REF(2.50V) = 1.00V (FB=1-2:FORCE_BIP/SENSE_BIP: -0.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 2.00V) |
whismanoid | 5:965408a612dd | 171 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 172 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 173 | // |
whismanoid | 5:965408a612dd | 174 | // example #8 |
whismanoid | 5:965408a612dd | 175 | code = 0x1332; // 30.0% of full scale REF(2.50V) = 0.75V (FB=1-2:FORCE_BIP/SENSE_BIP: -1.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 1.50V) |
whismanoid | 5:965408a612dd | 176 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 177 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 178 | // |
whismanoid | 5:965408a612dd | 179 | // example #9 |
whismanoid | 5:965408a612dd | 180 | code = 0x0ccc; // 20.0% of full scale REF(2.50V) = 0.50V (FB=1-2:FORCE_BIP/SENSE_BIP: -1.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 1.00V) |
whismanoid | 5:965408a612dd | 181 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 182 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 183 | // |
whismanoid | 5:965408a612dd | 184 | // example #10 |
whismanoid | 5:965408a612dd | 185 | code = 0x0666; // 10.0% of full scale REF(2.50V) = 0.25V (FB=1-2:FORCE_BIP/SENSE_BIP: -2.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 0.50V) |
whismanoid | 5:965408a612dd | 186 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 187 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 188 | // |
whismanoid | 5:965408a612dd | 189 | // example #11 |
whismanoid | 5:965408a612dd | 190 | code = 0x0000; // 0.0% of full scale REF(2.50V) = 0.00V (FB=1-2:FORCE_BIP/SENSE_BIP: -2.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 0.00V) |
whismanoid | 5:965408a612dd | 191 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 192 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 193 | // |
whismanoid | 5:965408a612dd | 194 | // example #12 |
whismanoid | 5:965408a612dd | 195 | code = 0x0000; // 0.0% of full scale REF(2.50V) = 0.00V (FB=1-2:FORCE_BIP/SENSE_BIP: -2.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 0.00V) |
whismanoid | 5:965408a612dd | 196 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 197 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 198 | // |
whismanoid | 5:965408a612dd | 199 | // example #13 |
whismanoid | 5:965408a612dd | 200 | code = 0x0666; // 10.0% of full scale REF(2.50V) = 0.25V (FB=1-2:FORCE_BIP/SENSE_BIP: -2.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 0.50V) |
whismanoid | 5:965408a612dd | 201 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 202 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 203 | // |
whismanoid | 5:965408a612dd | 204 | // example #14 |
whismanoid | 5:965408a612dd | 205 | code = 0x0ccc; // 20.0% of full scale REF(2.50V) = 0.50V (FB=1-2:FORCE_BIP/SENSE_BIP: -1.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 1.00V) |
whismanoid | 5:965408a612dd | 206 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 207 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 208 | // |
whismanoid | 5:965408a612dd | 209 | // example #15 |
whismanoid | 5:965408a612dd | 210 | code = 0x1332; // 30.0% of full scale REF(2.50V) = 0.75V (FB=1-2:FORCE_BIP/SENSE_BIP: -1.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 1.50V) |
whismanoid | 5:965408a612dd | 211 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 212 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 213 | // |
whismanoid | 5:965408a612dd | 214 | // example #16 |
whismanoid | 5:965408a612dd | 215 | code = 0x1999; // 40.0% of full scale REF(2.50V) = 1.00V (FB=1-2:FORCE_BIP/SENSE_BIP: -0.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 2.00V) |
whismanoid | 5:965408a612dd | 216 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 217 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 218 | // |
whismanoid | 5:965408a612dd | 219 | // example #17 |
whismanoid | 5:965408a612dd | 220 | code = 0x1fff; // 50.0% of full scale REF(2.50V) = 1.25V (FB=1-2:FORCE_BIP/SENSE_BIP: 0.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 2.50V) |
whismanoid | 5:965408a612dd | 221 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 222 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 223 | // |
whismanoid | 5:965408a612dd | 224 | // example #18 |
whismanoid | 5:965408a612dd | 225 | code = 0x2665; // 60.0% of full scale REF(2.50V) = 1.50V (FB=1-2:FORCE_BIP/SENSE_BIP: 0.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 3.00V) |
whismanoid | 5:965408a612dd | 226 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 227 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 228 | // |
whismanoid | 5:965408a612dd | 229 | // example #19 |
whismanoid | 5:965408a612dd | 230 | code = 0x2ccc; // 70.0% of full scale REF(2.50V) = 1.75V (FB=1-2:FORCE_BIP/SENSE_BIP: 1.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 3.50V) |
whismanoid | 5:965408a612dd | 231 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 232 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 233 | // |
whismanoid | 5:965408a612dd | 234 | // example #20 |
whismanoid | 5:965408a612dd | 235 | code = 0x3332; // 80.0% of full scale REF(2.50V) = 2.00V (FB=1-2:FORCE_BIP/SENSE_BIP: 1.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 4.00V) |
whismanoid | 5:965408a612dd | 236 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 237 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 238 | // |
whismanoid | 5:965408a612dd | 239 | // example #21 |
whismanoid | 5:965408a612dd | 240 | code = 0x3998; // 90.0% of full scale REF(2.50V) = 2.25V (FB=1-2:FORCE_BIP/SENSE_BIP: 2.00V) (FB=2-3:FORCE_UNI/SENSE_UNI: 4.50V) |
whismanoid | 5:965408a612dd | 241 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 5:965408a612dd | 242 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 5:965408a612dd | 243 | // |
whismanoid | 5:965408a612dd | 244 | // example #22 |
whismanoid | 5:965408a612dd | 245 | code = 0x3fff; // 100.0% of full scale REF(2.50V) = 2.50V (FB=1-2:FORCE_BIP/SENSE_BIP: 2.50V) (FB=2-3:FORCE_UNI/SENSE_UNI: 5.00V) |
whismanoid | 4:c6e15fe3ea9d | 246 | g_MAX5171_device.CODE_LOAD(code); |
whismanoid | 4:c6e15fe3ea9d | 247 | wait_ms(3000); // wait_ms(unsigned long interval_msec) |
whismanoid | 4:c6e15fe3ea9d | 248 | |
whismanoid | 4:c6e15fe3ea9d | 249 | // wait(3.0); |
whismanoid | 4:c6e15fe3ea9d | 250 | } |
whismanoid | 4:c6e15fe3ea9d | 251 | } |