Microcontroller Experiment (2)

Preface

Experiment 1: Use the AT89C51 microcontroller to control the LCD 1602 to display two lines of text, respectively displaying your student number and name pinyin.

Experiment 2: Design an interrupt nested program. It is required that when K1 and K2 are not pressed, the microcontroller controls 8 digital tubes and scrolls to output the complete student number. When K1 is pressed, a low-priority external interrupt 0 request (negative transition trigger) is generated, and the external interrupt 0 interrupt service program is entered. The digital tube displays the year in the student number for more than 3 seconds. At this time, when K2 is pressed, a high-priority external interrupt 1 request (negative transition trigger) is generated, and the external interrupt 1 interrupt service program is entered. The last three digits of the student number are displayed on the digital tube for 3 seconds. When it is displayed for 3 seconds, it returns from external interrupt 1 to continue execution. External interrupt 0 is a low priority, and external interrupt 1 is a high priority.

Experiment 3: Elevator control design for the 36th floor. When the door opens, the digital tube displays AA. When the door closes, the digital tube displays bb. After reaching a certain floor, it displays AA. After a delay (the time when a person enters the elevator), it displays bb, and then goes to another floor.

Reference link

Static display and dynamic display of LED digital tube (Keil+Proteus)-CSDN Blog

Display control of character liquid crystal display LCD 1602 (Keil+Proteus)-CSDN Blog

Application of external interrupt-CSDN Blog

When I use proteus to simulate, the names of many components will be automatically modified as soon as I run it. What happened_Baidu Know (baidu.com)

keil compilation error KEY.c(44): error C141: syntax error near ‘unsigned’, expected ‘__asm’_syntax error near 'unsigned', expected '__asm_ONE_Day|’s blog-CSDN blog

Proteus+51 microcontroller simulates elevator operation (including source program) - Zhihu (zhihu.com)

Simple elevator moving system between upper and lower floors based on AT89C51 microcontroller_Qiyuejiu.'s blog-CSDN blog

Matrix keyboard independent interface design (Keil+Proteus)-CSDN Blog

Proteus sets network label_How to place network label in proteus-CSDN Blog

[Selected] Introduction to 51 MCU - Digital Tube_MCU Digital Tube_Qingchen Yan Yuxi's Blog-CSDN Blog

experiment one

Keil

What needs to be modified is to replace the characters displayed in each line. There is a command to move the cursor to the right in the book, so I canceled it here.

#include<reg51.h>
#include<intrins.h>	//包含_nop_()空函数指令的头文件
#define uchar unsigned char 
#define uint unsigned int
#define out P0
sbit RS=P2^0;//位变量
sbit RW=P2^1;//位变量
sbit E=P2^2;//位变量
//函数声明部分
void lcd_initial(void);//LCD初始化函数
void check_busy(void);//检查忙标志位函数
void write_command(uchar com);//写命令函数
void write_data(uchar dat);//写数据函数
void string(uchar ad,uchar *s);//显示字符串
void delay(uint);//延时

void main(void){
	lcd_initial();//对LCD初始化
	while(1){
		string(0x83,"202140200126");//显示第一行的字符
		string(0xC4,"Liu Jian");//显示第二行的字符
		delay(200);//延时
		write_command(0x01);//清屏
		delay(100);//延时
	}
}

//延时
void delay(uint j){
	uchar i=250;
	for(;j>0;j--){
		while(--i);
		i=249;
		while(--i);
		i=250;
	}
}

//检查忙标志
void check_busy(void){
	uchar dt;
	do{
		dt=0xff;//dt为变量单元,初值为0xff
		//RS=0,E=1时才可以读忙标志位
		E=0;
		RS=0;
		RW=1;
		E=1;
		dt=out;//out为P0口,P0口的状态送入dt中
	}while(dt&0x80);//如果忙标志位BF=1,继续循环检测,等待BF=0
	E=0;//BF=0,LCD 1602不忙,结束检测
}

//写命令
void write_command(uchar com){
	check_busy();
	//按规定RS和E同时为0时,才可以写命令
	E=0;
	RS=0;
	RW=0;
	out=com;//将命令com写入P0口
	E=1;//写命令时,E应为正脉冲,即正跳变,所以前面先置E=0
	_nop_();//空操作1个机器周期,等待硬件反应
	E=0;//E由高电平变为低电平,LCD 1602开始执行命令
	delay(1);//延时,等待硬件反应
}

