发布网友 发布时间:2022-05-12 05:15
共2个回答
热心网友 时间:2023-11-19 06:42
如果是普通的单片机,11.0592MHz的晶振,产生38400波特率,将有25%的误差,很难讲数据正确发送出去的。1T模式的单片机才能行。热心网友 时间:2023-11-19 06:43
c追问用c语言实现
include<reg51.h> sbit k1=P1^0;sbit k2=P1^1;void delay(unsigned char a){ unsigned char i,j;for(i=0;i<a;i++)for(j=0;j<120;j++);} main(){ unsigned char led=0xfe;while(1){ if(k1==0){ delay(10);if(k1==0){ while(k1==0);led=(led<<1)|0x01;if(led==...
请问单片机C51用C语言怎么编这个例子include <reg52.h> define uchar unsigned char uchar t0,count,NUM,NUM1;sbit K1=P2^0;sbit K2=P2^1;void delay(uchar count){uchar i;for(i=0;i<count;i++){TMOD=0X01;TH0=(65536-50000)%256;TL0=(65536-50000)/256;TR0=1;while(!TF0);TF0=0;} void keyscan(){ if(K1==0...
C51单片机编程include<reg51.h> define uchar unsigned char define uint unsigned int sbit high_key=P1^0;sbit low_key=P1^1;sbit led=P2^0;sbit speak=P2^1;uint count;void delay(uint x){ uchar j;while(x--){ for(j=0;j<125;j++){;} } } void main(void){ high_key=0;low_key=1;le...
求单片机c51的C语言编程:设当开关为1时,控制2个led交替闪烁,闪烁时间...include#defineucharunsignedcharuchartimes,led;sbitkey1=P1^0;sbitkey2=P1^1;voidt0isr()interrupt1{TH0=(65536-50000)/256;TL0=(65536-50000)%256;times++;}voidrolled(){P0=led;led=(led>>1)|0x80;if(led==0xff)l
c语言编程c51单片机include <reg51.h> define uchar unsigned char define uint unsigned int main(){ uint xdata *xp;//定义指向片外RAM的指针 uint data *p;//定义指向片内RAM的指针 uchar i;//定义循环变量 xp=0x100;//指向片外RAM的100H单元 p=0x30;//指向片内RAM的30H单元 for(i=0;i<10;i++){//...
如何用C51单片机做出以下程序 “秒表是倒计时,从100秒开始倒计时 用数...假设P0 P2接数码管,静态驱动,程序如下:include<reg52.h> define uchar unsigned char define uint unsigned int uchar num=100;uchar time=0;//共阴数码管七段码 uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d, 0x07,0x7f,0x6f,0x77};void Delay1ms(uint i) //1ms延时...
单片机C51编程(C语言):1到100的求和显示,在数码管里显示出来.include <reg51.h> include <stdio.h> define uchar unsigned char void convert();void display();void delay();//共阴:0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F code unsigned char Led[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x...
单片机C51编程(C语言):实现学号的显示(学号是10位数字)如果直接用I/O口驱动,8位数码管就这样写:wei=位选 duan=段选 //断码表 uchar code shuzi[12]={0xc0,0xf9,0xa4,0xb0,0x99,//0,1,2,3,4,0x92,0x82,0xf8,0x80,0x90,//5,6,7,8,9,0x00,0xff};void led_scan(void){ uchar i,j;//共阳数码管 wei=0xff;j=0x01;for(i=...
C51单片机程序16位计数器 TMOD=0x01 1 0 方式2 自动重装8位计数器 TMOD=0x02 1 1 方式3 T0分为2个8位独立计数器,T1为无中断重装8位计数器 TMOD=0x03 PCON = 0x00;PCON主要是为CHMOS型单片机的电源控制而设置的专用寄存器 WDCON = 0x00;清狗 SCON = 0x50;SCON1 = 0x40;串口控制寄存器 ...
跪求单片机c51用汇编语言写的程序,功能为:8只发光二极管依次点亮,从...//P1_0所接二极管亮,下面依次是P1_1到P1_7(电路连接时二极管一端连P1_0,一端连电阻再连5v,低电平的时候亮,因此加取反“~”)if(i==7)P1=~0x02;if(i==6)P1=~0x04;if(i==5)P1=~0x08;if(i==4)P1=~0x10;if(i==3)P1=~0x20;if(i==2)P1=~0x40;if(i==1)P1=~0x...