hi
in the demo project MSP430FR6043EVM_USS_Demo inside file USSLibGUIApp.c. i want to view my captured up/down flow values:
pUPSCap = USS_getUPSPtr(&gUssSWConfig);
pDNSCap = USS_getDNSPtr(&gUssSWConfig);
i also want to send the fixed flow rate:
prepareVolumeFlowVarForI2CFixed(algResFixed.iq16VolumeFlowRate);
kindly show me in the endless while loop where is the best place to place these commands:
/* Start Flow Measurement -- Main loop */ while(1) { P1OUT ^= BIT5; //blink LED // HMI function called before measurement to check for new packets // or perform user interaction (LCD/buttons) before measurement HMI_PreMeasurement_Update(); if (HMI_STATUS_FATAL_ERROR != HMI_GetStatus()) { #ifdef __ENABLE_LPM__ // Perform a low power measurement, going to LPM3 in between UPS and DNS code = USS_startLowPowerUltrasonicCapture(&gUssSWConfig); #else // Perform a regular measurement, staying in LPM0 during capture code = USS_startUltrasonicMeasurement(&gUssSWConfig, USS_capture_power_mode_low_power_mode_0); #endif // Invalid capture must report error if (USS_message_code_no_error != code) { if (USSSWLIB_USS_interrupt_status & USS_HSPLL_PLL_UNLOCK_INTERRUPT) { USS_resetUSSModule(&gUssSWConfig, true); USSLibGUIApp_send_error(COMMAND_HANDLER_ERROR_FAULT_INVALID_CAPTURE, (uint16_t) USS_message_code_HSPLL_pll_unlock_error); } else { USSLibGUIApp_send_error(COMMAND_HANDLER_ERROR_FAULT_INVALID_CAPTURE, (uint16_t) code); } } else // run algorithms on the captured results { #ifdef USS_APP_DC_OFFSET_CANCELLATION_ENABLE // Calibrate the gain amplifier. // This routine will update the agcConstant with optimal gain if (USS_App_userConfig.u16DCOffsetEstimateInterval != 0) { if (++dcOffsetEstcount >= USS_App_userConfig.u16DCOffsetEstimateInterval) { dcOffsetEstcount = 0; // Perform DC offset estimation using measurement sequence going // to LPM3 between UPS and DNS capture code = USS_estimateDCoffset(&gUssSWConfig, USS_dcOffEst_Calc_Mode_use_existing_UPS_DNS_capture ); } } #endif // HMI function called after measurement and before algorithms // are executed. // Used to send ADC waveforms before manipulation HMI_PostMeasurement_Update(); code = USS_runAlgorithmsFixedPoint(&gUssSWConfig,&algResFixed); if ( (USS_message_code_valid_results != code) && (USS_message_code_algorithm_captures_accumulated != code) ) { //Invalid algorithm results, report error USSLibGUIApp_send_error(COMMAND_HANDLER_ERROR_FAULT_ALG_ERROR, (uint16_t) code); } } } #ifdef USS_APP_RESONATOR_CALIBRATE_ENABLE // Calibrate the Resonator against the LFXT and obtain the correction // term relative to the expected value obtained during the // Initialization if (++resCalibcount >= USS_App_userConfig.u16ResonatorCalibrateInterval) { resCalibcount = 0; code = USS_verifyHSPLLFrequency(&gUssSWConfig,&pllCalibTestResults); if (code == USS_message_code_no_error) { // Update relative error if the HSPLL frequency is within range gUssSWConfig.algorithmsConfig->clockRelativeError = (_IQ27div(pllCalibTestResults.difference, pllCalibTestResults.expectedResult)); USS_updateClockRelativeError(&gUssSWConfig); } else { // Report error if the HSPLL frequency is outside the expected range if (code == USS_message_code_HSPLL_pll_unlock_error) { // Reset USS if a PLL unlock errror is detected USS_resetUSSModule(&gUssSWConfig, true); } USSLibGUIApp_send_error(COMMAND_HANDLER_ERROR_FAULT_INVALID_CAPTURE, code); } } #endif #ifdef USS_APP_AGC_CALIBRATE_ENABLE // Calibrate the gain amplifier. // This routine will update the agcConstant with optimal gain. if (USS_App_userConfig.u16AGCCalibrateInterval != 0) { if (++agcCalibcount >= USS_App_userConfig.u16AGCCalibrateInterval) { agcCalibcount = 0; code = USS_calibrateSignalGain(&gUssSWConfig); } } #endif #ifdef __WATCHDOG_ENABLE__ hal_system_WatchdogFeed(); #endif // HMI function called after algorithms are executed // Used to send results of algorithms. HMI_PostAlgorithm_Update(&algResFixed); pUPSCap = USS_getUPSPtr(&gUssSWConfig); pDNSCap = USS_getDNSPtr(&gUssSWConfig); // prepareVolumeFlowVarForI2C(algResults.volumeFlowRate); prepareVolumeFlowVarForI2CFixed(algResFixed.iq16VolumeFlowRate); USSLibGUIApp_Delay(); /* Delay for proper time */ }
for now i have put the at the end before the delay
thanks,