//写数据
void write_data(uchar dat){
	check_busy();//检测忙标志位BF=1则等待,若BF=0,则可对LCD 1602写入命令
	E=0;//按规定写数据时,E应为正脉冲,所以先置E=0
	//按规定RS=1和RW=0时,才可以写入数据
	RS=1;
	RW=0;
	out=dat;//将数据”dat“从P0口输出,即写入LCD 1602
	E=1;//E产生正跳变
	_nop_();//空操作1个机器周期,等待硬件反应
	E=0;//E由高电平变为低电平,写数据操作结束
	delay(1);
}

//液晶显示器初始化函数
void lcd_initial(void){
	write_command(0x38);//8位两行显示,5*7点阵字符
	_nop_();//空操作1个机器周期,等待硬件反应
	write_command(0x0C);//开整体显示,光标关,无闪烁
	_nop_();//空操作1个机器周期,等待硬件反应
	//write_command(0x05);//光标右移
	_nop_();//空操作1个机器周期,等待硬件反应
	write_command(0x01);//清屏
	delay(1);
}
//输出显示字符串
void string(uchar ad,uchar *s){
	write_command(ad);
	while(*s>0){
		write_data(*s++);//输出字符串,且指针增1
		delay(100);
	}
}

Proteus

 The schematic diagram of this experiment is mentioned in the book and previous blog, and does not need to be modified.

Components needed for experiments

operation result 

Experiment 2

Keil

On the basis of Experiment 1, add the code of the interrupt service function. One is to display the year in the student number, and the other is to display the last three digits of the student number. I directly use an array to implement it. The service function of external interrupt 0 is The year is displayed on the first four digital tubes. The service function of external interrupt 1 is to display the last three digits of the student number on the first three digital tubes. Then the priority of the interrupt needs to be set.

What to note here is:

Among the C standards supported by some C compilers, keil supports the ANSI C standard, which stipulates that the location of declared variables should be before all executable statements. Otherwise, the variable will not be defined and an error will be reported.

Another issue is the time. He needs to hold it for three seconds and then go back. I don’t know how to calculate this, so I just debug it myself and ignore it if it exceeds three seconds.

#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
	
uchar code dis_code[]={0xA4,0xC0,0xA4,0xF9,0x99,0xC0,0xA4,0xC0,0xC0,0xF9,0xA4,0x82};//202140200126(共阳极段码表)
uchar code wei_code[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};//对应输出的位置

//延时
void Delay(uint i){
	uint j;
	for(;i>0;i--)//晶体振荡器为12MHz,j的选择与晶体振荡器的频率有关
	for(j=0;j<333;j++){;}
}

void main(){
	uchar i,j=0x80;
	while(1){
		EA=1;//总中断允许
		EX0=1;//允许外部中断0
		EX1=1;//允许外部中断1
		IT0=1;//选择外部中断0为下降沿触发
		IT1=1;//选择外部中断1为下降沿触发
		PX0=0;//设置中断0为低优先级
		PX1=1;//设置中断1为高优先级

		for(i=0;i<12;i++){
			j=_crol_(j,1);//循环左移一位
			P0=dis_code[i];//P0口输出段码
			P2=j;//P2口输出位控码
			Delay(200);//延时
		}
	}
}


//外部中断0,显示学号中的年份3秒以上
void int0() interrupt 0{
	uchar i,j=0;
	EX0=0;//禁止外部中断0
	while(1){
	for(i=0;i<4;i++){
			P0=dis_code[i];//P0口输出段码
			P2=wei_code[i];//P2口输出位控码
			Delay(200);//延时
		}
	j++;
	if(j==3)
		break;
	}
	EX0=1;//打开外部中断0
}
 
//外部中断1,显示学号中的后三位3秒以上
void int1() interrupt 2{
	uchar i,j=0;
	EX1=0;//禁止外部中断1
	while(1){
	for(i=0;i<3;i++){
			P0=dis_code[i+9];//P0口输出段码
			P2=wei_code[i+5];//P2口输出位控码
			Delay(200);//延时
		}
		j++;
	if(j==4)
		break;
	}
	EX1=1;//打开外部中断1
}

