> ## 14. Graphical User Interface

> Dynamic C can be used to edit source files, compile and run programs, and choose options for these activities using pull-down menus or keyboard shortcuts. There are two modes: edit mode and run mode, which is also known as debug mode. Various debugging windows can be viewed in run mode. Programs can compile directly to a target controller for debugging in RAM or flash. Programs can also be compiled to a `.bin` file, with or without a controller connected to the PC. In order to run a program, a controller must be connected to the PC.

> Multiple instances of Dynamic C can be run simultaneously. This means multiple debugging sessions are possible over different serial ports. This is useful for debugging boards that are communicating among themselves.

> ### 14.1 Editing

> Once a file has been created or has been opened for editing, the file is displayed in a text window. It is possible to open or create more than one file and one file can have several windows. Dynamic C supports normal Windows text editing operations.

> Use the mouse (or other pointing device) to position the text cursor, select text, or extend a text selection. Scroll bars may be used to position text in a window. Dynamic C will, however, work perfectly well without a mouse, although it may be a bit tedious.

> It is also possible to scroll up or down through the text using the arrow keys or the PageUp and PageDown keys or the Home and End keys. The left and right arrow keys allow scrolling left and right.

> #### 14.1.0.1 Arrows

> Use the up, down, left and right arrow keys to move the cursor in the corresponding direction.

> The Ctrl key works in conjunction with the arrow keys this way.

> CTRL-Left Move to previous word

> CTRL-Right Move to next word

> CTRL-Up Scroll up one line (text moves down)

> CTRL-Down Scroll down one line

> #### 14.1.0.2 Home

> Moves the cursor backward in the text to the start of the line.

> Home Move to beginning of line

> CTRL-Home Move to beginning of file

> SHIFT-Home Select to beginning of line

> SHIFT-CTRL-Home Select to beginning of file

> #### 14.1.0.3 End

> Moves the cursor forward in the text.

> End Move to end of line

> CTRL-End Move to end of file

> SHIFT-End Select to end of line

> SHIFT-CTRL-End Select to end of file

> Sections of the program text can be "cut and pasted" (add and delete) or new text may be typed in directly. New text is inserted at the present cursor position or replaces the current text selection.

> The Replace command in the EDIT menu is used to perform search and replace operations either forwards or backwards.

> ### 14.2 Menus

> Dynamic C has eight command menus, as well as the standard Windows system menus. An available command can be executed from a menu by clicking the menu and then clicking the command, or by (1) pressing the Alt key to activate the menu bar, (2) using the left and right arrow keys to select a menu, (3) and using the up or down arrow keys to select a command, and (4) pressing Enter. It is usually more convenient to type keyboard shortcuts (such as <CTRL-H> for HELP) once they are known. Pressing the Esc key will make any visible menu disappear. A menu can be activated by holding the Alt key down while pressing the underlined letter of the menu name (use the space bar and minus key to access the system menus). For example, press <ALT-F> to activate the FILE menu.

> #### 14.2.1 File Menu

> Click the menu title or press <ALT-F> to select the FILE menu. Prior to Dynamic C 8.x, there is a 10,000 line limit on the size of a single source file. If your source code is that big, split some of it up into libraries.

> #### New

> Creates a new, blank, untitled program in a new window`.`

> #### Open

> Presents a dialog in which to specify the name of a file to open. Unless there is a problem, Dynamic C will present the contents of the file in a text window. The program can then be edited or compiled.

> To select a file, type in the desired file name, or select one from the list. The file's directory may also be specified.

> #### Save

> The Save command updates an open file to reflect the latest changes. If the file has not been saved before (that is. the file is a new untitled file), the Save As dialog will appear.

> Use the Save command often while editing to protect against loss during power failures or system crashes.

> #### Save As

> Allows a new name to be entered for a file and saves the file under the new name.

> #### Close

> Closes the active window. The active window may also be closed by pressing <CTRL-F4> or by double-clicking on its system menu. If there is an attempt to close a file before it has been saved, Dynamic C will present a dialog similar to one of these two dialogs.

> The file is saved when Yes (or type "y") is clicked. If the file is untitled, there will be a prompt for a file name in the Save As dialog. Any changes to the document will be discarded if No is clicked or "n" is typed. Cancel results in a return to Dynamic C, with no action taken.

> #### Project

> Allows a project file to be opened, saved, saved as a different name and closed. See Project Files for more information.

> #### Print Preview

> Shows approximately what printed text will look like. Dynamic C switches to preview "mode" when this command is selected, and allows the programmer to navigate through images of the printed pages.

> #### Print

> Text can be printed from any Dynamic C window. There is no restriction to printing source code. For example, the contents of the assembly window or the watch window can be printed. Dynamic C displays the a standard print dialog box when the Print command is selected.

