11-06-2013, 12:32 PM | #22 |
Nhập môn đệ tử
Tham gia ngày: Apr 2012
Bài gửi: 5
: |
#include <16f877a.h>
#FUSES HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT //#use i2c(Master,slow,sda=PIN_C4,scl=PIN_C3)//toc do 100kb slow #use Delay(clock=20000000) //#include "lcd 8bit.h" //#define Mode PIN_A3 //#define Up PIN_A2 //#define Down PIN_A1 //#define Setup PIN_A0 /* int8 value=0,value_display=1,value_VC_front=7,value_VC_ rear=7, value_Tr=5,value_Md=3,value_Bas=1, value_Ce=7,value_Sub=8, value_Mt,value_1db,value_10db, value_B=158,value_M=172,value_T=186, value_FL=24,value_FR=40,value_RR=88,value_RL=72, value_C=56,value_SW=104;// */ int8 value, value_display, value_VC_front, value_VC_rear, value_Tr,value_Md,value_Bas, value_Ce,value_Sub, value_Mt,value_1db,value_10db, value_B,value_M,value_T, value_FL,value_FR,value_RR,value_RL, value_C,value_SW;// void Write_EE() { Write_EEPROM(0x00,40); //value_Mt=40 Write_EEPROM(0x01,217); //value_1db=217 Write_EEPROM(0x02,227); //value_10db=227 Write_EEPROM(0x03,158); //value_B=158 Write_EEPROM(0x04,1); //value_Bas=1, Write_EEPROM(0x05,172); //value_M=172 Write_EEPROM(0x06,3); //value_Md=3 Write_EEPROM(0x07,186); //value_T=186 Write_EEPROM(0x08,5); //value_Tr=5 Write_EEPROM(0x09,7); //value_VC_front=7 Write_EEPROM(0x10,24); //value_FL=24 Write_EEPROM(0x11,40); //value_FR=40 Write_EEPROM(0x12,7); //value_VC_rear=7 Write_EEPROM(0x13,72); //value_RL=72 Write_EEPROM(0x14,88); //value_RR=88 Write_EEPROM(0x15,7); //value_Ce=7 Write_EEPROM(0x16,56); //value_C=56 Write_EEPROM(0x17,104); //value_SW=104 Write_EEPROM(0x18,8); //value_Sub=8 } void Read_EE() { value_Mt= Read_EEPROM(0x00); value_1db= Read_EEPROM(0x01); value_10db= Read_EEPROM(0x02); value_B= Read_EEPROM(0x03); value_Bas= Read_EEPROM(0x04); value_M= Read_EEPROM(0x05); value_Md= Read_EEPROM(0x06); value_T= Read_EEPROM(0x07); value_Tr= Read_EEPROM(0x08); value_VC_front= Read_EEPROM(0x09); value_FL= Read_EEPROM(0x10); value_FR= Read_EEPROM(0x11); value_VC_rear= Read_EEPROM(0x12); value_RL= Read_EEPROM(0x13); value_RR= Read_EEPROM(0x14); value_Ce= Read_EEPROM(0x15); value_C= Read_EEPROM(0x16); value_SW= Read_EEPROM(0x17); value_sub= Read_EEPROM(0x18); } ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// void main() { Write_EE(); //Read_EE(); while(1) {/* if(!input(Mode)) {while(!input(Mode)); value_Mt= Read_EEPROM(0x00); Lcd_gotoxy(0x80); printf(lcd_putchar,"%u",value_Mt); } if(!input(Up)) {while(!input(Up)); value_VC_front= Read_EEPROM(0x02); Lcd_gotoxy(0x40); printf(lcd_putchar,"%u",value_10db); } */ } } Chào các bạn. Mình có đoạn code ghi các giá trị vào eeprom. Sau khi nạp xong mình đọc lại bằng pickit2 thì tại địa chỉ 0x00 nó không ghi đúng giá trị mình đặt, mình có thử ghi lại tại địa chỉ khác cũng không được. Mong các bạn giúp đỡ. Thanks. |
|
|