RabbitCore RCM4100
User's Manual
PREV INDEX NEXT


3. Running Sample Programs

To develop and debug programs for the RCM4100 series (and for all other Rabbit Semiconductor hardware), you must install and use Dynamic C. This chapter provides a tour of its major features with respect to the RCM4100 series.

3.1 Introduction

To help familiarize you with the RCM4100 series of modules, Dynamic C includes several sample programs. Loading, executing and studying these programs will give you a solid hands-on overview of the RCM4100 series' capabilities, as well as a quick start with Dynamic C as an application development tool.

NOTE The sample programs assume that you have at least an elementary grasp of ANSI C. If you do not, see the introductory pages of the Dynamic C User's Manual for a suggested reading list.

In order to run the sample programs discussed in this chapter and elsewhere in this manual,

  1. Your module must be plugged in to the Prototyping Board as described in Chapter 2, "Getting Started."

  2. Dynamic C must be installed and running on your PC.

  3. The programming cable must connect the programming header on the module to your PC.

  4. Power must be applied to the module through the Prototyping Board.

Refer to Chapter 2, "Getting Started," if you need further information on these steps.

To run a sample program, open it with the File menu (if it is not still open), then compile and run it by pressing F9.

Each sample program has comments that describe the purpose and function of the program. Follow the instructions at the beginning of the sample program.

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

3.2 Sample Programs

Of the many sample programs included with Dynamic C, several are specific to the RCM4100 series of modules. These programs will be found in the -SAMPLES\RCM4100 folder.


Press "2" or "3" on your keyboard to select LED DS2 or DS3 on the Prototyping Board. Then follow the prompt in the Dynamic C STDIO window to turn the LED ON or OFF. A logic low will light up the LED you selected.

Once you have loaded and executed these five programs and have an understanding of how Dynamic C and the RCM4100 series of modules interact, you can move on and try the other sample programs, or begin building your own.

3.2.1 Serial Communication

The following sample programs are found in the SAMPLES\RCM4100\SERIAL folder.

3.2.2 A/D Converter Inputs (RCM4100 only)

The following sample programs are found in the SAMPLES\RCM4100\ADC folder.

NOTE The above sample program will overwrite the existing calibration constants.

NOTE The above sample program will overwrite the existing calibration constants for the selected channel.

3.2.2.1 Downloading and Uploading Calibration Constants

The Tera Term utility called for in these sample programs can be downloaded from hp.vector.co.jp/authors/VA002416/teraterm.html.

These sample programs must be compiled to flash memory. To do so, select Options > Project Options in Dynamic C, then select the "Compiler" tab, and select "Code and BIOS in Flash" for the BIOS Memory Setting.

Before you compile and run these sample programs, you will also need to connect the RS-232 header at J4 to your PC as shown in the diagram using the serial to DB9 cable supplied in the Development Kit.

  • Baud rate 19,200 bps, 8 bits, no parity, 1 stop bit

  • Enable Local Echo option

  • Feed options — Receive = CR, Transmit = CR + LF


Now compile and run this sample program. Verify that the message "Waiting, Please Send Data file" message is being display in the Tera Term display window before proceeding.

Within Tera Term, select File-->Send File-->Path and filename, then select the OPEN option within the dialog box. Once the data file has been downloaded, Tera Term will indicate whether the calibration data were written successfully.

  • Baud rate 19,200 bps, 8 bits, no parity, 1 stop bit

  • Enable Local Echo option

  • Feed options — Receive = CR, Transmit = CR + LF


Follow the remaining steps carefully in Tera Term to avoid overwriting previously saved calibration data when using same the file name.

  • Enable the File APPEND option at the bottom of the dialog box

  • Select the OPEN option at the right-hand side of the dialog box


Tera Term is now ready to log all data received on the serial port to the file you specified.

You are now ready to compile and run this sample program. A message will be displayed in the Tera Term display window once the sample program is running.

Enter the serial number you assigned to your RabbitCore module in the Tera Term display window, then press the ENTER key. The Tera Term display window will now display the calibration data.

Now select CLOSE from within the Tera Term LOG window, which will likely be a separate pop-up window minimized at the bottom of your PC screen. This finishes the logging and closes the file.

Open your data file and verify that the calibration data have been written properly. A sample is shown below.

Serial port transmission
========================

Uploading calibration table . . .

Enter the serial number of your controller = 9MN234

SN9MN234

ADSE

0
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
1
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
|
|

ADDF

0
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
2
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,float_gain,float_offset,
|
|

ADMA

3
float_gain,float_offset,
4
float_gain,float_offset,
|
|

END


3.2.3 Real-Time Clock

If you plan to use the real-time clock functionality in your application, you will need to set the real-time clock. Set the real-time clock using the SETRTCKB.C sample program from the Dynamic C SAMPLES\RTCLOCK folder, using the onscreen prompts. The RTC_TEST.C sample program in the Dynamic C SAMPLES\RTCLOCK folder provides additional examples of how to read and set the real-time clock.


Rabbit Semiconductor
www.rabbit.com
PREV INDEX NEXT