101-0359 Rabbit Semiconductor, 101-0359 Datasheet - Page 31

KIT DEVELOPMENT BASIC RABBIT2000

101-0359

Manufacturer Part Number
101-0359
Description
KIT DEVELOPMENT BASIC RABBIT2000
Manufacturer
Rabbit Semiconductor
Series
RabbitCore 2000r
Type
MPU Moduler
Datasheet

Specifications of 101-0359

Rohs Status
RoHS non-compliant
Contents
RabbitCore Module, Dev. Board, AC Adapter, Cable and Dynamic C® CD-Rom
Processor To Be Evaluated
Rabbit 2000
Interface Type
RS-232, RS-485
For Use With/related Products
RCM2000, RCM2010, RCM2020
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
316-1003
The numbers in the left margin are reference indicators and are not a part of the code.
Load and run the program. Note that LED DS4 flashes once per second. Push button S1
several times and note how LED DS1 is toggled.
The flashing of LED DS4 is performed by the costatement starting at the line marked (2).
Costatements need to be executed regularly, often at least every 25 ms. To accomplish
this, the costatements are enclosed in a while loop. The term while loop is used as a handy
way to describe a style of real-time programming in which most operations are done in
one loop. The while loop starts at (1) and ends at (7). The function
Getting Started Manual
int vswitch;
S1
main(){
(1) while (1) {
(2)
(3)
(4)
(5)
out
ms
(6)
(7) }
}
WrPortI(SPCR,NULL,0x84);
WrPortI(PADR,&PADRShadow,0xff);
vswitch=0;
// first task flash LED DS4 every second for 200 milliseconds
// second task - debounce switch #1 and toggle virtual switch vswitch
// check button 1 and toggle vswitch on or off
// make LED agree with vswitch if vswitch has changed
BigLoopTop();
costate {
}
costate {
}
if( (PADRShadow & 1) == vswitch) {
)
BitWrPortI(PADR,&PADRShadow,0,3); // LED DS4 on
waitfor(DelayMs(200));
BitWrPortI(PADR,&PADRShadow,1,3); // LED DS4 off
waitfor(DelayMs(800));
if(BitRdPortI(PBDR,2)) abort;
waitfor(DelayMs(50));
if(BitRdPortI(PBDR,2)) abort;
vswitch=!vswitch;
while (1) {
}
BitWrPortI(PADR,&PADRShadow,!vswitch,0);
waitfor(BitRdPortI(PBDR,2)); // wait for button to go up
waitfor(DelayMs(200));
if(BitRdPortI(PBDR,2)) break;// if button up break
// state of virtual switch controlled by button
// begin main program
// set up parallel port A as output
// toggle virtual switch- button was down 50
// end of while loop, go back to start
// end of main, never come here
// if button not down skip out
// wait 50 ms
// if button not still down skip
// wait for button to be off 200 ms
// wait for 200 milliseconds
// end of while(1)
// end of costatement
// Begin a big endless loop
// turn off all LEDs
// initialize virtual switch off
// Endless loop
// begin a costatement
// light on for 200 ms
// light off for 800 ms
// end of costatement
BigLoopTop()
is
27

Related parts for 101-0359