斑竹,下面是我测试程序,请指教
#include /* include peripheral declarations */
#include "hidef.h"
#include "start08.h"
/*调用USER.H文件*/
//#include
/*调用USER.H文件*/
#define Cpu_SetStopMode() __asm("STOP")
/*全局变量*/
//BAT_FLAG_UNION BAT_FLAG
byte Current_N;
byte Key_N,state,num;
void delay_time(word time)
{
word i,p;
p = time;
TSC_TSTOP = 1; /* 停止计数*/
TSC_TRST = 1; /*清TSC,COUNTER REGISTER*/
TSC =0x20;
TMODH=0x00;
TMODL=220;
TSC_TSTOP = 0; /*开始计数*/
for(i=0;i
while(!TSC_TOF);
TSC_TOF = 0;
}
TSC_TSTOP = 1; /*停止计数*/
}
void Sys_Init()
{
CONFIG2=0x80; /*内部时钟,无外部中断,复位*/
CONFIG1=0x13;
DDRA = 0x00;
PTA = 0x00;
PTAPUE=0xff;
ADSCR=0x1f; /*禁止中断,未用AD*/
}
void test(void) {
for(num=0;num<200;num++) {
delay_time(2000);
}
Cpu_SetStopMode();
}
#pragma DATA_SEG SHORT ZEROPAGE
void main(void) {
DisableInterrupts;
INIT_SP_FROM_STARTUP_DESC();
/*下面是用户程序段*/
Sys_Init();
test();
while(1) ;
} |