参数资料
型号: PIC16F676-E/SL
元件分类: 微控制器/微处理器
英文描述: 8-BIT, FLASH, 20 MHz, RISC MICROCONTROLLER, PDSO14
封装: 3.90 MM, LEAD FREE, PLASTIC, SOIC-14
文件页数: 82/132页
文件大小: 1344K
代理商: PIC16F676-E/SL
2010 Microchip Technology Inc.
DS40039F-page 53
PIC16F630/676
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 address-
able 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 user 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
Re
qu
ire
d
S
equ
en
ce
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
相关PDF资料
PDF描述
PIC16LC433E/P 8-BIT, OTPROM, 4 MHz, RISC MICROCONTROLLER, PDIP18
PIC16LC556-04/SS 8-BIT, OTPROM, 4 MHz, RISC MICROCONTROLLER, PDSO20
PIC16LC662T-04/L 8-BIT, OTPROM, 4 MHz, RISC MICROCONTROLLER, PQCC44
PIC16C662T-20I/P 8-BIT, OTPROM, 20 MHz, RISC MICROCONTROLLER, PDIP40
PIC16C662T-20I/L 8-BIT, OTPROM, 20 MHz, RISC MICROCONTROLLER, PQCC44
相关代理商/技术参数
参数描述
PIC16F676-I/ML 功能描述:8位微控制器 -MCU 1.75 KB 64 RAM 12I/O RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC16F676-I/P 功能描述:8位微控制器 -MCU 1.75KB 64 RAM 12 I/O Ind Temp PDIP14 RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC16F676-I/P 制造商:Microchip Technology Inc 功能描述:IC 8BIT FLASH MCU 16F676 DIP14
PIC16F676-I/SL 功能描述:8位微控制器 -MCU 1.75KB 64 RAM 12 I/O Ind Temp SOIC14 RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC16F676-I/SL 制造商:Microchip Technology Inc 功能描述:8BIT FLASH MCU SMD 16F676 SOIC14