Proteus

Components required for the experiment: The components are all used before.

This is when the reference value of a component changes on its own during simulation. After the manual modification is made, it goes back by itself, and it keeps reporting an error, saying that the name of your device is repeated.

Solution: After consulting online information, it was said that the problem was because the user name of the computer was in Chinese, but there was no solution. I simply deleted the reference of the component and then simulated it.

The schematic diagram is just to add two buttons for interruption on the basis of Experiment 1. For connection, refer to the interruption part.

Comprehensive experiment one and two

Just change the P0 port of the digital tube output to the P1 port. In fact, the crystal oscillator circuit on the left can also be removed. But the current problem is that the two of them affect each other, and they will wait for the output of one side to finish before outputting the other side.

#include<reg51.h>
#include<intrins.h>	//包含_nop_()空函数指令的头文件
#define uchar unsigned char 
#define uint unsigned int
#define out P0
sbit RS=P3^5;//位变量
sbit RW=P3^6;//位变量
sbit E=P3^7;//位变量

uchar code dis_code[]={0xA4,0xC0,0xA4,0xF9,0x99,0xC0,0xA4,0xC0,0xC0,0xF9,0xA4,0x82};//202140200126(共阳极段码表)
uchar code wei_code[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};//对应输出的位置

//函数声明部分
void lcd_initial(void);//LCD初始化函数
void check_busy(void);//检查忙标志位函数
void write_command(uchar com);//写命令函数
void write_data(uchar dat);//写数据函数
void string(uchar ad,uchar *s);//显示字符串
void delay(uint);//延时
 
void main(void){
	uchar i,j=0x80;
	lcd_initial();//对LCD初始化
	while(1){		
		EA=1;//总中断允许
		EX0=1;//允许外部中断0
		EX1=1;//允许外部中断1
		IT0=1;//选择外部中断0为下降沿触发
		IT1=1;//选择外部中断1为下降沿触发
		PX0=0;//设置中断0为低优先级
		PX1=1;//设置中断1为高优先级
 
		for(i=0;i<12;i++){
			//数码管部分
			j=_crol_(j,1);//循环左移一位
			P1=dis_code[i];//P1口输出段码
			P2=j;//P2口输出位控码
			delay(100);//延时
			//LCD 1602部分
			string(0x83,"202140200126");//显示第一行的字符
			string(0xC4,"Liu Jian");//显示第二行的字符
			delay(200);//延时
			write_command(0x01);//清屏
			delay(200);//延时
		}
	}
}
 
//延时
void delay(uint j){
	uchar i=250;
	for(;j>0;j--){
		while(--i);
		i=249;
		while(--i);
		i=250;
	}
}
 
//检查忙标志
void check_busy(void){
	uchar dt;
	do{
		dt=0xff;//dt为变量单元,初值为0xff
		//RS=0,E=1时才可以读忙标志位
		E=0;
		RS=0;
		RW=1;
		E=1;
		dt=out;//out为P0口,P0口的状态送入dt中
	}while(dt&0x80);//如果忙标志位BF=1,继续循环检测,等待BF=0
	E=0;//BF=0,LCD 1602不忙,结束检测
}
 
//写命令
void write_command(uchar com){
	check_busy();
	//按规定RS和E同时为0时,才可以写命令
	E=0;
	RS=0;
	RW=0;
	out=com;//将命令com写入P0口
	E=1;//写命令时,E应为正脉冲,即正跳变,所以前面先置E=0
	_nop_();//空操作1个机器周期,等待硬件反应
	E=0;//E由高电平变为低电平,LCD 1602开始执行命令
	delay(1);//延时,等待硬件反应
}
 
//写数据
void write_data(uchar dat){
	check_busy();//检测忙标志位BF=1则等待,若BF=0,则可对LCD 1602写入命令
	E=0;//按规定写数据时,E应为正脉冲,所以先置E=0
	//按规定RS=1和RW=0时,才可以写入数据
	RS=1;
	RW=0;
	out=dat;//将数据”dat“从P0口输出,即写入LCD 1602
	E=1;//E产生正跳变
	_nop_();//空操作1个机器周期,等待硬件反应
	E=0;//E由高电平变为低电平,写数据操作结束
	delay(1);
}
 
