Maxim Integrated MAX5719 20-bit, 0.05nV-sec DAC Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.
Dependencies: MaximTinyTester CmdLine MAX5719 USBDevice
Diff: Test_Menu_MAX5719.cpp
- Revision:
- 28:bae17ff10fa7
- Parent:
- 27:485b1b2f334c
- Child:
- 29:074e680ba5ea
--- a/Test_Menu_MAX5719.cpp Tue Jun 08 04:13:07 2021 -0700 +++ b/Test_Menu_MAX5719.cpp Tue Jun 08 17:44:53 2021 -0700 @@ -114,11 +114,28 @@ { g_MAX5719_device.DACCode = DACCode; // update global property value } +#if 1 + // "code" is an alias for argument "DACCode"; support DACCodeOfVoltage + double voltageV; // support DACCodeOfVoltage + switch (cmdLine.parse_double_or_int32("code", voltageV, DACCode)) + { + case 2: // 2: parsed as double + // parse_double_or_uint32 returns 1: parsed as integer; 2: parsed as double + DACCode = g_MAX5719_device.DACCodeOfVoltage((double)voltageV); + g_MAX5719_device.DACCode = DACCode; // update global property value + cmdLine.serial().printf("\r\nDACCodeOfVoltage(%1.6fV)=0x%6.6X\r\n", voltageV, g_MAX5719_device.DACCode); + break; + case 1: // 1: parsed as integer + g_MAX5719_device.DACCode = DACCode; // update global property value + break; + } +#else // "code" is an alias for argument "DACCode" if (cmdLine.parse_int32_dec("code", DACCode)) { g_MAX5719_device.DACCode = DACCode; // update global property value } +#endif // parse argument double VRef double VRef = g_MAX5719_device.VRef; // default to global property value @@ -272,11 +289,28 @@ { // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value } +#if 1 + // "code" is an alias for argument "dacCodeLsbs"; support DACCodeOfVoltage + double voltageV; // support DACCodeOfVoltage + switch (cmdLine.parse_double_or_uint32("code", voltageV, dacCodeLsbs)) + { + case 2: // 2: parsed as double + // parse_double_or_uint32 returns 1: parsed as integer; 2: parsed as double + dacCodeLsbs = g_MAX5719_device.DACCodeOfVoltage((double)voltageV); + // g_MAX5719_device.DACCode = DACCode; // update global property value + cmdLine.serial().printf("\r\nDACCodeOfVoltage(%1.6fV)=0x%6.6X\r\n", voltageV, dacCodeLsbs); + break; + case 1: // 1: parsed as integer + // g_MAX5719_device.DACCode = DACCode; // update global property value + break; + } +#else // "code" is an alias for argument "dacCodeLsbs" if (cmdLine.parse_uint32_dec("code", dacCodeLsbs)) { // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value } +#endif // print arguments cmdLine.serial().printf("CODE"); cmdLine.serial().printf(" dacCodeLsbs=%ld", dacCodeLsbs); @@ -329,11 +363,28 @@ { // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value } +#if 1 + // "code" is an alias for argument "dacCodeLsbs"; support DACCodeOfVoltage + double voltageV; // support DACCodeOfVoltage + switch (cmdLine.parse_double_or_uint32("code", voltageV, dacCodeLsbs)) + { + case 2: // 2: parsed as double + // parse_double_or_uint32 returns 1: parsed as integer; 2: parsed as double + dacCodeLsbs = g_MAX5719_device.DACCodeOfVoltage((double)voltageV); + // g_MAX5719_device.DACCode = DACCode; // update global property value + cmdLine.serial().printf("\r\nDACCodeOfVoltage(%1.6fV)=0x%6.6X\r\n", voltageV, dacCodeLsbs); + break; + case 1: // 1: parsed as integer + // g_MAX5719_device.DACCode = DACCode; // update global property value + break; + } +#else // "code" is an alias for argument "dacCodeLsbs" if (cmdLine.parse_uint32_dec("code", dacCodeLsbs)) { // g_MAX5719_device.__WARNING_no_match_for_argname_dacCodeLsbs_in_MAX5719_device_t__ = dacCodeLsbs; // update global property value } +#endif // print arguments cmdLine.serial().printf("CODE_LOAD"); cmdLine.serial().printf(" dacCodeLsbs=%ld", dacCodeLsbs);