Re: EEPROM的問題,我想使用0x100~0x3ff的位址。謝謝!
|
||||
---|---|---|---|---|
版主
|
可以的,直接填16進制的值應該比較好吧!
發表於: 2007/6/10 22:21
|
|||
|
Re: EEPROM的問題,我想使用0x100~0x3ff的位址。謝謝!
|
||||
---|---|---|---|---|
中級會員
|
不好意思~
請問我這樣算高位元及低位元的方法是對的嗎? 例如:0x3FF=1023 所以 1023/256=3(填入EEADRH) 1023%256=255(填入EEADR) EEADRH=3; EEADR=255; 謝謝~
發表於: 2007/6/10 0:11
|
|||
|
EEPROM的問題,我想使用0x100~0x3ff的位址。謝謝!
|
||||
---|---|---|---|---|
中級會員
|
下面這2個函試是我在範例程式抓來使用的。
我在寫入跟讀取的Address都只能使用到0xff 但是我使用的18f8722有1Kbytes的eeprom(0x00~0x3ff) 請問我要如何使用0xff之後的位址呢? 我都是這樣寫的: EE_Write(0xff,mydata); 也就是EE_Write(0x00~0xff,mydata); 都可以正常的使用 但是EE_Write(0x100~0x3ff,mydata); 只要超過了0xff都只會寫到0xff的位址中。 請問應該要怎麼寫,才能寫到0x100~0x3ff中呢? 謝謝~ void EE_Write (unsigned char EE_Address, unsigned char EE_Data) { PIR2bits.EEIF = 0; EEADR = EE_Address; EEDATA = EE_Data; EECON1bits.EEPGD = 0; EECON1bits.WREN = 1; INTCONbits.GIE = 0; _asm MOVLW 0X55 MOVWF EECON2,0 MOVLW 0XAA MOVWF EECON2,0 BSF EECON1,1,0 _endasm INTCONbits.GIE = 1; while (!PIR2bits.EEIF); PIR2bits.EEIF = 0; EECON1bits.WREN = 0; } unsigned char EE_Read (unsigned char EE_Address) { EEADR = EE_Address; EECON1bits.EEPGD = 0; EECON1bits.RD = 1; return EEDATA; }
發表於: 2007/6/8 20:12
|
|||
|