Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 4th December 2003, 02:47 AM   (permalink)
Default Using Internal Data EEPROM on PIC16F877

Hi everyone

I am trying too load the internal Data EEPROM on my PIC and it doesn't seem too be working. Can someone take a look at my code and tell me if it look ok or if you might see any problems

Thanks

Lee

P.S.
I have the data and address all ready loaded in ADDR and Temp_Data before calling the Proc.

Write_EEPROM

BSF STATUS, RP1
BSF STATUS, RP0 ;Bank 3
BTFSC EECON1, WR ;Wait for write to finish
GOTO $-1

BCF STATUS, RP0 ;Bank 0 ( ADDR at Bank 0)
BCF STATUS, RP1
MOVF ADDR, W ;Address to write to
BSF STATUS, RP1 ;Bank 2
MOVWF EEADR ;Save Address

BCF STATUS,RP1;Bank 0 ( Temp data at Bank0 )
MOVF Temp_Data, W ;Data to write
BSF STATUS,RP1 ;Bank 2
MOVWF EEDATA ;Save Data

BSF STATUS, RP0 ;Bank 3
BCF EECON1, EEPGD ;Point to Data memory
BSF EECON1, WREN ;Enable writes

MOVLW 0x55 ;Write 55h to EECON2
MOVWF EECON2
MOVLW 0xAA ;Write AAh to EECON2
MOVWF EECON2
BSF EECON1, WR ;Start write operation

BCF EECON1, WREN ;Disable writes

BCF STATUS,RP0 ;Bank 0
BCF STATUS,RP1

return
lee_man_tbu is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 04:24 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker