Iniciar sesión:
Votos - 2, Puntuación media: 4.5 ( )

Manual de usuario ABL electronic, modelo PIC Microcontrollers PIC16

Fabricar: ABL electronic
Tamaño del archivo: 1.34 mb
Nombre del archivo:
Idioma del manual:en
Enlace gratuito para este manual disponible en la parte inferior de la página



Resumen del manual


mikroC - C Compiler for Microchip PIC microcontrollers Type Qualifiers Type qualifiers const and volatile are optional in declarations and do not actually affect the type of declared object. Qualifier const Qualifier const implies that the declared object will not change its value during runtime. In declarations with const qualifier, you need to initialize all the objects in the declaration. Effectively, mikroC treats objects declared with const qualifier same as literals or preprocessor constants. Compiler will report an error if trying to change an object declared with const qualifier. For example: const double PI = 3.14159; Qualifier volatile Qualifier volatile implies that variable may change its value during runtime indepent from the program. Use the volatile modifier to indicate that a variable can be changed by a background routine, an interrupt routine, or an I/O port. Declaring an object to be volatile warns the compiler not to make assumptions concerning the value of the object while evaluating expressions in which it occurs because the value could change at any moment. page MikroElektronika: Development tools -Books -Compilers 91 mikroC mikroC - C Compiler for Microchip PIC microcontrollers making it simple... Typedef Specifier Specifier typedef introduces a synonym for a specified type. You can use type- def declarations to construct shorter or more meaningful names for types already defined by the language or for types that you have declared. You cannot use the typedef specifier inside a function definition. The specifier typedef stands first in the declaration: typedef synonym; The typedef keyword assigns the synonym to the . The synonym needs to be a valid identifier. Declaration starting with the typedef specifier does not introduce an object or function of a given type, but rather a new name for a given type. That is, the typedef declaration is identical to “normal” declaration, but instead of objects, it declares types. It is a common practice to name custom type identifiers with starting capital letter — this is not required by C. For example: // Let's declare a synonym for "unsigned long int": typedef unsigned long int Distance; // Now, synonym "Distance" can be used as type identifier: Distance i; // declare variable i of unsigned long int In typedef declaration, as in any declaration, you can declare several types at once. For example: typedef int *Pti, Array[10]; Here, Pti is synonym for type “pointer to int”, and Array is synonym for type “array of 10 int elements”. page 92 92 MikroElektronika: Development tools -Books -Compilers mikroC making it simple... mikroC - C Compiler for Microchip PIC microcontrollers asm Declaration C allows embedding assembly in the source code by means of asm declaration. Declarations _asm and __asm are also allowed in mikroC, and have the same meaning. Note that you cannot use numerals as absolute addresses for SFR or GPR variables in assembly instructions. You may use symbolic names instead (listing will display these names as well as addresses). You can group assembly instructions by the asm keyword (or _asm, or __asm): asm { block of assembly instructions } C comments (both single-line and multi-line) are allowed in embedded assembly code. Assembly-style comments starting with semicolon are not allowed. If you plan to use a certain C variable in embedded assembly only, be sure to at least initialize it in C code; otherwise, linker will issue an error. This does not apply to predefined globals such as PORTB. For example, the following code will not be compiled, as linker won’t be able to recognize variable myvar: unsigned myvar; void main() { asm { MOVLW 10 // just a test MOVLW test_main_global_myvar_1 } } Adding the following line (or similar) above asm block would let linker know that variable is used: myvar := 0; Note: mikroC will not check if the banks are set appropriately for your variable. You need to set the banks manually in assembly code. page MikroElektronika: Development tools -Books -Compilers 93 mikroC mikroC - C Compiler for Microchip PIC microcontrollers making it simple... Initialization At the time of declaration, you can set the initial value of a declared object, i.e. initialize it. Part of the declaration which specifies the initialization is called the initializer. Initializers for globals and static objects must be constants or constant expressions. The initializer for an automatic object can be any legal expression that evaluates to an assignment-compatible value for the type of the variable involved. Scalar types are initialized with a single expression, which can optionally be enclosed in braces. The initial value of the object is that of the expression; the same constraints for type and conversions apply as for simple assignments. For example: int i = 1; char *s = "hello"; struct complex c = {0.1, -0.2}; // where 'complex' is a structure (float, float) For structures or unions with automatic...

Otros modelos de este manual:
Notebooks - PIC Microcontrollers PIC12 (1.34 mb)
Notebooks - PIC Microcontrollers PIC18 (1.34 mb)

Comentarios



Tu reseña
Tu nombre:
Introduzca dos números de la imagen:
capcha





Categoría