PIC12F635-E/MF Microchip Technology, PIC12F635-E/MF Datasheet - Page 95

no-image

PIC12F635-E/MF

Manufacturer Part Number
PIC12F635-E/MF
Description
IC MCU FLASH 1KX14 8DFN
Manufacturer
Microchip Technology
Series
PIC® 12Fr
Datasheets

Specifications of PIC12F635-E/MF

Core Processor
PIC
Core Size
8-Bit
Speed
20MHz
Peripherals
Brown-out Detect/Reset, POR, WDT
Number Of I /o
5
Program Memory Size
1.75KB (1K x 14)
Program Memory Type
FLASH
Eeprom Size
128 x 8
Ram Size
64 x 8
Voltage - Supply (vcc/vdd)
2 V ~ 5.5 V
Oscillator Type
Internal
Operating Temperature
-40°C ~ 125°C
Package / Case
8-DFN
For Use With
AC164324 - MODULE SKT FOR MPLAB 8DFN/16QFNXLT08DFN2 - SOCKET TRANSITION ICE 14DIP/8DFNAC162057 - MPLAB ICD 2 HEADER 14DIPXLT08DFN - SOCKET TRANSITION ICE 8DFNAC164032 - ADAPTER PICSTART PLUS 8DFN/DIPAC124001 - MODULE SKT PROMATEII 8DIP/SOIC
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Data Converters
-
Connectivity
-
9.2
To read a data memory location, the user must write the
address to the EEADR register and then set control bit
RD of the EECON1 register, as shown in Example 9-1.
The data is available, in the very next cycle, in the
EEDAT register. Therefore, it can be read in the next
instruction. EEDAT holds this value until another read, or
until it is written to by the user (during a write operation).
EXAMPLE 9-1:
9.3
To write an EEPROM data location, the user must first
write the address to the EEADR register and the data
to the EEDAT register. Then the user must follow a
specific sequence to initiate the write for each byte, as
shown in Example 9-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.
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 of the
PIR1 register must be cleared by software.
EXAMPLE 9-2:
© 2007 Microchip Technology Inc.
BANKSEL
MOVLW
MOVWF
BSF
MOVF
BANKSEL EEADR
BSF
BCF
MOVLW
MOVWF
MOVLW
MOVWF
BSF
BSF
Reading the EEPROM Data
Memory
Writing to the EEPROM Data
Memory
EEADR
CONFIG_ADDR
EEADR
EECON1,RD
EEDAT,W
EECON1,WREN
INTCON,GIE
55h
EECON2
AAh
EECON2
EECON1,WR
INTCON,GIE
DATA EEPROM READ
DATA EEPROM WRITE
;
;
;Address to read
;EE Read
;Move data to W
;
;Enable write
;Disable INTs
;Unlock write
;
;
;
;Start the write
;Enable INTS
PIC12F635/PIC16F636/639
9.4
Depending on the application, good programming
practice may dictate that the value written to the data
EEPROM should be verified (see Example 9-3) to the
desired value to be written.
EXAMPLE 9-3:
9.4.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). When variables in one section change
frequently, while variables in another section do not
change, it is possible to exceed the total number of
write cycles to the EEPROM (specification D124)
without exceeding the total number of write cycles to a
single byte (specifications D120 and D120A). If this is
the case, then a refresh of the array must be
performed. For this reason, variables that change
infrequently (such as constants, IDs, calibration, etc.)
should be stored in Flash program memory.
BANKSEL
MOVF
BSF
XORWF
BTFSS
GOTO
:
Write Verify
USING THE DATA EEPROM
EEDAT
EEDAT,W
EECON1,RD ;YES, Read the
EEDAT,W
STATUS,Z
WRITE_ERR ;No, handle error
WRITE VERIFY
;
;EEDAT not changed
;from previous write
;value written
;
;Is data the same
;Yes, continue
DS41232D-page 93

Related parts for PIC12F635-E/MF