Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

PIC16F570 Datasheet(PDF) 24 Page - Microchip Technology

Part # PIC16F570
Description  20-Pin, 8-Bit Flash Microcontroller
PDF  134 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

PIC16F570 Datasheet(HTML) 24 Page - Microchip Technology

Back Button PIC16F570 Datasheet HTML 20Page - Microchip Technology PIC16F570 Datasheet HTML 21Page - Microchip Technology PIC16F570 Datasheet HTML 22Page - Microchip Technology PIC16F570 Datasheet HTML 23Page - Microchip Technology PIC16F570 Datasheet HTML 24Page - Microchip Technology PIC16F570 Datasheet HTML 25Page - Microchip Technology PIC16F570 Datasheet HTML 26Page - Microchip Technology PIC16F570 Datasheet HTML 27Page - Microchip Technology PIC16F570 Datasheet HTML 28Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 24 / 134 page
background image
PIC16F527
DS40001652C-page 24
 2012-2014 Microchip Technology Inc.
5.1.2
WRITING TO FLASH DATA
MEMORY
Once a cell is erased, new data can be written.
Program execution is suspended during the write cycle.
The self-write operation writes four bytes of data at one
time. The data must first be loaded into four write
latches. Once the write latches are loaded, the data will
be written to Flash data memory.
The self-write sequence is shown below.
The following self-write sequence must be performed
for four bytes to be written.
1.
Load EEADR with the address.
2.
Load EEDATA with the data to be written.
3.
Set the WREN bit to enable write access to the
array.
4.
Disable interrupts.
5.
Set the WR bit to load the data into the write
latch.
6.
Steps 1 through 5 are repeated three more times
to load the remaining write latches.
On the fourth and final loop, the EEADR register will
contain an address in the format of b’00xxxx11.
When the WR bit is set for the final time, the processor
will recognize that this is the last write latch to be
loaded, and will automatically load the write latch and
then, immediately perform the Flash data memory
write of all four bytes.
The specific sequence of setting the WREN bit and
setting the WR bit must be executed to properly initiate
each load of the write latches and the write to Flash
data memory.
If the WR bit is not set in the instruction cycle after the
WREN bit is set, the WREN bit will be cleared in
hardware.
Sample code that follows this procedure is included in
Example 5-3.
EXAMPLE 5-3:
WRITING TO FLASH DATA
MEMORY
5.2
Write/Verify
Depending on the application, good programming
practice may dictate that data written to the Flash data
memory be verified. Example 5-4 is an example of a
write/verify.
EXAMPLE 5-4:
WRITE/VERIFY OF FLASH
DATA MEMORY
Note 1: The FREE bit may be set by any
command normally used by the core.
However, the WREN and WR bits can
only be set using a series of BSF com-
mands, as documented in Example 5-1.
No other sequence of commands will
work, no exceptions.
2: Bits <5:3> of the EEADR register indicate
which row is to be erased.
Note 1: Only a series of BSF commands will work
to enable the memory write sequence
documented in Example 5-3. No other
sequence of commands will work, no
exceptions.
2: For reads, erases and writes to the Flash
data memory, there is no need to insert a
NOP into the user code as is done on mid-
range
devices.
The
instruction
immediately
following
the
“BSF
EECON,WR/RD” will be fetched and
executed properly.
MOVLB 0x01
;SWITCH TO BANK 1
MOVLW 0x04
;LOAD 4 DATA BYTES
MOVWF LoopCount
;WRITE LOOP
WRITE_LOOP
;VARIABLE STORED
MOVLW EE_ADR_WRITE
;LOAD ADDRESS TO
;WRITE
MOVWF EEADR
;INTO EEADR
;REGISTER
MOVLW EE_DATA_TO_WRITE;LOAD DATA TO
MOVWF EEDATA
;INTO EEDATA
;REGISTER
BSF
EECON,WREN
;ENABLE WRITES
BSF
EECON,WR
;LOAD WRITE LATCH
BTFSC LoopCount
;TEST IF 4th BYTE
GOTO
WRITE_LOOP
;
;WRITE IS DONE
;
MOVF
EEDATA, W
;EEDATA has not changed
;from previous write
BSF
EECON, RD
;Read the value written
XORWF
EEDATA, W
;
BTFSS
STATUS, Z
;Is data the same
GOTO
WRITE_ERR
;No, handle error
;Yes, continue



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