Application Note RL78/I1B Energy Monitor

Application Note RL78/I1B Energy Monitor
Application Note
16
32
RL78 Group
Application Note: RL78/I1B Energy Monitor
16-Bit Single-Chip Microcontrollers
All information contained in these materials, including products and product specifications, represents
information on the product at the time of publication and is subject to change by Renesas Electronics
Corporation without notice. Please review the latest information published by Renesas Electronics
Corporation through various means, including the Renesas Electronics Corporation website
(http://www.renesas.com).
Rev. 1.00 Apr 2015
Notice
1.
Descriptions of circuits, software and other related information in this document are provided only to illustrate the
operation of semiconductor products and application examples. You are fully responsible for the incorporation of these
circuits, software, and information in the design of your equipment. Renesas Electronics assumes no responsibility for
any losses incurred by you or third parties arising from the use of these circuits, software, or information.
2. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas
Electronics does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for
any damages incurred by you resulting from errors in or omissions from the information included herein.
3. Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property
rights of third parties by or arising from the use of Renesas Electronics products or technical information described in
this document. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other
intellectual property rights of Renesas Electronics or others.
4. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in
part. Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such
alteration, modification, copy or otherwise misappropriation of Renesas Electronics product.
5. Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”.
The recommended applications for each Renesas Electronics product depends on the product’s quality grade, as
indicated below.
“Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio
and visual equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial
robots etc.
“High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster
systems; anticrime systems; and safety equipment etc.
Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct
threat to human life or bodily injury (artificial life support devices or systems, surgical implantations etc.), or may cause
serious property damages (nuclear reactor control systems, military equipment etc.). You must check the quality grade
of each Renesas Electronics product before using it in a particular application. You may not use any Renesas
Electronics product for any application for which it is not intended. Renesas Electronics shall not be in any way liable for
any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for
which the product is not intended by Renesas Electronics.
6. You should use the Renesas Electronics products described in this document within the range specified by Renesas
Electronics, especially with respect to the maximum rating, operating supply voltage range, movement power voltage
range, heat radiation characteristics, installation and other product characteristics. Renesas Electronics shall have no
liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified
ranges.
7. Although Renesas Electronics endeavours to improve the quality and reliability of its products, semiconductor products
have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use
conditions. Further, Renesas Electronics products are not subject to radiation resistance design. Please be sure to
implement safety measures to guard them against the possibility of physical injury, and injury or damage caused by fire
in the event of the failure of a Renesas Electronics product, such as safety design for hardware and software including
but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any
other appropriate measures. Because the evaluation of microcomputer software alone is very difficult, please evaluate
the safety of the final products or systems manufactured by you.
8. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental
compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all
applicable laws and regulations that regulate the inclusion or use of controlled substances, including without limitation,
the EU RoHS Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your
noncompliance with applicable laws and regulations.
9. Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose
manufacture, use, or sale is prohibited under any applicable domestic or foreign laws or regulations. You should not use
Renesas Electronics products or technology described in this document for any purpose relating to military applications
or use by the military, including but not limited to the development of weapons of mass destruction. When exporting the
Renesas Electronics products or technology described in this document, you should comply with the applicable export
control laws and regulations and follow the procedures required by such laws and regulations.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, who distributes, disposes of, or
otherwise places the product with a third party, to notify such third party in advance of the contents and conditions set
forth in this document, Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as
a result of unauthorized use of Renesas Electronics products.
11. This document may not be reproduced or duplicated in any form, in whole or in part, without prior written consent of
Renesas Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this
document or Renesas Electronics products, or if you have any other inquiries.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its
majority owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
(2012.4)
Disclaimer
By using this Renesas RL78/I1B Energy Monitor platform, the user accepts the following terms:
The Renesas RL78/I1B Energy Monitor is not guaranteed to be error free and the entire risk as to the results and
performance of the Renesas RL78/I1B Energy Monitor is assumed by the user. The RL78/I1B Energy Monitor is
provided by Renesas on an “as is” basis without warranty of any kind whether express or implied, including but not
limited to the implied warranties of satisfactory quality, fitness for a particular purpose, title and non-infringement of
intellectual property rights with regard to the RL78/I1B Energy Monitor. Renesas expressly disclaims all such
warranties. Renesas or its affiliates shall in no event be liable for any loss of profit, loss of data, loss of contract, loss
of business, damage to reputation or goodwill, any economic loss, any reprogramming or recall costs (whether the
foregoing losses are direct or indirect) nor shall Renesas or its affiliates be liable for any other direct or indirect
special, incidental or consequential damages arising out of or in relation to the use of this RL78/I1B Energy Monitor,
even if Renesas or its affiliates have been advised of the possibility of such damages.
Electromagnetic Compatibility (EMC)
How to Use This Manual
1.
Purpose and Target Readers
This application note is designed to help the user understand how to interact safely and effectively with
Renesas RL78/I1B Energy Monitor. It is intended to be read by those using the Renesas RL78/I1B Energy
Monitor as a guide or starting point for their own applications.
This application note demonstrates a basic guide on how to navigate the on-board menu system and use the
accompanying PC application to monitor supply and load characteristics, in order to help familiarize the user
with the device operation.
2
This application note also provides a basic guide to e studio; showing how to develop and debug software for
the Renesas RL78/I1B Energy Monitor.
Particular attention should be paid to the precautionary notes when reading this application note. These notes occur
within the body of the text, at the end of each section, and in the Usage Notes section.
The revision history summarises the locations of revisions and additions. It does not list all revisions. Refer to the text of
the manual for details.
The following documents apply to the Renesas RL78/I1B Energy Monitor. Make sure to refer to the latest
versions of these documents. The newest versions of the documents listed may be obtained from the
Renesas Electronics Web site at http://www.renesas.eu/
Document Type
Description
Document Title
Document No.
Quick Start Guide
Quick start guide for the RL78/I1B Energy Monitor
Rl78/I1B Energy
Monitor Quick Start
Guide
R20UT3423EG
Hardware Manual
Provides technical details
microcontroller group.
Rl78/I1B User’s
Manual: Hardware
R01UH0407EJ
Schematics
Circuit schematics of the RL78/I1B Energy Monitor
of
the
RL78/I1B
Global Reference
PF Schematics
D013964_04
2.
List of Abbreviations and Acronyms
Abbreviation
ADC
A.C.
COM
CSV
DVD
E1
EMC
GDB
GUI
IAR
IDE
IEC
LCD
LED
MCU
PC
PCB
PGA
RTC
SFR
UAC
USB
Full Form
Analogue-to-Digital Converter
Alternating Current
Communication
Comma Separated Values
Digital Versitile (Video) Disk
On-chip Debugger
Electromagnetic Compatibility
GNU Debug
Graphical User Interface
Ingenjörsfirman Anders Rundgren
Integrated Development Environment
International Electrotechnical Commission
Liquid Crystal Display
Light Emitting Diode
Micro-controller Unit
Personal Computer
Printed Circuit Board
Programmable Gain Amplifier
Real Time Clock
Special Function Register
User Access Control
Universal Serial Bus
All trademarks and registered trademarks are the property of their respective owners.
Table of Contents
1. Introduction ........................................................................................................................ 7
1.1
Purpose ...................................................................................................................................................... 7
2. Introduction to the Energy Monitor ..................................................................................... 8
3. Connecting the RL78/I1B Energy Monitor ......................................................................... 9
3.1
3.2
AC Supply Connections ............................................................................................................................. 9
User and Development Interfaces ............................................................................................................. 9
4. Tool Installation ................................................................................................................ 11
4.1
4.2
IAR Embedded Workbench (Evaluation) Installation ............................................................................... 11
2
e studio & Energy Meter GUI Installation ............................................................................................... 12
5. Connecting E1 Emulator ................................................................................................. 14
5.1
5.2
5.3
Obtaining an E1 Debugger & E1_Tool ..................................................................................................... 14
Loction of Debug Connector P3 ............................................................................................................... 14
Connecting the E1 Debugger .................................................................................................................. 15
6. Importing, Programming and Debug ................................................................................ 16
6.1
6.2
6.3
2
Importing project in to e studio ............................................................................................................... 16
Building and Debugging the project ......................................................................................................... 16
Build Configurations ................................................................................................................................. 18
7. Graphical User Interface Operation ................................................................................. 19
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
Finding the Virtual COM Port Number ..................................................................................................... 19
Launching the GUI ................................................................................................................................... 19
Meter Configuration ................................................................................................................................. 20
COM Setting ............................................................................................................................................ 20
GUI Operation .......................................................................................................................................... 20
GUI – Calibration Menu ........................................................................................................................... 21
GUI – EM Config Menu ............................................................................................................................ 22
GUI – Data Record Menu ........................................................................................................................ 23
GUI – Debug Menu .................................................................................................................................. 23
8. E1 Tool Schematic Diagram............................................................................................. 25
9. Additional Information ...................................................................................................... 26
RL78/I1B Energy Monitor Application Note
RENESAS RL78/I1B Energy Monitor
`
R20AN0374EG0100
Rev. 1.00
Apr 28, 2015
1. Introduction
1.1
Purpose
The Renesas RL78/I1B Energy Monitor is an evaluation tool for demonstrating the use of the Renesas
RL78/I1B microcontroller in an energy monitoring application.
This document is intended to familiarize the user with interacting with the RL78/I1B Energy Monitor safely. It
2
provides details of debugging / programming the RL78/I1B via the Renesas E1 debugger using the e studio
IDE. It also provides details of the Graphical User Interface.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 7 of 32
RL78/I1B Energy Monitor
2. Introduction to the Energy Monitor
2. Introduction to the Energy Monitor
The Rl78/I1B Energy Monitor provides single input, dual output, high performance, low power consumption
Energy Monitor.
The Energy Monitor hardware platform is a derivative of the RL78/I1B Global Reference Meter from Renesas.
The Global Reference Meter provides additional features, such as tamper sensors, which are not used in the
Energy Monitor.
Supply
In
RL78/I1B – 80 Pin
P
RTC and
internal
oscillator
Reference
generator
32.768kHz
RTC crystal
AREGC
AVCM
PGA
Serial Array Unit
ADC CH1
ΔΣ
modulator +
filter
IIC00:
I2C EEPROM
USB to UART
interface
Mini-B
UART0
IIC EEPROM
CPU
ΔΣ
modulator +
filter
LCD
Driver
LCD display
LED pulse
indicators
LCD
Backlight
PGA
UART2
ΔΣ
modulator +
filter
ADC CH2
Optical
Interface
ADC CH0
PGA
USB
AVRT
Unused on
Energy Monitor
Power
supply
Optoisolator
N
Socket 1
Debug
Debug I/F:
E1 interface
Tamper
Switch
External
Isolation
Required
Magn etic
Sensor
Unused on
Energy Monitor
User
Switches
GPIO
Socket 2
Figure 3-1 RL78/I1B Energy Monitor Block Diagram
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 8 of 32
RL78/I1B Energy Monitor
3. Connecting the RL78/I1B Energy Monitor
3. Connecting the RL78/I1B Energy Monitor
3.1
AC Supply Connections
The Energy Monitor assembly is isolated from the system earth and therefore can be floating at
dangerous potentials. Extreme care must be used when operating the energy monitor when
connected to A.C. Line Voltages. Never operate the demonstration system with the covers
removed unless suitable isolation and protective equipment is used. This unit is intended to be
operated only by suitably qualified personnel.
The electrical connections to the meter are through an IEC C20 (input terminal) and two IEC C13 (load
terminals).
The RL78/I1B Energy Monitor is designed to be directly connected, so the current passes from input to output
terminals for each socket via the current sensing elements internal to the energy monitor. Refer to Figure 3-1
for connection information.
Load Socket 2
Measurement
Method: Current
Supply Input
100v to 253v
45Hz to 65Hz
16A Maximum
Load Socket 1
Measurement
Method: Shunt
Total 16A
Maximum
USB Virtual COM port
Figure 3-2 RL78/I1B Energy Monitor USB & Power Connections
3.2
3.2.1
User and Development Interfaces
General User Interfces:
The Renesas RL78/I1B Energy Monitor provides the following user-accessible interfaces which can be used
with the protective cover closed and can be used safely at all times.
 Menu navigation – Up / Down / Select buttons,
 Isolated USB Virtual COM port.
These interfaces are electrically isolated from the A.C. supply and are safe to use, however the user must be
aware that potentially hazardous voltages are present on all the other areas of the exposed PCB which do
potentially present a risk of electric shock if touched. This includes items such as the LCD display, MCU,
crystal etc.
This system should be operated only with suitable protective equipment and only by appropriately trained and
qualified personnel.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 9 of 32
RL78/I1B Energy Monitor
3. Connecting the RL78/I1B Energy Monitor
3.2.2
Menu Button Layout
The menu navigation buttons have the following functions:
Figure 3-3 Menu Button Layout
3.2.3
Screen Display loops and Button Functions
Please refer to the Quick Start Guide (R20UT3423EG) for information on the various screen displayed on the
RL78/I1B Energy Monitor and the functions of the three menu buttons.
3.2.4
Calibration Reset to Factory Default
In exceptional circumstances, it may be necessary to reset the RL78I1B Energy Monitor to factory default precalibration coefficient values.
This procedure will reset to pre-calibration factory defaults. Following this the unit will require calibration with
an external reference supply to provide accurate measurements (see section 7.6.1).
To reset the coefficient values to factory defaults: with power off, hold down Select, Down & Up buttons and
turn power on. Reset is complete when the display turns on and starts scrolling.
3.2.5
E1 Debugger Interface
The debug connector ‘P3’ is not isolated; it is at a hazardous voltage when A.C.
line power is applied to the Energy Monitor.
P3 interface allows the user to connect an E1 Debugger to the RL78/I1B Energy
Monitor via an intermediate adaptor board. Please see Section 5 for further
connection details.
The user MUST supply and use suitable isolation between the debug PC and the RL78/I1B
Energy Monitor if line power is applied.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 10 of 32
RL78/I1B Energy Monitor
4. Tool Installation
4. Tool Installation
In order to develop and debug the RL78/I1B Energy Monitor embedded project a number of tools need to be
installed on the development computer. Please install these tools in the following order.
Installation Disk #1:
• IAR Embedded Workbench – Provides compiler, assembler and linker.
Installation Disk #2:
2
• Renesas e studio – Integrated Development and Debugging environment,
Including the Renesas Energy Monitor Graphical interface.
4.1
IAR Embedded Workbench (Evaluation) Installation
This step with install IAR Embedded Workbench Evaluation copy. This provides a 30-day time limited
evaluation license providing a fully functional integrated development environment including project manager,
editor, compiler, assembler, linker, librarian, and debugger tools. A complete set of user guides is included in
PDF format.
After the 30-day evaluation period has ended, a license must be purchased.
1. Insert the IAR Embedded Workbench DVD into your computer’s DVD-ROM drive. The DVD should
automatically run the installation program. If the installer does not start, browse to the DVD root folder and
double click on ‘Autorun’.
2. Click the
entry on the displayed banner screen.
3. Windows™ 7 / 8 / 8.1 users may see the “User Account Control” dialog box. If applicable, enter the
administrator password and click ‘Yes’.
4. The installer welcome screen will open. Follow the on-screen instructions to install the RL78 IAR
Embedded Workbench. This process will take several minutes.
5. On the ‘InstallShield Wizard Complete’ dialogue – select ‘Launch IAR Embedded Workbench’ and click
‘Finish’.
6. When IAR Embedded Workbench loads, a ‘License Wizard’ will be displayed, unless you have an existing
license select ‘
obtain a ‘Time limited’ 30-day evaluation license.
’ and follow the License Wizard steps to
7. Once the license has been verified, the license wizard will show ‘Your evaluation license has been
activated’. Click ‘Done’ to complete this step.
Note: When prompted to specify a location for installing any tools, it is recommended that default entries be
accepted.
The Windows driver signing or Windows Security dialogs boxes may be displayed. Please accept the driver to
continue.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 11 of 32
RL78/I1B Energy Monitor
4. Tool Installation
e2 studio & Energy Meter GUI Installation
4.2
2
1. Insert the e studio DVD into your computer’s DVD-ROM drive. The DVD should automatically run the
2
installation program. If the installer does not start, browse to the DVD root folder, open the e studio folder
then double click on ‘setup.exe’.
2. Windows™ 7 / 8 / 8.1 users may see the “User Account Control” dialog box. If applicable, enter the
administrator password and click ‘Yes’.
3. The installer welcome screen will open. Follow the on-screen instructions to install the RL78/I1B Energy
Monitor software. This process will take several minutes.
Note: When prompted to specify a location for installing any tools, it is recommended that default entries be
accepted.
The Windows driver signing or Windows Security dialogs boxes may be displayed. Please accept the driver to
continue.
4.2.1
Configuring IAR Embedded Workbench Plugin
e studio now needs to be configured to use the IAR tool chain installed with the IAR Embedded Workbench.
2
2
1. Start e studio (skip this step if already open):
TM
Windows 7: Start Menu > All Programs > Renesas Electronics e2studio > e2 studio
Windows
TM
8 / 8.1: From Apps View
, click ‘e2studio’ icon.
2. In the ‘Select a workspace’ folder dialogue that appears, browse a suitable location and folder name to
save your new workspace to. Click OK to continue.
3. On the ‘There are no new toolchains avaiable for integration’ dialogue, click ‘OK’.
4. In the ‘Code Generator Registration’ dialog click ‘OK’
5. Windows™ 7 / 8 / 8.1 users may see the “User Account Control” dialog box. If applicable, enter the
administrator password and click ‘Yes’.
6. A ‘Code Generator COM component register’ dialog will pop-up with the text “Please restart e2 studio
to use Code Generator”. Click ‘OK’.
2
7. In the ‘Restart e2 studio’ dialog click ‘OK’. e studio will be restarted due to first-time registration of the
Code Generator COM component.
2
8. Once e studio is restarted the ‘Select a workspace’ window appears again. Click ‘OK’.
9. On the ‘There are no new toolchains avaiable for integration’ dialogue, click ‘OK’.
2
10. e studio needs an internet connection to obtain contents from IAR. If required for your network, proxy
servers can be setup in the preferences dialogue found here:
Window > Preferences > General > Network Connections.
11. Launch the IAR Plugin Manager by selecting: Help > IAR Embedded Workbench plugin manager…
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 12 of 32
RL78/I1B Energy Monitor
4. Tool Installation
12. Click ‘RL78’ in the list of ‘Supported targets’ and click the checkbox next to the latest version displayed
under ‘Available IAR Embedded Work installations’ and click ‘Install’. Installation progress can be seen
in the status bar at the bottom of the window, ‘Configuring IAR plugins’ may take a few minutes to
complete.
13. An Install dialogue box will be displayed, ensure all named items are selected and click ‘Next’. Click
‘Next’ on the ‘Install Details’ dialogue box.
14. If acceptable, select the ‘I Accept the terms of the license agreement’ and click ‘Finish’. The required
support software will now be installed. If a Security Warning dialogue box is shown, accept this by
clicking ‘OK’.
2
15. e studio now needs to be restarted, click ‘Yes’ on the ‘Software Updates’ to confirm the restart.
2
On the restart is complete, e studio is now configured to use the IAR Embedded Workbench RL78 tool chains.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 13 of 32
RL78/I1B Energy Monitor
5.
Connecting E1 Emulator
5. Connecting E1 Emulator
The debug connector ‘P3’ is not isolated; it is at a hazardous voltage when A.C. line
power is applied to the Energy Monitor.
The user MUST supply and use suitable isolation between the debug PC
and the RL78/I1B Energy Monitor if A.C. line power is applied.
The E1 Debugger can power the RL78/I1B Energy Monitor for programming and debugging when line power
is not applied. In this case additional isolation is not required.
5.1
Obtaining an E1 Debugger & E1_Tool
To allow the debugging and downloading of firmware an E1 Debugger must be used.
The part number for the E1 debugger required is R0E000010KCE00.
The E1_Tool is a small adaptor board that allows the E1 to connect to the RL78/I1B Energy Monitor. A
schematic diagram of this can be found in section 8.
These can be obtained from your local Renesas Sales Office (contact details can be found at the end of this
document).
5.2
Loction of Debug Connector P3
The Debug connector P3 is found on the reverse side of the Energy Monitor adjacent to the output sockets as
illustrated below.
Figure 3-4 RL78/I1B E1 Interface ‘P3’
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 14 of 32
RL78/I1B Energy Monitor
5.3
5.
Connecting E1 Emulator
Connecting the E1 Debugger
1. Ensure A.C. line power to the RL78/I1B Energy Monitor is OFF.
2. Connect the E1 debugger module to the interface board ‘E1_Tool’.
3. Connect the ribbon cable from the ‘E1_Tool’ interface board to P3 of the RL78/I1B Energy Monitor, noting
Pin 1 orientation.
4. Connecting the E1 to the PC depends if A.C. Line Power will be applied to the RL78/I1B Energy Monitor:
a. Debugging when A.C. Line power may be applied: Connect the E1 debugger to a suitable USB to
USB isolator and connect the USB to USB isolator to a spare USB port of your PC.
b. Debugging when A.C. Line power will never be applied: If debugging in a setup where A.C. line
power will not be applied to the RL78/I1B Energy Monitor, the USB to USB isolator is not required Connect the E1 debugger to a spare USB port of your PC.
5. The green ‘ACT’ LED on the E1 debugger will flash.
6. The E1 debugger drivers will now be installed. Note that, this may take up to a minute and administrator
privileges will be required.
Windows™ 7
“Device driver software installed
successfully” pop-up will appear in the
Windows™ toolbar and installation will
complete.
Windows™ 8 / 8.1
An icon will appear in the Windows™
toolbar and installation will complete.
7. The green ‘ACT’ LED on the E1 debugger will illuminate constantly.
At Hazardous Voltage Levels when A.C. Line Power is applied
USB to USB
Isolator
Pin 1
RL78/I1B
Energy Monitor
P3 Connector
The RL78/I1B Energy Monitor Debug Interface (P3) and any attached
equipment is at a Hazardous Voltage when A.C. line power is applied.
It is critical additional High Voltage Isolation is installed between the PC and E1
Debugger if A.C. line power is to be applied.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 15 of 32
RL78/I1B Energy Monitor
6. Importing, Programming and Debug
6. Importing, Programming and Debug
This section provides a guide to importing, programming and debugging the project for the RL78/I1B Energy
Monitor.
6.1
Importing project in to e2 studio
2
1. Start e studio (skip this step if already open):
TM
Windows 7: Start Menu > All Programs > Renesas Electronics e2studio > e2 studio
Windows
TM
8 / 8.1: From Apps View
, click ‘e2 studio’ icon.
2. In the ‘Select a workspace’ folder that appears, browse a suitable location and enter a folder name to
save your new workspace to. Click OK to continue.
3. On the ‘There are no new toolchains available for integration’ dialogue Click ‘OK’.
2
4. In the e studio welcome screen, click the ‘Go to the workbench’ arrow icon, on the far right.
5. Right-click in the project explorer window, and select ‘Import’.
6. Under ‘Select an Import Source’ select General > Existing Projects into Workspace, and click ‘Next’.
7. Click the ‘Browse’ button, and locate the following project directory and click ‘OK’:
C:\Renesas\Workspace\RL78I1B_EnergyMonitor’
8. Ensure the ‘Copy projects into workspace’ option is ticked and then click ‘Finish’.
9. A ‘Preferences’ dialogue will be displayed. Click ‘Browse’ and locate the folder in which IAR Embedded
TM
Workbench was installed and click ‘OK’. A Windows 7 32-bit example is shown below:
10. Click ‘OK’ to close the ‘Preferences’ dialogue.
6.2
Building and Debugging the project
The RL78/I1B Energy Monitor can be powered and debugged via the E1 Debugger if A.C. Line Voltage will
never be applied. In this configuration, the LED Backlight does not operate and ADC measurements are not
representative; this is a useful development configuration when A.C. Line Voltages presents an unacceptable
hazard.
With suitable isolation and precautions, (see section 5) the RL78/I1B Energy Monitor can be powered from the
A.C. Line Voltage and debugged by the E1 Debugger.
1. Select the “RL78I1B_EnergyMonitor” project by left clicking on it, then click the arrow next to
build button (hammer icon), and select ‘Debug’ from the drop down menu.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 16 of 32
RL78/I1B Energy Monitor
6. Importing, Programming and Debug
2
2. e studio will now build the project. Once this is finished, debugging can be started by clicking
the arrow next to debug button (bug icon), and selecting ‘Debug Configurations…’.
3. Click the entry ‘Renesas GDB Hardware Debugging’ and click
to create a new configuration.
4. Click ‘Search Project…’. In the ‘Program Selection’ window, select ‘RL78I1B_EnergyMonitor.d87’ and
click ‘OK’.
5. Click the ‘Debugger’ tab, then the ‘Connection Settings’ secondary tab. Change the highlighted items and
ensure all other entries match the screenshot below.
a. If the RL78/I1B Energy Monitor is being debugged with A.C. Line Voltage applied select:
‘Power Target From The Emulator (MAX 200mA)’ to NO
b. If the RL78/I1B Energy Monitor is being debugged stand alone with A.C. Line Voltage NOT applied
select:
‘Power Target From The Emulator (MAX 200mA)’ to YES
YES – A.C. Line Power
NOT Applied.
NO – A.C. Line Power
Applied.
*Ensure additional
Isolation is used – see
section 5 *
Figure 3-5 Debug Configuration Settings
8. Click the ‘Debug’ button to download the code to the target, and begin debugging.
9. A firewall warning may be displayed for ‘e2-server-gdb.exe’. Select the check-box for ‘Private networks,
such as my home or work network’, and click ‘Allow access’.
10. A User Account Control (UAC) dialog may be displayed. Enter the administrator password and click ‘Yes’.
2
11. e studio may ask you to ‘Confirm Perspective Switch’, click ‘Yes’.
12. Once the code has been downloaded, click the ‘Resume’ button to run the code up to the first line
of the main function, main().
Click ‘Resume’ again to start execution of the main code.
13. Click the ‘Suspend’ button. The program will stop and the source code will be opened at the
current program counter. Note: the application uses many library functions, ‘No source available’
warnings may be displayed if the program is suspended while executing library functions.
14. To disconnect from the target board, click the ‘Disconnect’ button on the toolbar:
15. Select the C/C++ perspective (at the top right) to return to the editor view.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 17 of 32
RL78/I1B Energy Monitor
6.3
2
6. Importing, Programming and Debug
Build Configurations
The e studio workspace has two build configurations: ‘Debug’ and ‘Release’.
Release
This build mode has optimisation turned on, and provides little debug information. The C code execution may
appear to be out of order, due to the way compiler optimises the code. This build configuration is intended for
final ROM-programmable code.
Debug
This default build mode has all optimisation turned off, and provides full debug information. This is the best
configuration to use whilst developing code as C code execution will be linear.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 18 of 32
RL78/I1B Energy Monitor
7. Graphical User Interface Operation
7. Graphical User Interface Operation
7.1
Finding the Virtual COM Port Number
The installation of the RL78/I1B Energy Monitor software automatically installs driver software onto the PC to
allow communication with the energy monitor via USB, acting as a virtual serial port.
Ensure that the RL78/I1B Energy Monitor is disconnected from the incoming A.C. Line Voltage. Connect the
PC to the Energy Monitor USB port, this will power the Energy Monitor’s USB circuitry.
The USB Serial Converter drivers will now be installed. Note that, this may take up to a minute and
administrator privileges will be required.
Windows™ 7
“Device driver software installed
successfully” pop-up will appear in the
Windows™ toolbar and installation will
complete.
Windows™ 8 / 8.1
An icon will appear in the Windows™
toolbar and installation will complete.
In order to connect with the RL78/I1B Energy Monitor, the allocated COM port number must be determined.
On the PC, open Windows™ ‘Device Manager’. Expand the “Ports (COM & LPT)” section and the COM port
will listed as ‘USB Serial Port (COMxx)’.
In the example below the serial port is identified as COM6.
7.2
Launching the GUI
The Energy Meter GUI is installed during the RL78/I1B Energy Monitor Software installation and provides an
intuitive way to view and modify many parameters of the RL78/I1B Energy Monitor.
Ensure the RL78/I1B Energy Monitor is running (see section 6).
Start the Energy Monitor GUI:
TM
Windows 7: Start Menu > All Programs > EnergyMeterGUIvxxx (where xxx is a version number)
TM
Windows 8 / 8.1: From Apps View
(where xxx is a version number)
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
, click EnergyMeterGUIvxxx icon
Page 19 of 32
RL78/I1B Energy Monitor
7.3
Meter Configuration
7.4
COM Setting
7. Graphical User Interface Operation
After starting the application, select the following options from the drop down list:
In the ‘COM Setting’ Dialogue, use the drop down menu change the ‘Port name:’ to the COM port identified in
Section 7.1.
Note, the RL78/I1B Energy Monitor virtual COM port must be connected before launching the GUI, or the Port
name will not appear in the list.
‘Baud rate (bps):’ must be set to 38400.
Click Connect.
7.5
GUI Operation
The main functions of the GUI can be accessed through the ‘View’ menu. These functions are duplicated with
buttons on the right of the GUI’s main window.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 20 of 32
RL78/I1B Energy Monitor
7.6
7. Graphical User Interface Operation
GUI – Calibration Menu
Please note: Auto calibration requires a precision external reference supply.
Attempts to calibrate without a suitable supply will result in poor accuracy and/or incorrect measurement
values.
7.6.1
Auto Calibration
This provides automatic calibration of the RL78/I1B Energy Monitor against a known external reference
supply.
Clicking ‘Start’ on the Auto Calibration tab will bring up the ‘Auto Calibration Setting’ window.
Ref. Voltage - Enter the value of the external reference supply output voltage. Suggested value 230.
Ref. Current - Enter the value of the external reference supply load current (per socket). Suggested value 5.
Max. Current - Enter ‘60’ . This value is used in the Metrology Code internal to the RL78/I1B and is not
related to the limits imposed by connectors and wiring.
EM Password – this is not used on the RL78/I1B Energy Monitor.
Click ‘Continue’, the Auto Calibration will commence. Once finished the window will display the calculated
calibration values or details of any problems found.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 21 of 32
RL78/I1B Energy Monitor
7. Graphical User Interface Operation
7.6.2
Manual Calibration
Please note: Manual calibration allows the modification of values used in the metrology calculations, which
will affect the accuracy of measurements. Autocalibration should be used as the primary calibration method.
This tab allows the direct reading and writing of the RL78/I1B Energy Monitor calibration values.
Not used on Energy Monitor
Not used on Energy Monitor
Not used on Energy Monitor
Not used on Energy Monitor
7.7
GUI – EM Config Menu
This ‘Configuration’ window allows the reading and writing of various parameters of the RL78/I1B Energy
Monitor:
Not used on Energy Monitor
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 22 of 32
RL78/I1B Energy Monitor
7.8
7. Graphical User Interface Operation
GUI – Data Record Menu
The Data Record window presents details of the supply and loads measured by the RL78/I1B Energy Monitor.
The Energy Records and Tamper Records are not currently used on the RL78/I1B Energy Monitor.
Units Displayed
V
Hz
A
W
kWh
Automatic Interval Update
This tick box enables automatic updating of the values. This is triggered 5-seconds after the previous update
has completed.
Note the Data Record window cannot be closed when an update is in progress. Please wait until the update
has finished and then close the window.
7.9
7.9.1
GUI – Debug Menu
SFR…
The SFR window provides a convenient way to read and write Special Function Registers within the RL78/I1B
microcontroller while the RL78/I1B Energy Monitor firmware is running.
For details of the SFRs please refer to the RL78/I1B user’s Manual: hardware.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 23 of 32
RL78/I1B Energy Monitor
7.9.2
7. Graphical User Interface Operation
Raw Data
The Raw Data window is split in to two sections: ADC Values and Measurement.
ADC Values
This feature logs 150 samples of each selected item directly from the RL78/I1B ADC. These samples are
taken prior to the application of any calibration or correction factors.
These values are presented as a graph and FFT plot of the frequency content.
A maximum of three items can be selected simultaneously.
Example below shows Voltage, Socket 1 Current and Socket 2 Current (with a harmonic content).
Several features are available to manipulate the Analysis Chart view such as drag to zoom and export
features available by right clicking on the trace area.
Measurement
The measurement section captures sequential measurements from the RL78/I1B Energy Monitor and exports
them as a CSV file. This file can easily be imported in to popular spreadsheet programs.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 24 of 32
RL78/I1B Energy Monitor
8. E1 Tool Schematic Diagram
8. E1 Tool Schematic Diagram
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 25 of 32
RL78/I1B Energy Monitor
9. Additional Information
9. Additional Information
Technical Support
2
For details on how to use e studio, refer to
2
the help file by opening e studio, then
selecting Help > Help Contents from the
menu bar.
For information about the RL78/I1B microcontrollers refer to the RL78/I1B User’s Manual: Hardware.
General information on Renesas microcontrollers can be found on the Renesas website at:
http://www.renesas.com/
Trademarks
All brand or product names used in this manual are trademarks or registered trademarks of their respective
companies or organizations.
Copyright
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 Electronics
Europe Limited.
© 2015 Renesas Electronics Europe Limited. All rights reserved.
© 2015 Renesas Electronics Corporation. All rights reserved.
© 2015 Renesas Solutions Corp. All rights reserved.
R20AN0374EG0100 Rev. 1.00
Apr 28, 2015
Page 26 of 32
REVISION HISTORY
Rev.
RL78/I1B Energy Monitor Application Note
Date
Description
Page
1.00
Apr 28, 2015

Summary
First Edition issued
C - 27
Application Note: RL78/I1B Energy Monitor
Publication Date:
Rev. 1.00
Apr 28, 2015
Published by:
Renesas Electronics Corporation
This page is intentionally left blank
This page is intentionally left blank
RL78/I1B Group
R20AN0374EG0100
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement