RabbitCore RCM3000 User's Manual

> ## 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 RCM3000.

> ### 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 RCM3000. The advantage of working in RAM is to save wear on the flash memory, which is limited to about 100,000 write cycles. The disadvantage is that the code and data might not both fit in RAM.

> 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 RCM3000 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 global 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 RCM3000 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 J3 of the RCM3000 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 5. Switching Between Program Mode and Run Mode

> #### 3.2.1 Changing from Program Mode to Run Mode

> 1. Disconnect the programming cable from header J3 of the RCM3000.

> 2. Reset the RCM3000. You may do this as explained in Figure 5.

> The RCM3000 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 RCM3000.

> 2. Reset the RCM3000. You may do this as explained in Figure 5.

> The RCM3000 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 RCM3000. The functions in the above libraries are described in the Dynamic C Premier User's Manual.

> #### 3.3.1 I/O

> The RCM3000 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.

> When using the auxiliary I/O bus on the Rabbit 3000 chip, add the line

>     #define PORTA_AUX_IO    // required to enable auxiliary I/O bus

> to the beginning of any programs using the auxiliary I/O bus.

> The sample programs in the Dynamic C `SAMPLES/RCM3000` directory provide further examples.

> #### 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 RCM3000.

> - RCM3000--Demonstrates the basic operation and the Ethernet functionality of the RCM3000.

> - TCPIP--Demonstrates more advanced TCP/IP programming for Z-World's Ethernet-enabled Rabbit-based boards.

> Follow the instructions included with the sample program to connect the RCM3000 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 (or press F5), and then run it by selecting Run in the Run menu (or press F9). The RCM3000 must be in Program Mode (see Figure 5) 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

> - www.zworld.com/support/

> or

> - www.rabbitsemiconductor.com/support/

> 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

> Dynamic C SE (Special Edition) versions are designed for use with select Rabbit products, and are included free as part of our low-cost development kits. Dynamic C SE is a complete software development system, but does not include all of Dynamic C Premier's features and upgrade path. Dynamic C Premier includes the popular µC/OS-II real-time operating system, as well as PPP, Advanced Encryption Standard (AES), and other select libraries. Dynamic C Premier includes a one-year maintenance agreement for telephone tech support and an upgrade path for all new releases. Serious users and OEMs are encouraged to buy Dynamic C Premier.

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