Digicom 2000 Manual do Utilizador

Consulte online ou descarregue Manual do Utilizador para Vbombas de água Digicom 2000. Digicom 2000 User`s manual Manual do Utilizador

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 366
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes

Resumo do Conteúdo

Página 1 - User’s Manual

Integrated C Development SystemFor Rabbit 2000 and 3000 MicroprocessorsUser’s Manual019-0125_K

Página 2 - Dynamic C User’s Manual

10 digi.com Installing Dynamic C

Página 3 - Table of Contents

100 digi.com Debugging with Dynamic C6.3.7 MAP FileMap files have been generated for compiled programs since Dynamic C 7.02. Pros The map file is fu

Página 4 - 4 digi.com Table of Contents

Dynamic C User’s Manual digi.com 101bytes added to the program. The follows action is an advanced topic related to the subject of origin directives. S

Página 5

102 digi.com Debugging with Dynamic C6.3.8 Execution TraceExecution tracing was introduced in Dynamic C 9. The program Samples\demo4.c demonstrates

Página 6 - 6 digi.com Table of Contents

Dynamic C User’s Manual digi.com 1036.3.9 Symbolic Stack TraceDynamic C has always had the Stack window, but the Stack Trace window is new in Dynamic

Página 7

104 digi.com Debugging with Dynamic C6.3.10 Assert MacroThe assert macro was introduced in Dynamic C 8.51. The Dynamic C implementation of assert fo

Página 8 - 8 digi.com Table of Contents

Dynamic C User’s Manual digi.com 105xalloc_stats()Prints a table of physical addresses that are available for allocation in xmem via xalloc() calls. T

Página 9 - 1. INSTALLING DYNAMIC C

106 digi.com Debugging with Dynamic CWatchdogsTen virtual watchdogs are provided, in addition to the hardware watchdog(s) of the processor. Watchdogs

Página 10

Dynamic C User’s Manual digi.com 1076.4 Where to Look for Debugger FeaturesDebugger features are accessed from several different Dynamic C menus. The

Página 11 - 2. INTRODUCTION TO DYNAMIC C

108 digi.com Debugging with Dynamic C6.4.1 Run and Inspect MenusThe Run and Inspect menus are covered in detail in Section 14.2.5 and Section 14.2.6

Página 12

Dynamic C User’s Manual digi.com 1096.5 Debug StrategiesSince bug-free code is a trade-off with time and money, we know that software has bugsi. This

Página 13

Dynamic C User’s Manual digi.com 11 2. INTRODUCTION TO DYNAMIC CDynamic C is an integrated development system for writing embedded software. It is des

Página 14

110 digi.com Debugging with Dynamic C• Coding Standards: The use of coding standards increases maintainability, portability and re-use of code. In Dy

Página 15 - 3. QUICK TUTORIAL

Dynamic C User’s Manual digi.com 1116.5.2.1 Reproduce the ProblemKeep an open mind. It might not be a bug in the software: you might have a bad cable

Página 16 - 3.1 Run DEMO1.C

112 digi.com Debugging with Dynamic C6.5.2.3 Other Things to TryGet out of your cubicle. It is a well-known fact that there are times when simply wa

Página 17 - 3.1.3 Breakpoint

Dynamic C User’s Manual digi.com 113 7. THE VIRTUAL DRIVERVirtual Driver is the name given to some initialization services and a group of services per

Página 18 - 3.2 Run DEMO2.C

114 digi.com The Virtual Driver7.3 Global Timer VariablesSEC_TIMER, MS_TIMER and TICK_TIMER are global variables defined as shared unsigned long. The

Página 19 - 3.3 Run DEMO3.C

Dynamic C User’s Manual digi.com 1157.3.2 Example: Delay LoopAn important detail about MS_TIMER is that it overflows (“rolls over”) approximately eve

Página 20 - 3.4 Run DEMO4.C

116 digi.com The Virtual Driver7.4 Watchdog TimersWatchdog timers limit the amount of time your system will be in an unknown state. 7.4.1 Hardware W

Página 21 - 3.4.1 Trace Macros

Dynamic C User’s Manual digi.com 1177.5 Preemptive Multitasking DriversA simple scheduler for Dynamic C’s preemptive slice statement is serviced by th

Página 22 - 3.5 Summary of Features

118 digi.com The Virtual Driver

Página 23 - 4. LANGUAGE

Dynamic C User’s Manual digi.com 119 8. RUN-TIME ERRORSCompiled code generated by Dynamic C calls an exception handling routine for run-time errors. T

Página 24 - 4.2 Punctuation Tokens

12 digi.com Introduction to Dynamic C2.2 Dynamic C Enhancements and DifferencesDynamic C differs from a traditional C programming system running on a

Página 25 - 4.3 Data

120 digi.com Run-Time Errors8.1.2 Fatal Error CodesThis table lists the fatal errors generated by Dynamic C.Table 8-2. Dynamic C Fatal ErrorsError

Página 26 - 4.4 Names

Dynamic C User’s Manual digi.com 1218.2 User-Defined Error HandlerDynamic C allows replacement of the default error handler with a custom error handle

Página 27 - 4.5 Macros

122 digi.com Run-Time Errors8.3 Run-Time Error LoggingError logging is available as a BIOS enhancement for storing run-time exception history. It can

Página 28 - 28 digi.com Language

Dynamic C User’s Manual digi.com 1238.3.2 Initialization and DefaultsAn initialization of the error log occurs when the BIOS is compiled, when clonin

Página 29 - 4.6 Numbers

124 digi.com Run-Time Errors8.3.4 Error Logging FunctionsThe run-time error logging API consists of the following functions:8.3.5 Examples of Error

Página 30 - 4.7.1 String Concatenation

Dynamic C User’s Manual digi.com 125 9. MEMORY MANAGEMENTProcessor instructions can specify 16-bit addresses, giving a logical address space of 64K (6

Página 31 - 4.7.2 Character Constants

126 digi.com Memory ManagementIf BIOS code runs from flash memory, the BIOS code starts in the root code section at address 0x00000 and fills upward.

Página 32 - 4.9 Declarations

Dynamic C User’s Manual digi.com 127Inline Assembly in C FunctionsInline assembly code may be written in any C function, regardless of whether it is c

Página 33 - 4.11 Prototypes

128 digi.com Memory Management

Página 34 - 4.12 Type Definitions

Dynamic C User’s Manual digi.com 129 10. FILE SYSTEMSThis chapter describes two separate file systems that can be used on Rabbit-based systems. The fi

Página 35 - 4.13 Aggregate Data Types

Dynamic C User’s Manual digi.com 132.2.2 Dynamic C DifferencesThe main differences in Dynamic C are summarized in the list below and discussed in deta

Página 36 - 4.13.4 Composites

130 digi.com File SystemsIncrease the useful lifetime and performance of the flash by buffering data before writing it to the flash. Accumulating 100

Página 37 - 4.15 Pointers

Dynamic C User’s Manual digi.com 13110.1.1.4 Wear LevelingThe current code has a rudimentary form of wear leveling. When you write into an existing b

Página 38 - 38 digi.com Language

132 digi.com File Systems10.1.2.2 FS2 Configuration MacrosFS_MAX_DEVICESThis macro defines the maximum physical media. If it is not defined in the p

Página 39 - 4.17 Argument Passing

Dynamic C User’s Manual digi.com 133FS2_USE_PROGRAM_FLASHThe number of kilobytes reserved in the first flash for use by FS2. If not defined in an appl

Página 40 - 4.18 Program Flow

134 digi.com File Systems10.1.3 File System API FunctionsThese functions are defined in FS2.LIB. For more information please see the Dynamic C Funct

Página 41 - 4.18.2 Continue and Break

Dynamic C User’s Manual digi.com 13510.1.3.1 FS2 API Error CodesThe library ERRNO.LIB contains a list of all possible error codes returnable by the F

Página 42 - 4.18.3 Branching

136 digi.com File Systems10.1.4.2 Logical Extents (LX)The presence of both “devices” causes an initial default configuration of two logical extents

Página 43

Dynamic C User’s Manual digi.com 13710.1.4.3 Logical Sector Sizefs_setup() can also be used to specify non-default logical sector (LS) sizes and othe

Página 44 - 4.19 Function Chaining

138 digi.com File SystemsTable 10-2. Flash File System Auxiliary FunctionsCommand Descriptionsspec_addfsfileAssociate a name with the flash file sys

Página 45 - sections may be used in

Dynamic C User’s Manual digi.com 13910.1.6 Skeleton Program Using FS2The following program uses some of the FS2 API. It writes several strings into a

Página 46 - 4.21 Libraries

14 digi.com Introduction to Dynamic C2.3 Rabbit and Z180 ComparisonA major difference in the way Dynamic C interacts with a Rabbit-based board compar

Página 47 - 4.23 Modules

140 digi.com File Systems10.2 FAT File SystemDynamic C 8.51 introduced a FAT (File Allocation Table) file system. The small footprint of this well-de

Página 48 - 4.23.1 The Parts of a Module

Dynamic C User’s Manual digi.com 14110.2.1 Overview of FAT DocumentationA sample program is reviewed in Section 10.2.2. Two additional sample program

Página 49 - 4.23.1.3 Module Body

142 digi.com File SystemsThe sample program has been broken into two functional parts for the purpose of discussion. The first part deals with gettin

Página 50 - 4.23.2 Module Sample Code

Dynamic C User’s Manual digi.com 143The first two statements:#define FAT_BLOCK#use "fat.lib" cause the FAT library to be used in blocking mo

Página 51 - 4.23.3 Important Notes

144 digi.com File SystemsLastly, a pointer to a partition structure is declared with the statement:fat_part *first_part;This pointer will be used as

Página 52 - 4.25 Support Files

Dynamic C User’s Manual digi.com 14510.2.2.2 Using the File SystemThe rest of fat_create.c demonstrates how to use the file system once it is up and

Página 53 - ULTITASKING WITH DYNAMIC C

146 digi.com File SystemsThe call to fat_Open() creates a file in the root directory and names it HELLO.TXT. A file must be opened before you can wri

Página 54 - 5.2 A Real-Time Problem

Dynamic C User’s Manual digi.com 147The file is closed to release the file handle to allow it to be used to identify a different file.rc = fat_Close(

Página 55

148 digi.com File Systems10.2.3 More Sample ProgramsThis section studies blocking sample FAT_SHELL.C and non-blocking sample FAT_NB_Costate.c More s

Página 56 - 5.3 Costatements

Dynamic C User’s Manual digi.com 149This shows the HELLO.TXT file that was created using the FAT_CREATE.C sample program. The file length is 15 bytes.

Página 57

Dynamic C User’s Manual digi.com 15 3. QUICK TUTORIALSample programs are provided in the Dynamic C Samples folder, which is in the root directory wher

Página 58 - is encountered

150 digi.com File SystemsTo see what was written, use the “rd” command.10.2.3.2 Non-Blocking SampleTo use the FAT file system in non-blocking mode,

Página 59 - 5.4.1 The CoData Structure

Dynamic C User’s Manual digi.com 151A while loop accomplishes our goal of blocking on the function call until it returns something other than busy.whi

Página 60 - • the costatement is aborted

152 digi.com File SystemsThe next block of code appends the latest entry into the file that was opened at the start of the application.Again, waitfor

Página 61

Dynamic C User’s Manual digi.com 153The outer while loop controls when to stop reading records from the file. After the last record is read, the fat_R

Página 62 - 5.5 Cofunctions

154 digi.com File Systems10.2.4 FAT OperationsThere are some basic groups of operations involved in using the Dynamic C FAT library. These are descr

Página 63 - 5.5.2 Calling Restrictions

Dynamic C User’s Manual digi.com 155tions will be formatted. Be forewarned that on removable media, using multiple partitions will typically make the

Página 64 - 5.5.5 Types of Cofunctions

156 digi.com File Systems10.2.4.2 File and Directory OperationsThe Dynamic C FAT implementation supports the basic set of file and directory operati

Página 65

Dynamic C User’s Manual digi.com 157Remember to check the return code from fat_Close() since an error return code may indicate the loss of data. Once

Página 66

158 digi.com File Systemsfiles on the device and unmount all mounted FAT partitions. Unmounting the device is the safest method for shutting down aft

Página 67 - 5.5.7 Special Code Blocks

Dynamic C User’s Manual digi.com 159 10.2.4.2.4 Creating Files and SubdirectoriesWhile the fat_Open() function is versatile enough to not only open a

Página 68

16 digi.com Quick Tutorial3.1 Run DEMO1.CThis sample program will be used to illustrate some of the functions of Dynamic C. Open the file Samples/DEM

Página 69 - 5.7 Timing Considerations

160 digi.com File Systems 10.2.4.2.5 Reading DirectoriesThe fat_ReadDir() function reads the next directory entry from the specified directory. A dir

Página 70 - 5.9 Slice Statements

Dynamic C User’s Manual digi.com 161But, if you want the next active file and do not care about the file’s other attributes, mode should be (FAT_INC_A

Página 71 - 5.9.5 Slice Internals

162 digi.com File Systems2. If you want the next hidden directory:Start with the FAT_INC_DEF macro default flag. To narrow the search to directories

Página 72

Dynamic C User’s Manual digi.com 16310.2.4.3 Error HandlingMost routines in the FAT library return an int value error code indicating the status of t

Página 73

164 digi.com File Systems10.2.5 More FAT InformationThe FAT file system stores and organizes files on a storage device such as a hard drive or a mem

Página 74 - 5.10 µC/OS-II

Dynamic C User’s Manual digi.com 165Figure 3. High-Level View of an MBR NOTE: Some devices are formatted without an MBR and, therefore, have no parti

Página 75

166 digi.com File SystemsThe FAT type (FAT12 or FAT16) is determined by the count of clusters on the partition. The “12” and “16” refer to the number

Página 76

Dynamic C User’s Manual digi.com 167The memset() function is used to initialize the entry to zero. The values for starthead and endhead should be 0xFE

Página 77 - Figure 5-8 Type 2 ISR

168 digi.com File Systems10.2.5.5 µC/OS-II and FAT CompatibilityVersions of the FAT file system prior to version 2.10 are compatible with µC/OS-II o

Página 78

Dynamic C User’s Manual digi.com 16910.2.5.8 Hot-Swapping an SD CardHot-swapping is currently supported on the RCM3900 and the RCM3910. FAT version 2

Página 79

Dynamic C User’s Manual digi.com 17dialog box must be the same as the one the programming cable is connected to. (The Communications dialog box is acc

Página 80 - Listing 1

170 digi.com File Systems

Página 81

Dynamic C User’s Manual digi.com 171 11. USING ASSEMBLY LANGUAGEThis chapter gives the rules for mixing assembly language with Dynamic C code. A refer

Página 82 - 5.10.3 Library Reentrancy

172 digi.com Using Assembly Language11.1.2 Embedded C SyntaxA C statement may be placed within assembly code by placing a “c” in column 1. Note that

Página 83

Dynamic C User’s Manual digi.com 17311.2 Assembler and PreprocessorThe assembler parses most C language constant expressions. A C language constant ex

Página 84

174 digi.com Using Assembly LanguageIf separate I&D space is enabled, db places bytes in the base segment of the data space when it is used with

Página 85 - Example 1

Dynamic C User’s Manual digi.com 17511.2.3 Multiline MacrosThe Dynamic C preprocessor has a special feature to allow multiline macros in assembly cod

Página 86

176 digi.com Using Assembly Language11.2.6 C VariablesC variable names may be used in assembly language. What a variable name represents (the value

Página 87 - Example 2

Dynamic C User’s Manual digi.com 17711.3 Stand-Alone Assembly CodeA stand-alone assembly function is one that is defined outside the context of a C la

Página 88

178 digi.com Using Assembly Language11.3.2 Example of Stand-Alone Assembly CodeThe stand-alone assembly function foo() can be called from a Dynamic

Página 89 - 5.11 Summary

Dynamic C User’s Manual digi.com 17911.4.1.1 Stack Frame DiagramFigure 11.1 shows the general appearance of a stack frame.Figure 11.1 Assembly Code

Página 90

18 digi.com Quick TutorialStarting with Dynamic C 9, you can also set breakpoints while in edit mode. Breakpoint information is not only retained whe

Página 91 - 6. DEBUGGING WITH DYNAMIC C

180 digi.com Using Assembly Language11.4.2 Embedded Assembly ExampleThe purpose of the following sample program, asm1.c, is to show the different wa

Página 92

Dynamic C User’s Manual digi.com 18111.4.3 The Disassembled Code WindowA program may be debugged at the assembly level by opening the Disassembled Co

Página 93 - 6.3 Debugging Tools

182 digi.com Using Assembly Language11.4.4 Local Variable AccessAccessing static local variables is simple because the symbol evaluates to the addre

Página 94 - 6.3.2 Software Breakpoints

Dynamic C User’s Manual digi.com 183 11.4.4.3 Functions in Extended MemoryIf the xmem keyword is present, Dynamic C compiles the function to extended

Página 95

184 digi.com Using Assembly LanguageThe following code shows how to clear field f1 of a structure (as a returned value) of type struct s.It is crucia

Página 96 - 6.3.3 Single Stepping

Dynamic C User’s Manual digi.com 18511.6 Assembly Calling C A program may call a C function from assembly code. To make this happen, set up part of th

Página 97 - 6.3.4 Watch Expressions

186 digi.com Using Assembly Language11.7 Interrupt Routines in AssemblyInterrupt Service Routines (ISRs) may be written in Dynamic C (declared with t

Página 98 - 6.3.5 Evaluate Expressions

Dynamic C User’s Manual digi.com 18711.7.2 Modifying Interrupt VectorsPrior to Dynamic C 7.30, interrupt vector code could be modified directly. By r

Página 99 - 6.3.6 Memory Dump

188 digi.com Using Assembly LanguageThe following example from RS232.LIB illustrates the new I&D space compatible way of modifying interrupt vect

Página 100 - 6.3.7 MAP File

Dynamic C User’s Manual digi.com 189The following example from RS232.LIB illustrates the new I&D space compatible way of modifying interrupt vecto

Página 101

Dynamic C User’s Manual digi.com 193.3 Run DEMO3.CThe example below, sample program DEMO3.C, uses costatements. A costatement is a way to perform a se

Página 102 - 6.3.8 Execution Trace

190 digi.com Using Assembly LanguageIf separate I&D space is enabled, using the modifiable interrupt vector proxy in RAM adds about 80 clock cycl

Página 103 - 6.3.9 Symbolic Stack Trace

Dynamic C User’s Manual digi.com 191Table 11-5 lists the defined interrupt vector names that may be used with interrupt_vector, along with their ISRs.

Página 104 - General Debug Windows

192 digi.com Using Assembly Language11.8 Common ProblemsIf you have problems with your assembly code, consider the possibility of any of the followin

Página 105 - Error Logging

Dynamic C User’s Manual digi.com 193 12. KEYWORDSA keyword is a reserved word in C that represents a basic C construct. It cannot be used for any othe

Página 106

194 digi.com KeywordsalignUsed in assembly blocks, the align keyword outputs a padding of nops so that the next instruction to be compiled is placed

Página 107

Dynamic C User’s Manual digi.com 195asmUse in Dynamic C code to insert one assembly language instruction. If more than one assembly instruction is des

Página 108 - 6.4.1 Run and Inspect Menus

196 digi.com KeywordsbreakJumps out of a loop, if, or case statement.while( expression ){...if( condition ) break;}switch( expression ){...case 3:...

Página 109 - 6.5 Debug Strategies

Dynamic C User’s Manual digi.com 197charDeclares a variable or array element as an unsigned 8-bit character.char c, x, *string = "hello";int

Página 110 - 6.5.2 Finding the Bug

198 digi.com KeywordsconstThis keyword declares that a value will be stored in flash, thus making it unavailable for modification. const is a type qu

Página 111 - • Interrupt latency

Dynamic C User’s Manual digi.com 199continueSkip to the next iteration of a loop.while( expression ){if( nothing to do ) continue;...}costateIndicates

Página 112

Dynamic C User’s Manual©2011 Digi International® Inc. All rights reserved. Rabbit, Dynamic C, Rabbit 2000, Rabbit 3000, RabbitSys, Digi, Digi Internat

Página 113 - 7. THE VIRTUAL DRIVER

20 digi.com Quick TutorialThe elapsed time message is printed by the costatement starting at the line marked (2). Costatements need to be executed re

Página 114 - 7.3 Global Timer Variables

200 digi.com KeywordsdefaultIdentifies the default case in a switch statement. The default case is optional. It executes only when the switch express

Página 115 - 7.3.2 Example: Delay Loop

Dynamic C User’s Manual digi.com 201enumDefines a list of named integer constants:enum foo {white, // default is 0 for the first itemblack, // will be

Página 116 - 7.4 Watchdog Timers

202 digi.com KeywordsfirsttimeThe keyword firsttime in front of a function body declares the function to have an implicit *CoData parameter as the fi

Página 117

Dynamic C User’s Manual digi.com 203forIndicates the beginning of a for loop. A for loop has an initializing expression, a limiting expression, and a

Página 118

204 digi.com KeywordsifIndicates the beginning of an if statement. if( tank_full ) shut_off_water();if( expression ){statements}else if( expression )

Página 119 - 8. RUN-TIME ERRORS

Dynamic C User’s Manual digi.com 205intDeclares variables, function return values, or array elements to be 16-bit integers. If nothing else is speci-f

Página 120 - 8.1.2 Fatal Error Codes

206 digi.com Keywordsinterrupt_vectorThis keyword, intended for use with separate I&D space, sets up an interrupt vector at compile time. This is

Página 121 - Register Expected Value

Dynamic C User’s Manual digi.com 207interrupt_vector (cont’d)As demonstrated in DC 9.52's standard samples that conditionally use the interrupt_v

Página 122 - 8.3 Run-Time Error Logging

208 digi.com Keywords__lcall__When used in a function definition, the __lcall__ function prefix forces long call and return (lcall and lret) instruct

Página 123

Dynamic C User’s Manual digi.com 209nodebugIndicates a function is not compiled in debug mode. This is the default for assembly blocks.nodebug int fun

Página 124 - 124 digi.com Run-Time Errors

Dynamic C User’s Manual digi.com 213.4.1 Trace MacrosTrace macros provide more fine-grained control than the menu options._TRACEThe _TRACE macro crea

Página 125 - 9. MEMORY MANAGEMENT

210 digi.com KeywordsprotectedAn important feature of Dynamic C is the ability to declare variables as protected. Such a variable is pro-tected again

Página 126 - 9.3 Code Placement in Memory

Dynamic C User’s Manual digi.com 211returnExplicit return from a function. For functions that return values, this will return the function result.void

Página 127 - 9.4 Dynamic Memory Allocation

212 digi.com KeywordssegchainIdentifies a function chain segment (within a function).int func ( int arg ){...int vec[10];...segchain _GLOBAL_INIT{for

Página 128

Dynamic C User’s Manual digi.com 213shortDeclares that a variable or array is short integer (16 bits). If nothing else is specified, short implies a 1

Página 129 - 10. FILE SYSTEMS

214 digi.com KeywordsstaticDeclares a local variable to have a permanent fixed location in memory, as opposed to auto, where the variable exists on t

Página 130 - 130 digi.com File Systems

Dynamic C User’s Manual digi.com 215switchIndicates the start of a switch statement.switch( expression ){case const1:...break;case const2:...break;cas

Página 131 - • which drivers to use

216 digi.com KeywordsunionIdentifies a variable that can contain objects of different types and sizes at different times. Items in a union have the s

Página 132 - 132 digi.com File Systems

Dynamic C User’s Manual digi.com 217voidThis keyword conforms to ANSI C. Thus, it can be used in three different ways.1. Parameter List - used to iden

Página 133 - XMEM_RESERVE_SIZE

218 digi.com Keywordswaitfordone(wfd)The waitfordone keyword can be abbreviated as wfd. It is part of Dynamic C’s cooperative multitask-ing construct

Página 134 - Command Description

Dynamic C User’s Manual digi.com 219xdataDeclares a block of data in extended flash memory.xdata name { value_1, ... value_n };The 20-bit physical add

Página 135

22 digi.com Quick Tutorial3.5 Summary of FeaturesThis chapter provided a quick look at the interface of Dynamic C and some of the powerful options av

Página 136 - Further Partitioning

220 digi.com KeywordsxmemIndicates that a function is to be placed in extended memory. This keyword is semantically meaningful in function prototypes

Página 137 - 10.1.5 File Identifiers

Dynamic C User’s Manual digi.com 221yieldUsed in a costatement, this keyword causes the costatement to pause temporarily, allowing other costate-ments

Página 138

222 digi.com Keywords12.1 Compiler DirectivesCompiler directives are special keywords prefixed with the symbol #. They tell the compiler how to pro-c

Página 139

Dynamic C User’s Manual digi.com 223#debug#nodebugEnables or disables debug code compilation. #debug is the default condition. A function's local

Página 140 - 10.2 FAT File System

224 digi.com Keywords#GLOBAL_INIT Syntax: #GLOBAL_INIT { variables }#GLOBAL_INIT sections are blocks of code that are run once before main() is calle

Página 141

Dynamic C User’s Manual digi.com 225#if#elif#else#endifSyntax: #if constant_expression #elif constant_expression#else#endifThese directives control co

Página 142 - 142 digi.com File Systems

226 digi.com Keywords#ifndefSyntax: #ifndef name This directive enables code compilation if name has not been defined with a #define directive. This

Página 143 - FAT Version Device Driver

Dynamic C User’s Manual digi.com 227#memmapSyntax: #memmap optionsControls the default memory area for functions. The following options are available.

Página 144 - 144 digi.com File Systems

228 digi.com Keywords#precompileAllows library functions in a comma separated list to be compiled immediately after the BIOS.The #precompile directiv

Página 145

Dynamic C User’s Manual digi.com 229#useix#nouseixControls whether functions use the IX register as a stack frame reference pointer or the SP (stack p

Página 146 - 146 digi.com File Systems

Dynamic C User’s Manual digi.com 23 4. LANGUAGEDynamic C is based on the C language. The programmer is expected to know programming methodologies and

Página 147

230 digi.com Keywords#zimportSyntax: #zimport “filename” symbolThis compiler directive extends the functionality of #ximport to include file compress

Página 148 - 10.2.3 More Sample Programs

Dynamic C User’s Manual digi.com 231 13. OPERATORSAn operator is a symbol such as +, –, or & that expresses some kind of operation on data. Most o

Página 149 - - system a - archive

232 digi.com OperatorsCertain operators, namely *, &, (), [], -> and . (dot), can be used on the left side of an assign-ment to construct what

Página 150 - 150 digi.com File Systems

Dynamic C User’s Manual digi.com 233Indirection, or multiplication. As a unary operator, it indicates indirection. When used in a declaration, * indic

Página 151

234 digi.com OperatorsPre- or post-increment is a unary operator designed primarily for convenience. If the ++ precedes an oper-and, the operand is i

Página 152 - 152 digi.com File Systems

Dynamic C User’s Manual digi.com 23513.2 Assignment OperatorsAssignment. This binary operator causes the value of the right operand to be assigned to

Página 153

236 digi.com OperatorsRight shift assignment.a >>= 5; // Shift a right 5 bits. Same as a = a >> 5Bitwise AND assignment.a &= b

Página 154 - 154 digi.com File Systems

Dynamic C User’s Manual digi.com 237Address operator, or bitwise AND. As a unary operator, this provides the address of a variable:int x;z = &x; /

Página 155

238 digi.com Operators13.4 Relational OperatorsLess than. This binary (relational) operator yields a Boolean value. The result is 1 if the left opera

Página 156 - DIR1\\FILE.EXT

Dynamic C User’s Manual digi.com 23913.5 Equality OperatorsEqual. This binary (relational) operator yields a Boolean value. The result is 1 if the lef

Página 157

24 digi.com Language4.2 Punctuation TokensPunctuation serves as boundaries in C programs. Table 4-2 lists the punctuation tokens.Table 4-2. Punctuat

Página 158 - 158 digi.com File Systems

240 digi.com OperatorsLogical NOT. This is a unary operator. Observe that C does not provide a Boolean data type. In C, logical false is equivalent t

Página 159

Dynamic C User’s Manual digi.com 241Right arrow. Used with pointers to structures and unions, instead of the dot operator.typedef struct{int x;int y;}

Página 160 - 160 digi.com File Systems

242 digi.com OperatorsBeware of using uninitialized pointers. Also, the indirection operator can be used in complex ways.int *list[10] // array of 10

Página 161

Dynamic C User’s Manual digi.com 24313.10 Other OperatorsThe cast operator converts one data type to another. A floating-point value is truncated when

Página 162 - "DIR/FILE.TXT");

244 digi.com OperatorsComma operator. This operator, unique to the C language, is a convenience. It takes two operands: the left operand—typically an

Página 163

Dynamic C User’s Manual digi.com 245 14. GRAPHICAL USER INTERFACEDynamic C can be used to edit source files, compile and run programs, and choose opti

Página 164 - 10.2.5 More FAT Information

246 digi.com Graphical User InterfaceThe Ctrl key works in conjunction with the arrow keys:The Ctrl key also works in conjunction with “[” for delimi

Página 165 - Master Boot Record (MBR)

Dynamic C User’s Manual digi.com 24714.2.2 File MenuTo select the File menu: click on its name in Dynamic C’s main menu or press <Alt+F>.New &l

Página 166 - 10.2.5.3.4 Data Area

248 digi.com Graphical User InterfacePrint SetupDisplays the Page Setup dialog box. Margins, page orientation, page numbers and header and footer pro

Página 167

Dynamic C User’s Manual digi.com 24914.2.3 Edit MenuClick the menu title or press <Alt+E> to select the EDIT menu.Undo <Ctrl+Z>This optio

Página 168 - • Use FAT version 2.10

Dynamic C User’s Manual digi.com 254.3 DataData (variables and constants) have type, size, structure, and storage class. Basic (a.k.a., primitive) dat

Página 169

250 digi.com Graphical User InterfaceFind <Ctrl F>Finds first occurrence of specified text. Text may be specified by selecting it prior to open

Página 170 - 170 digi.com File Systems

Dynamic C User’s Manual digi.com 251Find in Files (Grep)... <Shift+Ctrl+F>This option searches for text in the currently open file(s) or in any

Página 171 - 11. USING ASSEMBLY LANGUAGE

252 digi.com Graphical User InterfaceEditor Window Popup MenuRight click anywhere in the editor window and a popup menu will appear. All of the menu

Página 172 - 11.1.2 Embedded C Syntax

Dynamic C User’s Manual digi.com 25314.2.4 Compile MenuClick the menu title or press <Alt+C> to select the Compile menu. Compile <F5>Comp

Página 173 - 11.2.2 Defining Constants

254 digi.com Graphical User InterfaceCompile to .bin FileCompiles a program and writes the image to a .bin file. There are two choices available with

Página 174

Dynamic C User’s Manual digi.com 25514.2.5 Run MenuClick the menu title or press <Alt+R> to select the RUN menu.Run <F9>Starts program ex

Página 175 - 11.2.5 Special Symbols

256 digi.com Graphical User InterfaceToggle Hard Breakpoint <Alt+F2>Toggles a hard breakpoint at the current cursor location. A hard breakpoint

Página 176 - 11.2.6 C Variables

Dynamic C User’s Manual digi.com 25714.2.6 Inspect MenuClick the menu title or press <Alt+I> to open the Inspect menu.The Inspect menu provide

Página 177

258 digi.com Graphical User InterfaceDelete Watch Removes highlighted entry from the Watches window. Delete All WatchesRemoves all entries from the W

Página 178 - 11.4 Embedded Assembly Code

Dynamic C User’s Manual digi.com 259memory location 0x0022, which has a value of 0xFF. This information is given in the fly-over text and also in the

Página 179 - Stack Frame

26 digi.com Language4.4 NamesNames identify variables, certain constants, arrays, structures, unions, functions, and abstract data types. Names must

Página 180

260 digi.com Graphical User InterfaceStop Execution Tracing <Ctrl+Alt+T>This command causes the target to stop sending trace information to Dyn

Página 181

Dynamic C User’s Manual digi.com 26114.2.7 Options MenuClick the Options menu title or press <Alt+O> to select the Options menu.Environment Opt

Página 182 - 11.4.4 Local Variable Access

262 digi.com Graphical User InterfaceUse previous indentionUses the same characters for indentation that were used for the last indentation. If the l

Página 183 - 11.5 C Calling Assembly

Dynamic C User’s Manual digi.com 263Double click lineCheck this option to allow an entire line to be selected when you double click at any position in

Página 184

264 digi.com Graphical User Interfacetabs. E.g., if the list consists of “3,6,12” the first tab stop is 3 spaces, the second tab stop is 3 more space

Página 185 - 11.6 Assembly Calling C

Dynamic C User’s Manual digi.com 265Editor gutterCheck the Visible box to create a gutter in the far left side of the text window. Use the Width scrol

Página 186

266 digi.com Graphical User InterfaceDisplay TabClick on the Display tab to display the following dialog.Editor FontThis area of the dialog box is fo

Página 187 - EXT0_OFS

Dynamic C User’s Manual digi.com 267Foreground Color (non-syntax)If syntax highlighting is not used, the color selected here will be the foreground co

Página 188

268 digi.com Graphical User Interfacewithout saving the changes, the colors will go back to whatever they were before you opened the .rgb file.Code T

Página 189

Dynamic C User’s Manual digi.com 269Debug Windows TabClick on the Debug Windows tab to display the following dialog. Here is where you change the beha

Página 190

Dynamic C User’s Manual digi.com 274.5 MacrosMacros may be defined in Dynamic C by using #define. A macro is a name replacement feature. Dynamic C has

Página 191

270 digi.com Graphical User InterfaceAutomatic open Check this to open the Stdio window the first time printf() is encountered.Automatic Vertical Scr

Página 192 - 11.8 Common Problems

Dynamic C User’s Manual digi.com 271Assembly WindowThe Assembly window displays the disassembled code from the program just compiled. All but the opco

Página 193 - 12. KEYWORDS

272 digi.com Graphical User InterfaceShow File Name in Source LineCheck this to prepend the file name to the Dynamic C statements corresponding to th

Página 194 - 194 digi.com Keywords

Dynamic C User’s Manual digi.com 273Show registers as editableIn this mode, you can increment or decrement most of the registers, all but the SP, PC a

Página 195

274 digi.com Graphical User InterfaceMemory Dump WindowFor more information on using the Memory Dump window go to the section titled, Dump at Address

Página 196 - 196 digi.com Keywords

Dynamic C User’s Manual digi.com 275Segmented Dump RangeThe memory dump window can display 3 different types of dumps. A dump of a logi-cal address wi

Página 197

276 digi.com Graphical User InterfacePrint/Alerts TabClick on the Print/Alerts tab to display the following dialog. You may access both the Page Setu

Página 198 - Example 5:

Dynamic C User’s Manual digi.com 277that Dynamic C is working with the most current version. The last checkbox, if checked, causes Dynamic C to query

Página 199

278 digi.com Graphical User InterfaceSerial OptionsThis is where you setup for serial communication. The following options are available when the Use

Página 200 - 200 digi.com Keywords

Dynamic C User’s Manual digi.com 279TCP/IP OptionsTo program and debug a controller across a TCP/IP connection, the Network Address field must have th

Página 201

28 digi.com Language4.5.2 Nested Macro DefinitionsGenerally speaking, Dynamic C expands macro calls recursively until they can expand no more. Anoth

Página 202 - 202 digi.com Keywords

280 digi.com Graphical User InterfaceRun-Time CheckingThese options, if checked, can allow a fatal error at run time. They also increase the amount o

Página 203

Dynamic C User’s Manual digi.com 281Optimize ForAllows for optimization of the program for size or speed. When the compiler knows more than one sequen

Página 204 - 204 digi.com Keywords

282 digi.com Graphical User InterfaceSeparate Instruction and Data SpaceWhen checked, this option enables separate I&D space, doubling the amount

Página 205

Dynamic C User’s Manual digi.com 283User Defined BIOS File Use this option to change from the default BIOS to a user-specified file. Enter or select t

Página 206 - 206 digi.com Keywords

284 digi.com Graphical User InterfaceDebug Instructions and BIOS InclusionInclude RST 28 instructionsIf this is checked, the debug and nodebug keywor

Página 207

Dynamic C User’s Manual digi.com 285Debugger TabClick on the Debugger tab to display the following dialog. This is where you enable/disable debugging

Página 208 - __lcall__

286 digi.com Graphical User InterfaceEnable breakpointsIf this box is checked, the debug kernel will be able to toggle breakpoints on and off and wil

Página 209

Dynamic C User’s Manual digi.com 287Enable execution tracingIf this is checked, the target will send trace information back to Dynamic C when you turn

Página 210 - 210 digi.com Keywords

288 digi.com Graphical User InterfaceDefines TabThe Defines tab brings up a dialog box with a window for entering (or modifying) a list of defines th

Página 211

Dynamic C User’s Manual digi.com 289Examples and File Equivalents:Example:DEF1;MAXN=10;DEF2Equivalent:#define DEF1#define MAXN 10#define DEF2Example:D

Página 212 - 212 digi.com Keywords

Dynamic C User’s Manual digi.com 294.5.3 Macro RestrictionsThe number of arguments in a macro call must match the number of parameters in the macro d

Página 213

290 digi.com Graphical User InterfaceTargetless TabClick on the Targetless tab to reveal three additional tabs: RTI File, Specify Parameters and Boar

Página 214 - 214 digi.com Keywords

Dynamic C User’s Manual digi.com 291The term “Primary Flash” refers to the Flash device connected to /CS0, not the total amount of Flash available on

Página 215

292 digi.com Graphical User InterfaceToolbarsSelecting this menu item reveals a list of all menu button groups, i.e., the groups of icons that appear

Página 216 - 216 digi.com Keywords

Dynamic C User’s Manual digi.com 29314.2.8 Window MenuClick the menu title or press <Alt+W> to display the Window menu.You can choose to minimi

Página 217

294 digi.com Graphical User InterfaceStdioSelect this option to activate or deactivate the Stdio window. The Stdio window displays output from calls

Página 218 - 218 digi.com Keywords

Dynamic C User’s Manual digi.com 295highlighted with the mouse. The total assumes one execution per instruction, so the user must take looping and bra

Página 219

296 digi.com Graphical User InterfaceStack (F12)Select this option to activate or deactivate the Stack window. The Stack window displays the top 32 b

Página 220 - 220 digi.com Keywords

Dynamic C User’s Manual digi.com 297Debugger tab of the Project Options dialog, which allows saving the Trace window to a file upon program terminatio

Página 221

298 digi.com Graphical User InterfaceNote that some of the memory areas described here may be non-contiguous (e.g., 2 Flash compiles and the XMEM cod

Página 222 - 12.1 Compiler Directives

Dynamic C User’s Manual digi.com 29914.2.9 Help MenuClick the menu title or press <Alt+H> to select the HELP menu. The choices are given below:

Página 223 - #nodebug

Dynamic C User’s Manual digi.com 3Table of Contents 1. Installing Dynamic C ... 91.1 Requirements ...

Página 224 - #funcchain

30 digi.com Language4.7 Strings and Character DataA string is a group of characters enclosed in double quotes (""). "Press any key w

Página 225

300 digi.com Graphical User InterfaceIf the cursor is on a function when Help | Function Lookup is selected (or when <Ctrl+H> is pressed) then

Página 226 - #makechain

Dynamic C User’s Manual digi.com 301Instruction Set Reference <Alt+F1>Invokes an on-line help system and displays the alphabetical list of instr

Página 227

302 digi.com Graphical User Interface

Página 228 - #precompile

Dynamic C User’s Manual digi.com 303 15. COMMAND LINE INTERFACEThe Dynamic C command line compiler (dccl_cmp.exe) performs the same compilation and p

Página 229 - #ximport

304 digi.com Command Line Interface15.3 Saving Output to a FileThe output consists of all program printf’s as well as all error and warning messages.

Página 230 - #zimport

Dynamic C User’s Manual digi.com 305-h+ -h- -id+-id- -ini Description: Print program header information. Factory Default: No header information will b

Página 231 - 13. OPERATORS

306 digi.com Command Line Interface-lf- -mf-mfr-mrDescription: Generates inline code for WrPortI(), RdPortI(), BitWrPortI() and BitRdPortI() if all a

Página 232 - 13.1 Arithmetic Operators

Dynamic C User’s Manual digi.com 307-n-r-rb+-rb- -rd+ Description: Null compile for errors and warnings without running the program. The program will

Página 233

308 digi.com Command Line Interface-rd--ri+ -ri- -rp+-rp-Description: Do not include debug code when compiling to a file. This option is ignored if

Página 234 - 234 digi.com Operators

Dynamic C User’s Manual digi.com 309-rw+-rw- -sp-sz-td+Description: Restrict watch expressions—may save root code space.Factory Default: Allow any exp

Página 235 - 13.2 Assignment Operators

Dynamic C User’s Manual digi.com 314.7.2 Character ConstantsCharacter constants have a slightly different meaning. They are not strings. A character

Página 236 - 13.3 Bitwise Operators

310 digi.com Command Line Interface-td--tp+ -tp--tt+-tt- Description: Disable type demotion checking. Factory Default: Type demotion checking is perf

Página 237

Dynamic C User’s Manual digi.com 311-vp+ -vp--wa-wn-wsDescription: Verify the processor by enabling a DSR check. This should be disabled if a check of

Página 238 - 13.4 Relational Operators

312 digi.com Command Line Interface15.4.2 Switches Requiring a ParameterThe following switches require one or more parameters.-bf BIOSFilePathname-c

Página 239 - 13.6 Logical Operators

Dynamic C User’s Manual digi.com 313-d MacroDefinitionDescription: Define macros and optionally equate to values. The following rules apply and are sh

Página 240 - 13.7 Postfix Expressions

314 digi.com Command Line Interface-d- MacroToUndefine-eto EthernetResponseTimeout-i InputsFilePathnameDescription: Undefines a macro that might have

Página 241

Dynamic C User’s Manual digi.com 315-lf LibrariesFilePathname-ne maxNumberOfErrors-nw maxNumberOfWarningsDescription: Compile using a file found in Li

Página 242 - 13.9 Conditional Operators

316 digi.com Command Line Interface-o OutputFilePathname-oa OutputFilePathname-pbf PilotBIOSFilePathnameDescription: Write header information (if spe

Página 243 - 13.10 Other Operators

Dynamic C User’s Manual digi.com 317-pf projectFilePathname-pw TCPPassPhrase-ret Retries Description: Specify a project file to read before the comman

Página 244 - 244 digi.com Operators

318 digi.com Command Line Interface-rf RTIFilePathname-rti BoardID:CpuID:CrystalSpeed:RAMSize:FlashSizeDescription: Compile to a .bin file using targ

Página 245 - 14. GRAPHICAL USER INTERFACE

Dynamic C User’s Manual digi.com 319-s Port:Baud:Stopbits-sto SerialResponseTimeout Description: Use serial transmission with parameters defined in a

Página 246 - 14.2 Menus

32 digi.com Language4.8 StatementsExcept for comments, everything in a C program is a statement. Almost all statements end with a semico-lon. A C pro

Página 247 - 14.2.2 File Menu

320 digi.com Command Line Interface-t NetAddress:TcpName:TcpPort15.5 ExamplesThe following examples illustrate using multiple command line switches a

Página 248 - <Alt+F4>

Dynamic C User’s Manual digi.com 321Example 3These examples will compile and run myProgram.c with the current settings in default.dcp but using differ

Página 249 - 14.2.3 Edit Menu

322 digi.com Command Line Interface-d-fi Flash.ini PathName -pb PilotBiosPathName -pwDescription: Run Ethernet discovery to find RabbitLink or Rabbit

Página 250

Dynamic C User’s Manual digi.com 323-s port:baudrate-t ipAddress:tcpPort-v-vp+ Description: Select the comm port and baud rate for the serial connecti

Página 251 - <F4>

324 digi.com Command Line Interface-vp- -usb+ -usb-Description: Do not verify the presence of the processor.Default: The processor is verified.RFU GU

Página 252 - <Ctrl+Enter>

Dynamic C User’s Manual digi.com 325 16. PROJECT FILESIn Dynamic C, a project is an environment that consists of opened source files, a BIOS file, ava

Página 253 - • Compile to RAM

326 digi.com Project FilesThe active project file name, without path or extension, is always shown in the leftmost panel of the status bar at the bot

Página 254 - BIOS Memory

Dynamic C User’s Manual digi.com 32716.4 Command Line UsageWhen using the command line compiler, dccl_cmp.exe, a project file is always read. The defa

Página 255 - 14.2.5 Run Menu

328 digi.com Project Files

Página 256

Dynamic C User’s Manual digi.com 329 17. HINTS AND TIPSThis chapter offers hints on how to speed up an application and how to store persistent data at

Página 257 - 14.2.6 Inspect Menu

Dynamic C User’s Manual digi.com 334.10 FunctionsThe basic unit of a C application program is a function. Most functions accept parameters (a.k.a., ar

Página 258

330 digi.com Hints and TipsThe suggested method to use with Dynamic C 9.30 or later involves editing the file RABBITBIOS.C to include the user-define

Página 259

Dynamic C User’s Manual digi.com 331If programs are executing on the target controller with the debugging instructions present, but without Dynamic C

Página 260 - <Ctrl+E>

332 digi.com Hints and Tips• Battery-Backed RAM - Storing data here is as easy as assigning values to global variables or local static variables. The

Página 261 - 14.2.7 Options Menu

Dynamic C User’s Manual digi.com 33317.4 Root Memory Reduction TipsCustomers with programs that are near the limits of root code and/or root data spac

Página 262 - Show line numbers on gutter

334 digi.com Hints and Tips• Reduce usage of root constants and string literalsShortening literal strings and reusing them will save root space. The

Página 263 - Ctrl+k+u>

Dynamic C User’s Manual digi.com 335• Place assembly language code into xmemPure assembly language code functions can go into xmem.#asm foo_root:: [

Página 264

336 digi.com Hints and Tips

Página 265

Dynamic C User’s Manual digi.com 337APPENDIX A. MACROS AND GLOBALVARIABLESThis appendix contains descriptions of macros and global variables availabl

Página 266 - Usemonofont for

338 digi.com __DynamicC__This macro identifies the Dynamic C compiler, e.g:#ifdef __DynamicC__ // conditional code goes here#endifmay be used in a

Página 267 - Text attribues

Dynamic C User’s Manual digi.com 339_TARGETLESS_COMPILE_ Boolean value. It defaults to 0. Set it by selecting “Compile defined target configuration to

Página 268

34 digi.com Language4.12 Type DefinitionsBoth types and variables may be defined. One virtue of high-level languages such as C and Pascal is that abs

Página 269

340 digi.com A.2 Macros Defined in the BIOS or Configuration Libraries This is not a comprehensive list of configuration macros, but rather, a short

Página 270

Dynamic C User’s Manual digi.com 341A.3 Global VariablesThese variables may be read by any Dynamic C application program.dc_timestampThis internally-d

Página 271

342 digi.com A.4 Exception TypesThese macros are defined in errors.lib: A.5 Rabbit RegistersMacros are defined for all of the Rabbit registers that a

Página 272 - Show register history

Dynamic C User’s Manual digi.com 343APPENDIX B. MAP FILE GENERATIONAll symbol information is put into a single file. The map file has three sections:

Página 274

Dynamic C User’s Manual digi.com 345APPENDIX C. SECURITY SOFTWARE & UTILITYPROGRAMSThis appendix documents the security software and utility prog

Página 275 - Segmented Dump Range

346 digi.com C.2 Dynamic C UtilitiesThere are several utilities bundled with Dynamic C. C.2.1 Library File EncryptionThe Library File Encryption Util

Página 276

Dynamic C User’s Manual digi.com 347C.2.1.2 File ExtensionEncrypted files will be saved with the same pathname but with the extension supplied. Dynami

Página 277

348 digi.com C.2.2.2 File Compression/Decompression APIThe file compression API consists of 7 functions, 3 of which are of prime importance:OpenInput

Página 278

Dynamic C User’s Manual digi.com 349The compression utility must reside in the same directory as the Dynamic C compiler executable. Dynamic C expects

Página 279 - Network Address field

Dynamic C User’s Manual digi.com 35The program above calculates the sum of squares of two numbers, g and h, which are initialized to 10 and 12, respec

Página 280

350 digi.com The necessary files are included with Dynamic C. They are: the executable (Rfu.exe), the cold loader, the pilot BIOS, and a file used to

Página 281

Dynamic C User’s Manual digi.com 351-t ipAddress:tcpPort-v-cl ColdLoaderPathName -pb PilotBiosPathName Description: Select the IP address and port.Def

Página 282

352 digi.com -fi Flash.ini PathName -vp+ -vp- -usb+ Description: Select a new file that Dynamic C will use to externally define flash.Default: fl

Página 283

Dynamic C User’s Manual digi.com 353 -usb--dDescription: Disable use of USB to serial converter.Default: The use of the USB to serial converter is dis

Página 284

354 digi.com

Página 285

Dynamic C User’s Manual digi.com 355APPENDIX D. ADDITIONAL DOCUMENTATIONThere is a suite of documentation available for the Dynamic C user. Numerous

Página 286

356 digi.com

Página 287

Dynamic C User’s Manual digi.com 357IndexSymbols_GLOBAL_INIT ... 212{ } curly braces ...

Página 288

358 digi.com IndexBIOS ...14_xexit ...

Página 289

Dynamic C User’s Manual digi.com 359#ifdef ... 225#ifndef ...

Página 290

36 digi.com Language4.13.2 StructureVariables may be grouped together in structures (struct in C) or in arrays. Structures may be nested.Structure m

Página 291

360 digi.com Indexdifferences ...12, 44exit ...

Página 292 - Default Toolbars

Dynamic C User’s Manual digi.com 361anymem ... 194debug ...

Página 293 - 14.2.8 Window Menu

362 digi.com IndexStop ...255<F10>Assembly window ...293&

Página 294

Dynamic C User’s Manual digi.com 363main function ... 33, 46, 208, 331map file ...

Página 295

364 digi.com Indexin assembly ...173logical operators ...

Página 296 - (Alt+ F12)

Dynamic C User’s Manual digi.com 365static variables ... 127variable address ...

Página 297 - (Ctrl+T)

366 digi.com IndexTICK_TIMER ...114, 341tiling windows ...

Página 298

Dynamic C User’s Manual digi.com 374.14 Storage ClassesVariable storage can be auto or static. The term “static” means the data occupies a permanent f

Página 299 - 14.2.9 Help Menu

38 digi.com LanguageIt is possible to do pointer arithmetic, but this is slightly different from ordinary integer arithmetic. Here are some examples.

Página 300 - <Ctrl+H> is pressed)

Dynamic C User’s Manual digi.com 39You can pass arguments to functions that are called indirectly by pointers, but the compiler will not check them fo

Página 301

4 digi.com Table of Contents5.6 Patterns of Cooperative Multitasking ...685.7 Timing Considerations ...695.7.1 waitfo

Página 302

40 digi.com Language4.18 Program FlowThree terms describe the flow of execution of a C program: sequencing, branching and looping. Sequenc-ing is sim

Página 303 - 15. COMMAND LINE INTERFACE

Dynamic C User’s Manual digi.com 41Here, there is no initial condition, no end condition, and no stepping expression. The loop body (some statement(s)

Página 304 - 15.4 Command Line Switches

42 digi.com Language4.18.3 BranchingThe goto statement is the simplest form of a branching statement. Coupled with a statement label, it sim-ply tra

Página 305

Dynamic C User’s Manual digi.com 43The switch statement, the most complex branching statement, allows the programmer to phrase a “mul-tiple choice” br

Página 306

44 digi.com Language4.19 Function ChainingFunction chaining allows special segments of code to be distributed in one or more functions. When a named

Página 307

Dynamic C User’s Manual digi.com 454.20 Global InitializationVarious hardware devices in a system need to be initialized, not only by setting variable

Página 308

46 digi.com Language4.21 LibrariesDynamic C includes many libraries—files of useful functions in source code form. They are located in the \LIB direc

Página 309

Dynamic C User’s Manual digi.com 474.21.1 LIB.DIRAny library that is to be #use’d in a Dynamic C program must be listed in the file LIB.DIR, or anoth

Página 310

48 digi.com Language4.23.1 The Parts of a ModuleA module has three parts: the key, the header, and the body. The structure of a module is:A module b

Página 311

Dynamic C User’s Manual digi.com 49Using compiler directives like #class or #memmap inside module headers is inadvisable. If it is impor-tant to set,

Página 312 - \Bios\RabbitBios.c

Dynamic C User’s Manual digi.com 511.3 Stand-Alone Assembly Code ... 17711.3.1 Stand-Alone Assembly Code in Extended Memory ...

Página 313 - -d MacroDefinition

50 digi.com Language4.23.2 Module Sample CodeThere are many examples of modules in the Lib directory of Dynamic C. The following code will illus-tra

Página 314 - -i InputsFilePathname

Dynamic C User’s Manual digi.com 51Let’s say the above file is named mylibrary.lib. If an application has the statement #use “mylibrary.lib” and then

Página 315 - -nw maxNumberOfWarnings

52 digi.com Language4.24 Function Description HeadersEach user-callable function in a Dynamic C library has a descriptive header preceding the functi

Página 316 - -pbf PilotBIOSFilePathname

Dynamic C User’s Manual digi.com 53 5. MULTITASKING WITH DYNAMIC CIn a multitasking environment, more than one task (each representing a sequence of o

Página 317 - -ret Retries

54 digi.com Multitasking with Dynamic CState machines can become quite complicated, involving a large number of state variables and a large number of

Página 318 - -rf RTIFilePathname

Dynamic C User’s Manual digi.com 555.2.1 Solving the Real-Time Problem with a State Machine Here is what a state machine solution might look like.If

Página 319 - -sto SerialResponseTimeout

56 digi.com Multitasking with Dynamic C5.3 CostatementsCostatements are Dynamic C extensions to the C language which simplify implementation of state

Página 320 - 15.5 Examples

Dynamic C User’s Manual digi.com 575.3.2 Costatement SyntaxThe keyword costate identifies the statements enclosed in the curly braces that follow as

Página 321 - 15.6 Command Line RFU

58 digi.com Multitasking with Dynamic CFigure 5-2 Execution thread when waitfor evaluates to falseFigure 5-3 shows the execution thread through a co

Página 322 - -pb PilotBiosPathName

Dynamic C User’s Manual digi.com 59abortThe abort statement causes the costatement or cofunction to terminate execution. If a costatement is always_

Página 323 - -t ipAddress:tcpPort

6 digi.com Table of Contents/...233++...

Página 324

60 digi.com Multitasking with Dynamic C5.4.2 CoData FieldsThis section describes the fields of the CoData structure.CSStateThe CSState field contain

Página 325 - 16. PROJECT FILES

Dynamic C User’s Manual digi.com 61ContentThe content field (a union) is used by the costatement or cofunction delay routines to store a delay count.C

Página 326 - 16.3 Menu Selections

62 digi.com Multitasking with Dynamic C5.4.5 Firsttime FunctionsIn a function definition, the keyword firsttime causes the function to have an impli

Página 327 - 16.4 Command Line Usage

Dynamic C User’s Manual digi.com 63typeWhichever keyword (cofunc or scofunc) is used is followed by the data type returned (void, int, etc.).nameA nam

Página 328 - 328 digi.com Project Files

64 digi.com Multitasking with Dynamic C 5.5.2.1 Costate Within a CofuncIn all but trivial cases (where the costate is really not necessary), a costat

Página 329 - 17. HINTS AND TIPS

Dynamic C User’s Manual digi.com 65The indexed cofunction call is a cross between an array access and a normal function call, where the array access s

Página 330 - 17.2 Efficiency

66 digi.com Multitasking with Dynamic CExample5.5.6 Types of Cofunction CallsA wfd statement makes one of three types of calls to a cofunction. 5.5.

Página 331 - 17.3 Run-time Storage of Data

Dynamic C User’s Manual digi.com 675.5.7 Special Code BlocksThe following special code blocks can appear inside a cofunction.everytime { statements }

Página 332 - 17.3.4 Battery-Backed RAM

68 digi.com Multitasking with Dynamic C5.5.8 Solving the Real-Time Problem with CofunctionsCofunctions, with their ability to receive arguments and

Página 333 - • Increase DATAORG

Dynamic C User’s Manual digi.com 695.7 Timing ConsiderationsIn most instances, costatements and cofunctions are grouped as periodically executed tasks

Página 334 - 334 digi.com Hints and Tips

Dynamic C User’s Manual digi.com 7Global Variables ... 341Exception Types ...

Página 335 - • Decrease DATAORG

70 digi.com Multitasking with Dynamic C5.8 Overview of Preemptive MultitaskingIn a preemptive multitasking environment, tasks do not voluntarily reli

Página 336 - 336 digi.com Hints and Tips

Dynamic C User’s Manual digi.com 715.9.3 RestrictionsSince a slice statement has its own stack, local auto variables and parameters cannot be accesse

Página 337 - VARIABLES

72 digi.com Multitasking with Dynamic C 5.9.5.1 Example 1Two slice statements and a costatement will appear to run in parallel. Each block will run i

Página 338 - 338 digi.com

Dynamic C User’s Manual digi.com 73 5.9.5.3 Example 3This approach is more complicated, but will allow you to spend the idle time doing a low-priority

Página 339

74 digi.com Multitasking with Dynamic C5.10 µC/OS-IIµC/OS-II is a simple, clean, efficient, easy-to-use real-time operating system that runs on the R

Página 340 - USE_2NDFLASH_CODE

Dynamic C User’s Manual digi.com 75#define OS_TICKS_PER_SEC 32... OSInit();... OSStart();5.10.1.2 Task CreationIn a µC/OS-II application, stacks are

Página 341 - A.3 Global Variables

76 digi.com Multitasking with Dynamic CIf an application uses OSTaskCreateExt, which enables stack checking and allows an extension of the Task Contr

Página 342 - A.5 Rabbit Registers

Dynamic C User’s Manual digi.com 77Figure 5-7 Type 1 ISRIf, however, an ISR needs to signal a task to the ready state, then the ISR must be tasking a

Página 343 - B.1 Grammar

78 digi.com Multitasking with Dynamic CFigure 5-9 Type 2 ISR Nested Inside Type 3 ISRAs can be seen here, although the ISR for interrupt Z does not

Página 344 - 344 digi.com

Dynamic C User’s Manual digi.com 79Figure 5-10 Logical Flow of a TA-ISRSave registers used by TA-ISRReenable interrupts (optional)Do work necessary f

Página 345 - PROGRAMS

8 digi.com Table of Contents

Página 346 - C.2 Dynamic C Utilities

80 digi.com Multitasking with Dynamic C 5.10.2.3.1 Sample Code for a TA-ISRFortunately, the Rabbit BIOS and libraries provide all of the necessary fl

Página 347

Dynamic C User’s Manual digi.com 81taisr_decnesting:push ip (8)ipset 1ld hl,bios_intnesting ; nesting counter

Página 348 - 348 digi.com

82 digi.com Multitasking with Dynamic C5.10.3 Library ReentrancyWhen writing a µC/OS-II application, it is important to know which Dynamic C library

Página 349 - C.2.4 Rabbit Field Utility

Dynamic C User’s Manual digi.com 835.10.4 How to Get a µC/OS-II Application RunningµC/OS-II is a highly configureable, real-time operating system. It

Página 350

84 digi.com Multitasking with Dynamic COS_MEM_EN Disable memory managerDefault is 0OS_MBOX_EN Enable mailboxesDefault is 1OS_SEM_EN Enable semaphores

Página 351 - -pb PilotBiosPathName

Dynamic C User’s Manual digi.com 85application tasks will each have a 1024 byte stack, ten will each have a 2048 byte stack, and an extra stack is dec

Página 352 - -fi Flash.ini PathName

86 digi.com Multitasking with Dynamic C// 1. Explicitly use µC/OS-II library#use "ucos2.lib"void RandomNumberTask(void *pdata);// 2. Declar

Página 353

Dynamic C User’s Manual digi.com 87Example 2This application runs exactly the same code as Example 1, except that each of the tasks are created with 1

Página 354 - 354 digi.com

88 digi.com Multitasking with Dynamic Cvoid RandomNumberTask(void *pdata){// Declare as auto to ensure reentrancy.auto OS_TCB data;auto INT8U err;au

Página 355

Dynamic C User’s Manual digi.com 89If MAX_TCP_SOCKET_BUFFERS is not defined in the application program, it will be defined as MAX_SOCKETS. If, however

Página 356 - 356 digi.com

Dynamic C User’s Manual digi.com 9 1. INSTALLING DYNAMIC CInsert the installation disk or CD in the appropriate disk drive on your PC. The installatio

Página 357 - Numerics

90 digi.com Multitasking with Dynamic C

Página 358 - 358 digi.com Index

Dynamic C User’s Manual digi.com 916. DEBUGGING WITH DYNAMIC CThis chapter is intended for anyone debugging Dynamic C programs. For the person with li

Página 359

92 digi.com Debugging with Dynamic C6.2 Debugging Features Introduced in Dynamic C 9Dynamic C 9 contains all the previous debugging tools and the add

Página 360 - 360 digi.com Index

Dynamic C User’s Manual digi.com 936.3 Debugging ToolsThis section describes the different tools available for debugging, including their pros and con

Página 361

94 digi.com Debugging with Dynamic CExample There are numerous examples of using printf() in the programs provided in the Samples folder where you in

Página 362 - 362 digi.com Index

Dynamic C User’s Manual digi.com 95Example Open Samples\Demo1.c. If you are using DC 9, place the cursor on the word “for,” then press F2 to insert a

Página 363

96 digi.com Debugging with Dynamic C6.3.3 Single SteppingSingle stepping has always been available in Dynamic C. In version 7.10, the ability to sin

Página 364 - 364 digi.com Index

Dynamic C User’s Manual digi.com 976.3.4 Watch ExpressionsLike many other debugging features, watch expressions have been around since the beginning

Página 365

98 digi.com Debugging with Dynamic C6.3.5 Evaluate ExpressionsThe evaluate expression functionality was separated out from watch expressions in Dyna

Página 366 - 366 digi.com Index

Dynamic C User’s Manual digi.com 996.3.6 Memory DumpThe Dump window was improved in Dynamic C 8.01 in several ways. For example, multiple dump win-do

Comentários a estes Manuais

Sem comentários