Running Sample Program Flashled.c - Rabbit RabbitCore RCM2000 Getting Started Manual

C-programmable module
Hide thumbs Also See for RabbitCore RCM2000:
Table of Contents

Advertisement

4.2 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
gram will appear in a window, as shown in Figure 5 below (minus some comments). Use
the mouse to place the cursor on the function name
. This will bring up a documentation box for the function
<Ctrl-H>
you can do this with all functions in Dynamic C libraries, including libraries you write
yourself. Close the documentation box and continue.
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
To run the program
FLASHLED.C
pile
menu, and then run it by selecting
Board should start flashing if everything went well. If this doesn't work review the follow-
ing 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
Getting Started
, which is in the
C programs begin with main
Note: See the Rabbit 2000 Microprocessor User's Manual
(Software Chapter) for details on the routines that read and
write I/O ports.
Figure 5. Sample Program FLASHLED.C
, load it with the
Run
in the
or select
<Ctrl-Y>
Samples/COREMODULE
in the program and type
WrPortI
Set up Port A to output
to LED DS2 and DS3
Start a loop
Turn LED DS3 off
Time delay by counting
to 32,000
Turn LED DS3 on
Time delay by counting
to 25,000
End of the endless loop
File
menu, compile it using the
Run
menu. The LED on the Prototyping
from the
Recompile BIOS
folder. The pro-
. In general,
WrPortI
Com-
menu.
Compile
23

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RabbitCore RCM2000 and is the answer not in the manual?

Questions and answers

Table of Contents