用的是AT89C51单片机,程序是在网上搜的,不知道哪里错了,请各位指导,拜托了
#include<reg52.h>
#include<stdlib.h>
#include<stdio.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
uint num,A_num,x,y=0;
uint h,m,s,year=2020,month=7,day=4,lcd_x=0,lcd_y=0;
uchar code Zifu[]="0123456789";
sbit LCD_EN = P3^4;
sbit LCD_RS = P3^5;
sbit key_A = P1^0;
sbit key_B = P1^1;
sbit key_C = P1^2;
sbit key_D = P1^3;
void delay_1ms(uchar x){
uchar i,j;
for(j=0;j<x;j++)
for(i=0;i<110;i++);
}
void write_command(uchar command){
LCD_RS = 0;
LCD_EN = 0;
P0 = command;
delay_1ms(2);
LCD_EN = 1; //EN ?1 -- 0 ?? ???? ? ??
delay_1ms(2);
LCD_EN = 0;
}
void write_data(uchar fuck){
LCD_RS = 1;
LCD_EN = 0;
P0 = fuck;
delay_1ms(2);
LCD_EN = 1;
delay_1ms(2);
LCD_EN = 0;
}
void lcd_post(int X,int Y){ //0,1?? ??? ? ???
write_command(0x80+X*(0x40)+Y);
}
void init(){
h=m=s=0;
num=A_num=0;
LCD_EN=0;
write_command(0x38);
write_command(0x0c);
//write_command(0x06); //??????????
write_command(0x01);
TMOD = 0x02;
TH0 = 6;
TL0 = 6;
EA = 1;
ET0 = 1;
TR0 = 1;
/*???*/
lcd_post(0,0); write_data(Zifu[h/10]);
lcd_post(0,1); write_data(Zifu[h%10]);
lcd_post(0,2); write_data(':');
lcd_post(0,3); write_data(Zifu[m/10]);
lcd_post(0,4); write_data(Zifu[m%10]);
lcd_post(0,5); write_data(':');
lcd_post(0,6); write_data(Zifu[s/10]);
lcd_post(0,7); write_data(Zifu[s%10]);
/*???*/
lcd_post(1,6); write_data(Zifu[year/1000]);
lcd_post(1,7); write_data(Zifu[(year%1000)/100]);
lcd_post(1,8); write_data(Zifu[(year%100)/10]);
lcd_post(1,9); write_data(Zifu[year%10]);
lcd_post(1,10); write_data('-');
lcd_post(1,11); write_data(Zifu[month/10]);
lcd_post(1,12); write_data(Zifu[month%10]);
lcd_post(1,13); write_data('-');
lcd_post(1,14); write_data(Zifu[day/10]);
lcd_post(1,15); write_data(Zifu[day%10]);
}
void keyscan(){
if(key_A==0){
delay_1ms(3);
if(key_A==0){
m=(++m)%60;
lcd_post(0,3); write_data(Zifu[m/10]);
lcd_post(0,4); write_data(Zifu[m%10]);
while(!key_A);
}
}
if(key_B==0){
delay_1ms(3);
if(key_B==0){
h=(++h)%24;
lcd_post(0,0); write_data(Zifu[h/10]);
lcd_post(0,1); write_data(Zifu[h%10]);
while(!key_B);
}
}
}
void main()
{
init();
y = 0;
while(1){
if(key_D==0){
delay_1ms(3);
if(key_D==0){
y = 1;
}
while(!key_D);
}
if(key_C==0){
delay_1ms(3);
if(key_C==0){
y = 0;
}
while(!key_C);
}
if(num==3686){
num=0;
s++;
if(s==60){
s=0;
m++;
if(m==60){
m=0;
h++;
if(h==24)h=0;
lcd_post(0,0); write_data(Zifu[h/10]);
lcd_post(0,1); write_data(Zifu[h%10]);
}
lcd_post(0,3); write_data(Zifu[m/10]);
lcd_post(0,4); write_data(Zifu[m%10]);
}
lcd_post(0,6); write_data(Zifu[s/10]);
lcd_post(0,7); write_data(Zifu[s%10]);
}
if(y == 1)
{
keyscan();
}
}
}
void T0_time() interrupt 1
{
num++;
}
// if(key_A==0){ //??????
// delay_1ms(3);
// if(key_A==0){
// }
// while(!key_A);
// }
错误如下:
assembling dianzishizhongdesheji.asm...
D:\单片机\C51\INC\REG52.H(13): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(14): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(15): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(16): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(17): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(18): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(19): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(20): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(21): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(22): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(23): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(24): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(25): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(26): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(27): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(28): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(29): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(30): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(31): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(32): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(33): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(45): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(46): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(47): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(48): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(49): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(50): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(51): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(54): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(55): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(56): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(57): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(58): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(59): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(60): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(61): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(64): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(66): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(67): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(68): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(69): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(70): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(74): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(75): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(76): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(77): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(78): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(81): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(82): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(83): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(84): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(85): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(86): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(87): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(88): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(91): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(92): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(93): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(94): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(95): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(96): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(97): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\REG52.H(98): error A10: ATTEMPT TO DEFINE AN ALREADY DEFINED SYMBOL
D:\单片机\C51\INC\STDLIB.H(14): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(23): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(31): error A68: UNKNOWN CONTROL OR BAD ARGUMENT(S)
D:\单片机\C51\INC\STDLIB.H(33): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(34): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(36): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(37): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(38): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(39): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(40): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(42): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(43): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(44): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(48): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(49): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(50): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(51): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDLIB.H(52): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(26): error A68: UNKNOWN CONTROL OR BAD ARGUMENT(S)
D:\单片机\C51\INC\STDIO.H(27): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(28): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(29): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(30): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(31): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(32): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(33): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(34): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(35): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(36): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(37): error A9: SYNTAX ERROR
D:\单片机\C51\INC\STDIO.H(38): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(12): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(13): error A50: BIT-ADDRESS EXPECTED
D:\单片机\C51\INC\INTRINS.H(14): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(15): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(16): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(17): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(18): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(19): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(20): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(21): error A9: SYNTAX ERROR
D:\单片机\C51\INC\INTRINS.H(22): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(8): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(9): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(11): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(11): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(11): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(23): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(23): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(24): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(25): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(26): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(27): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(29): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(29): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(30): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(31): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(32): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(33): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(34): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(35): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(36): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(37): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(39): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(39): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(40): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(41): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(42): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(43): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(44): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(45): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(46): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(47): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(49): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(49): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(50): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(51): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(53): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(53): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(54): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(55): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(57): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(58): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(59): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(61): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(63): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(64): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(65): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(66): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(67): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(68): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(71): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(72): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(74): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(76): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(77): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(79): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(81): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(82): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(85): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(86): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(87): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(88): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(90): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(92): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(93): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(95): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(97): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(98): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(99): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(102): error A9: SYNTAX ERROR
dianzishizhongdesheji.asm(102): error A3: ILLEGAL CHARACTER
dianzishizhongdesheji.asm(200): error A56: UNBALANCED IF-ENDIF CONTROLS
dianzishizhongdesheji.asm(200): warning A41: MISSING 'END' STATEMENT
dianzishizhongdesheji.asm - 177 Error(s), 1 Warning(s).
|