简单计算器c语言程序.doc

  1. 1、本文档共19页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
简单计算器 c语言程序 //???DHC6800-EM3 ?a?????aê? //P0?ú?óêy???ü J12???? P2?ú?ó???ó???ü P1.0 P1.1 P1.2 ?ó38ò????? J6????A B C #includereg52.h sbit keyint1=P2^3;//???ó?ü?ì sbit keyint2=P2^2; sbit keyint3=P2^1; sbit keyint4=P2^0; sbit keyout1=P2^7; sbit keyout2=P2^6; sbit keyout3=P2^5; sbit keyout4=P2^4; sbit ADDR0=P1^0;//38ò?????A sbit ADDR1=P1^1;//38ò?????B sbit ADDR2=P1^2; //38ò?????C unsigned char keysta[4][4]={//???ü×?ì??Y????á? {1,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1} }; unsigned char LedBuff[8]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; unsigned char code LedChar[]={//êy???ü???μ?í0-F 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90, 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E }; unsigned char code keytab[4][4]={//?ê×??ü?ì???μ?í {0x31,0x32,0x33,0x26},//êy×??ü1??2??3???óo? {0x34,0x35,0x36,0x27},//êy×??ü4??5??6????o? {0x37,0x38,0x39,0x28},//êy×??ü7??8??9????o? {0x30,0x24,0x25,0x29} //êy×??ü0?????y??μèóú???yo? }; void inttimer0();//??ê?????ê??? void keydriver();//???ü?y?? void KeyScan();//???üé??è void ledscan();//LED??ì?é??è void ShowNumber(unsigned long num);//êy×???à???????0??òt void KeyAction(unsigned char keycode);//?ó??????o?êy void main() { inttimer0(); LedBuff[0] =LedChar[0]; while(1) { keydriver(); } } void inttimer0() { EA=1; TMOD=0x01; TH0=0Xfc; TL0=0X67; ET0=1; TR0=1; } void ShowNumber(unsigned long num) { signed char j; unsigned char buf[8]; for(j=0; j8; j++) { buf[j] = num % 10; num = num / 10; } for(j=7; j=1; j--) { if(buf[j] == 0) { LedBuff[j] = 0xff; } else break; } for(; j=0; j--) { LedBuff[j] = LedChar[buf[j]]; } } void KeyAction(unsigned char keycode)//?ó??????o?êy { static unsigned long result = 0; static unsigned long addend = 0; static unsigned char fuhao=0; static unsigned long addend1=0; if((keycode = 0x30) (keycode = 0x39)) { addend = (addend *10) + (keycode - 0x30); ShowNumber(addend); } else if((keycode=0x24)(keycode=0x29)) { if( keycode==0x24) { result=0; add

文档评论(0)

Kumba + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档