> As many copies of the text as needed may be printed. If more than one copy is requested, the pages may be collated or uncollated.

> If the Print to File option is selected, Dynamic C creates a file (it will ask for a pathname) in the format suitable to send to the specified printer. (If the selected printer is a PostScript printer, the file will contain PostScript.)

> To choose a printer, click the Setup button in the Print dialog, or choose the Print Setup.. command from the FILE menu.

> #### Print Setup

> Allows choice of which printers to use and to set them up to print text.

> There is a choice between using the computer system's default printer or selecting a specific printer. Depending on the printer selected, it may be possible to specify paper orientation (portrait or tall, vs. landscape or wide), and paper size. Most printers have these options. A specific printer may or may not have more than one paper source.

> The Options button allows the print options dialog to be displayed for a specific printer. The Network button allows printers to be added or removed from the list of printers.

> #### Exit

> To exit Dynamic C. When this is done, Windows will either return to the Windows Program Manager or to another application. The keyboard shortcut is <ALT-F4>.

> #### 14.2.2 Edit Menu

> Click the menu title or press <ALT-E> to select the EDIT menu.

> ``

> #### Undo

> This option undoes recent changes in the active edit window. The command may be repeated several times to undo multiple changes. The amount of editing that may be undone will vary with the type of operations performed, but should suffice for a few large cut and paste operations or many lines of typing. Dynamic C discards all undo information for an edit window when the file is saved. The keyboard shortcut is <ALT-backspace>.

> #### Redo

> Redoes modifications recently undone. This command only works immediately after one or more Undo operations. The keyboard shortcut is <ALT-SHIFT-backspace>.

> #### Cut

> Removes selected text from a source file. A copy of the text is saved on the clipboard. The contents of the clipboard may be pasted virtually anywhere, repeatedly, in the same or other source files, or even in word processing or graphics program documents. The keyboard shortcut is <CTRL-X>.

> #### Copy

> Makes a copy of selected text in a file or in one of the debugging windows. The copy of the text is saved on the "clipboard." The contents of the clipboard may be pasted virtually anywhere. The keyboard shortcut is <CTRL-C>.

> #### Paste

> Pastes text on the clipboard as a result of a copy or cut (in Dynamic C or some other Windows application). The paste command places the text at the current insertion point. Note that nothing can be pasted in a debugging window. It is possible to paste the same text repeatedly until something else is copied or cut. The keyboard shortcut is <CTRL-V>.

> #### Find

> Finds specified text.

> Type the text to be found in the Find box. The Find command (and the Find Next command, too) will find occurrences of the word "switch." If case sensitive is clicked, the search will find occurrences that match exactly. Otherwise, the search will find matches having upper- and lower-case letters. For example, "switch," "Switch," and "SWITCH" would all match. If reverse is clicked the search will occur in reverse, that is, the search will proceed toward the beginning of the file, rather than toward the end of the file. Use the From cursor checkbox to choose whether to search the entire file or to begin at the cursor location. The keyboard shortcut is <CTRL F>.

> #### Replace

> Replaces specified text.

> Type the text to be found in the Find text box (there is a pulldown list of previously entered strings). Then type the text to substitute in the Change to text box. If Case sensitive is selected, the search will find an occurrence that matches exactly. Otherwise, the search will find a match having upper- and lower-case letters. For example, "reg7," "REG7," and "Reg7" all match.

> If Reverse is clicked, the search will occur in reverse, that is, the search will proceed toward the beginning of the file, rather than toward the end of the file. The entire file may be searched from the current cursor location by clicking the From cursor box, or the search may begin at the current cursor location.

> The Selection only box allows the substitution to be performed only within the currently selected text. Use this in conjunction with the Change All button. This box is disabled if no text is selected.

> Normally, Dynamic C will find the search text, then prompts for whether to make the change. This is an important safeguard, particularly if the Change All button is clicked. If No prompt is clicked, Dynamic C will make the change (or changes) without prompting.

> The keyboard shortcut for Replace is <F6>.

> #### Find Next

> Once search text has been specified with the Find or Replace commands, the Find Next command (`F3` for short) will find the next occurrence of the same text, searching forward or in reverse, case sensitive or not, as specified with the previous Find or Replace command. If the previous command was Replace, the operation will be a replace.

> #### Goto

> Positions the insertion point at the start of the specified line.

> Type the line number (or approximate line number) to go to. That line, and lines in the vicinity, will be displayed in the source window.

> #### Previous Error

