Smart Star
User's Manual
PREV INDEX NEXT


4. Software

Dynamic C is an integrated development system for writing embedded software. It runs on an IBM-compatible PC and is designed for use with Rabbit Semiconductor controllers and other controllers based on the Rabbit microprocessor.

Chapter 4 provides the libraries, function calls, and sample programs related to the Smart Star backplane and CPU cards.

4.1 Running Dynamic C

You have a choice of doing your software development in the flash memory or in the static RAM included on the Smart Star CPU cards. The flash memory and SRAM options are selected with the Options > Program Options > Compiler menu.

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. 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 Smart Star and Dynamic C were designed to accommodate flash devices with various sector sizes.

Developing software with Dynamic C is simple. Users can write, compile, and test C and assembly code without leaving the Dynamic C development environment. Debugging occurs while the application runs on the target. Alternatively, users can compile a program to an image file for later loading. Dynamic C runs on PCs under Windows 95 or later. Programs can be downloaded at baud rates of up to 460,800 bps after the program compiles.

Dynamic C has a number of standard features.

4.1.1 Upgrading Dynamic C

4.1.1.1 Patches and Bug Fixes

Dynamic C patches that focus on bug fixes are available from time to time. Check the Web site www.rabbit.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. Rabbit Semiconductor 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. 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.

4.1.1.2 Upgrades

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. Dynamic C is a complete software development system, but does not include all the Dynamic C features. Rabbit Semiconductor also offers add-on Dynamic C modules containing 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.

4.2 Sample Programs

Sample programs are provided in the Dynamic C SAMPLES folder. The sample program PONG.C demonstrates the output to the STDIO window. The various directories in the SAMPLES folder contain specific sample programs that illustrate the use of the corresponding Dynamic C libraries.

The SAMPLES\SMRTSTAR folder provides sample programs specific to the Smart Star control system. Each sample program has comments that describe the purpose and function of the program. Follow the instructions at the beginning of the sample program.

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 BL2500 must be in Program mode (see Section 3.3, "Programming Cable") and must be connected to a PC using the programming cable as described in Section 2.2, "Connect the Power Supply."

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

Let's take a look at sample programs for the backplane and the CPU Card in the SMRTSTAR folder.

The RS232 directory contains two sample programs to illustrate RS-232 serial communication.

The RS485 directory contains two sample programs to illustrate RS-485 serial communication.

4.3 Dynamic C Libraries

One library directory contains software that is unique to the Smart Star.

Functions dealing with the backplane and the CPU Card are described in this chapter. Functions relevant to the individual I/O cards are described in the chapter specific to the I/O card.

Other functions applicable to all devices based on the Rabbit 2000 microprocessor are described in the Dynamic C User's Manual.

4.4 Smart Star Backplane Function Calls

4.4.1 Board Reset

void brdResetBus();


Resets all cards on the bus.
Return Value
None.

4.4.2 Board Initialization

void brdInit();


Initializes slot addressing, disables card enable/disable line, resets card slot bus and LED latch, and turns all LEDS OFF. Call this function at the beginning of the application.
Return Value
None.

4.5 Serial Communication Calls

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 Function Reference Manual and Technical Note 213, Rabbit 2000 Serial Port Software.

Use the following function calls with the Smart Star.

int serMode(int mode);


User interface to set up serial communication lines for the Smart Star control system. Call this function after serXOpen().
Parameters
mode is the defined serial port configuration of the CPU Card.
Mode
Serial Port
Parallel Port
C (PC2 and PC3)
D (PC0 and PC1)
D (PD0 and PD1)
0
RS-232, 3-wire
RS-485

1
RS-232, 3-wire
RS-232, 3-wire

2
RS-232, 5-wire

RTS/CTS
3
RS-232, 5-wire
RS-485
RTS/CTS

Return Value
0 if correct mode, 1 if not.

ser485Tx();


Enables RS-485 transmission (disables receive) on serial port D.
Return Value
None.
See Also

ser485Rx();


Disables RS-485 transmission (enables receive) on serial port D.
Return Value
None.
See Also

Rabbit Semiconductor
www.rabbit.com
PREV INDEX NEXT