第7章 单片的C语言程序设计.pptVIP

  • 9
  • 0
  • 约2.38万字
  • 约 78页
  • 2019-01-23 发布于江苏
  • 举报
第7章 单片的C语言程序设计

#include reg51.h #define uint unsigned int #define uchar unsigned char extern void callasm(uchar); /* 定义外部汇编函数 */ extern void dayl(uint); /* 定义外部汇编函数dayl */ void main(void) { uint i,j,m,total = 0; uchar idata buf[50],dis[3]; uchar code tab[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};/*段码表*/ P1 =0xf8; while(1) { total = 1; callasm( buf ); /* 调汇编函数,传递参数为数组首址*/ for( i = 50; i0;i-- ) / *汇编函数执行完后返回于此*/ total += buf[i-1]; /*50个数累加 */ total=total/50; /*求平均 */ dis[0]=total%10; /*求个位,并存入显示缓冲区 */ total=total/10; d

文档评论(0)

1亿VIP精品文档

相关文档