Renesas RSK H8S2215R Tutorial page 20

Single-chip microcomputer
Table of Contents

Advertisement

Right click on the 'FlashLEDs();' function and select 'Go
to cursor'.
The code will run to the selected line and stop. A temporary breakpoint was automatically inserted in the code and then removed when the
program stopped at the breakpoint.
Press 'Step Over' on the Debug Tool Bar.
The code will run and flash the LEDs 200 times. The debugger will not stop running until all 200 flashes have completed or any of user
switches (i.e. SW1, SW2 or SW3) is pressed on the RSK.
If the LEDs are still flashing press the SW1 button on the RSK to exit the FlashLEDs() function.
The code will run to the breakpoint we previously set on the Timer function.
There are several versions of the timer function depending upon the peripherals available in the device. The default function is TimerADC
which we shall demonstrate here.
The timer function initialises an interrupt on an available internal timer. On a compare match in the timer module an interrupt is generated.
In the TimerADC code version the interrupt reads the last ADC conversion for the external potentiometer and uses the result to set the next
compare match value. The ADC conversion is then re-started.
The interrupt initialisation is performed as part of the hardware setup. This is located in the file 'interrupts.c'.
Open the file 'interrupts.c' by double clicking on the file in the workspace view.
Review this file and find the interrupt function that changes the LED pins, INT_TGI1B_TPU1(void).
Set a breakpoint on the line where the LED pins are modified.
Press 'Go' or 'F5' to run the code from the current
PC position.
The code will stop in the interrupt routine. It is now possible to step through the interrupt function.
Remove the breakpoint in the interrupt by double clicking again before exiting the function.
Press 'Step Over' to step over the instruction and observe the LEDs turn off.
Press 'Go' to run the code from the current PC
position.
18

Advertisement

Table of Contents
loading

Table of Contents