完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
`#include #include #define uchar unsigned char #define uint unsigned int ***it k1=P3^0; ***it k3=P3^2; ***it k4=P3^3; ***it LCD_RS = P2^6; ***it LCD_RW = P2^5; ***it LCD_EN = P2^7; ***it maibo = P3^1; ***it Buzz = P1^5; uchar code dis1[] = {" Welcome!!! "}; uchar code dis2[] = {"Maibo Ceshi"}; uchar code dis3[] = {" Start Testing? "}; uchar code dis4[] = {" (1)Yes (2)No "}; uchar code dis5[] = {"Please Wait!!"}; uchar code dis6[] = {"xintiao: "}; uchar code disk7[]={"maibo normal"}; uchar code disk8[]={"maibo abnormal"}; uchar test_jieguo[16] = {" "}; uint xintiao; uint time; uchar tt; void delay(uint z) { uchar x,y; for(x=0;x } bit LCD_busy() { uint jg; LCD_RS = 0; LCD_RW = 1; LCD_EN = 1; delay(10); jg=(uint)(P0&0x80); LCD_EN = 0; return jg; } void write_mingling(uchar cmd) { while(LCD_busy()); LCD_RS = 0; LCD_RW = 0; LCD_EN = 0; delay(10); P0=cmd; delay(10); LCD_EN = 1; delay(10); LCD_EN = 0; delay(100); } void write_data(uchar dat) { while(LCD_busy()); LCD_RS = 1; LCD_RW = 0; LCD_EN = 0; delay(10); P0=dat; delay(10); LCD_EN = 1; delay(10); LCD_EN = 0; delay(100); } void LCD_init() { write_mingling(0x38); write_mingling(0x38); write_mingling(0x0c); write_mingling(0x0c); write_mingling(0x06); write_mingling(0x01); write_mingling(0x80); } void LCD_dingwei(uint hang,uint lie) { uchar wei; wei=0x80|(uchar)(0x40*(hang-1)+(lie-1)); write_mingling(wei); } void LCD_xianshi(uchar dis[]) { uchar i,arra; for(i=0;i<16;i++) { arra=dis[i]; if(arra==' |