> Locates the previous compilation error in the source code. Any errors will be displayed in a list in the message window after a program is compiled. Dynamic C selects the previous error in the list and positions the offending line of code in the text window when the Previous Error command (<CTRL-P> for short) is made. Use the keyboard shortcuts to locate errors quickly.

> #### Next Error

> Locates the next compilation error in the source code. Any errors will be displayed in a list in the message window after a program is compiled. Dynamic C selects the next error in the list and positions the offending line of code in the source window when the Next Error command (<CTRL-N> for short) is made. Use the keyboard shortcuts to locate errors quickly.

> #### Edit Mode

> Switches Dynamic C back to edit mode from run mode (also called debug mode). After a program has been compiled or executed, Dynamic C will not allow any modification to the program unless the Edit Mode is selected. The keyboard shortcut is F4.

> #### 14.2.3 Compile Menu

> Click the menu title or press <ALT-C> to select the COMPILE menu.

> #### Compile to Target

> Compiles a program and loads it in the target controller's memory. The keyboard shortcut is F5.

> Dynamic C determines whether to compile to RAM or flash based on the current compiler options (set with the Options menu). Any compilation errors are listed in the automatically activated message window. Hit <F1> to obtain a more descriptive message for any error message that is high-lighted in this window.

> #### Compile to .bin file

> Compiles a program and writes the image to a `.bin` file. The `.bin` file can then be used with a device programmer to program multiple chips; or the Rabbit Field Utility can load the `.bin` files to the target. In most cases, the Include BIOS option is checked. This causes the BIOS, as well as the user program, to be included in the `.bin` file. If you are creating special program such as a cold loader that starts at address 0x0000, then this option should be unchecked.

> When compiling to a `.bin` file, choose Use attached target to use the parameters of the controller connected to your system. If there is no connected controller, or if there is but you want to define a different configuration, choose Compile target configuration. Reset Target/Compile BIOS.

> The dialog for configuring the `Compile to a File' target has been relocated to Options | Define target configuration and the Compile | Compile to a .bin file menu selection now compiles with those parameters upon acceptance of a confirmation prompt.

> This option reloads the BIOS to RAM or flash, depending on the BIOS memory setting chosen in Options->Compiler Options. The default option is flash.

> The following box will appear upon successful compilation and loading of BIOS code.

> #### Include Debug Code/RST 28 Instructions

> If this is checked, debug code will be included in the program even if `#nodebug` precedes the main function in the program. Debug code consists mainly of `RST 28h` instructions inserted after every C statement. At an `RST 28h` instruction, program execution is transferred to the debug kernel where communication between Dynamic C and the target is tended to before returning to the user program. There are certain loop optimizations that are not generated when code is compiled as debug. This option also controls the definition of a compiler-defined macro symbol, `DEBUG_RST`. If the menu item is checked then `DEBUG_RST` is set to `1`, otherwise it is `0`.

> If the option is not checked, the compiler marks all code as `nodebug` and debugging is not possible. The only reason to check this option if debugging is finished and the program is ready to be deployed is to allow some current (or planned) diagnostic capability of the Rabbit Field Utility (RFU) to work in a deployed system. This option effects both code compiled to `.bin` files and code compiled to the target . In order to run the program after compiling to the target with this option, disconnect the target from the programming port and reset the target CPU.

> #### 14.2.4 Run Menu

> Click the menu title or press <ALT-R`>` to select the RUN menu.

> #### Run

> Starts program execution from the current breakpoint. Registers are restored, including interrupt status, before execution begins. The keyboard shortcut is F9.

> #### Run w/ No Polling

> This command is identical to the Run command, with an important exception. When running in polling mode (F9), the development PC polls or interrupts the target system every 100 ms to obtain or send information about target breakpoints, watch lines, keyboard-entered target input, and target output from `printf``` statements. Polling creates interrupt overhead in the target, which can be undesirable in programs with tight loops. The Run`` w/ No Polling command allows the program to run without polling and its overhead. (Any `printf``` calls in the program will cause execution to pause until polling is resumed. Running without polling also prevents debugging until polling is resumed.) The keyboard shortcut for this command is <ALT-F9>.

> #### Stop

> The Stop command places a hard breakpoint at the point of current program execution. Usually, the compiler cannot stop within ROM code or in `nodebug` code. On the other hand, the target can be stopped at the `rst` `028h` instruction if `rst` `028h` assembly code is inserted as inline assembly code in `nodebug` code. However, the debugger will never be able to find and place the execution cursor in `nodebug` code. The keyboard shortcut is <CTRL-Z>.

> #### Reset Program

> Resets program to its initial state. The execution cursor is positioned at the start of the main function, prior to any global initialization and variable initialization. (Memory locations not covered by normal program initialization may not be reset.) The keyboard shortcut is <CTRL-F2`>`.