//液晶显示器初始化函数
void lcd_initial(void){
	write_command(0x38);//8位两行显示,5*7点阵字符
	_nop_();//空操作1个机器周期,等待硬件反应
	write_command(0x0C);//开整体显示,光标关,无闪烁
	_nop_();//空操作1个机器周期,等待硬件反应
	//write_command(0x05);//光标右移
	_nop_();//空操作1个机器周期,等待硬件反应
	write_command(0x01);//清屏
	delay(1);
}
//输出显示字符串
void string(uchar ad,uchar *s){
	write_command(ad);
	while(*s>0){
		write_data(*s++);//输出字符串,且指针增1
		delay(100);
	}
}


//外部中断0,显示学号中的年份3秒以上
void int0() interrupt 0{
	uchar i,j=0;
	EX0=0;//禁止外部中断0
	while(1){
	for(i=0;i<4;i++){
			P1=dis_code[i];//P1口输出段码
			P2=wei_code[i];//P2口输出位控码
			delay(500);//延时
		}
	j++;
	if(j==3)
		break;
	}
	EX0=1;//打开外部中断0
}
 
//外部中断1,显示学号中的后三位3秒以上
void int1() interrupt 2{
	uchar i,j=0;
	EX1=0;//禁止外部中断1
	while(1){
	for(i=0;i<3;i++){
			P1=dis_code[i+9];//P1口输出段码
			P2=wei_code[i];//P2口输出位控码
			delay(500);//延时
		}
		j++;
	if(j==4)
		break;
	}
	EX1=1;//打开外部中断1
}

 operation result

Of course, you can also use two AT89C51 microcontrollers in one schematic diagram to achieve two independent implementations. (It is equivalent to the schematic diagrams originally written in two .dsn files now being drawn together, and the two displays do not affect each other) The C language code can be burned separately and written previously.

operation result 

Experiment 3

Keil

I don’t know the meaning of this question. Currently, the movement of floors has been realized. That is, from the first floor to the sixteenth floor, instead of directly displaying 16 from 1, the numbers in the middle from 1 to 16 also need to be displayed together.

This is just a matter of modifying the previous matrix keyboard program.

#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
	
sbit L1=P1^0;//定义列
sbit L2=P1^1;
sbit L3=P1^2;
sbit L4=P1^3;

uchar code digit[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};//共阳极字型码0~9

uchar future_keyval=1;//保存电梯将要取到的楼层
uchar previous_keyval=1;//保存之前电梯处在的楼层

void Delay(uint i);//延时函数
void key_scan(void);//矩阵键盘扫描函数
void display(uchar i);//显示当前楼层函数


void main(){
	while(1){
		key_scan();
		//电梯处在的楼层和将要去的楼层不一致,需要电梯变化
		if(future_keyval!=previous_keyval){
			//将去到的楼层比现在高,表示需要上楼
			while(future_keyval>previous_keyval){
				//逐层显示
				previous_keyval++;
				display(previous_keyval);
			}
			//将去到的楼层比现在低,表示需要下楼
			while(future_keyval<previous_keyval){
				//逐层显示
				previous_keyval--;
				display(previous_keyval);
			}
		}else{
			//一致表示不需要移动
			display(future_keyval);
		}
	}
}

//延时
void Delay(uint i){
	uint j;
	for(;i>0;i--)//晶体振荡器为12MHz,j的选择与晶体振荡器的频率有关
	for(j=0;j<333;j++){;}
}

//矩阵键盘扫描函数
void key_scan(void){
	uchar i,temp;
	P1=0xEF;//行扫描初值1110 1111(扫描P1^4)
		for(i=0;i<4;i++){//逐行为低,按行扫描,一共4行
			if(L1==0)future_keyval=i*4+1;//判断第一列有无键被按下
			if(L2==0)future_keyval=i*4+2;//判断第二列有无键被按下
			if(L3==0)future_keyval=i*4+3;//判断第三列有无键被按下
			if(L4==0)future_keyval=i*4+4;//判断第四列有无键被按下
			Delay(10);//延时
			temp=P1;//读入P1口的状态
			temp=temp|0x0F;//将P1^3~P1^0为1
			temp=temp<<1;//左移,准备扫描下一行
			temp=temp|0x0F;
			P1=temp;//为扫描下一行做准备
		}
}

