Instructions for Use

This is an operation guide to introduce the major functions for those using the RL78 Web simulator for the first time.
It provides an explanation of how to run the sample programs and how to use the simulator GUI, the automatic code generation tool, and others in an easy-to-understand manner.

1 How to run the A/D converter One-shot conversion mode(Low power)

1-1 How to import the sample program

1-1-1 To start the e2studio

Click [Workbench] in the lower right of the [Welcome] screen.

1-1-2 Expand the sample project

Expand the downloaded sample project into an arbitrary folder.

1-1-3 Importing the project

Select [Import] from the [File] menu of e2studio.

An import dialog will pop-up. Select [Existing Projects into Workspace] from [General], and click [Next].

The screen will switch to the project import screen.
Click [Browse] in [Select root directory:] and select the expanded downloaded sample project folder, [ADC_OneShot].

Place a check [Search for nested projects]. A list of nested projects will appear.
Check Project [ADC_OneShot] and click [Finish].

Loading of project is completed when the selected project appears in the project explorer.

1-1-4 Build Project

Right click [ADC_OneShot] in the project explorer to indicate the menu, then select [Build Project].

1-2 Summary of the sample project (ADC_OneShot)

Converts analog input value set by the potentiometer to digital when SW1 is pressed. Selects 8 bit resolution when SW2 is depressed and 10 bit resolution when SW3 is depressed.

Simulator screen

Assigned function

Potentiometer

Connect to AD input

SW1

Start analog to digital (A/D) conversion

SW2

Set to 8 bit resolution

SW3

Set to 10 bit resolution


1-2-1 Confirm Consumption Current simulator is enabled

Consumption current simulator is disabled in default mode and must be enabled. Indicate [Consumption Current] view.
If the [Consumption Current] panel is not visible,Select [debug],[Consumption Current] in the [renesas views] menu.


Enable the simulator by placing a check against the power supply mark icon in the upper right hand corner of the [Consumption Current] tool bar.

1-2-2 Debug configuration

Select [ADC_OneShot DebugBuild] in the project explorer, right click to indicate the menu and select [Debug As], [Debug Configurations..].


Select [Renesas Simulator Debugging (RX, RL78)] from [ADC_OneShot DebugBuild] debug configuration dialog. Click [Debug] button to start debug.

Perspective switch confirmation dialog will appear. Click [Yes]

To re-connect to debugger, select the applicable debugger from the [Debug] tool bar pull-down menu.

1-2-3 Configuring simulator GUI

Simulator GUI will boot simultaneously when the debugger is booted.

Select [Open] from Simulator GUI [File] menu.

A file selection dialog will appear. Select [ I/O Panel file] from the file type on the lower right, and select the following work space folder:
/ADC_OneShot /G13_RSK_Board.pnl.

The following board simulator screen will appear.

1-2-4 Adding numerical expressions

Add a variable to indicate the value after A/D conversion to the numerical expression view.

 
Add a variable to indicate the value after A/D conversion to the numerical expression view.
gADC_Result

1-2-5 Change numerical expression configuration

Configuration will be changed to renew the added “gADC_Result” even during operation. Right click on “gADC_Result” and select [Real-time Refresh] from the menu.

1-2-6 Running the program

Select [Resume] from the execution menu to run the program.

It is set to stop at the head of the main ( ) function. Run the program by clicking on [Resume] from the [Run] menu.
Pressing down the Resume icon on the tool bar will result in the same action.

1-2-7 Operation of board simulator potentiometer and A/D conversion

Set the input voltage level by operating the potentiometer with the mouse, in the I/O panel indicated by the simulator GUI. A/D conversion will occur when SW1 is clicked and the value will be indicated in “gADC_Result” registered in the formula panel.
Furthermore, it will be indicated in 8 bit resolution when SW2 is pressed and in 10 bit resolution when SW3 is pressed.

When A/D conversion is made using the SW1 button while SW3 is selected, “gADC_Result” registered in the formula panel will be indicated in 10 bit resolution.

By changing the input potential using the potentiometer and followed by A/D conversion with the SW1 button, the value of “gADC_Result” registered in the formula panel will change.



When A/D conversion is made using the SW1 button while SW2 is selected, “gADC_Result” registered in the formula panel will be indicated in 8 bit resolution.

