PIC12F629T-E/MD MICROCHIP [Microchip Technology], PIC12F629T-E/MD Datasheet - Page 51
![no-image](/images/no-image-200.jpg)
PIC12F629T-E/MD
Manufacturer Part Number
PIC12F629T-E/MD
Description
8-Pin, Flash-Based 8-Bit CMOS Microcontrollers
Manufacturer
MICROCHIP [Microchip Technology]
Datasheet
1.PIC12F629T-EMD.pdf
(136 pages)
- Current page: 51 of 136
- Download datasheet (2Mb)
8.3
To read a data memory location, the user must write
the address to the EEADR register and then set
control
Example 8-1. The data is available, in the very next
cycle, in the EEDATA register. Therefore, it can be
read in the next instruction. EEDATA holds this value
until another read, or until it is written to by the user
(during a write operation).
EXAMPLE 8-1:
8.4
To write an EEPROM data location, the user must first
write the address to the EEADR register and the data
to the EEDATA register. Then the user must follow a
specific sequence to initiate the write for each byte, as
shown in Example 8-2.
EXAMPLE 8-2:
The write will not initiate if the above sequence is not
exactly followed (write 55h to EECON2, write AAh to
EECON2, then set WR bit) for each byte. We strongly
recommend that interrupts be disabled during this
code segment. A cycle count is executed during the
required sequence. Any number that is not equal to the
required cycles to execute the required sequence will
prevent the data from being written into the EEPROM.
Additionally, the WREN bit in EECON1 must be set to
enable write. This mechanism prevents accidental
writes to data EEPROM due to errant (unexpected)
code execution (i.e., lost programs). The user should
keep the WREN bit clear at all times, except when
updating EEPROM. The WREN bit is not cleared
by hardware.
2010 Microchip Technology Inc.
BSF
MOVLW CONFIG_ADDR
MOVWF EEADR
BSF
MOVF
BSF
BSF
BCF
MOVLW 55h
MOVWF EECON2
MOVLW AAh
MOVWF EECON2
BSF
BSF
Reading the EEPROM Data
Memory
Writing to the EEPROM Data
Memory
bit
STATUS,RP0
EECON1,RD
EEDATA,W
STATUS,RP0
EECON1,WREN
INTCON,GIE
EECON1,WR
INTCON,GIE
RD
(EECON1<0>),
DATA EEPROM READ
DATA EEPROM WRITE
;Bank 1
;
;Address to read
;EE Read
;Move data to W
;Bank 1
;Enable write
;Disable INTs
;Unlock write
;
;
;
;Start the write
;Enable INTS
as
shown
in
After a write sequence has been initiated, clearing the
WREN bit will not affect this write cycle. The WR bit will
be inhibited from being set unless the WREN bit is set.
At the completion of the write cycle, the WR bit is
cleared in hardware and the EE Write Complete
Interrupt Flag bit (EEIF) is set. The user can either
enable this interrupt or poll this bit. The EEIF bit
(PIR<7>) register must be cleared by software.
8.5
Depending on the application, good programming
practice may dictate that the value written to the data
EEPROM should be verified (see Example 8-3) to the
desired value to be written.
EXAMPLE 8-3:
8.5.1
The data EEPROM is a high-endurance, byte
addressable array that has been optimized for the
storage of frequently changing information (e.g.,
program variables or other data that are updated
often). Frequently changing values will typically be
updated more often than specifications D120 or
D120A. If this is not the case, an array refresh must be
performed. For this reason, variables that change
infrequently (such as constants, IDs, calibration, etc.)
should be stored in Flash program memory.
8.6
There are conditions when the device may not want to
write to the data EEPROM memory. To protect against
spurious EEPROM writes, various mechanisms have
been built in. On power-up, WREN is cleared. Also, the
Power-up
EEPROM write.
The write initiate sequence and the WREN bit together
help prevent an accidental write during:
• brown-out
• power glitch
• software malfunction
BCF
:
BSF
MOVF
BSF
XORWF EEDATA,W
BTFSS STATUS,Z
GOTO
:
Write Verify
Protection Against Spurious Write
USING THE DATA EEPROM
Timer
STATUS,RP0
STATUS,RP0
EEDATA,W
EECON1,RD
WRITE_ERR
PIC12F629/675
(72
WRITE VERIFY
ms
;Bank 0
;Any code
;Bank 1 READ
;EEDATA not changed
;from previous write
;YES, Read the
;value written
;Is data the same
;No, handle error
;Yes, continue
duration)
DS41190G-page 51
prevents
Related parts for PIC12F629T-E/MD
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
![PIC12F629-I/SN](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS FLSH-BASE 8BIT 8SOIC
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629](/images/manufacturer_photos/0/4/440/microchip_technology_inc__tmb.jpg)
Part Number:
Description:
Manufacturer:
Microchip Technology Inc.
Datasheet:
![PIC12F629-I/P](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS FLASH-BASE 8BIT 8DIP
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629-I/MF](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-DFN
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629-I/MD](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC PIC MCU FLASH 1KX14 8DFN
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629-E/SN](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-SOIC
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629-E/P](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-DIP
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629-E/MF](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-DFN
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629-E/MD](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
1.75KB Flash, 64 RAM, 6 I/O 8 DFN 4x4mm TUBE
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629T-I/SN](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-SOIC
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629T-E/MF](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-DFN
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629T-E/SN](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-SOIC
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F629T-I/MF](/images/manufacturer_photos/0/4/439/microchip_technology_tmb.jpg)
Part Number:
Description:
IC MCU CMOS 8BIT 1K FLASH 8-DFN
Manufacturer:
Microchip Technology
Datasheet:
![PIC12F1840-I/P](/photos/16/3/160349/pdip8_tmb.jpg)
Part Number:
Description:
7 KB Flash, 256 Bytes RAM, 32 MHz Int. Osc, 6 I/0, Enhanced Mid Range Core 8 PDI
Manufacturer:
Microchip Technology
Datasheet:
![PIC12LF1840-I/MF](/photos/16/0/160077/dfn8_tmb.jpg)
Part Number:
Description:
7 KB Flash, 256 Bytes RAM, 32 MHz Int. Osc, 6 I/0, Enhanced Mid Range Core, Nano
Manufacturer:
Microchip Technology
Datasheet: