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

Create successful ePaper yourself

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

Programming<br />

5<br />

Programming<br />

When you have your 8052-BASIC system up and running, you’re ready to start writing and<br />

running your own programs. This chapter is an introduction to the BASIC-52 programming<br />

language. It includes a summary of BASIC-52’s abilities, some examples that illustrate what<br />

you can do with it, plus tips for writing and debugging programs.<br />

For a complete reference to BASIC-52, see the BASIC-52 programming manual (either<br />

version), which includes many more examples and details about the language and how it<br />

works. You can learn a lot about BASIC-52 by browsing through the programming manual<br />

and experimenting on your own.<br />

Programming Basics<br />

Like other BASIC programs, BASIC-52 programs are built around a set of keywords, or<br />

reserved words. Each keyword has a specific meaning to the BASIC-52 interpreter. or<br />

example, the program line PRINT XTAL tells BASIC-52 to find the stored value of the<br />

XTAL operator and send it to the console input device (the serial port of the host computer),<br />

which will then display the value it receives.<br />

If you’re familiar with BASIC programming, most of BASIC-52’s keywords and conventions<br />

will be familiar. If you have little programming experience, or if your experience is<br />

with assembly language, C, Pascal, or another language, you’ll have more to learn. But on<br />

the whole, BASIC-52 makes it easy to quickly write and test your programs.<br />

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

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

Saved successfully!

Ooh no, something went wrong!