DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

PIC16F753-I/SLQTP 查看數據表(PDF) - Microchip Technology

零件编号
产品描述 (功能)
生产厂家
PIC16F753-I/SLQTP
Microchip
Microchip Technology 
PIC16F753-I/SLQTP Datasheet PDF : 238 Pages
First Prev 31 32 33 34 35 36 37 38 39 40 Next Last
PIC16F753/HV753
An example of the complete four-word write sequence
is shown in Example 3-2. The initial address is loaded
into the PMADRH and PMADRL register pair; the four
words of data are loaded using indirect addressing.
EXAMPLE 3-2: WRITING TO FLASH PROGRAM MEMORY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This write routine assumes the following:
;
A valid starting address (the least significant bits = '00')
;
is loaded in ADDRH:ADDRL
;
ADDRH, ADDRL and DATADDR are all located in data memory
;
BANKSEL
PMADRH
MOVF ADDRH,W
;Load initial address
MOVWF PMADRH
;
MOVF ADDRL,W
;
MOVWF PMADRL
;
MOVF DATAADDR,W ;Load initial data address
MOVWF FSR
;
LOOP MOVF INDF,W
;Load first data byte into lower
MOVWF PMDATL
;
INCF FSR,F
;Next byte
MOVF INDF,W
;Load second data byte into upper
MOVWF PMDATH
;
INCF FSR,F
;
BANKSEL PMCON1
BSF
PMCON1,WREN ;Enable writes
BCF
INTCON,GIE ;Disable interrupts (if using)
BTFSC INTCON,GIE ;See AN576
GOTO $-2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
Required Sequence
MOVLW 55h
;Start of required write sequence:
MOVWF PMCON2
;Write 55h
MOVLW 0AAh
;
MOVWF PMCON2
;Write 0AAh
BSF
PMCON1,WR ;Set WR bit to begin write
NOP
;Required to transfer data to the buffer
NOP
;registers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BCF
PMCON1,WREN ;Disable writes
BSF
INTCON,GIE ;Enable interrupts (comment out if not using interrupts)
BANKSEL PMADRL
MOVF PMADRL, W
INCF PMADRL,F
;Increment address
ANDLW 0x03
;Indicates when sixteen words have been programmed
SUBLW 0x03
;Change value for different size write blocks
;0x0F = 16 words
;0x0B = 12 words
;0x07 = 8 words
;0x03 = 4 words
BTFSS STATUS,Z
;Exit on a match,
GOTO LOOP
;Continue if more data needs to be written
DS40001709A-page 34
Preliminary
2013 Microchip Technology Inc.

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]