欢迎访问ic37.com |
会员登录 免费注册
发布采购

PIC18LF4320-I/ML 参数 Datasheet PDF下载

PIC18LF4320-I/ML图片预览
型号: PIC18LF4320-I/ML
PDF下载: 下载PDF文件 查看货源
内容描述: 28 /40/ 44引脚高性能,增强型闪存微控制器与10位A / D和纳瓦技术 [28/40/44-Pin High-Performance, Enhanced Flash Microcontrollers with 10-Bit A/D and nanoWatt Technology]
分类和应用: 闪存微控制器和处理器外围集成电路时钟
文件页数/大小: 388 页 / 6899 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第81页浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第82页浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第83页浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第84页浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第86页浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第87页浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第88页浏览型号PIC18LF4320-I/ML的Datasheet PDF文件第89页  
PIC18F2220/2320/4220/4320  
After a write sequence has been initiated, EECON1,  
EEADR and EEDATA cannot be modified. The WR bit  
will be inhibited from being set unless the WREN bit is  
7.3  
Reading the Data EEPROM  
Memory  
To read a data memory location, the user must write the  
address to the EEADR register, clear the EEPGD con-  
trol bit (EECON1<7>) and then set control bit, RD  
(EECON1<0>). The data is available for the very next  
instruction cycle; therefore, the EEDATA register can  
be read by the next instruction. EEDATA will hold this  
value until another read operation or until it is written to  
by the user (during a write operation).  
set. The WREN bit must be set on a previous instruc-  
tion. Both WR and WREN cannot be set with the same  
instruction.  
At the completion of the write cycle, the WR bit is  
cleared in hardware and the EEPROM Interrupt Flag bit  
(EEIF) is set. The user may either enable this interrupt  
or poll this bit. EEIF must be cleared by software.  
7.5  
Write Verify  
7.4  
Writing to the Data EEPROM  
Memory  
Depending on the application, good programming  
practice may dictate that the value written to the mem-  
ory should be verified against the original value. This  
should be used in applications where excessive writes  
can stress bits near the specification limit.  
To write an EEPROM data location, the address must  
first be written to the EEADR register and the data  
written to the EEDATA register. The sequence in  
Example 7-2 must be followed to initiate the write cycle.  
The write will not begin if this sequence is not exactly  
followed (write 55h to EECON2, write AAh to EECON2,  
then set WR bit) for each byte. It is strongly recom-  
mended that interrupts be disabled during this  
code segment.  
7.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, the WREN bit is cleared.  
Also, the Power-up Timer (72 ms duration) prevents  
EEPROM write.  
Additionally, the WREN bit in EECON1 must be set to  
enable writes. This mechanism prevents accidental  
writes to data EEPROM due to unexpected code exe-  
cution (i.e., runaway programs). The WREN bit should  
be kept clear at all times except when updating the  
EEPROM. The WREN bit is not cleared by hardware.  
The write initiate sequence and the WREN bit together  
help prevent an accidental write during brown-out,  
power glitch, or software malfunction.  
EXAMPLE 7-1:  
DATA EEPROM READ  
MOVLW  
MOVWF  
BCF  
BSF  
MOVF  
DATA_EE_ADDR  
EEADR  
EECON1, EEPGD  
EECON1, RD  
EEDATA, W  
;
; Data Memory Address to read  
; Point to DATA memory  
; EEPROM Read  
; W = EEDATA  
EXAMPLE 7-2:  
DATA EEPROM WRITE  
MOVLW  
MOVWF  
DATA_EE_ADDR  
EEADR  
;
; Data Memory Address to write  
MOVLW  
MOVWF  
BCF  
BSF  
BCF  
MOVLW  
MOVWF  
MOVLW  
MOVWF  
BSF  
DATA_EE_DATA  
EEDATA  
EECON1, EEPGD  
EECON1, WREN  
INTCON, GIE  
55h  
EECON2  
AAh  
EECON2  
EECON1, WR  
INTCON, GIE  
;
; Data Memory Value to write  
; Point to DATA memory  
; Enable writes  
; Disable Interrupts  
;
; Write 55h  
;
; Write AAh  
; Set WR bit to begin write  
; Enable Interrupts  
Required  
Sequence  
BSF  
SLEEP  
BCF  
; Wait for interrupt to signal write complete  
; Disable writes  
EECON1, WREN  
2003 Microchip Technology Inc.  
DS39599C-page 83