![]() |
|
| RabbitCore RCM3000 Getting Started |
|
3. Software Installation & Overview
To develop and debug programs for the RCM3000 (and for all other Z-World and Rabbit Semiconductor hardware), you must install and use Dynamic C. Dynamic C 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 An Overview of 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 User's Manual.
You have a choice of doing your software development in the flash memory or in the data SRAM 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.
The disadvantage of using flash memory for debug is that interrupts must be disabled for up to 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. The flash memory and SRAM options are selected through the "BIOS Memory Setting" from the Options > Project Options > Compiler menu.
Dynamic C 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 Installing Dynamic C
Insert the Dynamic C CD from the Development Kit in your PC's CD-ROM drive. If the installation does not auto-start, run the
setup.exeprogram in the root directory of the Dynamic C CD. Install any Dynamic C modules after you install Dynamic C.Dynamic C has two components that can be installed together or separately. One component is Dynamic C itself, with the development environment, support files and libraries. The other component is the documentation library in HTML and PDF formats, which may be left uninstalled to save hard drive space or installed elsewhere (on a separate or network drive, for example).
The installation type is selected in the installation menu shown above. The options are:
- Typical Installation Both Dynamic C and the documentation library will be installed in the specified folder (default).
- Compact Installation Only Dynamic C will be installed.
- Custom Installation You will be allowed to choose which components are installed. This choice is useful to install or reinstall just the documentation.
3.3 Sample Programs
To help familiarize you with the RCM3000 modules, Dynamic C includes several sample programs in the Dynamic C
SAMPLES\RCM3000directory. Loading, executing and studying these programs will give you a solid hands-on overview of the RabbitCore's capabilities, as well as a quick start with Dynamic C as an application development tool.Two folders contain sample programs that illustrate features unique to the RCM3000.
- RCM3000Demonstrates the basic operation and the Ethernet functionality of the RCM3000.
- TCPIPDemonstrates 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. The RCM3000 module must be installed on the Prototyping Board as shown in Figure 3.
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 connected to a PC using the programming cable.
More complete information on Dynamic C is provided in the Dynamic C User's Manual.
CONTROLLED.Cuses the STDIO window to demonstrate digital outputs by toggling LEDs DS1 and DS2 on the Prototyping Board on and off.
- Parallel Port G bit 6 = LED DS1
Parallel Port G bit 7 = LED DS2- Once you have compile this program and it is running, you will be prompted via the Dynamic C STDIO window to select LED DS1 or DS2. Use your PC keyboard to make your selection.
- Once you have selected the LED, you will be prompted to select to turn the LED either ON or OFF. A logic low will light up the LED you selected.
FLASHLED1.cdemonstrates the use of costatements to flash LEDs DS1 and DS2 on the Prototyping Board at different rates. Once you have compile this program and it is running, LEDs DS1 and DS2 will flash on/off at different rates.
FLASHLED2.cdemonstrates the use of cofunctions and costatements to flash LEDs DS1 and DS2 on the Prototyping Board at different rates. Once you have compile this program and it is running, LEDs DS1 and DS2 will flash on/off at different rates.
TOGGLESWITCH.cdemonstrates the use of costatements to detect switches using the press-and-release method of debouncing. LEDs DS1 and DS2 on the Prototyping Board are turned on and off when you press switches S2 and S3.
IR_DEMO.cDemonstrates sending Modbus ASCII packets between two Prototyping Board assemblies via the IrDA transceivers with the IrDA transceivers facing each other. Note that this sample program will only work with the RCM30/31/32XX Prototyping Board.
- First, compile and run this program on one Prototyping Board assembly, then remove the programming cable and press the RESET button on the Prototyping Board so that the first RabbitCore module is operating in the Run mode. Then connect the programming cable to the second Prototyping Board assembly with the RCM3000 and compile and run the same sample program. With the programming cable still connected to the second Prototyping Board assembly, press switch S2 on the second Prototyping Board to transmit a packet. Once the first Prototyping Board assembly receives a test packet, it will send back a response packet that will be displayed in the Dynamic C STDIO window. The test packets and response packets have different codes.
Once you have loaded and executed these sample programs and have an understanding of how Dynamic C and the RCM3000 modules interact, you can move on and try the other sample programs, or begin building your own.
3.3.1 Serial Communication
The following sample programs can be found in the
SAMPLES\RCM3000\SERIALfolder.
FLOWCONTROL.CThis program demonstrates hardware flow control by configuring Serial Port C (PC3/PC2) for CTS/RTS with serial data coming from TxB at 115,200 bps. One character at a time is received and is displayed in the STDIO window.
- To set up the Prototyping Board, you will need to tie TxB and RxB together on the RS-232 header at J5, and you will also tie TxC and RxC together using the jumpers supplied in the Development Kit as shown in the diagram.
![]()
- A repeating triangular pattern should print out in the STDIO window. The program will periodically switch flow control on or off to demonstrate the effect of no flow control.
PARITY.CThis program demonstrates the use of parity modes by repeatedly sending byte values 0127 from Serial Port B to Serial Port C. The program will switch between generating parity or not on Serial Port B. Serial Port C will always be checking parity, so parity errors should occur during every other sequence.![]()
- To set up the Prototyping Board, you will need to tie TxB and RxC together on the RS-232 header at J5 using the jumpers supplied in the Development Kit as shown in the diagram.
- The Dynamic C STDIO window will display the error sequence.
SIMPLE3WIRE.CThis program demonstrates basic RS-232 serial communication.Lower case characters are sent by TxC, and are received by RxB. The characters are converted to upper case and are sent out by TxB, are received by RxC, and are displayed in the Dynamic C STDIO window.![]()
- To set up the Prototyping Board, you will need to tie TxB and RxC together on the RS-232 header at J5, and you will also tie RxB and TxC together using the jumpers supplied in the Development Kit as shown in the diagram.
SIMPLE5WIRE.CThis program demonstrates 5-wire RS-232 serial communication with flow control on Serial Port C and data flow on Serial Port B.
- To set up the Prototyping Board, you will need to tie TxB and RxB together on the RS-232 header at J5, and you will also tie TxC and RxC together using the jumpers supplied in the Development Kit as shown in the diagram.
![]()
- Once you have compiled and run this program, you can test flow control by disconnecting TxC from RxC while the program is running . Characters will no longer appear in the STDIO window, and will display again once TxC is connected back to RxC.
SWITCHCHAR.CThis program demonstrates transmits and then receives an ASCII string on Serial Ports B and C. It also displays the serial data received from both ports in the STDIO window.
- To set up the Prototyping Board, you will need to tie TxB and RxC together on the RS-232 header at J5, and you will also tie RxB and TxC together using the jumpers supplied in the Development Kit as shown in the diagram.
![]()
- Once you have compiled and run this program, press and release S2 and S3 on the Prototyping Board. The data sent between the serial ports will be displayed in the STDIO window.
Two sample programs,
SIMPLE485MASTER.CandSIMPLE485slave.C, are available to illustrate RS-485 master/slave communication. To run these sample programs, you will need a second Rabbit-based system with RS-485, and you will also have to add an RS-485 transceiver such as the SP483E and bias resistors to the RCM30/31/32XX Prototyping Board.![]()
The diagram shows the connections. You will have to connect PC0 and PC1 (Serial Port D) on the RCM30/31/32XX Prototyping Board to the RS-485 transceiver, and you will connect PD4 to the RS-485 transceiver to enable or disable the RS-485 transmitter.
The RS-485 connections between the slave and master devices are as follows.
- RS485+ to RS485+
- RS485 to RS485
- GND to GND
SIMPLE485MASTER.CThis program demonstrates a simple RS-485 transmission of lower case letters to a slave RCM3000. The slave will send back converted upper case letters back to the master RCM3000 and display them in the STDIO window. UseSIMPLE485SLAVE.Cto program the slave RCM3000.
SIMPLE485slave.CThis program demonstrates a simple RS-485 transmission of lower case letters to a master RCM3000. The slave will send back converted upper case letters back to the master RCM3000 and display them in the STDIO window. UseSIMPLE485MASTER.Cto program the master RCM3000.3.3.2 Other Sample Programs
Section 4.11 describes the TCP/IP sample programs, and the RabbitCore RCM3000 User's Manual provides sample programs for the optional LCD/keypad module that can be installed on the Prototyping Board.
3.4 Upgrading Dynamic C
Dynamic C patches that focus on bug fixes are available from time to time. Check the Web sites
for the latest patches, workarounds, and bug fixes.
3.4.1 Add-On Modules
Dynamic C installations are designed for use with the board they are included with, and are included at no charge as part of our low-cost kits. Z-World offers add-on Dynamic C modules for purchase, including the popular µC/OS-II real-time operating system, as well as PPP, Advanced Encryption Standard (AES), and other select libraries.
In addition to the Web-based technical support included at no extra charge, a one-year telephone-based technical support module is also available for purchase.
| Z-World, Inc. www.zworld.com Phone: 1.530.757.3737 FAX: 1.530.757.3792 |
Rabbit Semiconductor www.rabbitsemiconductor.com Phone: 1.530.757.8400 FAX: 1.530.757.8402 |