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

PIC12F617T-I/MS View Datasheet(PDF) - Microchip Technology

Part Name
Description
Manufacturer
PIC12F617T-I/MS
Microchip
Microchip Technology 
PIC12F617T-I/MS Datasheet PDF : 212 Pages
First Prev 31 32 33 34 35 36 37 38 39 40 Next Last
PIC12F609/615/617/12HV609/615
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 eight
words of data are loaded using indirect addressing.
EXAMPLE 3-2: WRITING TO FLASH PROGRAM MEMORY
LOOP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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
;
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
; 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
DS41302D-page 34
2010 Microchip Technology Inc.

Share Link: 

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