Hardware Reference
In-Depth Information
to that in Figure E.3 if the user clicks on the keyword Terminal above the status pane and
then presses the Enter key once or twice when the demo board is powered on.
Figure E.3 shows the power-on status for a demo board with the D-Bug12 monitor.
When the status pane is used as the terminal window, we can enter any D-Bug12 monitor
command.
Figure E.3 Using the status pane as the terminal window
Step 2
Click on the File menu and select New Source File to create a new file for holding a
program. The resultant screen is shown in Figure E.4. This step must be repeated as many
times as the number of files required in the project. As shown in Figure E.4, one can also
press the Ctrl 1 U keys to open a new file. To open an existing file, we select Reopen File ->
instead of New Source File.
Step 3
Type in the C program and save it in an appropriate directory (name it hcs12_timer.c ). An
example is shown in Figure E.4. The example program performs the following functions:
1. Defines the cnt variable and initializes it to 0.
2. Configures port B for output and outputs the value of cnt to it.
3. Calls the delayby100ms() function to wait for 0.5 s and then increments the variable cnt .
The argument to this function specifies the number of 100-ms time delays to be created.
4. Output the value of cnt to port B and go to 3.
Port B is driving eight light-emitting diodes (LEDs). When this program is running,
you can see the change of the LED pattern.
Search WWH ::




Custom Search