RabbitCore RCM2200
User's Manual
PREV NEXT INDEX



3. Software Reference

Dynamic C Premier is an integrated development system for writing embedded software. It runs on an IBM-compatible PC and is designed for use with Z-World controllers and other controllers based on the Rabbit microprocessor. Chapter 3 provides the libraries, function calls, and sample programs related to the RCM2200.

3.1 More About Dynamic C

Dynamic C has been in use worldwide since 1989. It is specially designed for programming embedded systems, and features quick compile and interactive debugging in the real environment. A complete reference guide to Dynamic C is contained in the Dynamic C Premier User's Manual.

You have a choice of doing your software development in the flash memory or in the static RAM included on the RCM2200. The advantage of working in RAM is to save wear on the flash memory, which is limited to about 100,000 write cycles.

NOTE An application can be developed in RAM, but cannot run standalone from RAM after the programming cable is disconnected. All standalone applications can only run from flash memory.
NOTE Do not depend on the flash memory sector size or type. Due to the volatility of the flash memory market, the RCM2200 and Dynamic C were designed to accommodate flash devices with various sector sizes.

The disadvantage of using flash memory for debug is that interrupts must be disabled for approximately 5 ms whenever a break point is set in the program. This can crash fast interrupt routines that are running while you stop at a break point or single-step the program. Flash memory or RAM is selected on the Options > Compiler menu.

Dynamic C Premier provides a number of debugging features. You can single-step your program, either in C, statement by statement, or in assembly language, instruction by instruction. You can set break points, where the program will stop, on any statement. You can evaluate watch expressions. A watch expression is any C expression that can be evaluated in the context of the program. If the program is at a break point, a watch expression can view any expression using local or external variables. If a periodic call to runwatch() is included in your program, you will be able to evaluate watch expressions by hitting <Ctrl-U> without stopping the program.

3.2 Programming Cable

The RCM2200 is automatically in program mode when the PROG connector on the programming cable is attached, and is automatically in run mode when no programming cable is attached.

The DIAG connector of the programming cable may be used on header J5 of the RCM2200 with the board operating in the run mode. This allows the programming port to be used as an application port. See Appendix E, "Programming Cable," for more information.


Figure 6. Switching Between Program Mode and Run Mode

3.2.1 Changing from Program Mode to Run Mode


Figure 7. Location of Reset Button
on Prototyping Board
1. Disconnect the programming cable from header J5 of the RCM2200.
2. Reset the RCM2200. You may do this as explained in Figure 6.

The RCM2200 is now ready to operate in the run mode.

3.2.2 Changing from Run Mode to Program Mode

1. Attach the programming cable to header J3 on the RCM2200.
2. Reset the RCM2200. You may do this as explained in Figure 6.

The RCM2200 is now ready to operate in the program mode.

3.3 Dynamic C Libraries

With Dynamic C running, click File > Open, and select Lib. The following list of Dynamic C libraries will be displayed.


There is no unique library that is specific to the RCM2200. The functions in the above libraries are described in the Dynamic C Premier User's Manual.

3.3.1 I/O

The RCM2200 was designed to interface with other systems, and so there are no drivers written specifically for the I/O. The general Dynamic C read and write functions allow you to customize the parallel I/O to meet your specific needs. For example, use


WrPortI(PEDDR, &PEDDRShadow, 0x00);

to set all the port E bits as inputs, or use


WrPortI(PEDDR, &PEDDRShadow, 0xFF);

to set all the Port E bits as outputs.

The sample programs in the Dynamic C SAMPLES/RCM2200 directory provide further examples.

3.3.1.1 PCLK Output

The PCLK output is controlled by bits 7 and 6 of the Global Output Register (GOCR) on the Rabbit 2000 microprocessor, and so can be enabled or disabled in software. Starting with Dynamic C v 7.02, the PCLK output is disabled by default at compile time to minimize radiated emissions; the PCLK output is enabled in earlier versions of Dynamic C.

Use the following code to set the PCLK output as needed.

PCLK output driven with peripheral clock:

	 WrPortI(GOCR, &GOCRShadow, (GOCRShadow&~0xc0));
PCLK output driven with peripheral clock ÷ 2:

	 WrPortI(GOCR, &GOCRShadow, ((GOCRShadow&~0xc0)| 0x40));	 
PCLK output off (low):

	 WrPortI(GOCR, &GOCRShadow, ((GOCRShadow&~0xc0)| 0x80));
PCLK output on (high):

	 WrPortI(GOCR, &GOCRShadow, (GOCRShadow | 0xc0));

3.3.2 Serial Communication Drivers

Library files included with Dynamic C provide a full range of serial communications support. The RS232.LIB library provides a set of circular-buffer-based serial functions. The PACKET.LIB library provides packet-based serial functions where packets can be delimited by the 9th bit, by transmission gaps, or with user-defined special characters. Both libraries provide blocking functions, which do not return until they are finished transmitting or receiving, and nonblocking functions, which must be called repeatedly until they are finished. For more information, see the Dynamic C Premier User's Manual and Technical Note 213, Rabbit 2000 Serial Port Software.

3.3.3 TCP/IP Drivers

The TCP/IP drivers are located in the TCPIP directory.


Complete information on these libraries and the TCP/IP functions is provided in the Dynamic C TCP/IP User's Manual.

3.4 Sample Programs

Sample programs are provided in the Dynamic C Samples folder, which is shown below.


The various folders contain specific sample programs that illustrate the use of the corresponding Dynamic C libraries. For example, the sample program PONG.C demonstrates the output to the Dynamic C STDIO window.

Two folders contain sample programs that illustrate features unique to the RCM2200.

Follow the instructions included with the sample program to connect the RCM2200 and the other hardware identified in the instructions.

To run a sample program, open it with the File menu (if it is not still open), compile it using the Compile menu, and then run it by selecting Run in the Run menu. The RCM2200 must be in Program Mode (see Section , "The Dynamic C BIOS source files handle different standard RAM and flash EPROM sizes automatically.,") and must be connected to a PC using the programming cable.

More complete information on Dynamic C is provided in the Dynamic C Premier User's Manual.

3.5 Upgrading Dynamic C

Dynamic C patches that focus on bug fixes are available from time to time. Check the Web sites

or

for the latest patches, workarounds, and bug fixes.

The default installation of a patch or bug fix is to install the file in a directory (folder) different from that of the original Dynamic C installation. Z-World recommends using a different directory so that you can verify the operation of the patch without overwriting the existing Dynamic C installation. If you have made any changes to the BIOS or to libraries, or if you have programs in the old directory (folder), make these same changes to the BIOS or libraries in the new directory containing the patch. Do not simply copy over an entire file since you may overwrite a bug fix; of course, you may copy over any programs you have written. Once you are sure the new patch works entirely to your satisfaction, you may retire the existing installation, but keep it available to handle legacy applications.

3.5.1 Upgrades

A special edition of Dynamic C, Dynamic C SE, is included on the CD that comes with the RCM2200 Development Kit, and has been customized with all the libraries and features needed to develop and run an application on the RCM2200.

More advanced users who may need upgrades and additional capabilities for other Z-World products in the future are encouraged to consider the standard edition of Dynamic C Premier, which Z-World plans to fully supported with upgrades now and into the future.


PREV NEXT INDEX




Z-World
http://www.zworld.com
Voice: (530) 757-3737
FAX: (530) 757-3792
sales@zworld.com
Rabbit Semiconductor
http://www.rabbitsemiconductor.com
Voice: (530) 757-8400
FAX: (530) 757-8402
sales@rabbitsemiconductor.com