menu.c

来自「89S52上实现51单片机的串口FIFO功能。即串口的收和发均采用了FIFO作为」· C语言 代码 · 共 42 行

C
42
字号
#include <stdio.h>
#include <reg52.h>
#include <menu.h>
#include <string.h>
unsigned char MenuState;
unsigned char MenuSubState;

#define MENU_NUM  5

char code Menutable1[MENU_NUM][20]= {"system test","harddisk veri","harddisk copy","harddisk image","directory"};
char code Menutable2[MENU_NUM][20]= {"SYSTEM TEST","HARDDISK VERI","HARDDISK COPY","HARDDISK IMAGE","DIRECTORY"};

void Display(byte State,byte SubState)
{
	char i;
	char temp[20];
	SubState = SubState;
	printf("\n");
	if((State > (MENU_NUM + 0x30)) || (State < 0x30))
		{
			printf("param error!\n");
			return ;
		}
	for(i=1;i<=MENU_NUM;i++)
	{
		if(State == (i + 0x30))
		{
			strcpy(temp,Menutable2[i-1]);
			printf("%x:",i);
			printf("%s\n",temp);
		}
		else
		{
			strcpy(temp,Menutable1[i-1]);
			printf("%x:",i);
			printf("%s\n",temp);
		}
	}
	printf("\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?