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.
C programs begin with main
NULL is a macro for a zero pointer
main(){
write to SPCR register to
initialize parallel port A
WrPortI(SPCR,NULL,0x84);
Write all 1’s to port A
to turn off all LEDs
WrPortI(PADR,&PADRShadow,0xff);
Start a loop
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)
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 main
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.
Figure 4. Sample Program DEMOJR1.C
To run the program DEMOJR1.C , load it with the File > Open 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 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.
? A message reports that “No Rabbit processor detected” in cases where the BL1810 and
Prototyping Board are not connected together, the wall transformer is not connected, or
is not plugged in. (The red power LED lights whenever power is connected.)
18
Rabbit 2000 Development Kit
相关PDF资料
101-0523 KIT DEV RABBIT3000/RCM3000
101-1109 KIT EMBEDDED PLC APPLICATION
101-1147 KIT RIO PROGRAM I/O
101-606 CONN SOCKET IDC 60POS W/KEY GOLD
10113616-01531LF CONN MOD JACK 8PORT 8/8 R/A PCB
10117863-5036010LF CONN MOD JACK 8/8 R/A PCB
10118061-5005010LF CONN MOD JACK 2PORT 8/8 R/A PCB
10118062-5001310LF CONN MOD JACK 4PORT 8/8 R/A PCB
相关代理商/技术参数
101-0359-000 制造商:ITT Interconnect Solutions 功能描述:1010359000 / 101-0359-000 / Circular
10103592 制造商:FCI-CONNECTOR 制造商全称:FCI connector 功能描述:MICRO-USB B-TYPE REVERSE
10103592-0001LF 功能描述:USB接头 5P Quick Connect Micro USB TypeB Plug RoHS:否 制造商:FCI 产品:USB Type A Connectors 标准:USB 3.0 端口数量: 位置/触点数量:9 型式:Female 电流额定值:1.8 A 安装风格:Through Hole 端接类型:Solder Pin 连接器类型:USB 3.0 Receptacle
10103593 制造商:FCI-CONNECTOR 制造商全称:FCI connector 功能描述:MICRO-USB B-TYPE MID-MOUNT
10103593-0001LF 功能描述:USB接头 5P Quick Connect Micro USB TypeB RCPT RoHS:否 制造商:FCI 产品:USB Type A Connectors 标准:USB 3.0 端口数量: 位置/触点数量:9 型式:Female 电流额定值:1.8 A 安装风格:Through Hole 端接类型:Solder Pin 连接器类型:USB 3.0 Receptacle
10103593-0001LF 制造商:FCI 功能描述:MICRO USB B, RECEPTACLE, 5POS, SMT RT AN
10103594 制造商:FCI-CONNECTOR 制造商全称:FCI connector 功能描述:MICRO-USB B-TYPE RECEP.
10103594-0001LF 功能描述:USB接头 5P Quick Connect Micro USB TypeB Rcpt RoHS:否 制造商:FCI 产品:USB Type A Connectors 标准:USB 3.0 端口数量: 位置/触点数量:9 型式:Female 电流额定值:1.8 A 安装风格:Through Hole 端接类型:Solder Pin 连接器类型:USB 3.0 Receptacle