- UID
- 852722
|
#Include"EM78x153xx.H"
#Define DISI() _asm{Disi}
#Define ENI() _asm{Eni}
#Define SLEP() _asm{Slep}
#Define NOP() _asm{Nop}
#Define WDTC() _asm{Wdtc}
Typedef Unsigned Char Uchar;
Typedef Unsigned Int Uint;
Typedef Unsigned Short Ushort;
#Define Ledl PORT5
#Define Ledh PORT6
Void Delay(Void)
{Uchar I,J;
For(J=0;J<200;J++)
For(I=0;I<200;I++)NOP();
}
Const Ushort Rundata[16]={0xfffe,0xfffc,0xfff8,0xfff0,
0xffe0,0xffc0,0xff80,0xff00,
0xfe00,0xfc00,0xf800,0xf000,
0xe000,0xc000,0x8000,0x0000};
Void Main(Void)
{Uchar I,J,K;
Uint Run;
WDTC();//清看门狗
DISI();//禁止中断
STATUS=0X00;//清除状态标志位
P5CR=0x00;//置P5为输出口
P6CR=0x00;//置P6为输出口
PDCR=0x00;//禁止P5,P6下拉
ODCR=0x00;//禁止P6开漏
PHCR=0x00;//禁止P6上拉
For(;;)
For(I=0,K=0;I<16;I++,K--)
{Run=Rundata[I];
For(J=0;J<K;J++)
{Ledl=Run;
Ledh=(Run>>8);
Delay();
}
}
}
Void _intcall Interrupt(Void) @ Int
{
// Write Your Code (Inline Assembly Or C) Here
//Restore ACC,R3,R4
_asm
{
Reti //Tell Compiler To Recover Common Registers Here
SWAP 0X1F ;Restore A
SWAPA 0X1F
}
}
Void _intcall Interrupt_l(Void) @ 0x08ow_int 0
{
_asm
{
//Save A --> 0x1F
MOV 0X1F,A ;Backup A To 0x1F
}
} |
|