|
|
#include "at89x51.h" #define uchar unsigned char #define uint unsigned int uint a_100; uchar bai,shi,ge; sbit RS=P3^0; sbit RW=P3^1; sbit E=P3^5; sbit P17=P1^7; sbit P27=P2^7; sbit start=P3^6; sbit OE=P3^7; sbit EOC=P3^2; sbit P20=P2^0; uchar code disp[]={"welcome to use"}; delay () { uchar i,j; for (i=0;i<5;i++) for (j=0;j<50;j++); } wr_order (uchar h) { E=0; RS=0; RW=0; P1=h; E=1; E=0; } wr_data (uchar h) { E=0; RS=1; RW=0; P1=h; E=1; E=0; } busy () { flag: E=0; RS=0; RW=1; P1=0xff; E=1; if (P17==0) return; else goto flag; } LCD_start() { busy (); wr_order (0x01); busy (); wr_order (0x0c); busy (); wr_order (0x38); } wlcome () { uchar i; busy (); wr_order (0x00+0x80); for (i=0;i<50;i++) { busy (); wr_data (disp[i]); if (disp[i]=='\0') break; } } BCD_data() { uchar j; a_100=a_100*100; a_100=a_100/51; j=a_100/100; bai=j+48; j=a_100%100/10; shi=j+48; j=a_100%10; ge= j+48; } uchar BCD () { uchar ad; OE=1; start=1; start=0; start=1; while(EOC); OE=0; ad=P0; OE=1; delay (); return ad; } xianshi () { busy (); wr_order (0x40+0x80); busy (); wr_data (bai); busy (); wr_data ('.'); busy (); wr_data (shi); busy (); wr_data (ge); busy (); wr_data ('v'); } main () { LCD_start (); wlcome (); while(1) { a_100=BCD (); BCD_data (); xianshi (); } } 數值不匹配 請問我那出錯了 |
| 想學習 |
| 支持支持 |
| 好東西啊 學些學習 |
| 學習學習! |
學習學習![]() ![]() ![]() |
|
很好,只是仿真中只有一個volts的值 |
| 過來看看 |
| 學習學習~ |
| 正是我想要的 |
| 學習學習 |
|
學習學習 |
|
你好 可以留個QQ請教問題嗎 |
| 來學習啦,嘿嘿 |
| 來學習啦 |
| 我來學習學習 |