//置IO口为高,输入状态 ADCOUT = 1; SCLK = 0; //启动转换 ADCCS = 0; NOP(); //bit7不需要时钟 if(ADCOUT) rbyte = rbyte + 0x01; else rbyte = rbyte + 0x00; rbyte = rbyte << 1; //读取bit6~bit0 for(i = 0; i < 7; i++) { SCLK = 1; NOP(); //下降沿读取数据 SCLK = 0; if(ADCOUT) rbyte = rbyte + 0x01; else rbyte = rbyte + 0x00; rbyte = rbyte << 1; } //需要第8个时钟 SCLK = 1; NOP(); SCLK = 0; //开始下次转换 ADCCS = 1; -------------------------------------------------- 完全按照datasheet时序要求来的,Vref+ = 4V;Vref- = 0; 是不是比较电压有关? |