我需要在串口助手中显示,怎么修改采样3次取平均值发送到串口。谢谢大家
void main (void)
{ int i;
u16 Voltage;
P00_PushPull_Mode;
P04_Input_Mode;
InitialUART0_Timer1(115200);
Enable_ADC_AIN5;
while(1)
{
clr_ADCF;
set_ADCS;
while(ADCF == 0);
Voltage=(ADCRH<<4) + ADCRL;
printf ("\n ADC_RH = 0x%bx",ADCRH);
printf ("\n ADC_RL = 0x%bx",ADCRL);
printf ("\n Voltage = 0x%x",Voltage);
LED2=0;
Timer0_Delay1ms(100);
LED2=1;
}
}
|