----- Original Message -----From: SashaSent: Wednesday, November 14, 2007 9:13 PMSubject: [piclist] Writing to PIC16F626 EEPROMDears,
I need help on a code to write to the PIC16F628 EEPROM.
I should write decimal '11' in the first two bytes of the EEPROM
address.
I have tried a sample code but I need confirmation of the Interrupt
controls EEIF and EEIE have and where to put them; main program or
in the Interrupt Service Routine program.
BSF STATUS,RP0 ;select bank1
MOVLW 0x00 ;EEPROM address
MOVWF EEADR
MOVF 0x01,w ;EEPROM Data
MOVWF EEDATA
BSF EECON1,wren ;enable write
BCF INTCON, GIE ;Disable interrupts
MOVLW 0x55 ;unlock codes sequence
MOVWF EECON2
MOVLW 0xaa
MOVWF EECON2
BSF EECON1,WR ;write begins
SRE1: BTFSC EECON1,WR ;wait for "write" to complete
GOTO SRE1
BCF EECON1,wren ;disable other writes
BSF INTCON, GIE ;Enable interrupts
;BSF PIE1, EEIE ;Set interrupt flag in PIE1
;BCF PIR1, EEIF ;Clear Interrupt flag in PIR1
Thanks all.
Shaaks.
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.9/1155 - Release Date: 27/11/2007 20:30
Earn your degree in as few as 2 years - Advance your career with an AS, BS, MS degree - College-Finder.net.
Fed Lowers Rates Again - $270,000 Mortgage for $1,498/Mo. No Credit Check Needed No Credit Check Needed - Estimate New Payment.
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch format to Traditional
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
No comments:
Post a Comment