|
里面程序有点问题,大佬看看- #include "stm32f10x.h"
- #include "adc.h"
- #include "SysTick.h"
- #include "led.h"
- extern vu16 AD_Value[4];
- u16 transmit(u16 a[],float value[]);
- u16 transmit(u16 a[],float value[])
- {
- int i,j;
- float count=0;
- for(i=0;i<4;i++)
- {
- for(j=0;j<10;j++)
- {
- count+=a[i];
- }
- value[i]=(float)((count/10)*(3300/4096));
- Delay_us(500);
- }
- }
- float value[4];
- int main()
- {
- SysTick_Init();
- ADC1_Init();
- LED_GPIO_Config1();
- while(1)
- {
- LED1(ON);
- LED2(ON);
- LED3(ON);
- LED4(ON);
-
- transmit(AD_Value,value);
- while(value[0]!=value[1])
- {
- if(value[0]>value[1])
- LED1(OFF);
- else
- LED2(OFF);
- }
- while(value[2]!=value[3])
- {
- if (value[2]>value[3])
- LED3(OFF);
- else
- LED4(OFF);
- }
- }
- }
复制代码
|
|