# Application Note 191
Toolchain Extensions for R8051XC Core

Revision 1 - April 2006

This Application Note tells you how to configure the Keil 8051 development tools for Evatronix R8051XC based devices. The R8051XC is a highly configurable IP core that provides many extensions such as configurable DPTR registers, MDU, and a flexible set of peripherals.

Information in this file, the accompany manuals, and software is
Copyright © KEIL - An ARM Company.
All rights reserved.

## Contents

1. Overview
2. Device Database Configuration
3. Multiple DPTR Support
4. Simulator Configuration
5. Example Programs
6. Technical Support
7. Contact Details

## Overview

This application note describes the configuration features for the Evatronix R8051XC CPU core that are available in the Keil PK51 Professional Developer's Kit.

- The µVision® Device Database® allows to define new devices that you have created with the R8051XC CPU core. Refer to the article UVISION: ADDING CUSTOM PARTS TO THE DEVICE DATABASE for information on how to create a new device within the µVision environment. The article UVISION: ADDING A USER-SPECIFIC DEVICE DATABASE (CDB FILE) explains how to organize new devices in a custom device database.
- The µVision Simulation DLLs can be configured to cover several aspects of the R8051XC CPU core.
- The standard code banking feature of Keil PK51 allows you to use the program memory banking feature of the R8051XC CPU core
- The Keil C51 Compiler provides extensions to use the multiple DPTR registers and the MDU of the R8051XC CPU core.

NOTE:

- The R8051XC extensions described in this application note are part of Keil PK51 Version 8.03 or higher. Previous versions do not support the R8051XC features.

## Device Database Configuration

The µVision Device Database allows you to create custom devices that simplifies the configuration tool configuration. The article UVISION: ADDING CUSTOM PARTS TO THE DEVICE DATABASE explains the various configuration options.

The string CPU= configures the memory sizes of the device and specific options such as MDU or multiple DPTR. The following options are relevant for the R8051XC:

- MODC2: enable 2 DPTR registers in both the simulator and the C51 Compiler. For more information refer to the C51 User's Guide - MODC2 Compiler Directive.
- MOD517DP: enable 8 DPTR registers in both the simulator and the C51 Compiler. For more information refer to the C51 User's Guide - MOD517 Compiler Directive.
- MDU_R515: configure for Multiply/Devide Unit of Evatronix R8051XC. Allows you to use the C51 extensions for MDU. For more information refer to the C51 User's Guide - MDU_R515 Compiler Directive.

The string SIM= configures the CPU and Peripheral simulation DLLs. For the R8051XC device you need to use the DLL's S8051.DLL and DCore51.DLL with the parameter -pR8051XC. Additional parameters described in the next section Simulator Configuration.

Sample configuration options:

    CPU=IRAM(0-0x7F)  CLOCK(12000000) MOD517DP MDU_R515
    SIM=S8051.DLL("-PMW -DPC -BSE") DCore51.DLL("-pR8051XC")

## Multiple DPTR Support

The R8051XC device provides auto-increment features and automatic saving of the multiple DPTR register banks. When using the C51 directive BSE, the compiler does no longer save the DPTR registers when switching register banks. When using this feature together with t he MOD517(DP8) directive, the C51 Compiler uses the auto-increment features with the C51 library functions memcpy, memcmp, memmove, strcpy, and strcmp.

## Simulator Configuration

The R8051XC device is simulated with the CPU DLL S8051.DLL and the Dialog DLL DCore51.DLL. These DLL provide several parameters that provide configuration features for the device. The parameters may be entered in the µVision dialog page Options for Target - Debug. When you select a device from the device database, the DLL parameters are copied from the string SIM= as described in the previous section Device Database Configuration.

### S8051.DLL Parameters for R8051XC

- -PMW: enable the PCON.PMW feature that allows to use MOVX instructions to write into the code space.
- -DPC: enable the data pointer control registers that provide auto-increment features for the DPTR registers.
- -BSE: enable the Bank Switch Enable feature in the register DPSEL.3.

