我的程序在一路的时候还是好的
float AD_value;
vu16 ADC_ConvertedValue;
/********************************
* Func
tion Name : main
* Description : Main program
*********************************/
int main(void)
{
GPIO_Configuration();
USART_Configuration();
ADC_Configuration();
delay_init();
/* Infinite loop */
while (1)
{
/* Printf message with AD value to serial port every 1 second */
AD_value = ADC_ConvertedValue;
AD_value = (AD_value/4096)*3.3;
printf("The current AD value = %4.2fV rn", AD_value);
但是改成多路时就出问题了,显示出来数值第二个显示的是0.00V,第一个是两个数值来回变动
float AD_value1,AD_value2;
vu16 ADC_ConvertedValue[2];
/******************************** Function Name : main
* Description : Main program
*******************************/
int main(void)
{
GPIO_Configuration();
USART_Configuration();
ADC_Configuration();
delay_init();
/* Infinite loop */
while (1)
{
/* Printf message with AD value to serial port every 1 second */
AD_value1 = ADC_ConvertedValue[0];
AD_value2 = ADC_ConvertedValue[1];
AD_value1 = (AD_value1/4096)*3.3;
AD_value2 = (AD_value2/4096)*3.3;
printf("The current AD value1 = %4.2fV rn", AD_value1);
printf("The current AD value2 = %4.2fV rn", AD_value2);
比如一路时串口显示的都是The current AD value=1.63V。然而多路时却是
The current AD value1 = 1.63V
The current AD value2 =0.00V
The current AD value1 = 1.03V
The current AD value2 =0.00V
我两路分别给的是1.6和1V。为何第二个出不来。
ADC+DMA.zip(4.95 MB )
2ADC+DMA.zip(4.99 MB )
0