标题:
mc9s12xf的ATD配置问题
[打印本页]
作者:
flexraybeginer
时间:
2011-3-23 11:49
标题:
mc9s12xf的ATD配置问题
写了个函数,用于采集单通道,AN1即 adInitialSCH(0);是可以的CCF【0】是会置位的。
但adInitialSCH(1);的时候CCF【1】却不会置位,这是为什么?
void adInitialSCH(int channel) {
ATDCTL01_WRAP = 0x0F;//AN15 back
ATDCTL01_ETRIGSEL = 0; // no external triger
ATDCTL01_SRES = 2; //12 bit
ATDCTL01_SMP_DIS = 0;// no discharge
ATDCTL01_ETRIGCH = 0;// not useful now
ATDCTL23_AFFC = 1;// automatic ccf[n] to clear
ATDCTL23_ICLKSTP = 0;// no stop
ATDCTL23_ETRIGP = 0 ;//low /* External Trigger Polarity */
ATDCTL23_ETRIGLE = 0;//edge /* External Trigger Level/Edge control */
ATDCTL23_ETRIGE = 0;// foribde externel triger
ATDCTL23_ASCIE = 0;// no interrupt
ATDCTL23_ACMPIE = 0;// no interrupt
ATDCTL23_DJM = 1;// right aligment
ATDCTL23_S8C = 0;
ATDCTL23_S4C = 0;
ATDCTL23_S2C = 0;
ATDCTL23_S1C = 1;// conversion sequence length = 1
ATDCTL23_FIFO = 0;// not FIFo
ATDCTL23_FRZ = 0;//continue when debug
ATDCTL45_SMP = 1;// Sample rate: 4 ATD clk
ATDCTL45_PRS = 0x01;// Fatdclk = Fbus /(2*(PRS+1))
//ATDCMPE = 0;// no compare
//ATDCMPHT = 0;//<=
ATDCTL45_SC = 0;//not special channel
ATDCTL45_SCAN = 0;// continuous scan
ATDCTL45_MULT = 0;//single channel
ATDCTL45_Cx = channel;//channel select
ATDDIEN = 0;//all ATD module
}
作者:
flexraybeginer
时间:
2011-3-28 11:16
是应该CCF【0】置位
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0