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

X  

PIC24FJ64GA104T-E/SS Datasheet(PDF) 57 Page - Microchip Technology

Part # PIC24FJ64GA104T-E/SS
Description  28/44-Pin, 16-Bit General Purpose Flash Microcontrollers with nanoWatt XLP Technology
PDF  308 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

PIC24FJ64GA104T-E/SS Datasheet(HTML) 57 Page - Microchip Technology

Back Button PIC24FJ64GA104T-E/SS Datasheet HTML 53Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 54Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 55Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 56Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 57Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 58Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 59Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 60Page - Microchip Technology PIC24FJ64GA104T-E/SS Datasheet HTML 61Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 57 / 308 page
background image
 2010 Microchip Technology Inc.
DS39951C-page 57
PIC24FJ64GA104 FAMILY
5.6.2
PROGRAMMING A SINGLE WORD
OF FLASH PROGRAM MEMORY
If a Flash location has been erased, it can be pro-
grammed using table write instructions to write an
instruction word (24-bit) into the write latch. The
TBLPAG register is loaded with the 8 Most Significant
Bytes of the Flash address. The TBLWTL and TBLWTH
instructions write the desired data into the write latches
and specify the lower 16 bits of the program memory
address to write to. To configure the NVMCON register
for a word write, set the NVMOP bits (NVMCON<3:0>)
to ‘0011’. The write is performed by executing the
unlock sequence and setting the WR bit (see
Example 5-7).
EXAMPLE 5-7:
PROGRAMMING A SINGLE WORD OF FLASH PROGRAM MEMORY
(ASSEMBLY LANGUAGE CODE)
EXAMPLE 5-8:
PROGRAMMING A SINGLE WORD OF FLASH PROGRAM MEMORY
(C LANGUAGE CODE)
; Setup a pointer to data Program Memory
MOV
#tblpage(PROG_ADDR), W0
;
MOV
W0, TBLPAG
;Initialize PM Page Boundary SFR
MOV
#tbloffset(PROG_ADDR), W0
;Initialize a register with program memory address
MOV
#LOW_WORD, W2
;
MOV
#HIGH_BYTE, W3
;
TBLWTL
W2, [W0]
; Write PM low word into program latch
TBLWTH
W3, [W0++]
; Write PM high byte into program latch
; Setup NVMCON for programming one word to data Program Memory
MOV
#0x4003, W0
;
MOV
W0, NVMCON
; Set NVMOP bits to 0011
DISI
#5
; Disable interrupts while the KEY sequence is written
MOV
#0x55, W0
; Write the key sequence
MOV
W0, NVMKEY
MOV
#0xAA, W0
MOV
W0, NVMKEY
BSET
NVMCON, #WR
; Start the write cycle
NOP
; Insert two NOPs after the erase
NOP
; Command is asserted
// C example using MPLAB C30
unsigned int offset;
unsigned long progAddr = 0xXXXXXX;
// Address of word to program
unsigned int progDataL = 0xXXXX;
// Data to program lower word
unsigned char progDataH = 0xXX;
// Data to program upper byte
//Set up NVMCON for word programming
NVMCON = 0x4003;
// Initialize NVMCON
//Set up pointer to the first memory location to be written
TBLPAG = progAddr>>16;
// Initialize PM Page Boundary SFR
offset = progAddr & 0xFFFF;
// Initialize lower word of address
//Perform TBLWT instructions to write latches
__builtin_tblwtl(offset, progDataL);
// Write to address low word
__builtin_tblwth(offset, progDataH);
// Write to upper byte
asm(“DISI #5”);
// Block interrupts with priority < 7
// for next 5 instructions
__builtin_write_NVM();
// C30 function to perform unlock
// sequence and set WR



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