12.07.2015 Views

Section 4. Program Memory - Microchip Taiwan

Section 4. Program Memory - Microchip Taiwan

Section 4. Program Memory - Microchip Taiwan

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Section</strong> <strong>4.</strong> <strong>Program</strong> <strong>Memory</strong>Example 4-5 illustrates the placement of constant data in program memory, and accesses thisdata through the PSV data window using an assembly program.Example 4-5: PSV Code Example in Assembly.section .const, psvfib_data:.word 0, 1, 2, 3, 5, 8, 13; Start of code section.text.global __main__main:; Set DSRPAG to the page that contains the “fib_data” arrayMOVPAG #psvpage(fib_data), DSRPAG; Set up W0 as a pointer to “fib_data” through the PSV data windowMOV #psvoffset(fib_data), W0; Load the data values into registers W1 - W7MOV [W0++], W1MOV [W0++], W2MOV [W0++], W3MOV [W0++], W4MOV [W0++], W5MOV [W0++], W6MOV [W0++], W7done:BRA doneRETURN<strong>4.</strong>6 PROGRAM MEMORY WRITESThe dsPIC33E/PIC24E families of devices contain internal program Flash memory for executinguser code. There are two methods by which the user application can program this memory:• Run-Time Self-<strong>Program</strong>ming (RTSP)• In-Circuit Serial <strong>Program</strong>ming (ICSP)RTSP is accomplished using TBLWT instructions. ICSP is accomplished using the SPI interfaceand integral bootloader software. For further details on RTSP, refer to <strong>Section</strong> 5. “Flash<strong>Program</strong>ming” (DS70609). For further details on ICSP, refer to the “dsPIC33E/PIC24E Flash<strong>Program</strong>ming Specification” (DS70619), which can be obtained from the <strong>Microchip</strong> web site(www.microchip.com).<strong>4.</strong>7 PROGRAM MEMORY LOW-POWER MODEThe voltage regulator for the program Flash memory can be placed in Stand-by mode when thedevice is in Sleep mode, resulting in a significant reduction in device power-down current (IPD).When the VREGSF bit (RCON) is equal to ‘0’, the Flash memory voltage regulator goes intoStand-by mode during Sleep. When the VREGSF bit is equal to ‘1’, the Flash memory voltageregulator is active during Sleep mode.4<strong>Program</strong> <strong>Memory</strong>© 2010 <strong>Microchip</strong> Technology Inc. DS70613B-page 4-19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!