The design of the quiz answerer based on the single-chip computer-bishi course design materials

[Resource download] The download address is as follows:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl

①For 6 groups of players to participate, the numbers are 1--6, and the numbers of the buttons correspond to the numbers of the players.
②The host control switch can be used to control the reset and start of the system. When the "Start" key is pressed, it enters normal work.
③ It has the function of data latch and display. If there is a player rushing to answer, the answering circuit and the timing circuit will stop working, and other players are prohibited from rushing to answer, and the number of the player and the time of answering will be displayed at the same time.
④Timed rush answer: The time for a quick answer is set to 30S, and the circuit will be decremented and displayed in turn after "start". Additional features: the answering time can be adjusted.

#include <at89x51.h>
#define uchar	unsigned char
#define uint	unsigned int
char	s;
uchar	num		= 0;
char	time		= 30;                   /* 抢答时间 */
uint	tt, t1;                                 /* T0,T1定时器定一秒时 */
bit	flag, s_flag = 1, b_flag, fall_flag;    /* 标志位 */
bit	K_startcountflag, K_timecountflag;      /* 时间调整标志位 */
sbit	K0		= P3 ^ 0;
sbit	beep		= P3 ^ 7;               /* 蜂鸣器 */
sbit	rled		= P3 ^ 1;               /* 指示灯 */
sbit	K1		= P1 ^ 0;
sbit	K2		= P1 ^ 1;
sbit	K3		= P1 ^ 2;
sbit	K4		= P1 ^ 3;
sbit	K5		= P1 ^ 4;
sbit	K6		= P1 ^ 5;
sbit	K7		= P1 ^ 6;
sbit	K8		= P1 ^ 7;
sbit	DE		= P0 ^ 7;
sbit	K_startcount	= P3 ^ 3;       /* 开始抢答时间调整键 */
sbit	K_timecount	= P3 ^ 2;       /* 清零 */
void delay( uchar ms )
{
	uchar y;
	for (; ms > 0; ms-- )
		for ( y = 120; y > 0; y-- )
			;
}


uchar code	tabledu[] = { 0x3f, 0x06, 0x5b, 0x4f,
			      0x66,	 0x6d, 0x7d, 0x07,
			      0x7f,	 0x6f, 0x77, 0x7c,
			      0x39,	 0x5e, 0x79, 0x71 };
uchar code	tablewe[] = { 0XFE, 0XFD, 0XFB, 0XF7 };
void T0_Init( void )
{
	TMOD	= 0X01;
	TH0	= (65536 - 2000) / 256;
	TL0	= (65536 - 2000) % 256;
	TH1	= (65536 - 2000) / 256;
	TL1	= (65536 - 2000) % 256;
	ET0	= 1;
	ET1	= 1;
	EA	= 1;

Guess you like

Origin blog.csdn.net/AuroraFaye/article/details/115053389