1)兩個(gè)單片機(jī)系統(tǒng)分別作為服務(wù)器和答題終端。服務(wù)器負(fù)責(zé)驗(yàn)正考生個(gè)人信息,發(fā)送試愿到降端,定時(shí)收卷及判分功能。答題終端負(fù)責(zé)輸入考生個(gè)人信息,答題,修改答案及傳送答案到服務(wù)器。
2)服務(wù)器驗(yàn)證考生個(gè)人信息,若信息不正確則向終端發(fā)出提示信息。信息驗(yàn)證正確后將試題發(fā)送到答題終端,同時(shí)開(kāi)始計(jì)時(shí)。無(wú)論答題是否完成??荚嚂r(shí)間到則強(qiáng)制收題。也可在考試時(shí)同尚有剩余時(shí)接收答題終端發(fā)送過(guò)來(lái)的答案。收題后進(jìn)行判分工作并給出最終得分及答題情況統(tǒng)計(jì)信息。對(duì)回答錯(cuò)誤的題日則給出原題及正確答案。
3)答題終端在收到試題后向考生顯示試題內(nèi)容(可逐道顯示)并接受考生輸入的答案。試題顯示應(yīng)具備翻頁(yè)功能以允許考生反復(fù)瀏覽試題或檢查所作答案。當(dāng)考生檢查完畢且考試時(shí)間尚有剩余,允許考生向服務(wù)器發(fā)送最終答案。
4)實(shí)現(xiàn)服務(wù)器和答題終端的兩個(gè)單片機(jī)系統(tǒng)均應(yīng)包含鍵盤(pán)和LCD液品顯示模塊。兩個(gè)單片機(jī)系統(tǒng)通過(guò)串口進(jìn)行通信。
*************************************************
(1)給出使用說(shuō)明,包括按鍵的定義,操作方法等。
(2)所有功能用途均可實(shí)現(xiàn)且各功能轉(zhuǎn)換正常(模擬5道題即可)。
(3)考生個(gè)人信息包括考生姓名(可用拼音表示)和6位的學(xué)號(hào)。
(4)驗(yàn)收時(shí)需要演示考生個(gè)人信息不正確時(shí)的處理情況:
(5)服務(wù)器和終端都應(yīng)實(shí)時(shí)顯示考試剩余時(shí)間:
(6)四則運(yùn)算應(yīng)覆蓋加減乘除四種運(yùn)算:
(7)終端答題時(shí),在未提交答案前應(yīng)允許反復(fù)瀏覽或修改答案
服務(wù)端
#include "reg52.h" //此文件中定義了單片機(jī)的一些特殊功能寄存器
#define uchar unsigned char
#define uint unsigned int
typedef unsigned int u16; //對(duì)數(shù)據(jù)類(lèi)型進(jìn)行聲明定義
typedef unsigned char u8;
sbit wr=P2^0; //數(shù)據(jù)寫(xiě)
sbit rd=P2^1; //數(shù)據(jù)讀
sbit ce=P2^2; //片選
sbit cd=P2^3; //指令數(shù)據(jù)通道,1指令,0數(shù)據(jù)
sbit rst=P2^4; //復(fù)位信號(hào)
sbit key = P3^2;
uchar S_datt[2][6]={{1,2,3,4,5,6},{1,1,1,1,1,1}};
uchar Title[10] = {5,1,3,2,1,5,6,3,1,1};
uchar Answer[5] = {6,1,5,2,2};
uchar R_mode;
uchar R_wei;
uchar R_buff[20];
uint dis_tim;
uint ALL_time=30;
uchar flag_mode;
uchar C_T[6];
uchar bl;
uchar code HZ0[][32]={
{0x00,0x00,0x3E,0xFC,0x22,0x84,0x22,0x84,0x22,0x94,0x3E,0x88,0x22,0x80,0x22,0xFC,
0x22,0xA4,0x3E,0xA4,0x22,0xA8,0x22,0xA8,0x22,0x90,0x42,0xA8,0x4A,0xC4,0x84,0x82},/*"服",0*/
{0x04,0x00,0x04,0x00,0x0F,0xF0,0x18,0x20,0x24,0xC0,0x03,0x00,0x0C,0xC0,0x32,0x30,
0xC2,0x0E,0x1F,0xF0,0x02,0x10,0x04,0x10,0x04,0x10,0x08,0x10,0x10,0xA0,0x20,0x40},/*"務(wù)",1*/
{0x00,0x00,0x3E,0x7C,0x22,0x44,0x22,0x44,0x3E,0x7C,0x01,0x20,0x01,0x10,0xFF,0xFE,
0x02,0x80,0x0C,0x60,0x30,0x18,0xC0,0x06,0x3E,0x7C,0x22,0x44,0x22,0x44,0x3E,0x7C},/*"器",2*/
{0x01,0x00,0x21,0x08,0x11,0x08,0x09,0x10,0x09,0x20,0x01,0x00,0x7F,0xF8,0x00,0x08,
0x00,0x08,0x00,0x08,0x3F,0xF8,0x00,0x08,0x00,0x08,0x00,0x08,0x7F,0xF8,0x00,0x08},/*"當(dāng)",3*/
{0x10,0x10,0x08,0x10,0x08,0x20,0xFF,0xFE,0x00,0x00,0x3E,0x08,0x22,0x48,0x22,0x48,
0x3E,0x48,0x22,0x48,0x22,0x48,0x3E,0x48,0x22,0x08,0x22,0x08,0x2A,0x28,0x24,0x10},/*"前",4*/
{0x08,0x40,0x08,0x20,0x0B,0xFE,0x10,0x00,0x10,0x00,0x31,0xFC,0x30,0x00,0x50,0x00,
0x91,0xFC,0x10,0x00,0x10,0x00,0x11,0xFC,0x11,0x04,0x11,0x04,0x11,0xFC,0x11,0x04},/*"信",5*/
{0x01,0x00,0x02,0x00,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,
0x1F,0xF0,0x10,0x10,0x01,0x00,0x08,0x84,0x48,0x92,0x48,0x12,0x87,0xF0,0x00,0x00},/*"息",6*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00},/*":",7*/
{0x07,0x02,0x78,0x02,0x08,0x02,0xFF,0x82,0x2A,0x12,0x2A,0x92,0xEB,0x12,0x2A,0x92,
0x6A,0x92,0xA9,0x92,0x1C,0x12,0x2A,0x12,0x49,0x02,0x88,0x82,0x08,0x0A,0x08,0x04},/*"剩",8*/
{0x01,0x00,0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,0x10,0x10,0x2F,0xE8,0xC1,0x06,
0x01,0x00,0x3F,0xF8,0x01,0x00,0x11,0x10,0x11,0x08,0x21,0x04,0x45,0x04,0x02,0x00},/*"余",9*/
{0x00,0x08,0x00,0x08,0x7C,0x08,0x44,0x08,0x45,0xFE,0x44,0x08,0x44,0x08,0x7C,0x08,
0x44,0x88,0x44,0x48,0x44,0x48,0x44,0x08,0x7C,0x08,0x44,0x08,0x00,0x28,0x00,0x10},/*"時(shí)",10*/
{0x20,0x00,0x13,0xFC,0x10,0x04,0x40,0x04,0x47,0xC4,0x44,0x44,0x44,0x44,0x44,0x44,
0x47,0xC4,0x44,0x44,0x44,0x44,0x44,0x44,0x47,0xC4,0x40,0x04,0x40,0x14,0x40,0x08},/*"間",11*/
{0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x00,0x00,0xFF,0xFE,0x22,0x00,
0x3E,0xF8,0x22,0x88,0x3E,0x90,0x22,0x50,0x2F,0x20,0xF2,0x50,0x42,0x88,0x03,0x06},/*"最",12*/
{0x10,0x80,0x10,0x80,0x20,0xF8,0x21,0x08,0x4B,0x10,0xFC,0xA0,0x10,0x40,0x20,0xA0,
0x43,0x18,0xFC,0x06,0x40,0xC0,0x00,0x20,0x18,0x10,0xE1,0x80,0x40,0x60,0x00,0x10},/*"終",13*/
{0x00,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10,0x20,0x08,0x40,0x04,0x9F,0xE2,
0x04,0x20,0x04,0x20,0x04,0x20,0x08,0x20,0x08,0x20,0x10,0x20,0x21,0x40,0x40,0x80},/*"分",14*/
{0x08,0x20,0x49,0x20,0x2A,0x20,0x08,0x3E,0xFF,0x44,0x2A,0x44,0x49,0x44,0x88,0xA4,
0x10,0x28,0xFE,0x28,0x22,0x10,0x42,0x10,0x64,0x28,0x18,0x28,0x34,0x44,0xC2,0x82},/*"數(shù)",15*/
{0x00,0x00,0x7F,0xFC,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x11,0x00,0x11,0xF8,
0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0xFF,0xFE,0x00,0x00},/*"正",16*/
{0x00,0x40,0x00,0x40,0xFC,0x7C,0x10,0x84,0x11,0x08,0x22,0xFE,0x3C,0x92,0x64,0x92,
0x64,0xFE,0xA4,0x92,0x24,0x92,0x24,0xFE,0x3C,0x92,0x25,0x12,0x21,0x0A,0x02,0x04},/*"確",17*/
{0x21,0x10,0x21,0x10,0x39,0x10,0x27,0xFC,0x41,0x10,0x79,0x10,0xAF,0xFE,0x20,0x00,
0xFB,0xF8,0x22,0x08,0x22,0x08,0x23,0xF8,0x2A,0x08,0x32,0x08,0x23,0xF8,0x02,0x08},/*"錯(cuò)",18*/
{0x00,0x00,0x43,0xF8,0x22,0x08,0x22,0x08,0x03,0xF8,0x00,0x00,0xE0,0x00,0x27,0xFC,
0x20,0x40,0x20,0x40,0x2F,0xFE,0x20,0x40,0x28,0xA0,0x31,0x10,0x22,0x08,0x0C,0x06},/*"誤",19*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",20*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
};
uchar code SZ[][16]={
{0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00},/*"0",0*/
{0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"1",1*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00},/*"2",2*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x04,0x02,0x42,0x42,0x3C,0x00,0x00},/*"3",3*/
{0x00,0x00,0x00,0x04,0x0C,0x0C,0x14,0x24,0x24,0x44,0x7F,0x04,0x04,0x1F,0x00,0x00},/*"4",4*/
{0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x78,0x44,0x02,0x02,0x42,0x44,0x38,0x00,0x00},/*"5",5*/
{0x00,0x00,0x00,0x18,0x24,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x22,0x1C,0x00,0x00},/*"6",6*/
{0x00,0x00,0x00,0x7E,0x42,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x00,0x00},/*"7",7*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00},/*"8",8*/
{0x00,0x00,0x00,0x38,0x44,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x24,0x18,0x00,0x00},/*"9",9*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",10*/
{0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x00,0x00,0x00,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",12*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x24,0x18,0x18,0x18,0x24,0x6E,0x00,0x00},/*"x",13*/
{0x00,0x00,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x00},/*"/",14*/
{0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x00,0x00,0x00,0x00},/*"=",15*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00},/*"=",16*/
};
void delay(uint t) //延時(shí)函數(shù)
{
uint i,j;
for(i=0;i1;i++);
}
void Delay_xms(uint x)
{
uint i,j;
for(i=0;i
答題端:
#include "reg52.h" //此文件中定義了單片機(jī)的一些特殊功能寄存器
#define uchar unsigned char
#define uint unsigned int
typedef unsigned int u16; //對(duì)數(shù)據(jù)類(lèi)型進(jìn)行聲明定義
typedef unsigned char u8;
u8 data_send;
sbit wr=P2^0; //數(shù)據(jù)寫(xiě)
sbit rd=P2^1; //數(shù)據(jù)讀
sbit ce=P2^2; //片選
sbit cd=P2^3; //指令數(shù)據(jù)通道,1指令,0數(shù)據(jù)
sbit rst=P2^4; //復(fù)位信號(hào)
sbit h1 = P1^0;
sbit h2 = P1^1;
sbit h3 = P1^2;
sbit h4 = P1^3;
sbit l1 = P1^4;
sbit l2 = P1^5;
sbit l3 = P1^6;
sbit l4 = P1^7;
uchar flag_mode;//當(dāng)前輸入模式 0為考生號(hào) 1為學(xué)號(hào)
uchar S_num; //考生號(hào)
uchar S_buff[6]; //學(xué)號(hào)
uchar S_wei;
uchar R_mode;
uchar R_wei;
uchar R_buff[20];
uchar Tit[10];
uchar Tit_Now;
uchar Answer[5];
uint dis_tim;
uint ALL_time=30;
uchar code HZ0[][32]={
{0x10,0x40,0x10,0x40,0x3F,0x7E,0x28,0x90,0x45,0x08,0x82,0x80,0x0C,0x60,0x30,0x18,
0xCF,0xE6,0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10},/*"答",0*/
{0x00,0x00,0x3E,0xFE,0x22,0x10,0x3E,0x20,0x22,0x7C,0x3E,0x44,0x00,0x54,0xFF,0x54,
0x08,0x54,0x08,0x54,0x2F,0x28,0x28,0x44,0x28,0x82,0x58,0x00,0x4F,0xFE,0x80,0x00},/*"題",1*/
{0x00,0xF8,0x3F,0x00,0x04,0x00,0x08,0x20,0x10,0x40,0x3F,0x80,0x01,0x00,0x06,0x10,
0x18,0x08,0x7F,0xFC,0x01,0x04,0x09,0x20,0x11,0x10,0x21,0x08,0x45,0x04,0x02,0x00},/*"系",2*/
{0x10,0x40,0x10,0x20,0x20,0x20,0x23,0xFE,0x48,0x40,0xF8,0x88,0x11,0x04,0x23,0xFE,
0x40,0x92,0xF8,0x90,0x40,0x90,0x00,0x90,0x19,0x12,0xE1,0x12,0x42,0x0E,0x04,0x00},/*"統(tǒng)",3*/
{0x00,0x40,0x40,0x40,0x27,0xFC,0x20,0x40,0x03,0xF8,0x00,0x40,0xE7,0xFE,0x20,0x00,
0x23,0xF8,0x22,0x08,0x23,0xF8,0x22,0x08,0x2B,0xF8,0x32,0x08,0x22,0x28,0x02,0x10},/*"請(qǐng)",4*/
{0x20,0x40,0x20,0xA0,0x21,0x10,0xFA,0x08,0x25,0xF6,0x40,0x00,0x53,0xC4,0x92,0x54,
0xFA,0x54,0x13,0xD4,0x1A,0x54,0xF2,0x54,0x53,0xD4,0x12,0x44,0x12,0x54,0x12,0xC8},/*"輸",5*/
{0x04,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,0x02,0x80,
0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,0x10,0x10,0x20,0x10,0x40,0x08,0x80,0x06},/*"入",6*/
{0x02,0x00,0x02,0x08,0x3F,0xD0,0x02,0x20,0x02,0x40,0xFF,0xFE,0x01,0x00,0x02,0x00,
0x0F,0xF8,0x12,0x00,0x24,0x00,0x47,0xF0,0x80,0x10,0x00,0x10,0x00,0xA0,0x00,0x40},/*"考",7*/
{0x01,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x3F,0xFC,0x21,0x00,0x41,0x00,0x81,0x00,
0x01,0x00,0x3F,0xF8,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0xFF,0xFE,0x00,0x00},/*"生",8*/
{0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x00,0x00,0xFF,0xFE,
0x08,0x00,0x10,0x00,0x1F,0xF0,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0xA0,0x00,0x40},/*"號(hào)",9*/
{0x00,0x40,0x40,0x40,0x27,0xFC,0x20,0x40,0x03,0xF8,0x00,0x40,0xE7,0xFE,0x20,0x00,
0x23,0xF8,0x22,0x08,0x23,0xF8,0x22,0x08,0x2B,0xF8,0x32,0x08,0x22,0x28,0x02,0x10},/*"請(qǐng)",10*/
{0x20,0x40,0x20,0xA0,0x21,0x10,0xFA,0x08,0x25,0xF6,0x40,0x00,0x53,0xC4,0x92,0x54,
0xFA,0x54,0x13,0xD4,0x1A,0x54,0xF2,0x54,0x53,0xD4,0x12,0x44,0x12,0x54,0x12,0xC8},/*"輸",11*/
{0x04,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,0x02,0x80,
0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,0x10,0x10,0x20,0x10,0x40,0x08,0x80,0x06},/*"入",12*/
{0x22,0x08,0x11,0x08,0x11,0x10,0x00,0x20,0x7F,0xFE,0x40,0x02,0x80,0x04,0x1F,0xE0,
0x00,0x40,0x01,0x80,0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x05,0x00,0x02,0x00},/*"學(xué)",13*/
{0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x00,0x00,0xFF,0xFE,
0x08,0x00,0x10,0x00,0x1F,0xF0,0x00,0x10,0x00,0x10,0x00,0x10,0x00,0xA0,0x00,0x40},/*"號(hào)",14*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00},/*":",15*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",16*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x7F,0xFC,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x11,0x00,0x11,0xF8,
0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0xFF,0xFE,0x00,0x00},/*"正",17*/
{0x00,0x40,0x00,0x40,0xFC,0x7C,0x10,0x84,0x11,0x08,0x22,0xFE,0x3C,0x92,0x64,0x92,
0x64,0xFE,0xA4,0x92,0x24,0x92,0x24,0xFE,0x3C,0x92,0x25,0x12,0x21,0x0A,0x02,0x04},/*"確",18*/
{0x21,0x10,0x21,0x10,0x39,0x10,0x27,0xFC,0x41,0x10,0x79,0x10,0xAF,0xFE,0x20,0x00,
0xFB,0xF8,0x22,0x08,0x22,0x08,0x23,0xF8,0x2A,0x08,0x32,0x08,0x23,0xF8,0x02,0x08},/*"錯(cuò)",19*/
{0x00,0x00,0x43,0xF8,0x22,0x08,0x22,0x08,0x03,0xF8,0x00,0x00,0xE0,0x00,0x27,0xFC,
0x20,0x40,0x20,0x40,0x2F,0xFE,0x20,0x40,0x28,0xA0,0x31,0x10,0x22,0x08,0x0C,0x06},/*"誤",20*/
};
uchar code SZ[][16]={
{0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00},/*"0",0*/
{0x00,0x00,0x00,0x08,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x3E,0x00,0x00},/*"1",1*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x02,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00},/*"2",2*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x02,0x04,0x18,0x04,0x02,0x42,0x42,0x3C,0x00,0x00},/*"3",3*/
{0x00,0x00,0x00,0x04,0x0C,0x0C,0x14,0x24,0x24,0x44,0x7F,0x04,0x04,0x1F,0x00,0x00},/*"4",4*/
{0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x78,0x44,0x02,0x02,0x42,0x44,0x38,0x00,0x00},/*"5",5*/
{0x00,0x00,0x00,0x18,0x24,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x22,0x1C,0x00,0x00},/*"6",6*/
{0x00,0x00,0x00,0x7E,0x42,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x00,0x00},/*"7",7*/
{0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00},/*"8",8*/
{0x00,0x00,0x00,0x38,0x44,0x42,0x42,0x42,0x46,0x3A,0x02,0x02,0x24,0x18,0x00,0x00},/*"9",9*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",10*/
{0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x00,0x00,0x00,0x00},/*"+",11*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*"-",12*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x24,0x18,0x18,0x18,0x24,0x6E,0x00,0x00},/*"x",13*/
{0x00,0x00,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x00},/*"/",14*/
{0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x00,0x00,0x00,0x00},/*"=",15*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00},/*"=",16*/
};
void delay(uint t) //延時(shí)函數(shù)
{
uint i,j;
for(i=0;i1;i++);
}
void Delay_xms(uint x)
{
uint i,j;
for(i=0;i1)
{
Tit_Now--;
display_SZ(3,0,SZ[Tit[(Tit_Now-1)*2]]);
display_SZ(3,1,SZ[Tit_Now+10]);
display_SZ(3,2,SZ[Tit[(Tit_Now-1)*2+1]]);
display_SZ(3,3,SZ[16]);
display_SZ(3,10,SZ[Tit_Now]);
display_SZ(3,4,SZ[Answer[Tit_Now-1]]);
}
}
}
else
{
h1=1;
h2=0;
if(l1==0 && h1==1 && h2==0 && l2==1 && l3==1 && l4==1 )//6
{
while(l1==0);
if(flag_mode == 0)
{
S_num = 4;
display_SZ(2,6,SZ[S_num]);
}else if(flag_mode == 1)
{
S_buff[S_wei] = 4;
display_SZ(2,S_wei,SZ[4]);
S_wei++;
}else if(flag_mode == 2)
{
Answer[Tit_Now-1] = 4;
display_SZ(3,4,SZ[4]);
}
}else if(l1==1 && h1==1 && h2==0 && l2==0 && l3==1 && l4==1 )//7
{
while(l2==0);
if(flag_mode == 1)
{
S_buff[S_wei] = 5;
display_SZ(2,S_wei,SZ[5]);
S_wei++;
}else if(flag_mode == 2)
{
Answer[Tit_Now-1] = 5;
display_SZ(3,4,SZ[5]);
}
}else if(l1==1 && h1==1 && h2==0 && l2==1 && l3==0 && l4==1)//8
{
while(l3==0);
if(flag_mode == 1)
{
S_buff[S_wei] = 6;
display_SZ(2,S_wei,SZ[6]);
S_wei++;
}else if(flag_mode == 2)
{
Answer[Tit_Now-1] = 6;
display_SZ(3,4,SZ[6]);
}
}else if(l1==1 && h1==1 && h2==0 && l2==1 && l3==1 && l4==0)//9
{
while(l4==0);
}else
{
h1=1;
h2=1;
h3=0;
if(l1==0 && h1==1 && h2==1 && h3==0 && l2==1 && l3==1 && l4==1)//11
{
while(l1==0);
if(flag_mode == 1)
{
S_buff[S_wei] = 7;
display_SZ(2,S_wei,SZ[7]);
S_wei++;
}else if(flag_mode == 2)
{
Answer[Tit_Now-1] = 7;
display_SZ(3,4,SZ[7]);
}
}else if(l1==1 && h1==1 && h2==1 && h3==0 && l2==0 && l3==1 && l4==1)//12
{
while(l2==0);
if(flag_mode == 1)
{
S_buff[S_wei] = 8;
display_SZ(2,S_wei,SZ[8]);
S_wei++;
}else if(flag_mode == 2)
{
Answer[Tit_Now-1] = 8;
display_SZ(3,4,SZ[8]);
}
}else if(l1==1 && h1==1 && h2==1 && h3==0 && l2==1 && l3==0 && l4==1)//13
{
while(l3==0);
if(flag_mode == 1)
{
S_buff[S_wei] = 9;
display_SZ(2,S_wei,SZ[9]);
S_wei++;
}else if(flag_mode == 2)
{
Answer[Tit_Now-1] = 9;
display_SZ(3,4,SZ[9]);
}
}else if(l1==1 && h1==1 && h2==1 && h3==0 && l2==1 && l3==1 && l4==0 )//14
{
while(l4==0);
if(flag_mode == 2)
{
if(Tit_Now5)
{
Tit_Now++;
display_SZ(3,0,SZ[Tit[(Tit_Now-1)*2]]);
display_SZ(3,1,SZ[Tit_Now+10]);
display_SZ(3,2,SZ[Tit[(Tit_Now-1)*2+1]]);
display_SZ(3,3,SZ[16]);
display_SZ(3,10,SZ[Tit_Now]);
display_SZ(3,4,SZ[Answer[Tit_Now-1]]);
}
}
}
else
{
h3=1;
h4=0;
if(l1==0 && h1==1 && h2==1 && h3==4 && l2==1 && l3==1 && l4==1)//11
{
while(l1==0);
if(flag_mode == 1)
{
S_wei = 0;
CLear_N(1);
CLear_N(2);
display_HZ(1,0,HZ0[4]);
display_HZ(1,1,HZ0[5]);
display_HZ(1,2,HZ0[6]);
display_HZ(1,3,HZ0[7]);
display_HZ(1,4,HZ0[8]);
display_HZ(1,5,HZ0[9]);
display_HZ(1,6,HZ0[15]);
flag_mode = 0;
}
}else if(l1==1 && h1==1 && h2==1 && h3==4 && l2==0 && l3==1 && l4==1)//12
{
while(l2==0);
if(flag_mode == 1)
{
S_buff[S_wei] = 0;
display_SZ(2,S_wei,SZ[0]);
S_wei++;
}
}else if(l1==1 && h1==1 && h2==1 && h3==4 && l2==1 && l3==0 && l4==1)//13
{
while(l3==0);
if(flag_mode==2)
{
SEND_A();
flag_mode = 3;
}
}else if(l1==1 && h1==1 && h2==1 && h3==4 && l2==1 && l3==1 && l4==0 )//14
{
while(l4==0);
if(flag_mode == 0)
{
flag_mode = 1;
display_HZ(1,0,HZ0[10]);
display_HZ(1,1,HZ0[11]);
display_HZ(1,2,HZ0[12]);
display_HZ(1,3,HZ0[13]);
display_HZ(1,4,HZ0[14]);
display_HZ(1,5,HZ0[15]);
display_HZ(1,6,HZ0[16]);
CLear_N(2);
}else if(flag_mode == 1)
{
SEND_X();
}
}
}
}
}
}
void main()
{
UsartInit(); // 串口初始化
init();
Delay_xms(10);
display_HZ(0,0,HZ0[0]);
display_HZ(0,2,HZ0[1]);
display_HZ(0,4,HZ0[2]);
display_HZ(0,6,HZ0[3]);
display_HZ(1,0,HZ0[4]);
display_HZ(1,1,HZ0[5]);
display_HZ(1,2,HZ0[6]);
display_HZ(1,3,HZ0[7]);
display_HZ(1,4,HZ0[8]);
display_HZ(1,5,HZ0[9]);
display_HZ(1,6,HZ0[15]);
//display_SZ(1,6,SZ[2]);
while(1)
{
KEY_Scan();
}
}
void Usart_rec() interrupt 4
{
unsigned char datt;
if(RI == 1)
{
RI=0;
datt=SBUF;//出去接收到的數(shù)據(jù)
if(R_mode == 1)
{
R_buff[R_wei] = datt;
Tit[R_wei] = datt;
R_wei++;
if(R_wei == 10)
{
R_wei = 0;
R_mode = 0;
Tit_Now = 1;
display_SZ(3,0,SZ[Tit[0]]);
display_SZ(3,1,SZ[11]);
display_SZ(3,2,SZ[Tit[1]]);
display_SZ(3,3,SZ[16]);
display_SZ(3,10,SZ[Tit_Now]);
flag_mode = 2;
}
}
if(datt == 'D')
{
display_HZ(2,4,HZ0[17]);
display_HZ(2,6,HZ0[18]);
}else if(datt == 'X')
{
display_HZ(2,4,HZ0[19]);
display_HZ(2,6,HZ0[20]);
}else if(datt == 'T')
{
R_mode = 1;
}
}
}
void Timer0() interrupt 1 //參考上圖 定時(shí)器1時(shí)為3
{
TH0=0XFC; //給定時(shí)器賦初值,定時(shí)1ms TH1
TL0=0X18; //TL1
dis_tim++;
if(dis_tim==1000)
{
dis_tim=0;
if(flag_mode == 2)
{
if(ALL_time!=0)
{
ALL_time -- ;
}else
{
SEND_A();
flag_mode = 3;
}
display_SZ(3,13,SZ[ALL_time/10]);
display_SZ(3,14,SZ[ALL_time%10]);
}
}
}
審核編輯:湯梓紅
-
單片機(jī)
+關(guān)注
關(guān)注
6035文章
44554瀏覽量
634633 -
Proteus
+關(guān)注
關(guān)注
79文章
1692瀏覽量
106515 -
服務(wù)器
+關(guān)注
關(guān)注
12文章
9123瀏覽量
85324 -
仿真系統(tǒng)
+關(guān)注
關(guān)注
1文章
97瀏覽量
20650
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論