//自己定义楼层显示函数
void display(uchar i){
	switch(i){
		case 1:P0=digit[0];P2=digit[1];break;
		case 2:P0=digit[0];P2=digit[2];break;
		case 3:P0=digit[0];P2=digit[3];break;
		case 4:P0=digit[0];P2=digit[4];break;
		case 5:P0=digit[0];P2=digit[5];break;
		case 6:P0=digit[0];P2=digit[6];break;
		case 7:P0=digit[0];P2=digit[7];break;
		case 8:P0=digit[0];P2=digit[8];break;
		case 9:P0=digit[0];P2=digit[9];break;
		case 10:P0=digit[1];P2=digit[0];break;
		case 11:P0=digit[1];P2=digit[1];break;
		case 12:P0=digit[1];P2=digit[2];break;
		case 13:P0=digit[1];P2=digit[3];break;
		case 14:P0=digit[1];P2=digit[4];break;
		case 15:P0=digit[1];P2=digit[5];break;
		case 16:P0=digit[1];P2=digit[6];break;
	}
	Delay(150);//延时
}

Proteus

Required devices

Component name Proteus keyword
51 microcontroller AT89C51
reset button BUTTON
Blue digital tube 7SEG-COM-AN-BLUE
Red digital tube 7SEG-WITH-ANODE

 

expand

The teacher didn't reply to my message, and I didn't know what he meant. Then he wrote "Fun Fun" to expand the movement of numbers.

#include<reg51.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
	
sbit L1=P1^0;//定义列
sbit L2=P1^1;
sbit L3=P1^2;
sbit L4=P1^3;
sbit L5=P1^4;
sbit L6=P1^5;
sbit L7=P1^6;
sbit L8=P1^7;

uchar code digit[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};//共阳极字型码0~9

uchar future_keyval=1;//保存电梯将要取到的楼层
uchar previous_keyval=1;//保存之前电梯处在的楼层

void Delay(uint i);//延时函数
void key_scan(void);//矩阵键盘扫描函数
void display(uchar i);//显示当前楼层函数


void main(){
	while(1){
		key_scan();
		//电梯处在的楼层和将要去的楼层不一致,需要电梯变化
		if(future_keyval!=previous_keyval){
			//将去到的楼层比现在高,表示需要上楼
			while(future_keyval>previous_keyval){
				//逐层显示
				previous_keyval++;
				display(previous_keyval);
			}
			//将去到的楼层比现在低,表示需要下楼
			while(future_keyval<previous_keyval){
				//逐层显示
				previous_keyval--;
				display(previous_keyval);
			}
		}else{
			//一致表示不需要移动
			display(future_keyval);
		}
	}
}

//延时
void Delay(uint i){
	uint j;
	for(;i>0;i--)//晶体振荡器为12MHz,j的选择与晶体振荡器的频率有关
	for(j=0;j<333;j++){;}
}

//矩阵键盘扫描函数
void key_scan(void){
	uchar i,temp;
	P1=0xFF;//列都置为1
	P3=0xFE;//逐行扫描
	for(i=0;i<8;i++){//逐行为低,按行扫描,一共4行
		if(L1==0)future_keyval=i*8+1;//判断第一列有无键被按下
		if(L2==0)future_keyval=i*8+2;//判断第二列有无键被按下
		if(L3==0)future_keyval=i*8+3;//判断第三列有无键被按下
		if(L4==0)future_keyval=i*8+4;//判断第四列有无键被按下
		if(L5==0)future_keyval=i*8+5;//判断第五列有无键被按下
		if(L6==0)future_keyval=i*8+6;//判断第六列有无键被按下
		if(L7==0)future_keyval=i*8+7;//判断第七列有无键被按下
		if(L8==0)future_keyval=i*8+8;//判断第八列有无键被按下
		Delay(10);//延时
		temp=P3;//读入P3口的状态
		P1=0xFF;
		P3=_crol_(temp,1);//需要采用循环左移,扫描下一行(不然会导致出现很多个0,低位补0)
	}
}

//自己定义楼层显示函数
void display(uchar i){
	P0=digit[i/10];
	P2=digit[i%10];
	Delay(150);//延时
}

 

I still don’t know how to implement this. There are not so many wires anymore. Currently, an LED light is used instead. For 36 layers, 12 wires are needed.

