1 / 9

ECT 357

ECT 357. Ch 20 EEPROM. Today’s Quote: Conscience is God’s built-in warning system. Be very happy when it hurts you. Be very worried when it doesn’t. And herein do I exercise myself, to have always a conscience void to offense toward God, and toward men. Acts 24:16. EEPROM.

saburo
Download Presentation

ECT 357

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECT 357 Ch 20 EEPROM

  2. Today’s Quote: Conscience is God’s built-in warning system. Be very happy when it hurts you. Be very worried when it doesn’t. And herein do I exercise myself, to have always a conscience void to offense toward God, and toward men. Acts 24:16

  3. EEPROM The 256 byte Data EEPROM is readable and writable during normal operation over the entire VDD range. The data memory is not directly mapped in the register file space. Instead, it is indirectly addressed through the Special Function Registers (SFR).

  4. EEPROM Registers EECON1: used for EEPROM control and status EECON2: not a physical register, used for unlock mechanism to previous inadvertent writes EEDATA: Data of EEPROM being written to or read from EEPROM address EEADR: Address of EEPROM reading from or writing to PIR2: EEIF flag signals write completion

  5. EEPROM Initialization 1. Clear EECON1 in the Initial Subroutine.

  6. EEPROM Write Sequence MOVLF 0x00,EEADR ;load address movff ADRESH,EEDATA ;load data bsf EECON1,WREN ;enable writes bcf INTCON,GIEH ;disable interrupts MOVLF 0x55,EECON2 ;unlock code 1 MOVLF 0xaa,EECON2 ;unlock code 2 bsf EECON1,WR ;write to EEPROM bsf INTCON,GIEH ;re-enable interrupts Wait: btfss PIR2,EEIF ;wait for write to finish bra Wait ;takes 4 ms bcf PIR2,EEIF ;clear EEPROM flag bcf EECON1,WREN ;disable writes

  7. EEPROM Read Sequence MOVLF 0x00,EEADR ;load address bsf EECON1,RD movf EEDATA,W ;copy data to WREG

  8. EEPROM Interrupts The EEPROM mechanism has the ability to generate interrupts upon completion of an EEPROM write. The registers associated with this are: IPR2, EEIP PIR2, EEIF PIE2, EEIE

More Related