answerMachine.c
/****************************************************
抢答器
1.用键盘设定两位的计数值
2.按回车键结束设定,并开始倒计时
3.按下0-9的一位,表示抢答,停止计时,
在数码管上显示选手的编号并通过串口
将抢答选手的编号发送给上位机
****************************************************/
#include <reg52.h>
#include <stdio.h>
#include "utilities.h"
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
sbit ENLED = P1^4;
extern uchar T0RH;
extern uchar T0RL;
extern uchar LEDBuff[6];
extern uchar code LEDChar[];
extern void showNumber(ulong num);
//extern void LEDScan();
extern void keyScan();
extern void keyDriver();
extern void setTmr0Mod1(uint ms);
extern void setUART(uint baud);
ulong number = 0;
bit LEDLock = 1;
uchar RXDByte = 0;
void LEDScan() {
static uchar i = 0;
P0 = 0xFF;
P1 = (