Board logo

标题: AD转换程序 [打印本页]

作者: choujay    时间: 2007-1-21 20:48     标题: AD转换程序

ATD1状态和控制寄存器的初始化工作?
请问mc13192中A/D转换的初始化程序在那?谢谢!
/*** ATD1SC - ATD1 Status and Control Register; 0x00000051 ***/
typedef union {
byte Byte;
struct {
byte ATDCH0 :1; /* Analog Input Channel Select Bit 0 */
byte ATDCH1 :1; /* Analog Input Channel Select Bit 1 */
byte ATDCH2 :1; /* Analog Input Channel Select Bit 2 */
byte ATDCH3 :1; /* Analog Input Channel Select Bit 3 */
byte ATDCH4 :1; /* Analog Input Channel Select Bit 4 */
byte ATDCO :1; /* ATD Continuous Conversion */
byte ATDIE :1; /* ATD Interrupt Enabled */
byte CCF :1; /* Conversion Complete Flag */
} Bits;
struct {
byte grpATDCH :5;
byte :1;
byte :1;
byte :1;
} MergedBits;
} ATD1SCSTR;
extern volatile ATD1SCSTR _ATD1SC @0x00000051;
#define ATD1SC _ATD1SC.Byte
#define ATD1SC_ATDCH0 _ATD1SC.Bits.ATDCH0
#define ATD1SC_ATDCH1 _ATD1SC.Bits.ATDCH1
#define ATD1SC_ATDCH2 _ATD1SC.Bits.ATDCH2
#define ATD1SC_ATDCH3 _ATD1SC.Bits.ATDCH3
#define ATD1SC_ATDCH4 _ATD1SC.Bits.ATDCH4
#define ATD1SC_ATDCO _ATD1SC.Bits.ATDCO
#define ATD1SC_ATDIE _ATD1SC.Bits.ATDIE
#define ATD1SC_CCF _ATD1SC.Bits.CCF
#define ATD1SC_ATDCH _ATD1SC.MergedBits.grpATDCH

#define ATD1SC_ATDCH0_MASK 1
#define ATD1SC_ATDCH0_BITNUM 0
#define ATD1SC_ATDCH1_MASK 2
#define ATD1SC_ATDCH1_BITNUM 1
#define ATD1SC_ATDCH2_MASK 4
#define ATD1SC_ATDCH2_BITNUM 2
#define ATD1SC_ATDCH3_MASK 8
#define ATD1SC_ATDCH3_BITNUM 3
#define ATD1SC_ATDCH4_MASK 16
#define ATD1SC_ATDCH4_BITNUM 4
#define ATD1SC_ATDCO_MASK 32
#define ATD1SC_ATDCO_BITNUM 5
#define ATD1SC_ATDIE_MASK 64
#define ATD1SC_ATDIE_BITNUM 6
#define ATD1SC_CCF_MASK 128
#define ATD1SC_CCF_BITNUM 7
#define ATD1SC_ATDCH_MASK 31
#define ATD1SC_ATDCH_BITNUM 0
作者: seuafu2005    时间: 2007-1-22 18:49

smac中用于3g加速度传感器的应用中用到的AD,可以参考




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0