数据搜索系统,热门电子元器件搜索
  Chinese  ▼
ALLDATASHEETCN.COM

X  

PIC12F675T-E/P 数据表(PDF) 51 Page - Microchip Technology

部件名 PIC12F675T-E/P
功能描述  8-Pin, Flash-Based 8-Bit CMOS Microcontrollers
PDF  136 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
制造商  MICROCHIP [Microchip Technology]
网页  http://www.microchip.com
标志 MICROCHIP - Microchip Technology

PIC12F675T-E/P 数据表(HTML) 51 Page - Microchip Technology

Back Button PIC12F675T-E/P Datasheet HTML 47Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 48Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 49Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 50Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 51Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 52Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 53Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 54Page - Microchip Technology PIC12F675T-E/P Datasheet HTML 55Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 51 / 136 page
background image
 2010 Microchip Technology Inc.
DS41190G-page 51
PIC12F629/675
8.3
Reading the EEPROM Data
Memory
To read a data memory location, the user must write
the address to the EEADR register and then set
control bit RD (EECON1<0>), as shown in
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:
DATA EEPROM READ
8.4
Writing to the EEPROM Data
Memory
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:
DATA EEPROM WRITE
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
(PIR<7>) register must be cleared by software.
8.5
Write Verify
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:
WRITE VERIFY
8.5.1
USING THE DATA EEPROM
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
Protection Against Spurious Write
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
Timer
(72
ms
duration)
prevents
EEPROM write.
The write initiate sequence and the WREN bit together
help prevent an accidental write during:
•brown-out
• power glitch
• software malfunction
BSF
STATUS,RP0
;Bank 1
MOVLW CONFIG_ADDR
;
MOVWF EEADR
;Address to read
BSF
EECON1,RD
;EE Read
MOVF
EEDATA,W
;Move data to W
BSF
STATUS,RP0
;Bank 1
BSF
EECON1,WREN
;Enable write
BCF
INTCON,GIE
;Disable INTs
MOVLW 55h
;Unlock write
MOVWF EECON2
;
MOVLW AAh
;
MOVWF EECON2
;
BSF
EECON1,WR
;Start the write
BSF
INTCON,GIE
;Enable INTS
BCF
STATUS,RP0
;Bank 0
:
;Any code
BSF
STATUS,RP0
;Bank 1 READ
MOVF
EEDATA,W
;EEDATA not changed
;from previous write
BSF
EECON1,RD
;YES, Read the
;value written
XORWF EEDATA,W
BTFSS STATUS,Z
;Is data the same
GOTO
WRITE_ERR
;No, handle error
:
;Yes, continue



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


数据表 下载

Go To PDF Page


链接网址



ALLDATASHEET是否为您带来帮助?  [ DONATE ] 

关于 Alldatasheet   |   广告服务   |   联系我们   |   隐私政策   |   数据表链接    |   链接交换   |   制造商名单
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com