To our customers, Old Company Name in Catalogs and Other Documents On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology Corporation, and Renesas Electronics Corporation took over all the business of both companies. Therefore, although the old company name remains in this document, it is a valid Renesas Electronics document. We appreciate your understanding. Renesas Electronics website: http://www.renesas.
Notice 1. 2. 3. 4. 5. 6. 7. All information included in this document is current as of the date this document is issued. Such information, however, is subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please confirm the latest product information with a Renesas Electronics sales office.
User’s Manual Renesas Starter Kit RSKM16C6NK Tutorial Manual RENESAS SINGLE-CHIP MICROCOMPUTER Rev.4.00 2007.
Table of Contents Chapter 1. Preface ..................................................................................................................................................1 Chapter 2. Introduction............................................................................................................................................2 Chapter 3. Tutorial Project Workspace ...................................................................................................................
Chapter 1. Preface Cautions This document may be, wholly or partially, subject to change without notice. All rights reserved. Duplication of this document, either in whole or part is prohibited without the written permission of Renesas Technology Europe Limited. Trademarks All brand or product names used in this manual are trademarks or registered trademarks of their respective companies or organisations. Copyright © Renesas Technology Europe Ltd. 2007. All rights reserved. © Renesas Technology Corporation.
Chapter 2. Introduction This manual is designed to answer, in tutorial form, the most common questions asked about using a Renesas Starter Kit (RSK): The tutorials help explain the following: • How do I compile, link, download, and run a simple program on the RSK? • How do I build an embedded application? • How do I use Renesas’ tools? The project generator will create a tutorial project with two selectable build configurations • ‘Debug’ is a project built with the debugger support included.
Chapter 3. Tutorial Project Workspace The workspace includes all of the files for two build configurations. The tutorial code is common to both the Debug and the Release build configurations. The tutorial is designed to show how code can be written, debugged then downloaded in a ‘Release’ situation. The build configuration menu in High-performance Embedded Workshop (HEW) allows the project to be configured such that certain files may be excluded from each of the build configurations.
Chapter 4. Project Workspace 4.1. Introduction HEW is an integrated development tool that allows the user to write, compile, program and debug a software project on any of the Renesas Microcontrollers. HEW will have been installed during the installation of the software support for the RSK product. This manual will describe the stages required to create and debug the supplied tutorial code. 4.2.
of many code examples for the peripheral modules of the device. The final option is for an application build where the debugger is configured but there is no program code. This project is suitable for the user to add code without having to configure the debugger. • Select “Tutorial” as the type of project to generate and then click “Next”. • Click “Finish” to create the project The project generator wizard will display a confirmation dialog.
Chapter 5. Building the Tutorial Project The tutorial project build settings have been pre-configured in the tool-chain options. To view the tool chain options select the ‘Build’ Menu item and the relevant tool-chain. This should be the first option(s) on the drop down menu. The dialog that is displayed will be specific to the tool-chain selected. The configuration pane on the left hand side will exist on all the tool-chain options.
5.2. Connecting the debugger For this tutorial it is not necessary to provide an external power supply to the board. The power will be obtained from the USB port. Please be aware that if you have too many devices connected to your USB port it may be shut down by windows. If this happens remove some devices and try again. Alternatively provide an external power source taking care to ensure the correct polarity and voltage.
14. Select FF000 for the Firmware location for the program. It is recommended that the E8a firmware location is towards the top of the memory map. 15. Select 7F00 for the Work RAM location. It is recommended that the Work RAM is towards the top of the memory map. 16. Ensure that the checkbox “Debugging of program that uses WDT” is not checked. 17. Select the ‘MCU Setting’ tab.. 18. Select the processor mode “Single-Chip Mode”. 19. Select “PM13 …”. 20. Clear “PM10 …”. 21. Click .
22. The Flash Memory write program is downloaded. 23. The Output window in HEW will state ‘Connected’. Now is a good time to save the HEW session. 24. Select ‘File’ | ‘Save Session’. If you have changed any workspace settings now is a good time to save the workspace. 25. Select ‘File’ | ‘Save Workspace’.
Chapter 6.Downloading and Running the Tutorial Once the code has been built in HEW it needs to be downloaded to the RSK. There will now be an additional category in the workspace view for downloading. 26. Right click on the download module listed and select ‘Download’ On completion the debugger and code are ready to be executed. To start debugging we need to reset the debugger and target. 27. Press ‘Reset CPU’ on the Debug Tool Bar. The File window should open the Tutorial code at the entry point.
column to the left of the breakpoint column. Up to 8 eventpoints can be set. Eventpoints do not require programming the flash memory, and thus are faster to use. 30. Press ‘Reset Go’ on the Debug Tool Bar. The code will execute to the breakpoint. At this point all the device initialisation will have been completed. 31. Press ‘Step In’ on the Debug Tool Bar. The code window will open ‘main.c’ and show the new position of the program counter. 32. Insert a breakpoint on the call to the ‘TimerADC’ function.
33. Right click on the ‘FlashLEDs()’; function and select ‘Go to cursor’. The code will execute to the selected line and stop. An automatic breakpoint was inserted in the code and then removed after calling the break. 34. Press ‘Step Over’ on the Debug Tool Bar. The code will run and flash the LEDs 200 times. The debugger will not exit until all 200 flashes have completed or a button is pressed on the RSK. 35. If the LEDs are still flashing press the SW1 button on the RSK to exit the flashLEDs() function.
42. Press on the debug tool bar. 43. Press ‘CTRL-B’ to open the breakpoint window. 44. Select ‘Remove All’ 45. Press . 46. Open the file ‘main.c’ 47. Insert a breakpoint on ‘StaticsTest();’. The statics test is used to demonstrate that the initialisation has successfully copied all initialised variables from storage in flash to RAM. 48. Press on the Debug Tool Bar. The code will stop at the breakpoint. (Press a button to bypass the flashing LED test.) 49.
replacement string. 54. Remove the breakpoint 55. Right click on the ‘DisplayString();’ function call after the loop and select ‘Go to cursor’. This shows that the variable was initialised at program start up and can be overwritten with ‘TESTTEST’. You have now run the tutorial code and used many of the common features of the debugger.
Chapter 7. Project Files 7.1. Standard Project Files The RSK tutorials are configured so that it is possible to provide the same tutorial code on multiple RSK products. This allows the evaluation of the different processor cores using equivalent code. To achieve this, the following files are common between all device cores and Tool-chains. Each of the tutorial files has detailed comment text describing the function of each code entry.
The call to ‘hardwaresetup()’ will initialise the device hardware and peripherals ready for the tutorial software. The call to ‘main()’ will start the main demonstration code. 7.1.2. Board initialisation code (Hwsetup.c / hwsetup.h) There are four common stages to the configuration of the microcontroller device. The code to demonstrate this is therefore split into four functions. Each function is written specifically for the device supported. The function calls are shown below.
7.1.3. Main tutorial code (Main.c / main.h) The main tutorial code is common to all tutorial projects. The display initialisation and string display functions operate on the LCD display module. Check compatibility with ks0066u controller and pin connection on the schematic before connecting a LCD module not supplied by Renesas.
Chapter 8. Additional Information For details on how to use High-performance Embedded Workshop (HEW), refer to the HEW manual available on the CD or from the web site. Further information available for this product can be found on the Renesas website at: www.renesas.com/renesas_starter_kits General information on Renesas Microcontrollers can be found at the following website: http://www.renesas.
Renesas Starter Kit RSKM16C6NK Tutorial Manual Publication Date Rev.04.00 30.OCT.2007 Published by: Renesas Technology Europe Ltd. Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK ©2007 Renesas Technology Europe and Renesas Solutions Corp., All Rights Reserved.
Renesas Starter Kit for M16C/6NK Tutorial Manual 1753, Shimonumabe, Nakahara-ku, Kawasaki-shi, Kanagawa 211-8668 Japan REG10J0018-0400