### DCore51.DLL Parameters for R8051XC

- -pR8051XC: configure for the R8051XC core.
- -oXXXXXXXX: specifies the implemented peripherals. XXXXXXXX is a 32-bit HEX number that is encoded as shown table below:

  Bit | Description
  --- | ---
  0 | Port 0
  1 | Port 1
  2 | Port 2
  3 | Port 3
  4 | Timer 0
  5 | Timer 1
  6 | Timer 2
  7 | UART 0
  8 | UART1
  9 | PMU (Power Management Unit)
  10 | PMW (Program Memory Write)
  11 | MDU (Multiplication/Division Unit)
  12 | CKCON (Clock Control)
  13 | Watchdog
  15-14 | 00: No Interrupt Controller 01: 8051 compatible, 2-level 10: 80515 compatible, 4 level 11: invalid
  17-16 | 00: no DPTR 01: one DPTR 10: two DPTR 11: eight DPTR
  18 | DPTR auto incremtent
  19 | I2C
  20 | SPI
  24-21 | 0000: no external interrupt 0001: 1 external interrupt 0010: 2 external interrupts 0011: 3 external interrupts :
  1100: 12 external interrupts
  1101: 13 external interrupts
  25 | Disable MUL instruction
  26 | Disable DIV instruction
  27 | Disable DA instruction
  30-28 | 000: no additional address lines (16 bit address, no code banking) 001: 1 additional address line 010: 2 additional address line : 111: 7 additional address line
  31 | unused

Configuration parameter examples for the DCore51.DLL:http://www.keil.com/update/rvmdk.asp

- -pR8051XC -o00001234: enables timer 0, timer1, ..
- -pR8051XC -o01BDBFFF (default): enables port 0-3, timer 0/1/2, UART 0/1, PMU, PMW, MUL/DIV, CKCON, Watchdog timer, ISR515, one DPTR, DPTR auto increment, I2C, SPI, 13 external interrupts, full instruction set, no additional address lines.

NOTE:

- The peripheral simulation components of the DCore51.DLL may be expanded by using the AGSI Interface. Refer to Application Note 154: Implementing DLLs for User-defined Simulation (AGSI) for more information.

## Example Programs

Example programs in the folder ..\C51\EXAMPLES\R8051XC demonstrate some features of the Evatronix R8051XC core. All programs can be fully simulated with the uVision Debugger.

## Technical Support

At Keil Software, we are dedicated to providing you with the best development tools and technical support. That's why we offer numerous ways you can get the technical support you need to complete your embedded projects.

- Technical Support Knowledgebase
  More than 1500 technical support questions and answers are available in the Support Solutions Knowledgebase. When a new question arises, it is added to the knowledgebase which is continuously published to the Web. This enables you to get technical support at times when our support staff is unavailable.
- Application Notes
  Numerous Application Notes help you decipher complex features and implement robust applications.
- Example Programs and Files
  Utility programs, example code, and sample projects are regularly added to the Download File section of the web site.
- Discussion Forum
  Post questions, comments, and suggestions to the Keil Software Discussion Forum and interact with other Keil users around the world.

Many of the features of our Technical Support Knowledgebase and Web Site are the results of your suggestions. If you have any ideas that will improve them, please give us your feedback!

## Contact Details

If you experience any problems or have any questions about this Application Note, contact one of our distributors or offices for assistance.

In the USA... KEIL - An ARM Company 1501 10th Street, Suite 110 Plano, TX 75074 USA
800-348-8051 - Sales
972-312-1107 - Support
972-312-1159 - Fax
sales.us@keil.com - Sales E-Mail
support.us@keil.com - Support E-mail

In Europe...
KEIL - An ARM Company
Bretonischer Ring 15
D-85630 Grasbrunn
Germany
+49 89 456040-0 - Sales
+49 89 456040-24 - Support
+49 89 468162 - Fax
sales.intl@keil.com - Sales E-Mail
support.intl@keil.com - Support E-Mail

Copyright © KEIL - An ARM Company.
All rights reserved.
Visit our web site at www.keil.com.