• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   1 Anonymous Users






Re: 讀取eeprom內資料並顯示於LCD上
#2
版主
版主


查看用戶資訊
這程式是 W401 練習六的程式,程式沒有問題的。請檢查一下 hyper-Terminal 是否有自 RS-232 送出資料到 PIC18F452, 要用示波器檢查一下是否有收到 UART 的訊號?

設個斷點在 UART 的接收中斷程式裡,看看是否正常接收?

發表於: 2009/1/14 13:55
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


讀取eeprom內資料並顯示於LCD上
#1
新會員
新會員


查看用戶資訊
小弟是使用p18f452試了幾天還是一直無法在LCD上顯示,鍵盤輸入的數字,主要是在鍵盤上輸入四個以上至十個以下的數字,每輸入一個數字後即存入EEPROM內,確定輸入完畢後按下Enter,需顯示輸入的數字於LCD顯示器上。(問題:測試過LCD無法顯示出任何數字),不知道程式方面還需要修改哪些,jump10 1-2接、3-4接,jump9皆斷

const rom char LCD_MSG1[]="Waiting Data Now!";
const rom char LCD_MSG2[]="-Display EEPROM- ";

const rom far char Disp_Msg1[]="Please Enter your Number :";
const rom far char Disp_Msg2[]="EEPROM WRITE is completed!";
const rom far char Disp_Msg3[]="\aError! Please enter again:";
const rom far char Disp_Msg4[]="\aYou must get 4 Digials at least! ";
const rom far char Disp_Msg5[]="Completed to save your Number!";

main program

void main(void)
{

InitializePORT( );
InitializeTMR2( );
OpenLCD( );
Initialize_I2C_Master( );
InitializeINTs( );
InitializeUSART( );
Display_Terminal(Disp_Msg1);
LCD_Set_Cursor(0,0);
putrsLCD(LCD_MSG1);
Rec_Data=0x00;
EE_Addr=0; // Set EEPROM start address = 0

do
{
while(Rec_Data==0x00);
if (isdigit(Rec_Data ))
{
f=EEByteWrite (0xA0,EE_Addr,Rec_Data);
f=EEAckPolling(0xA0);
EE_Addr++;
Rec_Data=0x00;
Display_Terminal(Disp_Msg2);
}
else if (Rec_Data!=0x0D)
{
Display_Terminal(Disp_Msg3);
Rec_Data=0x00;
}
else if (EE_Addr<Min_Langth)
{
Display_Terminal(Disp_Msg4);
Rec_Data=0x00;
}
} while ((EE_Addr<10) && ((Rec_Data!=0x0d)||(EE_Addr<Min_Langth)));
{
Rec_Data=NULL;
f=EEByteWrite (0xA0,EE_Addr,Rec_Data);
f=EEAckPolling(0xA0);
Display_Terminal(Disp_Msg5);
}
LCD_Set_Cursor(0,0);
putrsLCD(LCD_MSG2);
LCD_Set_Cursor(1,0);
j=0;

while(1)
{
EE_Read_Data.l = EERandomRead(0xA0,j);
if (EE_Read_Data.i[0]!=NULL)
{
WriteDataLCD(EE_Read_Data.i[0]);
j++;
}
else break;
}
while(1);
}

請各位高手大大,能幫幫小弟我,謝謝。

發表於: 2009/1/12 17:23
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------