データシートサーチシステム
  Japanese  ▼
ALLDATASHEET.JP

X  

PIC16F628A-I/ML データシート(PDF) 93 Page - Microchip Technology

部品番号 PIC16F628A-I/ML
部品情報  FLASH-Based 8-Bit CMOS Microcontrollers
PDF  168 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
メーカー  MICROCHIP [Microchip Technology]
ホームページ  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

PIC16F628A-I/ML データシート(HTML) 93 Page - Microchip Technology

Back Button PIC16F628A-I/ML Datasheet HTML 89Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 90Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 91Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 92Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 93Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 94Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 95Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 96Page - Microchip Technology PIC16F628A-I/ML Datasheet HTML 97Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 93 / 168 page
background image
 2002 Microchip Technology Inc.
Preliminary
DS40044A-page 91
PIC16F627A/628A/648A
13.3
READING THE EEPROM DATA
MEMORY
To read a data memory location, the user must write the
address to the EEADR register and then set control bit
RD (EECON1<0>). The data is available, in the very
next cycle, in the EEDATA register; therefore it can be
read in the next instruction. EEDATA will hold this value
until another read or until it is written to by the user
(during a write operation).
EXAMPLE 13-1:
DATA EEPROM READ
13.4
WRITING TO THE EEPROM DATA
MEMORY
To write an EEPROM data location, the user must first
write the address to the EEADR register and the data
to the EEDATA register. Then the user must follow a
specific sequence to initiate the write for each byte.
EXAMPLE 13-2:
DATA EEPROM WRITE
The write will not initiate if the above sequence is not
exactly followed (write 55h to EECON2, write AAh to
EECON2, then set WR bit) for each byte. We strongly
recommend that interrupts be disabled during this
code segment. A cycle count is executed during the
required sequence. Any number what is not equal to
the required cycles to execute the required sequence
will cause the data not to be written into the EEPROM.
Additionally, the WREN bit in EECON1 must be set to
enable write. This mechanism prevents accidental
writes to data EEPROM due to errant (unexpected)
code execution (i.e., lost programs). The user should
keep the WREN bit clear at all times, except when
updating EEPROM. The WREN bit is not cleared
by hardware.
After a write sequence has been initiated, clearing the
WREN bit will not affect this write cycle. The WR bit will
be inhibited from being set unless the WREN bit is set.
At the completion of the write cycle, the WR bit is
cleared in hardware and the EE Write Complete
Interrupt Flag bit (EEIF) is set. The user can either
enable this interrupt or poll this bit. The EEIF bit in the
PIR1 registers must be cleared by software.
13.5
WRITE VERIFY
Depending on the application, good programming
practice may dictate that the value written to the Data
EEPROM should be verified (Example 13-3) to the
desired value to be written. This should be used in
applications where an EEPROM bit will be stressed
near the specification limit.
EXAMPLE 13-3:
WRITE VERIFY
13.6
PROTECTION AGAINST
SPURIOUS WRITE
There are conditions when the device may not want to
write to the data EEPROM memory. To protect against
spurious EEPROM writes, various mechanisms have
been built in. On power-up, WREN is cleared. Also
when enabled, the Power-up Timer (72 ms duration)
prevents EEPROM write.
The write initiate sequence, and the WREN bit together
help prevent an accidental write during brown-out,
power glitch, or software malfunction.
BSF
STATUS, RP0
;Bank 1
MOVLW
CONFIG_ADDR
;
MOVWF
EEADR
;Address to read
BSF
EECON1, RD
;EE Read
MOVF
EEDATA, W
;W = EEDATA
BCF
STATUS, RP0
;Bank 0
BSF
STATUS, RP0
;Bank 1
BSF
EECON1, WREN
;Enable write
BCF
INTCON, GIE
;Disable INTs.
MOVLW
55h
;
MOVWF
EECON2
;Write 55h
MOVLW
AAh
;
MOVWF
EECON2
;Write AAh
BSF
EECON1,WR
;Set WR bit
;begin write
BSF INTCON, GIE
;Enable INTs.
BSF
STATUS, RP0 ;Bank 1
MOVF
EEDATA, W
BSF
EECON1, RD ;Read the
;value written
;
;Is the value written (in W reg) and
;read (in EEDATA) the same?
;
SUBWF EEDATA, W
;
BTFSS STATUS, Z
;Is difference 0?
GOTO
WRITE_ERR
;NO, Write error
:
;YES, Good write
:
;Continue program



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


データシート ダウンロード

Go To PDF Page


リンク URL



ALLDATASHEETはお客様のビジネスに役立ちますか?  [ DONATE ] 

Alldatasheetは   |   広告   |   お問い合わせ   |   プライバシーポリシー   |   データシートへのリンク    |   リンク交換   |   メーカーリスト
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