To display an array using a static digital tube, you can use a 4-wire 7SEG-BCD digital tube, which uses 7448. I don't know how to output characters.

Using 7SEG-COM-AN-BLUE, 7*4+12=40>32 lines are needed.

7SEG-MPX8-CA-BLUE is used, but I don’t know if it’s because of my computer or something else. No matter how I set the delay time of the two displays, it cannot achieve the effect of two simultaneous displays for the human eye. The time is too short. The result is that both displays are incomplete.

Currently, LED lights are used to indicate whether the elevator is open as follows:

#include<reg51.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
	
sbit L1=P1^0;//定义列
sbit L2=P1^1;
sbit L3=P1^2;
sbit L4=P1^3;
sbit L5=P1^4;
sbit L6=P1^5;
sbit L7=P1^6;
sbit L8=P1^7;

uchar code digit[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};//共阳极字型码0~9

uchar future_keyval=1;//保存电梯将要取到的楼层
uchar previous_keyval=1;//保存之前电梯处在的楼层

void Delay(uint i);//延时函数
void key_scan(void);//矩阵键盘扫描函数
void display(uchar i);//显示当前楼层函数


void main(){
	while(1){
		key_scan();
		//电梯处在的楼层和将要去的楼层不一致,需要电梯变化
		if(future_keyval!=previous_keyval){
			//将去到的楼层比现在高,表示需要上楼
			while(future_keyval>previous_keyval){
				//逐层显示
				previous_keyval++;
				display(previous_keyval);
			}
			//将去到的楼层比现在低,表示需要下楼
			while(future_keyval<previous_keyval){
				//逐层显示
				previous_keyval--;
				display(previous_keyval);
			}
		}else{
			//一致表示不需要移动
			display(future_keyval);
		}
	}
}

//延时
void Delay(uint i){
	uint j;
	for(;i>0;i--)//晶体振荡器为12MHz,j的选择与晶体振荡器的频率有关
	for(j=0;j<333;j++){;}
}

//矩阵键盘扫描函数
void key_scan(void){
	uchar i,temp;
	P1=0xFF;//列都置为1
	P3=0xFE;//逐行扫描
	for(i=0;i<8;i++){//逐行为低,按行扫描,一共4行
		if(L1==0)future_keyval=i*8+1;//判断第一列有无键被按下
		if(L2==0)future_keyval=i*8+2;//判断第二列有无键被按下
		if(L3==0)future_keyval=i*8+3;//判断第三列有无键被按下
		if(L4==0)future_keyval=i*8+4;//判断第四列有无键被按下
		if(L5==0)future_keyval=i*8+5;//判断第五列有无键被按下
		if(L6==0)future_keyval=i*8+6;//判断第六列有无键被按下
		if(L7==0)future_keyval=i*8+7;//判断第七列有无键被按下
		if(L8==0)future_keyval=i*8+8;//判断第八列有无键被按下
		Delay(10);//延时
		temp=P3;//读入P3口的状态
		P1=0xFF;
		P3=_crol_(temp,1);//需要采用循环左移,扫描下一行(不然会导致出现很多个0,低位补0)
	}
}

//自己定义楼层显示函数
void display(uchar i){
	//显示高位
	P0=digit[i/10];
	//显示低位
	P2=digit[i%10];
	if(future_keyval==previous_keyval){
			//亮(高位置0)
			P0=P0&0x7F;
	}else{
			//不亮(高位置1)
			P0=P0|0x80;
	}
	Delay(150);//延时
}

When the elevator moves

When the elevator stops

In short, the function currently implemented is the display of the digital tube. In the past, clicking the button simply displayed the number. Now it will also display the numbers along the way, but it is not so smart. If there are multiple presses, such as what I am doing now On the first floor, he pressed sixteen first, and then eight. He would not stop on the eighth floor. This is obviously illogical. The second step is to press the elevator, internal press and external press. This I There is no distinction either. In short, the experiment was far from meeting the requirements, and the teacher did not provide a schematic diagram for reference. I didn’t quite understand what he was going to do, so I left it at that for the time being.​ 

Summarize

This experiment is obviously much more difficult than the last time. Last time, the program was slightly modified. Now, it is necessary to add devices to the schematic diagram.

Guess you like

Origin blog.csdn.net/weixin_64066303/article/details/134479372