1-2-8 Terminating the program

Select [Suspend] from [Run] menu to terminate the program.

1-2-9 Confirm results of consumption current simulation

Indicate the results of consumption current simulation in the [Consumption Current] view and confirm that consumption current has increased during the period of A/D conversion.

(1) Enlarge or reduce graphs

Graphs can be enlarged or reduced by a right click in the [Consumption Current] view to indicate the menu.

(2) To display detailed information

Drag mouse over the graph to indicate detailed information.

 

1-2-10 Ending the debugger

Select [End] or [Disconnect] from the [Run] menu.

1-2-11 Ending e2studio

Select [End] from the [File] menu.

2 How to run the Usage Example of the Code Generator (Sample Program)

2-1 How to import and run the sample program

2-1-1 To start the e2studio

Click [Workbench] in the [Welcome] screen of e2studio.

2-1-2 Expand the sample project

Expand the downloaded sample project into an arbitrary folder.

2-1-3 Importing the project

Select [Import] from the [File] menu of e2studio.

An import dialog will pop-up. Select [Existing Projects into Workspace] from [General], and click [Next>].

The screen will switch to the project import screen.
Click [Browse…] in [Select root directory:] and select the expanded downloaded sample project folder, [an_r20an0399jj0100_rl78].

Place a check [Search for nested projects]. A list of nested projects will appear.
Check Project [RL78G13_CG_Sample_e2s] and click [Finish].


Loading of project is completed when the selected project appears in the project explorer.

2-1-4 Build Project

Right click [RL78G13_CG_Sample_e2s] in the project explorer to indicate the menu, then select [Build Project].


2-1-5 Confirm Consumption Current simulator is enabled

Consumption current simulator is disabled in default mode and must be enabled. Indicate [Consumption Current] view.
If the [Consumption Current] panel is not visible,Select [debug],[Consumption Current] in the [renesas views] menu.

Enable the simulator by placing a check against the power supply mark icon in the upper right hand corner of the [Consumption Current] tool bar.

2-1-6 Debug configuration

Select [RL78G13_CG_Sample_e2s SimulatorDebug] in the project explorer, right click to indicate the menu, then select [Debut as] and [Debug Configurations..].

Select [RL78G13_CG_Sample_e2s SimulatorDebug] of [Renesas Simulator Debugging (RX, RL78)] of debug configuration dialog. Click [Debug] button to start debug.

Perspective Switch confirmation dialog will appear. Click [Yes]

To re-connect to debugger, select the applicable debugger from the [Debug] tool bar pull-down menu.

2-1-7 Configuring simulator GUI

Simulator GUI will boot simultaneously when the debugger is booted.

Select [Open] from the Simulator GUI [File] menu.

A file selection dialog will appear. Select [I/O Panel file] from the file type on the lower right, and select the following work space folder:
/RL78G13_CG_Sample_e2s /G13_RSK_Board.pnl

The following board simulator screen will appear.

2-1-8 Adding numerical expressions

Numerical expressions will be added to confirm the variables and the value of the expressions in the sample program.
Click [Add new numerical expression] in the numerical expression view and register variables and expressions.
Please register the required variable names and numerical expressions when confirming each of the functions.

2-1-9 Change numerical expression setting

Setting will be changed to renew the added variables even during operation. Right click on the variable and select [Real-time Refresh] from the menu.

2-1-10 Running the program

Select [Resume] from the execution menu to run the program.

It is set to stop at the head of the main ( ) function. Run the program by clicking on [Resume] from the [Run] menu.
Pressing down the Resume icon on the tool bar will result in the same action.

2-2 How to use the sample program

2-2-1 Summary of the sample program

The sample program is designed, based on the hardware configuration of RSKRL78G13.
RL78/G13 (R5F100LE 64pin) is used for the microcomputer and operates under the following clock:
- High speed system clock: 20MHz
- High speed on-chip oscillator clock: 12MHz (for Snooze Mode)
- Sub-system clock: 32.768 kHz
Major functions of the sample are as follows:
(1) LED flashing (12 bit interval timer)
(2) PWM output
(3) Square wave output
(4) Number of switch depression counter (timer event counter)
(5) UART communications
(6) CSI communications
(7) IIC communications
(8) DMA transfer
(9) Standby function (Halt, Stop, Snooze)

