APPLICATION EXAMPLES

To make it easy for you to evaluate and become familiar with our 8051 development tools, we provide a demonstration diskette with 8051 program examples and limited versions of our tools. The sample programs are also provided as a part of our standard product distribution.

The demonstration versions of our tools are not fully functional. They are limited in one way or another. For example, the C51 compiler and A51 assembler do not generate object files; C51 has a 500-line limit; and the WinSim51 debugger/simulator allows you to debug using the 8051 processor.

This chapter will detail the examples program:

 HELLO

The production versions of our tools are fully functional and are not restricted or limited in any way. You may generate object modules for any of the sample programs and step through them using the WinSim debugger/simulator.

This chapter describes how to use the ProView-51 integrated development environment and the other 8051 development tools to compile, link, and test many of the sample source files. At this point, you should have already installed either the demonstration software or the actual development software.

The sample programs are found in the EXAMPLES  subdirectory under the \FSI\ installation directory. Each sample program is stored in a separate subdirectory along with all necessary associated files. ProView-51 project files are included so that you may quickly build and evaluate each sample program.

The following table lists the included sample programs and their locations. You may use ProView-51 to build and test each of these programs.

Subdirectory

Description

\FSI\EXAMPLES\CALC

The CALC sample program provides a simple, four-function calculator that demonstrates the effectiveness of the code generated by the C51 compiler. This example is contained in a single source file, CALC.C..

\FSI\EXAMPLES\CSAMPLE

This example demonstrates a simple addition and subtraction calculator and presents multiple module projects.

\FSI\EXAMPLES\DCLOCK

The DCLOCK example provides you with code that turns an 8051 into an alarm clock. Functions are available to display and change the time and set an alarm.

\FSI\EXAMPLES\DHRY

The DHRY example is a DHRYSTONE benchmark program that calculates and displays the dhrystones per second for the host CPU. This example is mainly provided for benchmark enthusiasts.

\FSI\EXAMPLES\HELLO

This demonstration program is the embedded 8051 C “Hello World” program. †

\FSI\EXAMPLES\LSIEVE

The LSIEVE example demonstrates the large model version of the sieve of Eratosthenes prime number generator. This example is mainly provided for benchmark enthusiasts.

\FSI\EXAMPLES\WHETS

The WHETS example is a WHETSTONE benchmark program that calculates and displays the whetstones per second for the host CPU. This example is mainly provided for benchmark enthusiasts.

† The HELLO sample program is described in detail in the following sections. The examples that are not marked are included in the examples directory, but are not specifically addressed in this manual. Each example has an associated Project file.

To start working with the sample files, you must open the appropriate project file from the \FSI\EXAMPLES\<example> directory. Using ProView-51 select OPEN from the PROJECT menu and select the appropriate .PRV file and press OK.

The remainder of this chapter describes, in detail, how to use the following sample program:

  HELLO: Your First C51 Program

In addition to these programs, this chapter also introduces additional sample programs that users of the commercial release may wish to investigate.

  HINT
Before you launch into a long, complex project, take a moment to build and test a very small, simple program such as HELLO. It provides you with an excellent test of your path, environment variables, and library and include file locations.