智能车制作
标题:
xs128CCD采集问题,AO端口根本采集不对,我怀疑是AD采集模块问题
[打印本页]
作者:
丨奇灬锦兮丶
时间:
2015-5-27 23:56
标题:
xs128CCD采集问题,AO端口根本采集不对,我怀疑是AD采集模块问题
void PortInit(void) //端口初始化
{ // 1 为输出 0 为输入
DDRB = 0x00; //端口B方向为输入
DDRM = 0XFF; //低四位为输入
PTM = 0x00;
/*------------------------------
ccd initialization
------------------------------ */
DDRA_DDRA7 = 1; //CCD1CLK
DDRA_DDRA5 = 1; //CCD1SI
PORTA_PA7 = 0; //CCD1CLK
PORTA_PA5 = 0; //CCD1SI
}
void ATD_Init(void) //AD初始化
{
ATD0CTL0 = 0x07; //返转通道设定为AN7
ATD0CTL1 = 0x40; //7-外部触发,65:10-12位精度,4:不放电,3210:ch0 40
ATD0CTL2 = 0x40; //禁止外部触发, 中断禁止
ATD0CTL3 = 0xc0; //a右对齐无符号,每次转换7个序列, No FIFO, Freeze模式下继续转
ATD0CTL4 = 0x09; //765:采样时间为4个AD时钟周期,ATDClock=[BusClock*0.5]/[PRS+1] //转换时间 1.6us
ATD0CTL5 = 0x30; //6:0特殊通道禁止,5:1连续转换 ,4:1多通道轮流采样
ATD0DIEN = 0x00; //禁止数字输
}
void ImageCapture(unsigned char * ImageData) {
unsigned char i;
TSL1401_SI=1; /* SI = 1 */
SamplingDelay();
TSL1401_CLK=1; /* CLK = 1 */
SamplingDelay();
TSL1401_SI=0; /* SI = 0 */
SamplingDelay();
//Delay 10us for sample the first pixel
for(i = 0; i < 10; i++) {
Cpu_Delay1us();
}
//Sampling Pixel 1
*ImageData = (byte)( Read_ADValue(5));
*ImageData++ ;
TSL1401_CLK=0; /* CLK = 0 */
for(i=0; i<127; i++) {
SamplingDelay();
SamplingDelay();
TSL1401_CLK=1; /* CLK = 1 */
SamplingDelay();
SamplingDelay();
//Sampling Pixel 2~128
*ImageData = (byte)( Read_ADValue(5));
*ImageData++ ;
TSL1401_CLK=0; /* CLK = 0 */
}
SamplingDelay();
SamplingDelay();
TSL1401_CLK=1; /* CLK = 1 */
SamplingDelay();
SamplingDelay();
TSL1401_CLK=0; /* CLK = 0 */
}
作者:
ThatsAlL
时间:
2015-5-28 09:35
波特率,115200!!
作者:
丨奇灬锦兮丶
时间:
2015-5-28 11:13
115200,根本就不发送了
欢迎光临 智能车制作 (http://111.231.132.190/)
Powered by Discuz! X3.2