keil编程 确实函数原型 我这个要怎么声明? 50
#include<reg51.h>#include<LCD1602.h>#defineucharunsignedchar#defineuintunsignedintuch...
#include<reg51.h>
#include<LCD1602.h>
#define uchar unsigned char
#define uint unsigned int
uchar int_time; uchar second;uchar minute;uchar hour;uchar code date[]="H.I.T.CHINA";uchar code time[]="TIME 23:59:55";uchar second=55,minute=59,hour=23;void clock_init(){ uchar i,j; for(i=0;i<16;i++) { write_data(date[i]); } write_com(0x80+0x40); for(j=0;j<16;j++) { write_data(time[j]); }}void clock_write(uint s,uint m,uint h){ write_sfm(0x47,h); write_sfm(0x4a,m); write_sfm(0x4d,s);}void main(){ init1602(); clock_init(); TMOD=0x01; EA=1; ET0=1; TH0=(65536-46483)/256; TL0=(65536-46483)%256; TR0=1; int_time=0; second=55; minute=59; hour=23; while(1) { clock_write(second,minute,hour); }}
void T0_interserve(void) interrupt 1 using 1
{ int_time++; if(int_time==20) { int_time=0; second++; } if(second==60) { second=0; minute++; } if(minute==60) { minute=0; hour++; } if(hour==0) { hour=0; } TH0=(65536-46038)/256; TL0=(65536-46038)%256;} 展开
#include<LCD1602.h>
#define uchar unsigned char
#define uint unsigned int
uchar int_time; uchar second;uchar minute;uchar hour;uchar code date[]="H.I.T.CHINA";uchar code time[]="TIME 23:59:55";uchar second=55,minute=59,hour=23;void clock_init(){ uchar i,j; for(i=0;i<16;i++) { write_data(date[i]); } write_com(0x80+0x40); for(j=0;j<16;j++) { write_data(time[j]); }}void clock_write(uint s,uint m,uint h){ write_sfm(0x47,h); write_sfm(0x4a,m); write_sfm(0x4d,s);}void main(){ init1602(); clock_init(); TMOD=0x01; EA=1; ET0=1; TH0=(65536-46483)/256; TL0=(65536-46483)%256; TR0=1; int_time=0; second=55; minute=59; hour=23; while(1) { clock_write(second,minute,hour); }}
void T0_interserve(void) interrupt 1 using 1
{ int_time++; if(int_time==20) { int_time=0; second++; } if(second==60) { second=0; minute++; } if(minute==60) { minute=0; hour++; } if(hour==0) { hour=0; } TH0=(65536-46038)/256; TL0=(65536-46038)%256;} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询