不要尝试创建自己的延迟。使用编译器提供的_u._ms()和_u._us()宏。尝试将:更改为:并对其他通道执行相同的操作。
以上来自于百度翻译
以下为原文
Don't try to create your own delays.
Use the __delay_ms() and __delay_us() macros provided by the compiler.
Try changing:
SELECT_CHANNEL_0();
delay(2) ;
temp = ReadADC();
delay(2) ;
Result();
to:
SELECT_CHANNEL_0(); //select new channel
__delay_us(20); //wait 20us
Result(); //start conversion, and wait for it to complete
temp = ReadADC(); //fetch result from ADC
and do the same for the other channel.
不要尝试创建自己的延迟。使用编译器提供的_u._ms()和_u._us()宏。尝试将:更改为:并对其他通道执行相同的操作。
以上来自于百度翻译
以下为原文
Don't try to create your own delays.
Use the __delay_ms() and __delay_us() macros provided by the compiler.
Try changing:
SELECT_CHANNEL_0();
delay(2) ;
temp = ReadADC();
delay(2) ;
Result();
to:
SELECT_CHANNEL_0(); //select new channel
__delay_us(20); //wait 20us
Result(); //start conversion, and wait for it to complete
temp = ReadADC(); //fetch result from ADC
and do the same for the other channel.
举报