Chapter 5. EEPROM Demo – PIC16F84
WriteOne is where the actual writing of the EEPROM takes place. EEPROM
writes will not initiate if the proper sequence (write 55h to EECON2, write AAh
to EECON2, then set the WR bit) is not followed with exact timing. In order to
ensure this, interrupts have not been enabled. After the writing of the data,
and initiating the write sequence, the loop, W01 , waits for the WR bit to go low
indicating that the write has completed.
Note:
The timing in WriteOne is critical. Do not single step or do a soft-
ware trace through this routine.
WriteOne
WO1
bsf
movlw
movwf
movlw
movwf
bsf
btfsc
goto
bcf
STATUS,RP0
0x55
EECON2
0xaa
EECON2
EECON1,WR
EECON1,WR
WO1
STATUS,RP0
;page 1
;do write seq.
; /
; /
; /
;initiate write
;write complete?
;no then keep checking
;pg 0
return
Refer to PIC16F8X Data Sheet for EEPROM programming requirements.
CheckAll reads each location of the EEPROM and verifies that it matches
the value displayed on the LEDs plus one. If the value does not match, bit
EEPERROR of file register GPFLAG will be set and the routine will return
without verifying the other locations.
CheckAll
CA1
clrf
incf
EEADR
PORTB,W
;start at addr = 0
;ld. data to inspect
call
btfsc
return
incf
btfss
goto
CheckOne ;check location
GPFLAG,EEPERROR ;any error?
;yes then quit
EEADR, F ;inc address
EEADR,6 ;all 64 checked?
CA1 ;no then do next
return
CheckOne does the actual reading of the EEPROM byte and verifying that it
is correct. Although it is not necessary to check any flag bits during EEPROM
reads, they can be done immediately after setting the address in EEADR and
setting the read control bit ( RD EECON1<0> ), the RD bit will be cleared by the
hardware when the data has been placed in the EEDATA register. If there is a
verification error, the EEPERROR bit is set in the GPFLAG register.
? 1999 Microchip Technology Inc.
DS33015C-page 29
相关PDF资料
DM163004-LT BOARD DEMO PICDEM.NET
DM163005 KIT EVAL PIC16C432/433 LIN BUSS
DM163007 PICDEM CAN-LIN 1 FOR 18C658/858
DM163008 KIT MCP2120/2150 FOR IRDA COMM
DM163010 BOARD DEMO PICDEM USB
DM163012 BOARD DEMO PICDEM FOR 16C781/782
DM163024 BOARD DEMO PICDEM.NET 2
DM163025 PIC DEM FULL SPEED USB DEMO BRD
相关代理商/技术参数
DM163002 制造商:Microchip Technology Inc 功能描述:PIC16C64/74 DEMO BOARD
DM163003 功能描述:开发板和工具包 - PIC / DSPIC PICDEM 3 PIC16C923/4 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163004 功能描述:开发板和工具包 - PIC / DSPIC USE 579-DM163004-LT RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163004 制造商:Microchip Technology Inc 功能描述:DEMO BOARD W/TCP/IP ((NW))
DM163004-LT 功能描述:开发板和工具包 - PIC / DSPIC PICDEM.net Demo Kit w/o TCP/IP Lean Book RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163005 功能描述:开发板和工具包 - PIC / DSPIC PICDEM PIC16C432/3 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163006 功能描述:开发板和工具包 - PIC / DSPIC 18R PIC18C601/801 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压:
DM163007 功能描述:开发板和工具包 - PIC / DSPIC For PIC18C658/858 RoHS:否 制造商:Microchip Technology 产品:Starter Kits 工具用于评估:chipKIT 核心:Uno32 接口类型: 工作电源电压: