Getting Started
21
4.1 Running Sample Program FLASHLED.C
This sample program will be used to illustrate some of the functions of Dynamic C.
First, open the file
FLASHLED.C
, which is in the
Samples/CoreModule
folder. The
program will appear in a window, as shown in Figure 3 below (minus some comments).
Use the mouse to place the cursor on the function name
WrPortI
in the program and type
<ctrl-H>
. This will bring up a documentation box for the function
WrPortI
. In general,
you can do this with all functions in Dynamic C libraries, including libraries you write
yourself. Close the documentation box and continue.
Figure 3. Sample Program FLASHLED.C
To run the program
FLASHLED.C
, load it with the
File
menu, compile it using the
Com-
pile
menu, and then run it by selecting
Run
in the
Run
menu. The LED on the Prototyp-
ing Board should start flashing if everything went well. If this doesn’t work review the
following points.
•
The target should be ready, which is indicated by the message “BIOS successfully com-
piled...” If you did not receive this message or you get a communication error, recom-
pile the BIOS by typing
<ctrl-Y>
or select
Recompile BIOS
from the
Compile
menu.
main(){
int j;
WrPortI(SPCR,&SPCRShadow,0x84);
WrPortI(PADR,&PADRShadow,0xFF);
while(1) {
BitWrPortI(PADR,&PADRShadow,1,1);
for(j=0; j<32000; j++);
BitWrPortI(PADR,&PADRShadow,0,1);
for(j=0; j<25000; j++);
} // end while
} // end of main
&SURJUDPVEHJLQZLWKPDLQ
6WDUWDORRS
7LPHGHOD\E\FRXQWLQJ
WR
(QGRIWKHHQGOHVVORRS
Note: See the Rabbit 2000 Microprocessor User’s Manual
(Software Chapter) for details on the routines that read and
write I/O ports.
6HWXS3RUW$WRRXWSXW
WR/(''6DQG'6
7XUQ/(''6RII
7XUQ/(''6RQ
7LPHGHOD\E\FRXQWLQJ
WR
Содержание RabbitCore 2000
Страница 1: ...RabbitCore 2000 C Programmable Core Module Getting Started 001004 C...
Страница 4: ...RabbitCore 2000...
Страница 7: ...Getting Started 1 1 INSTALLING DYNAMIC C...
Страница 24: ...18 RabbitCore 2000...
Страница 25: ...Getting Started 19 4 SAMPLE PROGRAMS...
Страница 33: ...Getting Started SCHEMATICS...
Страница 34: ......