Nonvolatile Memory Demo


In this exercise we'll learn how to read from and write to the PIC's two nonvolatile memory regions: the program space itself and the EEPROM. Bear in mind that PIC Micro Pascal has all sorts of powerful commands built-in to carry out these operations automatically at a high level. But the purpose of this demo is to show what's going on at the lowest level.

To monitor the results, we'll use an RS-232 card for convenience. This then hooks up to the PIC's hardware serial port, and the PMP code uses the Serial.pas library unit. The activity is then watched on a terminal program. As I've mentioned before, I like using Br@y's Terminal. See a previous exercise for more details.

Here's the connection, then:


Start the terminal program, then fire up the circuit. At this point, it's just a matter of following the instructions provided by the software. For example, you'll be able to access the EEPROM, as well as the program space proper, reading, writing and erasing. Bear in mind that the latter memory has a limited lifetime compared to the former, so don't run this program ten-thousand times, for instance, or you'll wear out the program space!

A sample run looks like this. Click it to enlarge.


Click to get the source code.
Click to get the schematic PDF.

Next Project: Mathematical Functions

No comments:

Post a Comment