2-2-2 LED flashing

Run the program and open the I/O panel of the simulator GUI.
Resume the program.
Confirm LED0 in I/O panel is flashing.

2-2-3 AD operation, conversion result, and LED flashing interval

Interrupt the program if it is running.
Open the numerical expression view and add the following variable:
gADC_Result

Resume the program and open the I/O panel of the simulator GUI.
Change the potential by operating the potentiometer on the I/O panel.
A/D conversion is carried out when SW3 on the I/O panel is depressed.
Confirm that the flashing interval of LED on the I/O panel has changed.


Display the numerical expression view and confirm that the value of gADC_Results change.

2-2-4 SW input

Interrupt the program if it is running.
Open the numerical expression view and add the following variable:
gEventCount

Resume the program and open the I/O panel of the simulator GUI.
Counting-up of variable will start when SW3 on the I/O panel is depressed.
Confirm that the flashing interval of LED on the I/O panel has changed.

Display the numerical expression view and confirm that the value of “gEventCount” will increment each time SW3 is depressed.

2-2-5 PWM output

Interrupt the program if it is running.
Select [Timing Chart] in [Simulator] menu of simulator GUI. The timing chart window will be displayed.

Select [Select Pin] from the [Edit] menu and register “P16/TI01/TO01/INTP5” for the pin name in the [Select Pin] dialog.

Waveform will be displayed in the timing chart window when the program is resumed.

Interrupt the program to measure the cycle. From the right click menu, set “Marker A set” (blue) and “Marker B set” (green) and confirm that the cycle is 1ms. Marker position can be moved to the location of the rising and the trailing gradient, using the search function on the [Edit] menu.

2-2-6 UART Transmission

Interrupt the program if it is running.
Open the serial window by selection [Serial] in the [Simulator] menu.
Select [UART0] on the upper left hand side of the window. It cannot be changed once it has been selected.
Press [Format] button to configure UART0.


Item

Setting

Baud rate

19,200 bps

Transfer direction

LSB first

Data bit length

8

Stop bit length

1

Parity

No parity


Select [Timing Chart] from [Simulator] menu on the simulator GUI. The timing chart window will appear.

Select from the [Edit] menu and register
“P11/SI00/RXD0/TOOLRXD/SDA00” for the pin name in the [Select Pin] dialog.

Resume the program to indicate the data transmitted from the microcomputer to the serial window. As it is a transmission received, seen from the serial window side, it will be indicated on the “Received Data” side.
Entering “0x7a” in the lower left area and pressing “Send” will temporarily suspend the receiving of data. Pressing “Send” after entering “0x79” will resume the reception of data.

Transmit “0x7a” and “0x79” again to interrupt the program.
Display the timing chart and confirm the waveform.
Marker position can be moved to the location of the rising and the trailing gradient, using the [search] function on the [Edit] menu.

2-2-7 CSI transmission and reception

Interrupt the program if it is running.
Select [Timing Chart] from the [Simulator] menu of simulator GUI. The Timing Chart window will be displayed.

Select [Select Pin] from the [Edit] menu and register “P03/ANI16/SI10/RXD1/SDA10” and “P02/ANI17/SO10/TXD1” as the pin names in the [Select Pin] dialog.

Select [Serial] from the [Simulator] menu.
A new serial window will open. Select [CSI_10] from the upper left side of the window. It cannot be changed once it has been selected.
Press [Formal] button to configure CSI10. Place a check mark next to [Repeat].

Item

Configured contents

Clock mode

Slave

Transfer clock

10 kHz

Transfer direction

MSB first

Data bit length

8

Data phase

Normal

Clock phase

Normal

Configure a one-byte transmission data (value is arbitrary) at the bottom left of the serial window. Resume the program and press [Auto Send] in the serial window just once.
Depressing SW2 in the I/O panel in this condition will receive data transmitted from the microcomputer. Depressing SW2 again will repeat the transmission and reception.
Simultaneously, the transmission data configured previously will be transmitted to the microcomputer. In this sample, data received by CSI10 will not be used.

Similarly, open the serial window and select [CSI_20], depress [Format] button and configure CSI20.

Item

Configured contents

Clock mode

Master

Transfer clock

10 kHz

Transfer direction

LSB first

Data bit length

8

