AnsweredAssumed Answered

AmperometricMeasurement Example - Getting currents

Question asked by kathyhanley on Sep 7, 2016
Latest reply on Sep 8, 2016 by PatrickN

Hi there, 


I am hoping to use the AmperometricMeasurement Example code to measure the current going through a sensor. I am just wondering if it is possible to access the ADC measurements which are being printed to the UART, and make the necessary calculations within the main to calculate the current. 


I can see that this function seems to print the values to the terminal, is there anyway of accessing these values in the main and editing them before printing?


* @brief AFE Rx DMA Callback Function.
* @param[in] hAfeDevice Device handle obtained from adi_AFE_Init()
* length Number of U16 samples received from the DMA
* pBuffer Pointer to the buffer containing the LPF results
* @details 16-bit results are converted to bytes and transferred using the UART
void RxDmaCB(void *hAfeDevice, uint32_t length, void *pBuffer)
#if (1 == USE_UART_FOR_DATA)
char msg[MSG_MAXLEN];
uint32_t i;
uint16_t *ppBuffer = (uint16_t*)pBuffer;

/* Check if there are samples to be sent */
if (length)
for (i = 0; i < length; i++)
sprintf(msg, "%u\r\n", *ppBuffer++);

#elif (0 == USE_UART_FOR_DATA)
FAIL("Std. Output is too slow for ADC/LPF data. Use UART instead.");

#endif /* USE_UART_FOR_DATA */


Any help would be appreciated, thanks.