调试通过了的程序,能用,贴出来放着,反正放在机子里也没什么作用。
忘高手指点
#include /* common defines and macros */
#include /* derivative information */
#define word unsigned int
#define dword unsigned long
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
uchar AD_wValue; //uint is in stdtypes.h
uchar AD_wData[8]; //全局变量存放 AD0,AD1,AD2的结果 2字节
void AD_Init(void) //AD初始化
{
//控制寄存器2: 上电,标志位快速清零
ATD0CTL2 = (ATD0CTL2_ADPU_MASK|ATD0CTL2_AFFC_MASK);
//MASK置一 ,开中断|ATD0CTL2_ASCIE_MASK
// In ‘normal flags’ mode (AFFC=0), reading the ATDSTAT1 register with CCFx set, followed by a read of data from the associated result register
// In ‘fast flags’ mode (AFFC=1), reading data from the associated result register
/* asm{LDAA #$0A //回车
JSR 0xFE83 //print decimal format with a enter
};
*/
asm{LDAA tem[0]
JSR 0xFE83 //print decimal format with a enter
};
asm{LDAA tem[1]
JSR 0xFE83 //print decimal format with a enter
};
asm{LDAA tem[2]
JSR 0xFE83 //print decimal format with a enter
};
asm{LDAA #$5F
JSR 0xFE83 //print decimal format with a enter
};
}
// change to next row
void nextrow(void) {
asm{
LDAA #$0A //换行
JSR 0xFE83
};