> The initial state includes only the execution point (program counter), memory map registers, and the stack pointer. The Reset Program command will not reload the program if the previous execution overwrites the code segment.

> #### Trace into

> Executes one C statement (or one assembly language instruction if the assembly window is displayed) with descent into functions. Execution will not descend into functions stored in ROM because Dynamic C cannot insert the required breakpoints in the machine code. If `nodebug` is in effect, execution continues until code compiled without the `nodebug``` keyword is encountered. The keyboard shortcut is F7.

> #### Step over

> Executes one C statement (or one assembly language instruction if the assembly window is displayed) without descending into functions. The keyboard shortcut is F8.

> #### Source Trace into

> Executes one C statement with descent into functions when the assembly window is open. Execution will not descend into functions stored in ROM because Dynamic C cannot insert the required breakpoints in the machine code. If `nodebug` is in effect, execution continues until code compiled without the `nodebug``` keyword is encountered. The keyboard shortcut is <Alt-F7>.

> #### Source Step over

> Executes one C statement without descending into functions when the assembly window is open. The keyboard shortcut is <Alt-F8>.

> #### Toggle Breakpoint

> Toggles a regular ("soft") breakpoint at the location of the execution cursor. Soft breakpoints do not affect the interrupt state at the time the breakpoint is encountered, whereas hard breakpoints do. The keyboard shortcut is F2.

> #### Toggle Hard Breakpoint

> Toggles a hard breakpoint at the location of the execution cursor. A hard breakpoint differs from a soft breakpoint in that interrupts are disabled when the hard breakpoint is reached. The keyboard shortcut is <ALT-F2>.

> #### Clear All Breakpoints

> Self explanatory. The keyboard shortcut is <Ctrl-A>.

> #### Toggle Interrupt Flag

> Toggles interrupt state. The keyboard shortcut is <CTRL-I>.

> #### Toggle Polling

