10
Rabbit 2000 Development Kit
3.1 Running Sample Program DEMOJR1.C
This sample program can be used to illustrate some of the functions of Dynamic C.
First, open the file
DEMOJR1.C
, which is in the
Samples/JackRab
folder. The program
will appear in a window, as shown in Figure 4 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 4. Sample Program DEMOJR1.C
To run the program
DEMOJR1.C
, load it with the
File
menu, compile it using the
Compile
menu, and then run it by selecting
Run
in the
Run
menu. The LED on the Development
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
compiled...” If you did not receive this message or you get a communication error,
recompile the BIOS by typing
<ctrl-Y>
or select
Recompile BIOS
from the
Compile
menu.
main(){
WrPortI(SPCR,NULL,0x84);
WrPortI(PADR,&PADRShadow,0xff);
while(1) {
BitWrPortI(PADR,&PADRShadow,1,2);
for(j=0; j<25000; j++);
BitWrPortI(PADR,&PADRShadow,0,2);
for(j=0; j<1000; j++);
} // end while(1)
} // end of main
C programs begin with main
write to SPCR register to
initialize parallel port A
to turn off all LEDs
Start a loop
Set bit 2 to a “1”
LED DS3 off.
Time delay by counting
to 25,000.
Set bit 2 to a “0”
turning LED DS3 on
Count to 1000 for a shorter
time delay
End of the endless loop
Note: See Rabbit 2000 Microprocessor User’s Manual
(Software Chapter) for details on the routines that read and
write I/O ports.
NULL is a macro for a zero pointer
Write all 1’s to port A
Summary of Contents for 2000
Page 1: ...Rabbit 2000 Microprocessor Development Kit Getting Started 010118 D...
Page 4: ...Rabbit 2000 Development Kit...
Page 9: ...4 Rabbit 2000 Development Kit...
Page 21: ...16 Rabbit 2000 Development Kit...
Page 35: ...30 Rabbit 2000 Development Kit...
Page 36: ...Getting Started Manual Schematics...
Page 38: ...B NONE B NONE...
Page 39: ...B NONE B NONE...
Page 41: ...B NONE B NONE...
Page 43: ......