background image

12

Rabbit 2000 Development Kit

You can set break points while the program is running by positioning the cursor to a state-
ment and using the 

F2

 key.  If the execution thread hits the break point, a break point will 

take place. You can toggle the break point off with the 

F2

 key and continue execution with 

the 

F9

 key.  Try this a few times to get the feel of things.

3.2.3  Editing the Program

Click on the 

Edit

 box on the task bar.  This will set Dynamic C into the edit mode so that 

you can change the program.  Use the 

Save as

 choice on the 

File

 menu to save the file 

with a new name so as not to change the demo program.  Save the file as 

MYTEST.C

. Now 

change the number 25000 in the 

for (..

 statement to 10000.  Then use the 

F9

 key to recom-

pile and run the program.  The LED will start flashing, but it will flash much faster than 
before because you have changed the loop counter terminal value from 25000 to 10000.

3.2.4  Watching Variables Dynamically

Go back to edit mode (select edit) and load the program 

DEMOJR2.C

 using the 

File

 menu 

Open

 command.  This program is the same as the first program, except that a variable 

k

 

has been added along with a statement to increment 

k

 each time around the endless loop. 

The statement:

runwatch();

has been added.  This is a debugging statement that makes it possible to view variables 
while the program is running.

Use the 

F9

 key to compile and run 

DEMOJR2.C

.  Now type 

<ctrl-W>

 to open the watch 

window and add the watch expression 

k

 to the top of the list of watch expressions.  Now 

type 

<ctrl-U>

.  Each time you type 

<ctrl-U>

, you will see the current value of 

k

, which is 

incrementing about 5 times a second.

As an experiment add another expression to the watch window: 

k*5

Then type 

<ctrl-U>

 several times to observe the watch expressions 

k

 and 

k*5

.

3.2.5  Summary of Features

So far you have practiced using the following features of Dynamic C.

Loading, compiling and running a program.  When you load a program it appears in an 
edit window.  You can compile by selecting 

Compile

 on the task bar or from the 

Com-

pile

 menu.  When you compile the program, it is compiled into machine language and 

downloaded to the target over the serial port.  The execution proceeds to the first state-
ment of main where it pauses, waiting for you to command the program to run, which 
you can do with the 

F9

 key or by selecting 

Run

 on the 

Run

 menu.  If want to compile 

and start the program running with one keystroke, use 

F9

, the run command.  If the pro-

gram is not already compiled, the run command will compile it first.

Single-stepping.  This is done with the 

F8

 key. The 

F7

 key can also be used for single-

stepping.  If the 

F7

 key is used, then descent into subroutines will take place. With the 

F8

 key the subroutine is executed at full speed when the statement that calls it is 

stepped over.

Summary of Contents for 2000

Page 1: ...Rabbit 2000 Microprocessor Development Kit Getting Started 010118 D...

Page 2: ...nst consequences resulting from system failure is the buyer s responsibility This device is not approved for life support or medical systems All Rabbit Semiconductor products are 100 percent functiona...

Page 3: ...3 2 4 Watching Variables Dynamically 12 3 2 5 Summary of Features 12 3 3 Cooperative Multitasking 13 3 4 Advantages of Cooperative Multitasking 15 4 Software Reference 17 4 1 More About Dynamic C 17 4...

Page 4: ...Rabbit 2000 Development Kit...

Page 5: ...of the basics of operating a software program and editing files under Windows on a PC Knowledge of basic assembly language and architecture for controllers For a full treatment of C refer to the follo...

Page 6: ...ng Board includes various accessories such as pushbutton switches LEDs and a beeper In addition you can add your own circuitry Programming cable This is a cable that is used to connect your PC serial...

Page 7: ...yping Board that includes pushbutton switches LEDs and a beeper can be plugged into the Jackrabbit board By writing pro grams that run on the Jackrabbit board you can flash the LEDs beep the beeper an...

Page 8: ...s whenever a break point is set in the program This can crash fast interrupt routines that are running while you stop at a breakpoint or single step the program Flash or RAM is selected on the Options...

Page 9: ...4 Rabbit 2000 Development Kit...

Page 10: ...ely 10 megabytes of free space on your hard disk The software can be installed on your C drive or any other convenient drive 2 2 Getting Hooked Up Figure 1 below shows an overview of how the serial an...

Page 11: ...ND RXC TXC PC1 PC3 PC5 PC7 AGND DA1 PD1 PD3 PD5 PD7 GND 485 VCC SM1 STAT VBAT GND Z World Inc GND PA0 PA2 PA4 PA6 GND PB0 PB2 PB4 PB6 WDO GND PE6 PE4 PE2 PE0 HV0 HV2 K GND VCC PA1 PA3 PA5 PA7 GND PB1...

Page 12: ...VIN positive voltage is the middle pin and GND is available on both ends of the three pin header J1 3 Plug in the wall transformer The Jackrabbit board and the Prototyping Board are ready to be used...

Page 13: ...y the different COM ports in the OPTIONS menu until you find the one you are connected to If you can t get Dynamic C to recognize the target on any port then the hookup may be wrong or the COM port is...

Page 14: ...sample programs are listed in Table 1 The first five sample programs provide a step by step introduction to the Jackrabbit board Additional sample programs illustrate more advanced topics Each sample...

Page 15: ...evelopment Board should start flashing if everything went well If this doesn t work review the follow ing points The target should be ready which is indicated by the message BIOS successfully compiled...

Page 16: ...to single step Each time the F8 key is pressed the cursor will advance one statement When you get to the for j 0 j statement it becomes impractical to single step further because you would have to pre...

Page 17: ...ble to view variables while the program is running Use the F9 key to compile and run DEMOJR2 C Now type ctrl W to open the watch window and add the watch expression k to the top of the list of watch e...

Page 18: ...on is evaluated as if it were in a separate function with no local variables 3 3 Cooperative Multitasking Cooperative multitasking is a convenient way to perform several different tasks at the same ti...

Page 19: ...itfor BitRdPortI PBDR 2 wait for button to go up waitfor DelayMs 200 wait for 200 milliseconds if BitRdPortI PBDR 2 break if button up break end of while 1 end of costatement make LED agree with vswit...

Page 20: ...bort state ment is illustrated at 5 If executed the internal statement pointer is set back to the first statement within the costatement and a jump to the closing brace of the costatement is made At 6...

Page 21: ...16 Rabbit 2000 Development Kit...

Page 22: ...le debugging is being done because it is more flexible than flash memory Dynamic C does not use include files rather it has libraries which are used for the same purpose that is to supply function pro...

Page 23: ...t E bits 0 3 for digital output and starts up the pulse width modulation routines for the A D and D A channels Note that these routines can consume up to 20 of the CPU s processing power the routines...

Page 24: ...oth D A channels are used A voltage is selected by giving a value from 0 to 1024 to the driver corresponding roughly to 0 1 V to 3 5 V on DA0 Because of the PWM interrupt frequency the PWM driver can...

Page 25: ...y the driver and cause fluctuations in the voltage out puts Avoid using serial communications or printf statements during portions of your program where the voltage must remain steady Also be aware th...

Page 26: ...only on the Jackrabbit An integer between 0 and 1024 will be returned in value corresponding to a voltage obtained if output channel DA0 was set to that value If a value is found but the voltage has...

Page 27: ...llowing groups Open and Close Functions Non Cofunction Blocking Input Functions Non Cofunction Blocking Output Functions Single User Cofunction Input Functions Single User Cofunction Output Functions...

Page 28: ...able Parameters None Return Value An integer with return character in the low byte No character is represented by a return of 1 int serXread void data int length unsigned long tmout Reads a block of c...

Page 29: ...te Return Value 1 for success 0 if the character could not be written to the port int serXputs char s Calls serXwrite s strlen s Parameters s Null terminated character string source to write to the se...

Page 30: ...ecution and only returns control to the following statement in its own costatement block when it completes Parameters data Destination data structure The user must ensure data is allocated for at leas...

Page 31: ...Parameters c Character to write to the serial port Return Value None scofunc void cof_serXputs char s Writes a null terminated character string to the serial port yielding to other tasks when unsucces...

Page 32: ...ze of 31 will be used and a compiler warn ing will be given When using cofunctions smaller buffer sizes can yield more frequently to other tasks but have the risk of a large input data stream overrunn...

Page 33: ...becoming full int serXwrFree Calculates the free space in the serial port transmit buffer Parameters None Return Value The number of characters the serial port transmit buffer can accept before becom...

Page 34: ...de A D input input range 0 V to 3 V 10 bit resolution 8 bit accuracy average acquisition time 150 ms 165 ms maximum with 14 7 MHz clock Analog Outputs Two filtered and buffered PWM outputs Digital Out...

Page 35: ...30 Rabbit 2000 Development Kit...

Page 36: ...Getting Started Manual Schematics...

Page 37: ...B DRAWING CONTENT APPROVALS INITIAL RELEASE SIGNATURES 2900 SPAFFORD ST DAVIS CA 95616 530 757 4616 THIS DOCUMENT APPEND THE FOLLOWING DOCUMENTS WHEN CHANGING ECO APPROVAL APPROVAL CONTROL DOCUMENT DA...

Page 38: ...B NONE B NONE...

Page 39: ...B NONE B NONE...

Page 40: ...B DRAWING CONTENT APPROVALS INITIAL RELEASE SIGNATURES 2900 SPAFFORD ST DAVIS CA 95616 530 757 4616 THIS DOCUMENT APPEND THE FOLLOWING DOCUMENTS WHEN CHANGING ECO APPROVAL APPROVAL CONTROL DOCUMENT DA...

Page 41: ...B NONE B NONE...

Page 42: ...ALS INITIAL RELEASE DRAWING CONTENT B 2900 SPAFFORD ST DAVIS CA 95616 ZWORLD DATE NONE 530 757 4616 THIS DOCUMENT APPEND THE FOLLOWING DOCUMENTS WHEN CHANGING ECO APPROVAL APPROVAL CONTROL DOCUMENT DA...

Page 43: ......

Reviews: