Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
gomathi said:plz any one can help me
how to read and write the EEPROM of PIC 16f877?
EE_Read bsf STATUS, RP0 ; Bank 1
movlw EEPROM_Addr
movwf EEADR ; Address to read
bsf EECON1, RD ; EE Read
movf EEDATA, W ; W = EEDATA
bcf STATUS, RP0 ; Bank 0
movwf LED_PORT ; restore previous value
retlw 0x00
EE_Write movf LED_PORT, w ; read current value
bsf STATUS, RP0 ; Bank 1
bsf EECON1, WREN ; Enable write
movwf EEDATA ; set EEPROM data
movlw EEPROM_Addr
movwf EEADR ; set EEPROM address
movlw 0x55
movwf EECON2 ; Write 55h
movlw 0xAA
movwf EECON2 ; Write AAh
bsf EECON1, WR ; Set WR bit
; begin write
bcf STATUS, RP0 ; Bank 0
btfss PIR1, EEIF ; wait for write to complete.
goto $-1
bcf PIR1, EEIF ; and clear the 'write complete' flag
bsf STATUS, RP0 ; Bank 1
bcf EECON1, WREN ; Disable write
bcf STATUS, RP0 ; Bank 0
retlw 0x00
EE_Read bsf STATUS, RP0 ; Bank 1
movlw EEPROM_Addr
movwf EEADR ; Address to read
bsf EECON1, RD ; EE Read
movf EEDATA, W ; W = EEDATA
bcf STATUS, RP0 ; Bank 0
movwf LED_PORT ; restore previous value
retlw 0x00
EE_Write movf LED_PORT, w ; read current value
bsf STATUS, RP0 ; Bank 1
bsf EECON1, WREN ; Enable write
movwf EEDATA ; set EEPROM data
movlw EEPROM_Addr
movwf EEADR ; set EEPROM address
movlw 0x55
movwf EECON2 ; Write 55h
movlw 0xAA
movwf EECON2 ; Write AAh
bsf EECON1, WR ; Set WR bit
; begin write
bcf STATUS, RP0 ; Bank 0
btfss PIR1, EEIF ; wait for write to complete.
goto $-1
bcf PIR1, EEIF ; and clear the 'write complete' flag
bsf STATUS, RP0 ; Bank 1
bcf EECON1, WREN ; Disable write
bcf STATUS, RP0 ; Bank 0
retlw 0x00