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

PIC16F877T-20PQ 参数 Datasheet PDF下载

PIC16F877T-20PQ图片预览
型号: PIC16F877T-20PQ
PDF下载: 下载PDF文件 查看货源
内容描述: 8位微控制器\n [8-Bit Microcontroller ]
分类和应用: 微控制器
文件页数/大小: 200 页 / 3338 K
品牌: ETC [ ETC ]
 浏览型号PIC16F877T-20PQ的Datasheet PDF文件第41页浏览型号PIC16F877T-20PQ的Datasheet PDF文件第42页浏览型号PIC16F877T-20PQ的Datasheet PDF文件第43页浏览型号PIC16F877T-20PQ的Datasheet PDF文件第44页浏览型号PIC16F877T-20PQ的Datasheet PDF文件第46页浏览型号PIC16F877T-20PQ的Datasheet PDF文件第47页浏览型号PIC16F877T-20PQ的Datasheet PDF文件第48页浏览型号PIC16F877T-20PQ的Datasheet PDF文件第49页  
PIC16F87X  
trol bit (EECON1<7>), and then set control bit WR  
(EECON1<1>). The sequence in Example 4-4 must be  
followed to initiate a write to program memory.  
4.6  
Writing to the FLASH Program  
Memory  
A word of the FLASH program memory may only be  
written to if the word is in a non-code protected seg-  
ment of memory and the WRT configuration bit is set.  
To write a FLASH program location, the first two bytes  
of the address must be written to the EEADR and  
EEADRH registers and two bytes of the data to the  
EEDATA and EEDATH registers, set the EEPGD con-  
The microcontroller will then halt internal operations  
during the next two instruction cycles for the TPEW  
(parameter D133) in which the write takes place. This  
is not SLEEP mode, as the clocks and peripherals will  
continue to run. Therefore, the two instructions follow-  
ing the “BSF EECON, WR” should be NOPinstructions.  
After the write cycle, the microcontroller will resume  
operation with the 3rd instruction after the EECON1  
write instruction.  
EXAMPLE 4-4: FLASH PROGRAM WRITE  
BSF  
STATUS, RP1  
STATUS, RP0  
ADDRH  
;
BCF  
; Bank 2  
;
MOVLW  
MOVWF  
MOVLW  
MOVWF  
MOVLW  
MOVWF  
MOVLW  
MOVWF  
BSF  
EEADRH  
; MSByte of Program Address to read  
ADDRL  
;
EEADR  
; LSByte of Program Address to read  
DATAH  
;
EEDATH  
; MS Program Memory Value to write  
;
DATAL  
EEDATA  
; LS Program Memory Value to write  
; Bank 3  
STATUS, RP0  
EECON1, EEPGD  
EECON1, WREN  
BSF  
; Point to PROGRAM memory  
; Enable writes  
BSF  
BCF  
INTCON, GIE  
55h  
; Disable Interrupts  
MOVLW  
MOVWF  
MOVLW  
MOVWF  
BSF  
;
Required  
Sequence  
EECON2  
AAh  
; Write 55h  
;
EECON2  
EECON1, WR  
; Write AAh  
; Set WR bit to begin write  
NOP  
NOP  
; Instructions here are ignored by the microcontroller  
; Microcontroller will halt operation and wait for  
; a write complete. After the write  
; the microcontroller continues with 3rd instruction  
; Enable Interrupts  
BSF  
BCF  
INTCON, GIE  
EECON1, WREN  
; Disable writes  
4.7  
Write Verify  
Depending on the application, good programming prac-  
tice may dictate that the value written to the memory  
should be verified against the original value. This  
should be used in applications where excessive writes  
can stress bits near the specification limit.  
Generally a write failure will be a bit which was written  
as a '1', but reads back as a '0' (due to leakage off the  
bit).  
1999 Microchip Technology Inc.  
DS30292B-page 45  
 复制成功!