| 전자부품 데이터시트 검색엔진 |
|
PIC16F883-E/SO. 데이터시트(PDF) 123 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16F883-E/SO. 데이터시트(HTML) 123 Page - Microchip Technology |
|
123 / 338 page ![]() 2006-2012 Microchip Technology Inc. DS41291G-page 123 PIC16F882/883/884/886/887 An example of the complete eight-word write sequence is shown in Example 10-4. The initial address is loaded into the EEADRH and EEADR register pair; the eight words of data are loaded using indirect addressing. EXAMPLE 10-4: WRITING TO FLASH PROGRAM MEMORY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This write routine assumes the following: ; A valid starting address (the least significant bits = '000') ; is loaded in ADDRH:ADDRL ; ADDRH, ADDRL and DATADDR are all located in data memory ; BANKSEL EEADRH MOVF ADDRH,W ; Load initial address MOVWF EEADRH ; MOVF ADDRL,W ; MOVWF EEADR ; MOVF DATAADDR,W ; Load initial data address MOVWF FSR ; LOOP MOVF INDF,W ; Load first data byte into lower MOVWF EEDATA ; INCF FSR,F ; Next byte MOVF INDF,W ; Load second data byte into upper MOVWF EEDATH ; INCF FSR,F ; BANKSEL EECON1 BSF EECON1,EEPGD ; Point to program memory BSF EECON1,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 EECON2 ; Write 55h MOVLW 0AAh ; MOVWF EECON2 ; Write 0AAh BSF EECON1,WR ; Set WR bit to begin write NOP ; Required to transfer data to the buffer NOP ; registers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BCF EECON1,WREN ; Disable writes BSF INTCON,GIE ; Enable interrupts (comment out if not using interrupts) BANKSEL EEADR MOVF EEADR, W INCF EEADR,F ; Increment address ANDLW 0x0F ; Indicates when sixteen words have been programmed SUBLW 0x0F ; 0x0F = 16 words ; 0x0B = 12 words (PIC16F884/883/882 only) ; 0x07 = 8 words ; 0x03 = 4 words(PIC16F884/883/882 only) BTFSS STATUS,Z ; Exit on a match, GOTO LOOP ; Continue if more data needs to be written |
|
링크 URL |
| ALLDATASHEET 가 귀하에 도움이 되셨나요? [ DONATE ] |
Alldatasheet는? | 광고문의 | 운영자에게 연락하기 | 개인정보취급방침 | 링크 투 데이터시트 | 링크교환 | 제조사별 검색 All Rights Reserved©Alldatasheet.com |
| 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 |