The Microcontroller Idea Book - Jan Axelson's Lakeview Research
The Microcontroller Idea Book - Jan Axelson's Lakeview Research
The Microcontroller Idea Book - Jan Axelson's Lakeview Research
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 13<br />
Most 8051-family cross-assemblers create files in Intel Hex format, which is convenient for<br />
EPROM programming and uploading to RAM. During the assembly process, if the assembler<br />
encounters a program line that is incomplete or not understandable, it will display an<br />
error message describing the problem. <strong>The</strong> assembler will also create a listing file that shows<br />
each line of your source file alongside the addresses and machine codes of the object file<br />
and any error messages generated.<br />
Memory for Program Storage<br />
On your BASIC-52 system, you’ll need room in external memory for storing your assembly-language<br />
routines. Remember that the 8052 has separate control signals for accessing<br />
code and data memory. For uploading into RAM and testing, you must use combined<br />
code/data memory, since you need data memory’s WR signal to write the routine into<br />
memory, and code memory’s PSEN to enable the 8052 to execute the routine.<br />
You can upload routines into any unused combined code/data memory from 2000h to FFFFh.<br />
Code memory from 0 to 1FFFh is not available, because the 8052-BASIC chip uses these<br />
locations for the BASIC-52 interpreter. If you have a 32K RAM addressed at 0 in combined<br />
code/data memory, you can use the area above 1FFFh for storing and testing assembly-language<br />
routines. For combined data/code memory in Figure 3-1’s circuit, move the connection<br />
at pin 22 of U7 from pin 17 of U2 (READ) to pin 3 of U3A (RDANY). With this setup,<br />
however, if you upload your programs into ordinary RAM, you’ll lose them when you power<br />
down.<br />
For more permanent storage, there are several options. You can use a 32K NV RAM, such<br />
as Dallas Semiconductor’s DS1235, or a Dallas 1213C SmartSocket and 62256 SRAM, in<br />
place of ordinary RAM at 0. Although you don’t need battery backup for data memory from<br />
0 to 1FFFh, it does no harm. Again, you must connect RDANY, not READ, to pin 22 of the<br />
NVRAM.<br />
To prevent overwriting your assembly-language routines in RAM when you reboot, set<br />
MTOP to 1FFFh, or another value that is lower than the beginning of your routines, and<br />
execute BASIC-52’s PROG3 command, as described in Chapter 3. (You must have NV<br />
memory at 8000h to save MTOP.)<br />
If you use a 32K NV RAM from 0 to 7FFFh, you should be aware that BASIC-52 reserves<br />
two areas of code memory for optional additions and enhancements. One area, from 2001h<br />
to 2091h, stores information that tells BASIC-52 about custom reset routines, keywords and<br />
other language extensions. Another area, from from 4003h to 41FFh, stores information<br />
about user-defined assembly-language interrupt routines.<br />
If you won’t be using these abilities, you can use these areas of memory for other purposes.<br />
However, if at all possible, it’s a good idea to avoid writing to locations 2001h, 2002h, and<br />
220 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>