飞思卡尔单片机电子时钟代码(含计算器功能).docVIP

  • 48
  • 0
  • 约6.4千字
  • 约 7页
  • 2016-03-13 发布于安徽
  • 举报

飞思卡尔单片机电子时钟代码(含计算器功能).doc

//功能:电子时钟+计算器 //知识点1: 串口初始化、串口数据收发及数据处理 // 2: 定时器如何实现指定的定时时间 // 3: 如何实现操作数和操作符的分离及提取 #include hidef.h #include string.h #include mc9s12xs128.h /* derivative information */ #pragma LINK_INFO DERIVATIVE mc9s12xs128 unsigned char time[3]={0,0,0}; unsigned char cmd_buf[20]; unsigned char pos=0; static const char segs[]={~0x3f,~0x06,~0x5b,~0x4f,~0x66,~0x6d,~0x7d,~0x07,~0x7f,~0x6f}; static void WriteToSCI0(const char *text){ while (*text != \0){ while (!(SCI0SR1 0x80)); // wait for output buffer empty SCI0DRL = *text++; } } void execute_cmd() { unsigned char i,k=0,j=0,o

文档评论(0)

1亿VIP精品文档

相关文档