微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 用EM78P153S给同事写流水灯

用EM78P153S给同事写流水灯

时间:11-29 来源:互联网 点击:
基于EM78P153S流水灯
#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 PORT6void 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>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 hereSWAP 0X1F    ;restore ASWAPA 0X1F}}void _intcall interrupt_l(void) @ 0x08:low_int 0{_asm {//save A --> 0x1F MOV 0X1F,A   ;backup A to 0x1F}   }

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top