Tool/software: TI C/C++ Compiler
Hi, I am trying to do the ADC example and would like to receive a voltage reading on pin_58. However, I am unsure of some parts of the codes. If anyone understands, please explain it to me..
while(uiIndex < NO_OF_SAMPLES + 4) { if(MAP_ADCFIFOLvlGet(ADC_BASE, uiChannel)) { ulSample = MAP_ADCFIFORead(ADC_BASE, uiChannel); pulAdcSamples[uiIndex++] = ulSample; } } MAP_ADCChannelDisable(ADC_BASE, uiChannel); uiIndex = 0; while(uiIndex < NO_OF_SAMPLES) { UART_PRINT("\n\rVoltage is %f\n\r",(((float)((pulAdcSamples[4+uiIndex] >> 2 ) & 0x0FFF))*1.4)/4096); uiIndex++; }
I don't get why it is required to loop the uiIndex until NO_OF_SAMPLES + 4 or NO_OF_SAMPLES. For my case, I'd like to just read the voltage once. How should I go about doing it? And how should I change the UART_PRINT for "(((float)((pulAdcSamples[4+uiIndex] >> 2 ) & 0x0FFF))*1.4)/4096" to just print out the voltage on PIN_58?