21.07.2013 Views

Introduction to Microcontrollers Lab Manual - Microchip

Introduction to Microcontrollers Lab Manual - Microchip

Introduction to Microcontrollers Lab Manual - Microchip

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.1 OBJECTIVE<br />

8.2 PRE-LAB<br />

<strong>Lab</strong> 8. External Memory<br />

LABS<br />

Investigate the MX PIC24F module memory resources and the general design issues<br />

surrounding memory use in embedded systems.<br />

8.2.1 Reference Material<br />

• PIC24FJ256GB110 Family Data Sheet (DS39897)<br />

• 16-Bit MCU and DSC Programmer’s Reference <strong>Manual</strong> (DS70157)<br />

• MPLAB IDE User’s Guide (DS51519)<br />

• PIC24F Family Reference <strong>Manual</strong> – Section 23. Serial Peripheral Interface (SPI)<br />

(DS39699)<br />

8.2.2 Memory Basics<br />

At a basic level, memory circuits hold their contents for future accesses. Most memory<br />

provides an interface <strong>to</strong> write information in<strong>to</strong> the memory (i.e. s<strong>to</strong>re) and <strong>to</strong> read information<br />

out of the memory (i.e. load). The write interface is not always available during<br />

run time, e.g. One-Time-Program (OTP) memories.<br />

The ability of a memory circuit <strong>to</strong> hold its contents when power is removed is one way<br />

<strong>to</strong> categorize memory. The contents of volatile memory are erased when power <strong>to</strong> the<br />

circuit is disconnected. Examples of this are the DDR memory of a desk<strong>to</strong>p computer.<br />

Nonvolatile memory holds its contents even when power is removed from the circuit.<br />

Examples of this are a USB disk that contains NAND Flash memory.<br />

8.2.3 Memory in Embedded Systems<br />

In some ways, developing firmware for an embedded controller is not unlike writing<br />

code for a desk<strong>to</strong>p computer. Many aspects of the design process are similar: languages<br />

can often be the same (i.e. “C”), the control loops are similar, the sequential<br />

access is the same, and even multi-tasking and threads can be used on each. But<br />

when it comes <strong>to</strong> memory, the equations are completely different.<br />

A desk<strong>to</strong>p computer has resources that are simply not feasible for embedded systems,<br />

e.g. a large hard drive. As a result, most modern OSs assume that a large hard drive<br />

is connected <strong>to</strong> the computer. By using a technique called “virtual memory”, a program<br />

that is executing has access <strong>to</strong> an almost unlimited amount of memory. If the OS needs<br />

more memory, then it will swap out little used areas of its volatile memory <strong>to</strong> the hard<br />

drive. This then allows the OS <strong>to</strong> use that volatile memory space for further program<br />

execution. If the memory that was previously swapped out is required, then the OS will<br />

swap it back with another area of memory. As a result, most programmers can assume<br />

that they have a virtually unlimited amount of RAM memory <strong>to</strong> use, and the OS takes<br />

care of the details.<br />

2011 <strong>Microchip</strong> Technology Inc. DS51963A-page 57

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

Saved successfully!

Ooh no, something went wrong!