LCD測試問題

看板ASM (組合語言)作者 (不彥其煩)時間15年前 (2010/09/30 23:47), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/2 (看更多)
小弟我寫了一個LCD測試的程式碼,主要是為了測試LCD能否正常運作,結果經過測試, LCD完全沒有動靜,硬體的部分也有用電錶測量過,LCD有電壓,所以不太清楚是軟體硬 體哪裡出了問題,希望各位大大幫我看一下,話不多說,奉上程式碼,小地不才,寫得 不好請見諒! #include <AT89X52.h> #include <stdio.h> sbit RS =P1^1; sbit RW =P1^0; sbit Enable =P1^2; void delay(void); void InitialLCD(void); void WriteIns(char); void WriteData(char); void WriteString(char,char *); void CheckBusy(void); char one=0; char zero=0; int KeyData=0xff; int KeyTemp=0xff; main() { char MSG0[]="0123456789"; InitialLCD(); WriteString(10,MSG0); } /* main */ void InitialLCD(void) { WriteIns(0x38); WriteIns(0x38); WriteIns(0x38); WriteIns(0x38); WriteIns(0x08); /* off display */ WriteIns(0x01); /* clear buffer */ WriteIns(0x0e); /* on display */ WriteIns(0x06); /* set input mode */ } /* InitialLCD */ void WriteIns(char instruction) { RS=0; RW=0; Enable=1; P1=instruction; Enable=0; CheckBusy(); } /* WriteIns */ void WriteData(char i) { RS=1; RW=0; Enable=1; P1=i; Enable=0; CheckBusy(); } /* WriteData */ void WriteString(count,MSG) char count; char MSG[]; { char i; for(i=0;i<count;i++) WriteData(MSG[i]); } /* WriteString */ void CheckBusy(void) { char i=0x80; while(i&0x80) { RS=0; RW=1; Enable=1; i=P1; Enable=0; delay(); } } /* CheckBusy */ void delay(void) { int i; for(i=0;i<500;i++) ; } /* delay */ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.248.7.77

10/01 00:07, , 1F
LCD動作很慢的,你看清楚那個範例的INIT程式.DELAY很久喔
10/01 00:07, 1F

10/01 11:52, , 2F
好低 那我在試試看先!
10/01 11:52, 2F
文章代碼(AID): #1CfB44Js (ASM)
討論串 (同標題文章)
以下文章回應了本文
7
28
完整討論串 (本文為第 1 之 2 篇):
7
28
1
2
文章代碼(AID): #1CfB44Js (ASM)