Data phase

Normal

Clock phase

Normal

Transmission of data in single-byte units can be made by the input of transmission data to the lower left of the serial window and depressing the [Send] button. The [Auto Send] button will transmit all the transmission data.

Data transmitted from the serial window can be confirmed by the reception buffer, “gCSI20_RXBuffer”, of CSI20. The value can be confirmed by returning to e2studio and adding “gCSI20_RXBuffer” to the numeric expression.

Waveform will be displayed in the Timing Chart window.
Marker position can be moved to the location of the rising and the trailing gradient, using the [search] function on the [Edit] menu.

2-2-8 IIC communications

Interrupt the program if it is running.
Select [Timing Chart] in [Simulator] menu of simulator GUI. The Timing Chart window will be displayed.

Select [Select Pin] from the [Edit] menu and register “P60/SCLA0” as the pin name in the [Select Pin] dialog.

Select [Serial] in the [Simulator] menu.
A new serial window will open. Select [IICA_0] from the upper side of the window. It cannot be changed once it has been selected.
Press [Formal] button to configure IICA0. Also place a check mark next to [Repeat].

Resume the program. Depressing SW2 in the I/O panel will transmit data from the microcomputer to the slave address.
The slave address will return ACK response when the address match, and will hold the IIC bus. Depressing [Auto Receive] button here will enable the reception of the continuation of the data.


Wave form will be displayed in the Timing Chart window.
Marker position can be moved to the location of the rising and the trailing gradient, using the search function on the [Edit] menu.

2-2-9 DMA transfer

DMA transfer made from RAM to SFR.

RAM address of the originator is re-configured to the leading address of a 16 byte array declared in the program. The initial value of RAM (16 bytes) is {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}.

Channel 2 of the timer is used as the interval timer and the interval time is set to 1000 [ms]. INTDMA0 interrupt will occur after the transfer of 16 bytes, so the originator address is return to the leading address of the array and will repeat the 16 byte transfer.

Interrupt the program if it is running.
Add [*(char *)0xFF07] (Address of P7) to the numerical expression view. Select [Real Time Refresh] from the right click menu while the added row is being selected.
Confirm that the value of [*(char *)0xFF07] changes every second in simulated time axis when the program is resumed.

2-2-10 Stand by Function

Interrupt the program if it is running.
Select [Signal Data Editor] in the [Simulator] menu and open the signal editor.

Select [Select Pin] from the [Edit] menu. Register “P41/TI07/TO07”, “P42/TI04/TO04” and “P43” as the three pin names.

Set “1, 0, 0” to the signal editor, starting sequentially from P41. Depress [Start] button of signal input. Depressing SW1 on the I/O panel when P41 to P43 are entered will transfer to Halt mode. It will transfer to Stop mode In case of “0”, “1”, and “1”, and to Snooze mode in case of “0”, “0”, and “1”.
LED0 to LED3 will turn off when transitioned to stand-by.

Suspend program to confirm the transitioning into each mode and confirm the stopped position of the program counter.

2-2-11 Confirm the results of Consumption Current simulation

Display the results of Consumption Current simulation on thee [Consumption Current] view and confirm the consumed current.

(1) Enlarge or reduce graphs

A right click in the [Consumption Current] view will indicate the menu to enlarge or reduce graphs.

(2) To display detailed information

Drag mouse over the graph to indicate detailed information.

2-2-12 Ending the debugger

