上一个错了我重发,为了好看我分模块发
主函数
int main(void)
{
u16 i;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//ÉèÖÃϵͳÖжÏÓÅÏȼ¶·Ö×é2
delay_init(168); //³õʼ»¯ÑÓʱº¯Êý
uart_init(115200); //³õʼ»¯´®¿Ú²¨ÌØÂÊΪ115200
delay_init(168);
LED_Init();
LCD_Init();
POINT_COLOR=RED;
LCD_ShowString(30,50,200,16,16,"Explorer STM32F4");
LCD_ShowString(30,70,200,16,16,"ADC TEST");
LCD_ShowString(30,90,200,16,16,"ATOM@ALIENTEK");
LCD_ShowString(30,110,200,16,16,"2014/5/6");
POINT_COLOR=BLUE;//ÉèÖÃ×ÖÌåΪÀ¶É«
LCD_ShowString(30,130,200,16,16,"ADC1_CH5_VAL:");
LCD_ShowString(30,150,200,16,16,"ADC1_CH5_VOL:0.000V"); //ÏÈÔڹ̶¨Î»ÖÃÏÔʾСÊýµã
/* ADC configuration */
ADC_Config();
/* Start ADC Software Conversion */
ADC_SoftwareStartConv(ADCx);
while (1)
{
for(i=0;i<50;i++)
{
uwADCxConvertedVoltage = uhADCxConvertedValue[i] *3.3/4096;
LCD_ShowxNum(134,130,uhADCxConvertedValue[1],4,16,0); //ÏÔʾADCC²ÉÑùºóµÄÔʼֵ
LCD_ShowxNum(134,150,uwADCxConvertedVoltage,3,16,0); //ÏÔʾµçѹֵµÄÕûÊý²¿·Ö£¬3.1111µÄ»°£¬ÕâÀï¾ÍÊÇÏÔʾ3
LCD_ShowxNum(134,170,uhADCxConvertedValue[0],4,16,0); //ÏÔʾADCC²ÉÑùºóµÄÔʼֵ
LCD_ShowxNum(134,200,uhADCxConvertedValue[49],4,16,0); //ÏÔʾADCC²ÉÑùºóµÄÔʼֵ
delay_ms(1000);
}
LED0=!LED0;
delay_ms(1000);
}
} |