jr们帮我看看这个代码
#include#define uchar unsigned char#define uint unsigned intsbit KEY1 = P3^1; sbit KEY2 = P3^0;sbit KEY3 = P3^2;sbit BEEP=P2^5;uchar buzzer_count = 0;uchar total_seconds = 60;uchar hour=0,min=0,sec=0;uchar tab[8] = {0x3f,0x3f,0x40,0x3f,0x3f,0x40,0x3f,0x3f};uchar code table[11] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};uchar code LED_W[8] = {0x1c,0x18,0x14,0x10,0x0c,0x08,0x04,0x00};uchar Count=0;void tran(); void scan(); void key();void Delay(uint i) {uint x,j;for(j=0;j 0) { sec = total_seconds % 60; min = total_seconds / 60; if (sec == 0 && min > 0) { sec = 59; min--; if (min == 0 && hour > 0) { min = 59; hour--; } } else { sec--; } tab[0] = table[hour / 10]; tab[1] = table[hour % 10]; tab[3] = table[min / 10]; tab[4] = table[min % 10]; tab[6] = table[sec / 10]; tab[7] = table[sec % 10]; total_seconds = hour * 3600 + min * 60 + sec; }} void scan(){ uchar k; for(k=0;k=100) { i++; Count=0; tran(); } scan(); key(); if(sec==0&&min==0&&hour==0) { Delay(5); BEEP=!BEEP; }} }这个代码的独立按键按下数码管会乱码为什么
jr们帮我看看这个代码
#include#define uchar unsigned char#define uint unsigned intsbit KEY1 = P3^1; sbit KEY2 = P3^0;sbit KEY3 = P3^2;sbit BEEP=P2^5;uchar buzzer_count = 0;uchar total_seconds = 60;uchar hour=0,min=0,sec=0;uchar tab[8] = {0x3f,0x3f,0x40,0x3f,0x3f,0x40,0x3f,0x3f};uchar code table[11] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00};uchar code LED_W[8] = {0x1c,0x18,0x14,0x10,0x0c,0x08,0x04,0x00};uchar Count=0;void tran(); void scan(); void key();void Delay(uint i) {uint x,j;for(j=0;j 0) { sec = total_seconds % 60; min = total_seconds / 60; if (sec == 0 && min > 0) { sec = 59; min--; if (min == 0 && hour > 0) { min = 59; hour--; } } else { sec--; } tab[0] = table[hour / 10]; tab[1] = table[hour % 10]; tab[3] = table[min / 10]; tab[4] = table[min % 10]; tab[6] = table[sec / 10]; tab[7] = table[sec % 10]; total_seconds = hour * 3600 + min * 60 + sec; }} void scan(){ uchar k; for(k=0;k=100) { i++; Count=0; tran(); } scan(); key(); if(sec==0&&min==0&&hour==0) { Delay(5); BEEP=!BEEP; }} }这个代码的独立按键按下数码管会乱码为什么