101-0360 Rabbit Semiconductor, 101-0360 Datasheet - Page 20

no-image

101-0360

Manufacturer Part Number
101-0360
Description
KIT DEV RABBIT 2000 INT'L
Manufacturer
Rabbit Semiconductor
Series
RabbitCore 2000r
Type
MPU Moduler
Datasheet

Specifications of 101-0360

Contents
RabbitCore Module, Dev. Board, AC Adapter, Cable and Dynamic C® CD-Rom
For Use With/related Products
RCM2000, RCM2010, RCM2020
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
Other names
101-360
101-360
The flashing of the LEDs is performed by the costatement. Costatements need to be exe-
cuted regularly, often at least every 25 ms. To accomplish this, the costatements are
enclosed in a
describe a style of real-time programming in which most operations are done in one loop.
The costatement is executed on each pass through the big loop. When a
condition is encountered the first time, the current value of
on each subsequent pass the saved value is compared to the current value. If a
condition is not encountered, then a jump is made to the end of the costatement, and on the
next pass of the loop, when the execution thread reaches the beginning of the costatement,
execution passes directly to the
it can wait for long periods of time, but not use a lot of execution time. Each costatement
is a little program with its own statement pointer that advances in response to conditions.
On each pass through the big loop, as little as one statement in the costatement is exe-
cuted, starting at the current position of the costatement’s statement pointer. Consult the
Dynamic C User’s Manual for more details.
This program also illustrates a use for a shadow register. A shadow register is used to keep
track of the contents of an I/O port that is write only—it can’t be read back. If every time a
write is made to the port the same bits are set in the shadow register, then the shadow reg-
ister has the same data as the port register.
16
#define DS2 0
#define DS3 1
//
cofunc flashled[4](int led, int ontime, int offtime) {
}
main {
}
This cofunction flashes LED on for ontime, then off for offtime
for(;;) {
}
// Initialize ports
WrPortI(SPCR,&SPCRShadow,0x84);
WrPortI(PEFR,&PEFRShadow,0x00);
WrPortI(PEDDR,&PEDDRShadow,0x01);
WrPortI(PECR,&PECRShadow,0x00);
for(;;) {
}
while
waitfor(DelayMs(ontime));
WrPortI(PADR,&PADRShadow,(1<<led)|PADR);
waitfor(DelayMs(offtime);
WrPortI(PADR,&PADRShadow,(1<<led)^0xff&PADR);
costate {
}
wfd {
}
loop or a
flashled[0](DS2,200,200); // flash DS2 on 200 ms, off 200 ms
flashled[1](DS3,1000,500);// flash DS3 on 1000 ms, off 500 ms
for
waitfor
// predefine for LED DS2
// predefine for LED DS3
loop. The term
statement. The costatement has the property that
// use wfd (waitfordone) with cofunctions
// Set Port A all outputs, LEDs on
// Set Port E normal I/O
// Set Port E bits 7…1 input, 0 output
// Set transfer clock as pclk/2
// run forever
// start costatement
while
// end costatement
// end for loop
// end of main, never come here
loop is used as a handy way to
MS_TIMER
// on delay
// turn LED off
// off delay
// turn LED on
waitfor
is saved and then
RabbitCore RCM2000
waitfor
or a
wfd

Related parts for 101-0360