26
RabbitCore RCM2100
3.3.4 Sample Program Descriptions
3.3.4.1 FLASHLED.C
This program is about as simple as a Dynamic C application can get—the equivalent of
the traditional “Hello, world!” program found in most basic programming tutorials. If you
are familiar with ANSI C, you should have no trouble reading through the source code and
understanding it.
The only new element in this sample application should be Dynamic C’s handling of the
Rabbit microprocessor’s parallel ports. The program:
4. Initializes the pins of Port A as outputs.
5. Sets all of the pins of Port A high, turning off the attached LEDs.
6. Starts an endless loop with a
for(;;)
expression, and within that loop:
• Writes a bit to turn bit 1 off, lighting LED DS3;
• Waits through a delay loop;
• Writes a bit to turn bit 1 on, turning off the LED;
• Waits through a second delay loop;
These steps repeat as long as the program is allowed to run.
You can change the flash rate of the LED by adjusting the loop values in the two
for
expressions. The first loop controls the LED’s “off” time; the second loop controls its “on”
time.
NOTE:
Since the variable
j
is defined as type
int
, the range for
j
must be between 0
and 32767. To permit larger values and thus longer delays, change the declaration of
j
to
unsigned int
or
long
.
More Information
See the section on primitive data types, and the entries for the library functions
WrPortI( )
and
BitWrPortI( )
in the
Dynamic C User’s Manual
.
Содержание RabbitCore RCM2100 Series
Страница 1: ...RabbitCore RCM2100 C Programmable Module with Ethernet Getting Started Manual 019 0093 050505 F ...
Страница 34: ...30 RabbitCore RCM2100 ...
Страница 52: ...48 RabbitCore RCM2100 ...
Страница 54: ...User s Manual 50 ...
Страница 56: ......