I Can't found reference for read all substract of array in MDK V5, where is the code generate from CubeMX it's activate adc1, adc2, adc3, adc5, adc6,& adc7. can any one help me ?
uint8_t ADC_buffer[6]; HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_DMA_Init(); MX_ADC1_Init(); MX_USART1_UART_Init(); HAL_ADC_Start_DMA(&hadc1, (uint32_t *)ADC_buffer, 6); while (1) { A1=ADC_buffer[0]; A2=ADC_buffer[1]; A3=ADC_buffer[2]; A5=ADC_buffer[3]; A6=ADC_buffer[4]; A7=ADC_buffer[5]; }
Your question really doesn't make a lot of sense. Is this the appropriate forum?
There's no indication of the processor, or how any of the pins are configured.
What is the problem reading the elements of the array? Should the array be volatile? Are the samples 8-bit wide? Should you be waiting on some event to know the samples are ready?
Where is A4?
What exactly is the problem?
Thank you Mr. Westonsupermare Pier. Oh ya i see, sorry mr.Westonsupermare Pier, I think general function with CubeMX so I don't describe the chip. i using STM32F103C8T6, any 6 pin ADC is configured where is pin 4 is not used ( only 1,2,3,5,6,7 pins configured). My problem is, i get same value for for each pin (any different but little only 1 in last digit), i see in youtube tutorial work perfectly but not for me
[SOLVED]
I change array to voalatile and important point is i foget for setting channel in "Parameter Settings" for ADC in CubeMX. where is default configuration is direct to channel 1. after channel have configured and my code is work now. thank's