Creating and Running a New Project Workspace
5.3.6 Writing the Main Function (Operation Confirmation)
Rev. 1.01 May 7, 2008 5-21
REJ11J0015-0101
5
5.3.6 Writing the Main Function (Operation Confirmation)
In the main function (test.c source file), write a program to turn on the LED (LED7 on the SH7670 CPU board lights up).
• Open the source file C:¥WorkSpace¥test¥test¥test.c with an editor, etc.
• Write the program that is shown below to turn on the LED.
Omitted
11: #include "iodefine.h"
12:
13: void main(void)
14: {
15: /* ==== Port setting ==== */
16: PORT.PCCRH1.BIT.PC20MD = 0;
17: PORT.PCDRH.BIT.PC20DR = 0;
18:
19: /* ====Port output (LED lights up) ==== */
20: PORT.PCIORH.BIT.PC20IOR = 1;
21: }
22:
Note: In this example, the value is set to the port C data register H (PCDRH) by the bit operation instruction. Since the
bit operation instruction performs the read modify write access, the port input level read for the unspecified bit is
written in the port data register. As a result, please note that the unintended value might be set. In the other ports
(1) Creating a new load module
Choose Build from the Build menu to execute build processing.
Note: Because the C section is not used, the following warning message will be displayed. It does not present
any problem.
<Warning message>
L1100(W)Cannot find “C” specified in option “start”
Phase OptLinker finished
Build Finished
0 Errors,1 Warning
(2) Creation of new test.abs
If a new load module (test.abs) has been created, it means that you’ve finished adding/modifying hardware setup
files successfully.
(3) Running the program
Try running the program after downloading the load module. (LED7 on the SH7670 CPU board lights up)