Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.COM

X  

PIC24FJ64GA310 Datasheet(PDF) 88 Page - Microchip Technology

Part # PIC24FJ64GA310
Description  64/80/100-Pin, General Purpose, 16-Bit Flash Microcontrollers with LCD Controller and nanoWatt XLP Technology
PDF  406 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

PIC24FJ64GA310 Datasheet(HTML) 88 Page - Microchip Technology

Back Button PIC24FJ64GA310 Datasheet HTML 84Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 85Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 86Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 87Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 88Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 89Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 90Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 91Page - Microchip Technology PIC24FJ64GA310 Datasheet HTML 92Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 88 / 406 page
background image
PIC24FJ128GA310 FAMILY
DS39996F-page 88
 2010-2011 Microchip Technology Inc.
6.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 (MSBs) 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 pro-
gram 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 6-5). An equivalent procedure in ‘C’
compiler, using the MPLAB C30 compiler and built-in
hardware functions, is shown in Example 6-6.
EXAMPLE 6-5:
PROGRAMMING A SINGLE WORD OF FLASH PROGRAM MEMORY
EXAMPLE 6-6:
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_N, W2
;
MOV
#HIGH_BYTE_N, 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.B
#0x55, W0
; Write the key sequence
MOV
W0, NVMKEY
MOV.B
#0xAA, W0
MOV
W0, NVMKEY
BSET
NVMCON, #WR
; Start the write cycle
NOP
; Required delays
NOP
// 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   |   Datasheet Upload   |   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