Select [End[ or [Disconnect] from the [Run] menu.

2-2-13 Ending e2studio

Select [End] from the [File] menu.

3 How to use the Code Generator

3-1 How to import the sample program

3-1-1 To start the e2studio

Click [Workbench] in the lower right of the [Welcome] screen.

3-1-2 Expand the sample project

Expand the downloaded sample project into an arbitrary folder.

3-1-3 Importing the project

Select [Import] from the [File] menu of e2studio.

An import dialog will pop-up. Select [Existing Projects into Workspace] from [General], and click Next>.

The screen will switch to the project import screen.
Click [Browse..] in [Select root directory:] and select the expanded downloaded sample project folder, [an_r20an0399jj0100_rl78].

Place a check [Search for nested projects]. A list of nested projects will appear.
Check Project [RL78G13_CG_Sample_e2s] and click [Finish].

Loading of project is completed when the selected project appears in the project explorer.


3-2 Generation of timer code

3-2-1 Open Peripheral Functions view

Select [Show View], [Other] in the [Window] menu of e2studio.

“Show View” dialog will open.
Select [Code Generator], [Peripheral Functions] and click [OK].

[Peripheral Functions] view will be displayed.

3-2-2 Generate code

Select [Timer] from the Peripheral Functions view menu.

Set square width of Square-wave Setting for Channel 5 to 1ms and click [Generate Code].


Message indicating generation of file was successful will be indicated on the console.

3-2-3 Build Project

Right click on [RL78G13_CG_Sample_e2s] in the project explorer to display the menu and select [Build Project].

3-2-4 Debug configuration

Select [RL78G13_CG_Sample_e2s SimulatorDebug] from the project explorer, right click the mouse to display the menu, then select [Debug As], [Debug Configurations..].

Select [RL78G13_CG_Sample_e2s SimulatorDebug] in [Renesas Simulator Debugging (RX,RL78)] of the debug configuration dialog. Click [Debug] button to start debug.

Perspective Switch confirmation dialog will open. Click [Yes]

To re-connect to debugger, select the applicable debugger from the [Debug] tool bar pull-down menu.

3-2-5 Configuring simulator GUI

Simulator GUI will boot simultaneously when the debugger is booted.

Select [Timing Chart] from the [Simulator] menu of the simulator GUI.

Select [Select Pin] from the [Edit] menu and register “P05/TI05/TO05” as the pin name in the “Select Pin” dialog.

3-2-6 Running the program

Select [Resume] from the [Run] menu to run the program.

It is set to stop at the head of the main ( ) function. Run the program by clicking on [Resume] from the [Run] menu.
Pressing down the Resume icon on the tool bar will result in the same action.

3-2-7 Confirm Waveform

Waveform will be displayed in the Timing Chart Window when the program is resumed.

Interrupt the program and measure the cycle. From the right click menu, set “Marker A set” (blue) and “Marker B set” (green) and confirm that the cycle is 1ms. Marker position can be moved to the location of the rising and the trailing gradient, using the search function on the [Edit] menu.

3-2-8 Confirm results of Consumption Current simulation

Confirm the consumption current by the display of consumption current simulation result in the [Consumption Current] view.
The consumption current simulator could be disabled. Confirm that it is enabled.
End any programs that are running and confirm that the power supply mark icon on the upper right of the tool bar in the [Consumption Current] view has been checked.
If not, select the [Run] menu [Exit] or [Disconnect].
Once you end the debugging, after you enable to check the power mark in [Consumption Current] view,Please resume from the steps in "3-2-4 Debug Configuration”.

(1) Enlarge or reduce graphs

Graphs can be enlarged or reduced by indicating the menu by a right click in the [Consumption Current] view

(2) To display detailed information

Drag mouse over the graph to indicate detailed information.

3-3 Generation of Serial Code

3-3-1 Open Peripheral Function view

Select [Show View], [Other..] in the [Window] menu of e2studio.

The view display dialog will open.
Select [Code Generator], [Peripheral Functions] and click [OK].

[Peripheral Functions] view is displayed.

3-3-2 Generate Code

Select [Serial] in the Peripheral Functions view menu.

Set reception/transmission rate of UART0 to 9600 bps and click [Generate Code].

Successful file generation will be indicated in the console.

3-3-3 Build Project

Right click [RL78G13_CG_Sample_e2s] in the project explorer to indicate the menu, then select [Build Project].

3-3-4 Debug Configuration

Select [RL78G13_CG_Sample_e2s SimulatorDebug] in the project explorer, right click the mouse to indicate the menu and select [Debug As], [Debug Configurations..].

Select [RL78G13_CG_Sample_e2s SimulatorDebug] of [Renesas Simulator Debugging (RX,RL78)] debug configuration dialog. Debug will start when the [Debug] button is clicked.

Perspective switch confirmation dialog will appear. Click [Yes].

To re-connect to debugger, select the applicable debugger from the [Debug] tool bar pull-down menu.

3-3-5 Configuring simulator GUI

Simulator GUI will boot simultaneously when the debugger is booted.

Select [Timing Chart] from the [Simulator] menu of the simulator GUI. The Timing Chart window will be displayed.

Select [Select Pin] from the [Edit] menu and register “P11/SI00/RXD0/TOOLRXD/SDA00” as the pin names in the Select Pin dialog.

Select [Serial] from the [Simulator] menu of the Simulator GUI. The Serial window will be displayed. Select “UART0” on the upper left side of the window. Once it has been selected, no changes can be made.

3-3-6 Running the program

Select [Resume] from the execution menu to run the program.

It is set to stop at the head of the main ( ) function. Run the program by clicking on [Resume] from the [Run] menu.
Pressing down the Resume icon on the tool bar will result in the same action.

3-3-7 Confirm Waveform

Data transmitted from the microcomputer will be displayed in the serial window when the program is resumed. It will be indicated in the “Receive Data” side, as it will appear to be a reception seen from the serial window side.
In case of transmitting a single byte to the microcomputer, input the data to be transmitted to the area on the lower left and depress [Send] button. The waveform will be displayed in the Timing Chart window.

3-3-8 Confirm results of Consumption Current simulation

Confirm the consumption current by the display of consumption current simulation result in the [Consumption Current] view.

(1) Enlarge or reduce graphs

Graphs can be enlarged or reduced by indicating the menu by a right click in the [Consumption Current] view.

(2) To display detailed information

Drag mouse over the graph to indicate detailed information.

3-3-9 Ending the debugger

Select [End] or [Disconnect] from the [Run] menu.

3-3-10 Ending e2studio

Select [End] from the [File] menu.

4 How to Revise the Program

4-1 Enable Clock Output/Buzzer Output

4-1-1 Open Peripheral Functions view

Select [Show View], [Other] in the [Window] menu of e2studio.

“Show View” dialog will open
Select [Code Generator], [Peripheral Functions] and click [OK].

[Peripheral Functions] view will be displayed.

4-1-2 Generate Code

Select [Clock Output/Buzzer Output] from the Peripheral Functions view menu.

Select PCLBUZ0 tab when using PCLBUZ0 and PCLBUZ1 tab when using PCLBUZ1, set “Clock Output/Buzzer Output operation setting” to “Used”, and click [Generate Code] button.


Message indicating generation of file was successful will be indicated on the console.

4-1-3 Revising the Source Code

Double click and open “src/r_main.c” in the project explorer.
Peripheral functions enabled in generating the code must be re-defined as peripheral functions in “r_main.c”.
In case PCLBUZ0 and PCLBUZ1 are both enabled in the generation of the code, add the following to the “start_function” function. In case one of them has been enabled, then only add the code of the one that has been enabled.
R_PCLBUZ0_Start();
R_PCLBUZ1_Start();

4-1-4 Build Project

Right click [RL78G13_CG_Sample_e2s] in the project explorer to display the menu and select [Build Project].

4-1-5 Debug Configuration

Select [RL78G13_CG_Sample_e2s SimulatorDebug] from the project explorer, right click the mouse to display the menu, then select [Debug As], [Debug Configurations..].

Select [RL78G13_CG_Sample_e2s SimulatorDebug] in [Renesas Simulator Debugging (RX,RL78)] of the debug configuration dialog. Click [Debug] button to start debug.

Perspective Switch confirmation dialog will open. Click [Yes].

To re-connect to debugger, select the applicable debugger from the [Debug] tool bar pull-down menu.

4-1-6 Configuring simulator GUI

Simulator GUI will boot simultaneously when the debugger is booted.

Select [Timing Chart] from the [Simulator] menu of the simulator GUI. The Timing Chart window will be displayed.

Select [Select Pin] from the [Edit] menu and register “P140/PCLBUZ0/INTP6” and “P141/PCLBUZ1/INTP7” as the pin names in the “Select Pin” dialog.

4-1-7 Running the program

Select [Resume] from the [Run] menu to run the program.


It is set to stop at the head of the main ( ) function. Run the program by clicking on [Resume] from the [Run] menu.
Pressing down the Resume icon on the tool bar will result in the same action.

4-1-8 Confirm Waveform

Waveform will be displayed in the Timing Chart Window when the program is resumed.

4-1-9 Ending the debugger

Select [End[ or [Disconnect] from the [Run] menu.

4-1-10 Ending e2studio

Select [End] from the [File] menu.

ページのトップへもどる