18.11.2014 Views

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

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.

Programming<br />

• Hexadecimal numbers that begin with A through F must have a leading 0, and all<br />

hexadecimal numbers must end in H. Here are some examples of valid hexadecimal<br />

numbers:<br />

Valid Hex Number<br />

Decimal Equivalent<br />

0DH 208<br />

0AH 10<br />

15H 21<br />

0FFFFH 65,535<br />

0CH 12<br />

Here are some invalid hex numbers, and a valid hex number that doesn’t have its intended<br />

value:<br />

Invalid Hex Number<br />

Problem<br />

FFH no leading 0<br />

0C<br />

no trailing H<br />

10 (intended as decimal 16) no trailing H. BASIC-52 will interpret at<br />

decimal 10 (0AH)<br />

BASIC-52 Bugs and Things to Watch Out For<br />

This section is a summary of other bugs and other minor problems with BASIC-52 to be<br />

aware of as you program. Many of BASIC-52’s bugs and limits have been eliminated in<br />

newer versions of BASIC-52 developed by other sources, described in Chapter 15.<br />

Assembly-language Issues:<br />

In external code memory, if 2002h contains 5Ah and bit 5 at 2048h is set, BASIC-52 will<br />

try to call a user-written token table. If 2001h contains 0AAh, BASIC-52 will try to call a<br />

user-written reset routine at 2090h. If the expected table or routine isn’t present, the system<br />

will crash. (See Chapter 13.) Solution: avoid writing to code memory at 2001h, 2002h, and<br />

2048h. (In Figure 3-1’s circuit, the RAM in this area (if any) is accessed as data memory<br />

only, so you don’t have to worry about this.)<br />

<strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong> 69

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

Saved successfully!

Ooh no, something went wrong!