1 / 32

EEPROM

EEPROM. 下載. eerom-key led.rar. eerom.c 相關副程式. oid EePROM_INIT(void); // EEPROM 24LC256 初始化 void EePROM_chip_select(unsigned long,unsigned char); // set control_byte "read/write" unsigned char EePROM_read_1byte(void); // read_1byte

Download Presentation

EEPROM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EEPROM

  2. 下載 • eerom-key led.rar

  3. eerom.c相關副程式 • oid EePROM_INIT(void); // EEPROM 24LC256 初始化 • void EePROM_chip_select(unsigned long,unsigned char); // set control_byte "read/write" • unsigned char EePROM_read_1byte(void); // read_1byte • unsigned char EePROM_write_startaddr(unsigned long); // write control_byte • unsigned char EePROM_write_1byte(unsigned char); // write_1byte • unsigned char EePROM_ack(void); // ack • void EePROM_S(void); // start signal • void EePROM_P(void); // stop signal

  4. 寫入1 byte至EEPROM • EePROM_wword_1b(k,data[k]); • K:address • Data:data[k]

  5. 由EEPROM讀取1 byte • EePROM_rword_1b(i) • i:address • Return:data

  6. 應用讀取EEPROM副程式 • for(i=0; i<0x1000; i++) • { • while (getkey() == 0xff ); • // { • // key = (char)getkey(); • // switch(key){ • // case • // } • P9OUT = numTAB[ EePROM_rword_1b(i)%16]; • P7OUT = numTAB[ (EePROM_rword_1b(i)/16)%16]; • for(k=0; k<2000; k++); • while (getkey() != 0xff ); • } • }

  7. 顯示讀取EEPROM資料到LED • P9OUT = numTAB[ EePROM_rword_1b(i)%16]; • P7OUT = numTAB[ (EePROM_rword_1b(i)/16)%16];

  8. 應用寫入副程式 • /* • for(k=0; k<0x1000; k++) • { • EePROM_wword_1b(k, k); • } • */

  9. 刪除/*與*/(啟用應用寫入副程式) • for(k=0; k<0x1000; k++) • { • EePROM_wword_1b(k, k); • }

  10. 應用寫入副程式 • for(k=0; k<0x1000; k++) • { • EePROM_wword_1b(k, k); • }

  11. 應用寫入副程式 • for(k=0; k<0x1000; k++) • { • EePROM_wword_1b(k, 0xff-(k%256)); • }

  12. 應用寫入副程式存中文字型 • for(k=0; k<216; k++) • { • EePROM_wword_1b(k,name[k]); • }

  13. 應用寫入副程式存中文字型 • for(k=0; k<216; k++) • { • EePROM_wword_1b(k,name[k]); • } 0000 中文字型 1000

  14. 應用寫入副程式存英文字型 0000 • int n; • for(n=0; n<0x50; n++) • for(k=0; k<5; k++) • { • EePROM_wword_1b(0x1000+n*5+k,font[n][k]); • } 中文字型 1000 英文字型

  15. 將中文字型加入

  16. 將英文字型加入

  17. 檢查

  18. 檢查英文字型是否加入 • for(i=0; i<0x1000; i++) • { • while (getkey() == 0xff ); • P9OUT = numTAB[ EePROM_rword_1b(0x1000+i)%16]; • P7OUT = numTAB[ (EePROM_rword_1b(0x1000+i)/16)%16]; • for(k=0; k<2000; k++); • while (getkey() != 0xff ); • } • }

  19. 下載 • eeprom-show-lcm.rar

  20. 刪除0x216(修改英文顯示) • void one_text(char ascii) • { • char j; • write_lcm_data(0x00); • for(j=0;j<5;j++) //display一字 8x5 • { • write_lcm_data(EePROM_rword_1b(0x1000+0x216+ascii*5+j)); • } • }

  21. 刪除//,修改紅字為6(顯示數字) • //write_one_text(1,1, 0xd); • //write_one_text(2,2, 0xd); • //write_one_text(3,3, 0xd); • //write_one_text(4,4, 0xd); • //write_one_text(5,5, 0xd); • //write_one_text(6,6, 0xd); • write_one_chinese(0,0,0); • write_one_chinese(0,1,1); • write_one_chinese(0,2,2);

  22. 下載 • 4619-lcm-text-chinese.rar

  23. 顯示學號姓名程式 • 在該程式資料夾中加入eerom.c檔案 • 在該程式資料夾中加入eerom.h檔案

  24. 在main檔案開頭加入

  25. 從這裡開始是改你的顯示學號姓名副程式

  26. write_lcm_data(font[ascii][j]); //write text • write_lcm_data(EePROM_rword_1b(0x1000+ascii*5+j) ); • 0x1000+ascii*5+j

  27. 修改one_text副程式

  28. 去除write_lcm_data(font[ascii][j]); • for(j=0;j<5;j++) //display一字 8x5 • { • //read text data=font[字的位置][第一筆資料],字的位置=page[第幾頁][第幾個字] • write_lcm_data(font[ascii][j]); //write text • write_lcm_data(EePROM_rword_1b(0x1000+ascii*5+j) ); }

  29. 修改write_one_chinese副程式

  30. 去除write_lcm_data(name[data*72+j]); • 改為 • write_lcm_data(EePROM_rword_1b(0x1000+data*72+j) );

  31. 初始化port 5

  32. 改完之後刪除font.c檔案 • 改完之後刪除font.c檔案 • 刪除name[216]={ } • 仍能正常顯示

More Related