Electronic Components Datasheet Search
  New Zealand  ▼
ALLDATASHEET.CO.NZ

X  

PIC16F15213 Datasheet(PDF) 117 Page - Microchip Technology

Part # PIC16F15213
Description  PIC16F15213/14/23/24/43/44 Full-Featured 8/14/20-Pin Microcontrollers
PDF  420 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

PIC16F15213 Datasheet(HTML) 117 Page - Microchip Technology

Back Button PIC16F15213 Datasheet HTML 113Page - Microchip Technology PIC16F15213 Datasheet HTML 114Page - Microchip Technology PIC16F15213 Datasheet HTML 115Page - Microchip Technology PIC16F15213 Datasheet HTML 116Page - Microchip Technology PIC16F15213 Datasheet HTML 117Page - Microchip Technology PIC16F15213 Datasheet HTML 118Page - Microchip Technology PIC16F15213 Datasheet HTML 119Page - Microchip Technology PIC16F15213 Datasheet HTML 120Page - Microchip Technology PIC16F15213 Datasheet HTML 121Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 117 / 420 page
background image
Note: 
1.
See Figure 15-2.
Example 15-4. Writing to Program Flash Memory
; This write routine assumes the following:
; 1. 64 bytes of data are loaded, starting at the address in DATA_ADDR
; 2. Each word of data is made up of two adjacent bytes in DATA_ADDR,
; stored in little endian format
; 3. A valid starting address (LSb’s = 00000) is loaded in ADDRH:ADDRL
; 4. ADDRH and ADDRL are located in common RAM (locations 0x70 - 0x7F)
; 5. NVM interrupts are not taken into account
BANKSEL
NVMADRH
MOVF
ADDRH,W
MOVWF
NVMADRH
; Load initial address
MOVF
ADDRL,W
MOVWF
NVMADRL
MOVLW
LOW DATA_ADDR
; Load initial data address
MOVWF
FSR0L
MOVLW
HIGH DATA_ADDR
MOVWF
FSR0H
BCF
NVMCON1,NVMREGS
; Set Program Flash Memory as write location
BSF
NVMCON1,WREN
; Enable writes
BSF
NVMCON1,LWLO
; Load only write latches
LOOP
MOVIW
FSR0++
MOVWF
NVMDATL
; Load first data byte
MOVIW
FSR0++
MOVWF
NVMDATH
; Load second data byte
MOVF
NVMADRL,W
XORLW
0x1F
; Check if lower bits of address are 00000
ANDLW
0x1F
; and if on last of 32 addresses
BTFSC
STATUS,Z
; Last of 32 words?
GOTO
START_WRITE
; If so, go write latches into memory
CALL
UNLOCK_SEQ
; If not, go load latch
INCF
NVMADRL,F
; Increment address
GOTO
LOOP
START_WRITE
BCF
NVMCON1,LWLO
; Latch writes complete, now write memory
CALL
UNLOCK_SEQ
; Perform required unlock sequence
BCF
NVMCON1,WREN
; Disable writes
UNLOCK_SEQ
MOVLW
55h
BCF
INTCON,GIE
; Disable interrupts
MOVWF
NVMCON2
; Begin unlock sequence
MOVLW
AAh
MOVWF
NVMCON2
BSF
NVMCON1,WR
BSF
INTCON,GIE
; Unlock sequence complete, re-enable interrupts
return
15.3.5
Modifying Flash Program Memory
When modifying existing data in a program memory, data within the memory row must be read and saved in a RAM
image. Program memory is modified using the following steps:
1.
Load the starting address of the row to be modified.
2.
Read the existing data from the row into a RAM image.
3.
Modify the RAM image to contain the new data to be written into program memory.
4.
Load the starting address of the row to be rewritten.
5.
Erase the program memory row.
6.
Load the write latches with data from the RAM image.
7.
Initiate a programming operation.
PIC16F15213/14/23/24/43/44
NVM - Nonvolatile Memory Control
© 2020 Microchip Technology Inc.
Preliminary Datasheet
DS40002195A-page 117



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com