
JU13
Installed: Connect pins 2
and 3
DS8007's INTAUX pin connected to GND (through 10K)
Creating and Loading an Executable File
The next step is to create a .HEX file that can be downloaded into the board's memory and can then be
executed by the DS5002FP. Creating this file involves configuring the Keil µVision® project file to create
the proper loadable file, and then downloading it to the board's nonvolatile memory.
Creating the µVision Project
After the Keil C51 Development Tools are installed on the PC, start the µVision program by clicking on
the icon created. We will now create a project and C source files for the demonstration program by
following these steps:
1. Under the Project heading, select "New Project," and type DS8007-1 for the project name.
2. When the "Select Device for Target" appears, select the Dallas Semiconductor group and the
DS5002FP from the device selection list.
3. Click the "Yes" button when the "Copy Standard 8051 Startup Code to Project Folder and Add File
to Project" message appears.
4. Create the source file by clicking "File" then "New," and typing the following information. If you
prefer downloading this file, it is available for
(ZIP, 11kB).
// File DS8007-1.C
#include <REG5000.H> // special function register
declarations
// // for the DS5000/5002
#include <stdio.h> // prototype declarations for I/O
functions
// Main C function. Program execution starts here.
void main (void) {
// Set up the serial port for 38400 baud at 14.7MHz.
TMOD=0x21; // Timer 1: 8-bit auto-reload
from TH1, Timer 0: 16-bit
TH1 = 0xFE; // Set timer reload value for
38,400 baud
PCON|=0x80; // Turn on baud rate doubler
SMOD_0
TCON=0x50; // Enable timers 0 and 1
SCON=0x50; // 10-bit async, enabled
TI=1; // Set TI to send first character
TR1 = 1; // Start timer 1
// Start main program
printf ("\nHello DS8007 World!\n\n"); // Output message
while (1) ; // End program by looping here.
}
5. After this text has been entered, save the file by clicking "File" then "Save As" and typing in
"DS8007-1.c" as the file name.
6. Add this file to the project list by right-clicking on Target 1 in the Project Workspace window, and
then click the "Manage Components" option. Under the Project Components tab, click the "Add
Files" button, and then enter the file name (DS8007-1.c) in the file name area. Click the "Add"
button and then click the "Close" button. Click the "OK" button to close the Components window.
Page 4 of 11