> Toggles polling mode. When running in polling mode (F9`)`, the development PC polls or interrupts the target system every 100 ms to obtain or send information regarding target breakpoints, watch lines, keyboard-entered target input, and target output from `printf``` statements. Polling creates interrupt overhead in the target, which can be undesirable in programs with tight loops. This command is useful to switch modes while a program is running. The keyboard shortcut is <CTRL-O>.

> #### Reset Target

> Tells the target system to perform a software reset including system initializations. Resetting a target `always` brings Dynamic C back to edit mode. The keyboard shortcut is <CTRL-Y>`.`

> #### Close Serial Port

> Disconnects the programming serial port between PC and target so that the target serial port is accessible to other applications.

> #### 14.2.5 Inspect Menu

> Click the menu title or press <ALT-I> to select the INSPECT menu.

> The INSPECT menu provides commands to manipulate watch expressions, view disassembled code, and produce hexadecimal memory dumps`.` The INSPECT menu commands and their functions are described here.

> #### Add/Del Watch Expression

> This command provokes Dynamic C to display the following dialog.

> This dialog works in conjunction with the Watch window. The text box at the top is the current expression. An expression may have been typed here or it was selected in the source code. This expression may be evaluated immediately by clicking the Evaluate button or it can be added to the expression list by clicking the Add to top button. Expressions in this list are evaluated, and the results are displayed in the Watch window, every time the Watch window is updated. Items are deleted from the expression list by clicking the Del from top button.

> An example of the results displayed in the Watch window appears below.

> #### Clear Watch Window

> Removes entries from the Watch dialog and removes report text from the Watch window. There is no keyboard shortcut.

> #### Update Watch Window

> Forces expressions in the Watch Expression list to be evaluated and displayed in the Watch window only when the function `runwatch()` is called from the application program. `runwatch()` monitors for watch update requests and should be called periodically if watch expressions are used. Normally the Watch window is updated every time the execution cursor is changed, that is when a single step, a breakpoint, or a stop occurs in the program. The keyboard shortcut is <CTRL-U>.

> #### Disassemble at Cursor

> Loads, disassembles and displays the code at the current editor cursor. This command does not work in user application code declared as `nodebug`. Also, this command does not stop the execution on the target. The keyboard shortcut is <CTRL-F10>.

> #### Disassemble at Address

> Loads, disassembles and displays the code at the specified address. This command produces a dialog box that asks for the address at which disassembling should begin. Addresses may be entered in two formats: a 4-digit hexadecimal number that specifies any location in the root space, or a 2-digit page number followed by a colon followed by a 4-digit logical address, from 00 to FF. The keyboard shortcut is <ALT-F10>.

> #### Dump at Address

> Allows blocks of raw values in any memory location (except the BIOS 0-2000H) to be looked at. Values can be displayed on the screen or written to a file.

> The option Dump to File requires a file pathname and the number of bytes to dump.

> The option Save Entire Flash to File requires a file pathname. If you are running in RAM, then it will be RAM that is saved to a file, not Flash, because this option simply starts dumping physical memory at address 0.

> A typical screen display appears below.

> The Memory Dump window may be scrolled. Scrolling causes the contents of other memory addresses to appear in the window. Hotkeys ArrowUp, ArrowDown, PageUp, PageDown are active in the Memory Dump window.The window always displays 128 bytes and their ASCII equivalent. Values in the Dump window are updated only when Dynamic C stops, or comes to a breakpoint.

> #### 14.2.6 Options Menu

> Click the menu title or press <ALT-O> to select the OPTIONS menu.

> #### 14.2.6.1 Editor

> The Editor command gets Dynamic C to display the following dialog.

> Use this dialog box to change the behavior of the Dynamic C editor. By default, tab stops are set every three characters, but may be set to any value greater than zero. Auto-Indent causes the editor to indent new lines to match the indentation of previous lines. Remove Trailing Whitespace causes the editor to remove extra space or tab characters from the end of a line.

> #### 14.2.6.2 Compiler

> The Compiler command gets Dynamic C to display the following dialog, which allows compiler operations to be changed.

> #### Run-Time Checking

> These options, if checked, can allow a fatal error at run-time. They also increase the amount of code and cause slower execution, but they can be valuable debugging tools.

> - Array Indices--Check array bounds. This feature adds code for every array reference.

> - Pointers--Check for invalid pointer assignments. A pointer assignment is invalid if the code attempts to write to a location marked as not writable. Locations marked not writable include the entire root code segment. This feature adds code for every pointer reference.

> #### BIOS Memory Setting

> A single, default BIOS source file that is defined in the system registry when installing Dynamic C is used for both compiling to RAM and compiling to flash. Dynamic C defines a preprocessor macro, `_FLASH_` or `_RAM_`, depending on which of the following options is selected. This macro is used to determine the relevant sections of code to compile for the corresponding memory type.

> - `Code and BIOS in Flash`--If you select this option, the compiler will load the BIOS to flash when cold-booting, and will compile the user program to flash where it will normally reside.

> - `Code and BIOS in RAM`--If you select this option, the compiler will load the BIOS to RAM on cold-booting and compile the user program to RAM. This option is useful if you want to use breakpoints while you are debugging your application, but you don't want interrupts disabled while the debugger writes a breakpoint to flash (this can take 10 ms to 20 ms or more, depending on the flash type used). Note that when you single step through code, the debugger is writing breakpoints at the next point in code you will step to. It is also possible to have a target that only has RAM for use as a slave processor, but this requires more than checking this option because hardware changes are necessary that in turn require a special BIOS and coldloader.

> #### User Defined BIOS File

> Use this option to change from the default BIOS to a user-specified file. Enter or select the file using the browse button/text box underneath this option. The check box labeled use must be selected or else the default file BIOS defined in the system registry will be used. Note that a single BIOS file can be made for compiling both to RAM and flash by using the preprocessor macros `_FLASH_` or`_RAM_`. These two macros are defined by the compiler based on the currently selected radio button in the BIOS Memory Setting group box.

> #### User Defined Libraries File

> The Library Lookup information retrieved with Ctrl-H is parsed from the libraries found in the `lib.dir` file, which is part of the Dynamic C installation. Checking the Use box for User Defined Libraries File, allows the parsing of a user-defined replacement for `lib.dir` when Dynamic C starts. Library files must be listed in `lib.dir` (or its replacement) to be `#use`'d by a program.

> If the function description headers are formatted correctly ( See "Function Description Headers" on page 40.), the functions in the libraries listed in the user-defined replacement for `lib.dir` will be available with Ctrl-H just like the user-callable functions that come with Dynamic C.

> This is the same as the command line compiler -LF option.

> #### Watch Expressions

> Allow any expressions in watch expressions. This option causes any compilation of a user program to pull in all the utility functions used for expression evaluation.

> Restricting watch expressions (may save root code space) Choosing this option means only utility code already used in the application program will be compiled.

> #### Type Checking

> This menu item allows the following choices:

> - Prototypes--Performs strict type checking of arguments of function calls against the function prototype. The number of arguments passed must match the number of parameters in the prototype. In addition, the types of arguments must match those defined in the prototype. Z-World recommends prototype checking because it identifies likely run-time problems. To use this feature fully, all functions should have prototypes (including functions implemented in assembly).

> - Demotion--Detects demotion. A demotion automatically converts the value of a larger or more complex type to the value of a smaller or less complex type. The increasing order of complexity of scalar types is:
>   `char
>   unsigned int
>   int
>   unsigned long
>   long
>   float`

>   A demotion deserves a warning because information may be lost in the conversion. For example, when a `long` variable whose value is 0x10000 is converted to an `int` value, the resulting value is 0. The high-order 16 bits are lost. An explicit type casting can eliminate demotion warnings. All demotion warnings are considered non-serious as far as warning reports are concerned.

> - Pointer--Generates warnings if pointers to different types are intermixed without type casting. While type casting has no effect in straightforward pointer assignments of different types, type casting does affect pointer arithmetic and pointer dereferences. All pointer warnings are considered non-serious as far as warning reports are concerned.

> #### Warning Reports

> This tells the compiler whether to report all warnings, no warnings or serious warnings only. It is advisable to let the compiler report all warnings because each warning is a potential run-time bug. Demotions (such as converting a `long` to an `int`) are considered non-serious with regard to warning reports.

> #### Optimize For

> Allows for optimization of the program for size or speed. When the compiler knows more than one sequence of instructions that perform the same action, it selects either the smallest or the fastest sequence, depending on the programmer's choice for optimization.

> The difference made by this option is less obvious in the user application (where most code is not marked `nodebug`). The speed gain by optimizing for speed is most obvious for functions that are marked `nodebug` and have no auto local (stack-based) variables.

> #### Max Shown

> This limits the number of error and warning messages displayed after compilation.

> #### Defines

> The Defines button brings up another dialog box with a window for entering (or modifying) a list of defines that are global to any source file programs that are compiled and run. The syntax expected is a semi-colon separated list of defined constants with optional values given with an equal sign. This is the same as the command line compiler -d option, except that the CLC expects a single defined expression to follow each -d:

>     dccl_cmp mysourcefile.c -d DEF1 -d MAXN=10 -d DEF2

> while the GUI window expects a semi-colon separated list

>     DEF1;MAXN=10;DEF2

> The end result is the same as if every file compiled and run were prepended with:

>     #define DEF1
>     #define MAXN 10
>     #define DEF2

> #### 14.2.6.3 Debugger

> Choosing the Debugger menu item from the Options dialog box gets Dynamic C to display the following dialog box:

> The options in the Debugger dialog box may be helpful when debugging programs. In particular, they allow printf statements and other STDIO output to be logged to a file. Check the box labeled Log STDOUT to send a copy of all standard output to the named log file. For a file that already exists, check Append Log unless you want to overwrite instead. Dynamic C automatically opens the STDIO window when a program first attempts to print to it unless a check appears in the box for Auto Open STDIO Window.

> The last three checkboxes allow the user to control the size and capabilities of the debug kernel. The debug kernel has grown significantly in size, so if there are tight code space requirements parts of the debug kernel can be disabled to save room. The three checkboxes are:

> #### Enable Breakpoints

> If this box is checked, the debug kernel will be able to toggle breakpoints on and off and will be able to stop at set breakpoints. Using the scroll bar to the right of Max breakpoints, one may enter up to the maximum amount of breakpoints the debug kernel will support. The debug kernel uses a small amount of root ram for each breakpoint, so reducing the number of breakpoints will slighty reduce the amount of root ram used.

> If this box is unchecked, the debug kernel will be compiled without breakpoint support and the user will receive an error message if they attempt to add a breakpoint.

> #### Enable Watch Expressions

> If this is checked, watch expressions will be enabled. Using the scroll bar to the right of Max watch expressions, enter up to the maximum amount of watch expressions the debug kernel will support. The debug kernel uses a small amount of root ram for evaluating each watch expression, so reducing the amount of watches will slighty reduce the amount of root ram used.

> With it unchecked, the debug kernel will be compiled without watch expressions support and the user will receive an error message if they attempt to add a watch expression.

> #### Enable Instruction Level Single Stepping

> If this is checked when the assembly window is open, single-stepping will be by instruction rather than by C statement. Unchecking this box will disable instruction level single-stepping on the target and, if the assembly window is open, the debug kernel will step by C statement.

> #### 14.2.6.4 Display

> The Display command gets Dynamic C to display the following dialog.

> Use the Display Options dialog box to change the appearance of Dynamic C windows. First choose the window from the window list. Then select an attribute from the attribute list and click the change button. Another dialog box will appear to make the changes. Note that Dynamic C allows only fixed-pitch fonts and solid colors (if a dithered color is selected, Dynamic C will use the closest solid color).

> The Editor window attributes affect all text windows, except two special cases. After an attempt is made to compile a program, Dynamic C will either display a list of errors in the message window (compil-ation failed), or Dynamic C will switch to run mode (compil-ation succeeded). In the case of a failed compile, the editor will take on the Error Editor attributes. In the case of a successful compile, the editor will take on the Debug Editor attributes.

> #### 14.2.6.5 Communications

> The Communications command displays the following dialog box. Use it to tell Dynamic C how to communicate with the target controller.

> #### TCP/IP Option

> In order to program and debug a controller across a TCP/IP connection, the Network Address field must have the IP address of either the Z-World RabbitLink board that is attached to the controller, or the IP address of a controller that has its own Ethernet interface.

> To accept control commands from Dynamic C, the Control Port field must be set to the port used by the ethernet-enabled controller. The Controller Name is for informational purposes only. The Discover button makes Dynamic C broadcast a query to any RabbitLinks attached to the network. Any RabbitLinks that respond to the broadcast can be selected and their information will be placed in the appropriate fields.

> #### Serial Options

> The COM port, baud rate, and number of stop bits may be selected. Their default values are COM1, 115200 and 1, respectively. Processor detection is enabled by default ( the `Enable` `Processor` `Verification` box is checked). The connection is normally checked with a test using the Data Set Ready (DSR) line of the PC serial connection. If the DSR line is not used as expected, a false error message will be generated in response to the connection check.

> To bypass the connection check, uncheck the Enable Processor Verification box. This allows custom designed systems to not connect the STATUS pin to the programming port. Also disabling the connection check allows non-standard PC ports or USB converters which might not implement the DSR line to work.

> If a USB to serial converter cable is being used, check the Use USB to Serial Converter checkbox. Dynamic C then attempts to compensate for abnormalities in USB converter drivers. This mode makes the communications more USB/RS232 converter friendly by allowing higher download baud rates and introducing short delays at key points in the loading process. Checking this box may also help non-standard PC ports to work properly with Dynamic `C.`

> #### 14.2.6.6 Define Target Configuration

> The Define target configuration menu option displays the following dialog box:

> There are three options available in this dialog box for choosing the board parameters that will be used in the compile. Select Board Type is the default choice and activates the Board ID pull-down menu, a list of all known board configurations. Specify Board Parameters, when checked, brings up a dialog box to enter data for a new board configuration. The name specified in the dialog box for the new board configuration will be automatically included in the Board ID pull-down menu. Use Target Information File, when checked, will prompt for a Remote Target Information (RTI) file. Any target configuration can be saved as a `.rti` file by clicking the Save as RTI button at the bottom of the dialog box.

> The baud rate, set in the Base Frequency (MHz) pulldown menu, only applies to debugging. The fastest baud rate for downloading is negotiated between the PC and the target.

> #### 14.2.6.7 Other Menu Choices

> #### Show Tool Bar

> The Show Tool Bar command toggles the display of the tool bar. Dynamic C remembers the toolbar setting on exit.

> #### Save Environment

> The Save Environment command gets Dynamic C to update the registry and `DCW.CFG` initialization files immediately with the current options settings. Dynamic C always updates these files on exit. Saving them while working provides an extra measure of security against Windows crashes.

> #### 14.2.7 Window Menu

> Click the menu title or press <ALT-W> to select the WINDOW menu.

> The first group of items is a set of standard Windows commands that allow the application windows to be arranged in an orderly way.

> The second group of items presents the various Dynamic C debugging windows. Click on one of these to activate or deactivate the particular window. It is possible to scroll these windows to view larger portions of data, or copy information from these windows and paste the information as text anywhere. The contents of these windows can be printed.

> The third group is a list of current windows, including source code windows. Click on one of these items to bring that window to the front.

> #### Message

> Click the Message command to activate or deactivate the Message window. A compilation with errors also activates the message window because the message window displays compilation errors.

> #### Watch

> The Watch menu option activates or deactivates the watch window. The Add/Del Items command on the INSPECT menu will do this too. The watch window displays the results whenever Dynamic C evaluates watch expressions.

> #### Stdio

> Click the Stdio command to activate or deactivate the Stdio window. The Stdio window displays output from calls to `printf`. If the program calls `printf`, Dynamic C will activate the Stdio window automatically, unless another request was made by the programmer. (See the Debugger Options under the OPTIONS menu.)

> #### Assembly

> Click the Assembly command to activate or deactivate the Assembly window. The Assembly window displays machine code generated by the compiler in assembly language format.

> The Disassemble at Cursor or Disassemble at Address commands also activate the Assembly window.

> The Assembly window shows the memory address on the far left, followed by the code bytes for the instruction at the address, followed by the mnemonics for the instruction. The last column shows the number of cycles for the instruction, assuming no wait states. The total cycle time for a block of instructions will be shown at the lowest row in the block in the cycle-time column, if that block is selected and highlighted with the mouse. The total assumes one execution per instruction, so the user must take looping and branching into consideration when evaluating execution times.

> Use the mouse to select several lines in the Assembly window, and the total cycle time for the instructions that were selected will be displayed to the lower right of the selection. If the total includes an asterisk, that means an instruction such as `ldir` or `ret``` `nz` with an indeterminate cycle time was selected.

> #### Registers

> Click the Registers command to activate or deactivate the Register window. The Register window displays the processor register set, including the status register. Letter codes indicate the bits of the status register (F register). The window also shows the source-code line and column at which the register "snapshot" was taken. It is possible to scroll back to see the progression of successive register snapshots. Registers may be changed when program execution is stopped by clicking the right mouse button over the name or value of the register to be changed. Registers PC, XPC, and SP may not be edited as this can adversely effect program flow and debugging.

> #### Stack

> Click the Stack command to activate or deactivate the Stack window. The Stack window displays the top 8 bytes of the run-time stack. It also shows the line and column at which the stack "snapshot" was taken. It is possible to scroll back to see the progression of successive stack snapshots.

> #### Information

> Click the Information menu option to activate the Information window.

> The Information window displays how the memory is partitioned and how well the compilation went.

> #### 14.2.8 Help Menu

> Click the menu title or press <ALT-H> to select the HELP menu. The choices are given below:

> #### Online Documentation

> Opens a browser page and displays a file with links to other manuals. When installing Dynamic C from CD, this menu item points to the hard disk; after a Web upgrade of Dynamic C, this menu item optionally points to the Web.

> #### Keywords

> Opens a browser page and displays an HTML file of Dynamic C keywords, with links to their descriptions in this manual.

> #### Operators

> Opens a browser page and displays an HTML file of Dynamic C operators, with links to their descriptions in this manual.

> #### HTML Function Reference

> Opens a browser page and displays an HTML file that has two links, one to Dynamic C functions listed alphabetically, the other to the functions listed by functional group. Each function listed is linked to its description in the Dynamic C Function Reference Manual.

> #### Function Lookup/Insert

> Obtains help information for library functions. When a function name is clicked (or the function name is selected) in source code and then the help command is issued, Dynamic C displays help information for that function. The keyboard shortcut is <CTRL-H>.

> If Dynamic C cannot find a unique description for the function, it will display the following dialog box.

> Click Lib Entries to display a list of the library functions currently available to the program. (These are the files named in the file `LIB.DIR`.) Then select a function name from the list to receive information about that function.

> Dynamic C displays a dialog box like this one when a function is selected to display help information.

> Although this may be sufficient for most purposes, the Insert Call button can be clicked to turn the dialog into a "function assistant."

> The function assistant will place a call to the function displayed at the insertion point in the source code. The function call will be prototypical if OK is clicked; the call needs to be edited for it to make sense in the context of the code.

> Each parameter can be specified, one-by-one, to the function assistant. The function assistant will return the name and data type of the parameter. When parameter expressions are specified in this dialog, the function assistant will use those expressions when placing the function call.

> If the text cursor is placed on a valid C function call (and one that is known to the function assistant), the function assistant will analyze the function call, and will copy the actual parameters to the function lookup dialog. Compare the function parameters in the Expr. in Call box in the dialog with the expected function call arguments.

> Consider, for example, the following code.

>     ...
>     x = strcpy( comment, "Lower tray needs paper.");
>     ...

> If the text cursor is placed on `strcpy` and the Function Lookup/Insert command is issued, the function assistant will show the comment as parameter 1 and "Lower tray needs paper." as parameter 2. The arguments can then be compared with the expected parameters, and the arguments in the dialog can then be modified.

> #### Instruction Set Reference

> Invokes an on-line help system and displays the alphabetical list of instructions for the Rabbit 2000 microprocessor and the Rabbit 3000 microprocessor.

> #### Keystrokes

> Invokes an on-line help system and displays the keystrokes page. Although a mouse or other pointing device may be convenient, Dynamic C also supports operation entirely from the keyboard.

> #### Contents

> Invokes an on-line help system and displays the contents page. From here view explanations of various features of Dynamic C.

> #### Tech Support Bulletin Board

> Opens a browser window to a Z-World/Rabbit Semiconductor forum for products based on the Rabbit 2000 and the Rabbit 3000.

> #### Tip of the Day

> Brings up a window displaying some useful information about Dynamic C. There is an option to scroll to another screen of Dynamic C information and an option to disable the feature. This is the same window that is displayed when Dynamic C initializes.

> #### About

> The About command displays the Dynamic C version number and the copyright notice.

Z-World http://www.zworld.com Voice: (530) 757-3737 FAX: (530) 757-3792 sales@zworld.com