unsigned int read_a2d(unsigned char channel)
{
unsigned int temp;
channel&=0b00001111; //A2D通道选择
ADCON0&=0b11000011;
ADCON0|=(channel<<2);
}
我的AD管脚设置如下
TRISA = 0b00000011; /* RA0,RA1 */模拟输入
TRISB = 0b00100000; /* RB4,RB6,RB7(TX)、RB5(RX)*/
TRISC = 0b00000111; /* RC0,RC1,RC2 */模拟输入
和上面的函数如何对应?
|