基于51的串口计算器程序

上传者: 40472181 | 上传时间: 2021-07-05 21:12:48 | 文件大小: 34KB | 文件类型: RAR
#include #include unsigned char tmp; unsigned char data1 = 0; unsigned int num1 = 0,num2 = 0,num3 = 0,fu = 0; int q[100] = {0}; int printf_flag = 0; int a = 0; int c = 0; void send_char(unsigned char txd); void send(unsigned int u); void main() { // EA = 1; //总开关 // ES = 1; //IE寄存器 通信开关 SCON = 0x50; // 设定串行口工作方式 0101 0000 工作方式1 TMOD = 0x20; // 定时器1工作于8位自动重载模式, 用于产生波特率 TH1 = 0xFD; // 波特率9600 TL1 = 0xFD; PCON = 0x00; // 波特率不倍增 TR1 = 1; // 启动定时器1 while(1) { if(RI == 1) // 是否有数据到来 { RI = 0; data1 = SBUF; //P1 = data1; // 数据传送到P0口 // send_char(data1); // 回传接收到的数据 if(( data1>='0') && (data1<='9')) { num1 = 10*num1+(data1 -'0'); } else if(data1 == '+'||data1 =='-'||data1 == '*'|| data1 == '/') { fu = data1; num2 = num1; num1 = 0; } else if(data1 == '='&&fu; == '+')// { num3 = num1+num2; printf_flag = 1; } else if(data1 == '='&&fu; == '-')// &&fu; == '-' { num3 = num2-num1; printf_flag = 1; } else if(data1 == '='&&fu; == '*')//&&fu; == '*' { num3 = num1*num2; printf_flag = 1; } else if(data1 == '='&&fu; == '/')// '&&fu; == '/' { num3 = num1/num2; printf_flag = 1;

文件下载

资源详情

[{"title":"( 17 个子文件 34KB ) 基于51的串口计算器程序","children":[{"title":"串口计算器","children":[{"title":"LSD.uvgui.lenovo <span style='color:#111;'> 84.07KB </span>","children":null,"spread":false},{"title":"Objects","children":[{"title":"delay.obj <span style='color:#111;'> 860B </span>","children":null,"spread":false},{"title":"LSD.build_log.htm <span style='color:#111;'> 1.06KB </span>","children":null,"spread":false},{"title":"LSD <span style='color:#111;'> 6.07KB </span>","children":null,"spread":false},{"title":"LSD.lnp <span style='color:#111;'> 111B </span>","children":null,"spread":false},{"title":"LSD.hex <span style='color:#111;'> 3.00KB </span>","children":null,"spread":false},{"title":"main.obj <span style='color:#111;'> 5.80KB </span>","children":null,"spread":false}],"spread":true},{"title":"delay.h <span style='color:#111;'> 88B </span>","children":null,"spread":false},{"title":"LSD.uvgui.Administrator <span style='color:#111;'> 83.21KB </span>","children":null,"spread":false},{"title":"delay.c <span style='color:#111;'> 144B </span>","children":null,"spread":false},{"title":"Listings","children":[{"title":"LSD.m51 <span style='color:#111;'> 8.36KB </span>","children":null,"spread":false},{"title":"delay.lst <span style='color:#111;'> 1.30KB </span>","children":null,"spread":false},{"title":"main.lst <span style='color:#111;'> 6.74KB </span>","children":null,"spread":false}],"spread":true},{"title":"main.c <span style='color:#111;'> 2.63KB </span>","children":null,"spread":false},{"title":"LSD.uvopt <span style='color:#111;'> 5.32KB </span>","children":null,"spread":false},{"title":"LSD.uvproj <span style='color:#111;'> 13.69KB </span>","children":null,"spread":false},{"title":"LSD.uvgui.uuuu <span style='color:#111;'> 83.38KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明