ABL electronic PIC18 Manuel d'utilisateur

Naviguer en ligne ou télécharger Manuel d'utilisateur pour Non ABL electronic PIC18. ABL electronic PIC18 User's Manual Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 312
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 0
mikroC
Develop your applications quickly and easily with the world's
most intuitive C compiler for PIC Microcontrollers (families
PIC12, PIC16, and PIC18).
Highly sophisticated IDE provides the power you need with the
simplicity of a Windows based point-and-click environment.
With useful implemented tools, many practical code examples,
broad set of built-in routines, and a comprehensive Help, mikroC
makes a fast and reliable tool, which can satisfy needs of experi-
enced engineers and beginners alike.
C Compiler for Microchip PIC microcontrollers
mikroElektronika
Development tools - Books - Compilers
www.mikroelektronika.co.yu
Users
manual
Making it simple
Vue de la page 0
1 2 3 4 5 6 ... 311 312

Résumé du contenu

Page 1 - Making it simple

mikroCDevelop your applications quickly and easily with the world'smost intuitive C compiler for PIC Microcontrollers (familiesPIC12, PIC16, and

Page 2 - Reader’s note

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...2MikroElektronika: Development tools - Books - CompilerspagemikroC

Page 3 - Table of Contents

Typedef SpecifierSpecifier typedef introduces a synonym for a specified type. You can use type-def declarations to construct shorter or more meaningfu

Page 4

asm DeclarationC allows embedding assembly in the source code by means of asm declaration.Declarations _asm and __asm are also allowed in mikroC, and

Page 5

InitializationAt the time of declaration, you can set the initial value of a declared object, i.e.initialize it. Part of the declaration which specifi

Page 6

Functions are central to C programming. Functions are usually defined as subpro-grams which return a value based on a number of input parameters. Retu

Page 7

Within parentheses, parameter-declarator-listis a list of formal argumentsthat function takes. These declarators specify the type of each function par

Page 8

Function DefinitionFunction definition consists of its declaration and a function body. The functionbody is technically a block – a sequence of local

Page 9 - QUICK OVERVIEW

Function CallsA function is called with actual arguments placed in the same sequence as theirmatching formal parameters. Use a function-call operator

Page 10

If a prototype is present, the number of arguments must match. The types need tobe compatible only to the extent that an assignment can legally conver

Page 11 - CODE EDITOR

Operators are tokens that trigger some computation when applied to variables andother objects in an expression.mikroC recognizes following operators:-

Page 12

MikroElektronika: Development tools - Books - Compilers101pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prec

Page 13 - Uncomment Icon

MikroElektronika: Development tools - Books - Compilers3pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...The Co

Page 14 - CODE EXPLORER

Arithmetic OperatorsArithmetic operators are used to perform mathematical computations. They havenumerical operands and return numerical results. Type

Page 15 - DEBUGGER

Binary Arithmetic OperatorsDivision of two integers returns an integer, while remainder is simply truncated:/* for example: */7 / 4; // equals

Page 16 - Watch Window

Relational OperatorsUse relational operators to test equality or inequality of expressions. If the expres-sion evaluates to true, it returns 1; otherw

Page 17

Bitwise OperatorsUse the bitwise operators to modify the individual bits of numerical operands.Bitwise operators associate from left to right. The onl

Page 18

/* Similarly: */0x1234 | 0x5678;/* equals 0x567C */0x1234 ^ 0x5678;/* equals 0x444C */~ 0x1234;/* equals 0xEDCB */Bitwise Shift OperatorsBinary operat

Page 19 - ERROR WINDOW

Logical OperatorsOperands of logical operations are considered true or false, that is non-zero orzero. Logical operators always return 1 or 0. Operand

Page 20 - STATISTICS

Logical Expressions and Side EffectsGeneral rule with complex logical expressions is that the evaluation of consecutivelogical operands stops the very

Page 21

Conditional Operator ? :The conditional operator ? : is the only ternary operator in C. Syntax of the con-ditional operator is:expression1? expression

Page 22

4. Both of type pointer to qualified or unqualified versions of compatible types. The resulting type is a pointer to a type qualified with all the typ

Page 23 - INTEGRATED TOOLS

Thus, we have 10 different compound assignment operators: +=, -=, *=, /=,%=, &=, |=, ^=, <<=, and >>=. All of these associate from rig

Page 24

Code Assistant [CTRL+SPACE]If you type a first few letter of a word and then press CTRL+SPACE, all the valididentifiers matching the letters you typed

Page 25

Sizeof OperatorPrefix unary operator sizeof returns an integer constant that gives the size inbytes of how much memory space is used by its operand (d

Page 26 - KEYBOARD SHORTCUTS

An expression is a sequence of operators, operands, and punctuators that specifiesa computation. Formally, expressions are defined recursively: subexp

Page 27

Binary operator comma (,) has the lowest precedence and associates from left toright, so that a, b, c is same as (a, b), c. This allows us to write se

Page 28

Statements specify the flow of control as a program executes. In the absence ofspecific jump and selection statements, statements are executed sequent

Page 29 - Applications

Expression StatementsAny expression followed by a semicolon forms an expression statement:expression;mikroC executes an expression statement by evalua

Page 30 - PROJECTS

Nested if statementsNested if statements require additional attention. General rule is that the nestedconditionals are parsed starting from the innerm

Page 31 - SOURCE FILES

Upon finding a match, program flow continues normally: following instructionswill be executed in natural order regardless of the possible case label.

Page 32 - New File

Iteration StatementsIteration statements let you loop a set of statements. There are three forms of itera-tion statements in C: while, do, and for.Whi

Page 33 - Close File

Do StatementThe do statement executes until the condition becomes false. Syntax of do state-ment is:dostatementwhile (expression);The statementis exec

Page 34 - COMPILATION

All the expressions are optional. If condition-expis left out, it is assumed to bealways true. Thus, “empty” for statement is commonly used to create

Page 35 - ERROR MESSAGES

Auto CorrectThe Auto Correct feature corrects common typing mistakes. To access the list ofrecognized typos, select Tools > Options from the drop-d

Page 36 - Compiler Warning Messages

Jump StatementsA jump statement, when executed, transfers control unconditionally. There are foursuch statements in mikroC: break, continue, goto, and

Page 37 - Reference

You can use goto to break out from any level of nested control structures. But,goto cannot be used to jump into block while skipping that block’s init

Page 38 - PIC SPECIFICS

Compound Statements (Blocks)A compound statement, or block, is a list (possibly empty) of statements enclosedin matching braces {}. Syntactically, a b

Page 39 - PIC16 Specifics

Preprocessor is an integrated text processor which prepares the source code forcompiling. Preprocessor allows:- inserting text from a specifed file to

Page 40 - ANSI Standard Issues

Line Continuation with BackslashIf you need to break directive into multiple lines, you can do it by ending the linewith a backslash (\):#define MACRO

Page 41 - Accessing Individual Bits

A macro won’t be expanded during its own expansion (so #define MACROMACROwon’t expand indefinitely).Let’s have an example:/* Here are some simple macr

Page 42 - Interrupts

Macros with ParametersThe following syntax is used to define a macro with parameters:#define macro_identifier(<arg_list>) token_sequenceNote the

Page 43 - Linker Directives

Here is a simple example:// A simple macro which returns greater of its 2 arguments:#define _MAX(A, B) ((A) > (B)) ? (A) : (B)// Let's call it

Page 44 - LEXICAL ELEMENTS

File InclusionThe preprocessor directive #include pulls in header files (extension .h) into thesource code. Do not rely on preprocessor to include sou

Page 45 - Comments

Note: There is also a third version of #include directive, rarely used, whichassumes that neither < nor " appears as the first non-whitespace

Page 46

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...6MikroElektronika: Development tools - Books - CompilerspageThe Co

Page 47 - CONSTANTS

Now, the following code,LCD_PRINT(temp)will be preprocessed to this:Lcd_Out_Cp("temp" ": "); Lcd_Out_Cp(IntToStr(temp));Operator #

Page 48

Directives #if, #elif, #else, and #endifThe conditional directives #if, #elif, #else, and #endif work very similar tothe common C conditional statemen

Page 49 - Floating Point Constants

Any processed sectioncan contain further conditional clauses, nested to anydepth. Each nested #else, #elif, or #endif directive belongs to the closest

Page 50 - Character Constants

CHAPTERMikroElektronika: Development tools - Books - Compilers4mikroC LibrariesmikroC provides a number of built-in and library routines which h

Page 51

mikroC compiler provides a set of useful built-in utility functions. Built-in func-tions do not require any header files to be included; you can use t

Page 52 - String Constants

MikroElektronika: Development tools - Books - Compilers137pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 53 - Constant Expressions

mikroC provides a set of libraries which simplifies the initialization and use ofPIC MCU and its modules. Library functions do not require any header

Page 54 - KEYWORDS

ADC (Analog to Digital Converter) module is available with a number of PICMCU models. Library function Adc_Read is included to provide you comfortable

Page 55 - IDENTIFIERS

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...140MikroElektronika: Development tools - Books - CompilerspageLibr

Page 56 - PUNCTUATORS

mikroC provides a library (driver) for working with the CAN module.CAN is a very robust protocol that has error detection and signalling, self–check-i

Page 57 - /* call func with two args */

MikroElektronika: Development tools - Books - Compilers7pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...The so

Page 58 - Semicolon

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...142MikroElektronika: Development tools - Books - CompilerspageProt

Page 59 - Equal Sign

MikroElektronika: Development tools - Books - Compilers143pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 60 - OBJECTS AND LVALUES

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...144MikroElektronika: Development tools - Books - CompilerspageProt

Page 61

MikroElektronika: Development tools - Books - Compilers145pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 62 - SCOPE AND VISIBILITY

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...146MikroElektronika: Development tools - Books - CompilerspageProt

Page 63 - Visibility

There is a number of constants predefined in CAN library. To be able to use thelibrary effectively, you need to be familiar with these. You might want

Page 64 - NAME SPACES

// ..continued#define CAN_CONFIG_DBL_BUFFER_BIT 0x10#define CAN_CONFIG_DBL_BUFFER_ON 0xFF // XXX1XXXX#define CAN_CONFIG_DBL_BUFFER_OFF 0xEF // XXX

Page 65 - DURATION

CAN_RX_MSG_FLAGSCAN_RX_MSG_FLAGS are flags related to reception of CAN message. If a particularbit is set; corresponding meaning is TRUE or else it wi

Page 66

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...150MikroElektronika: Development tools - Books - CompilerspageLibr

Page 67 - Type Categories

MikroElektronika: Development tools - Books - Compilers151pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...// .

Page 68 - FUNDAMENTAL TYPES

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...8MikroElektronika: Development tools - Books - CompilerspageToggle

Page 69

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...152MikroElektronika: Development tools - Books - CompilerspageRXDV

Page 70 - Enumerations

SPI module is available with a number of PICmicros. mikroC provides a library(driver) for working with the external CAN modules (such as MCP2515 orMCP

Page 71

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...154MikroElektronika: Development tools - Books - CompilerspageProt

Page 72 - Void Type

MikroElektronika: Development tools - Books - Compilers155pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 73 - DERIVED TYPES

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...156MikroElektronika: Development tools - Books - CompilerspageProt

Page 74

MikroElektronika: Development tools - Books - Compilers157pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 75

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...158MikroElektronika: Development tools - Books - CompilerspageProt

Page 76 - Pointers

MikroElektronika: Development tools - Books - Compilers159pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 77 - /* is same as: */

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...160MikroElektronika: Development tools - Books - Compilerspage// .

Page 78 - Pointer Arithmetic

MikroElektronika: Development tools - Books - Compilers161pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...+5VR

Page 79

Stopwatch WindowThe Stopwatch Window displays the current count of cycles/time since the lastDebugger action. Stopwatch measures the execution time (n

Page 80 - // so a[3] now equals 6

Compact Flash Library provides routines for accessing data on Compact Flashcard (abbrev. CF further in text). CF cards are widely used memory elements

Page 81

MikroElektronika: Development tools - Books - Compilers163pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 82 - Structures

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...164MikroElektronika: Development tools - Books - CompilerspageProt

Page 83 - // incomplete

MikroElektronika: Development tools - Books - Compilers165pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 84

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...166MikroElektronika: Development tools - Books - CompilerspageProt

Page 85 - // identical to (*ps).m

MikroElektronika: Development tools - Books - Compilers167pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 86

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...168MikroElektronika: Development tools - Books - CompilerspageProt

Page 87

MikroElektronika: Development tools - Books - Compilers169pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 88 - Bit Fields

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...170MikroElektronika: Development tools - Books - CompilerspageNext

Page 89 - // Relevant bits 2, 3, and 4

MikroElektronika: Development tools - Books - Compilers171pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...+5VC

Page 90 - TYPES CONVERSIONS

Call Stack WindowThe Call Stack Window keeps track of depth and order of nested routine calls inprogram simulation. Check the Nested Calls Limitations

Page 91

EEPROM data memory is available with a number of PICmicros. mikroC includeslibrary for comfortable work with EEPROM.Eeprom_ReadEeprom_WritemikroC- C C

Page 92

MikroElektronika: Development tools - Books - Compilers173pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 93 - DECLARATIONS

This library is designed to simplify handling of the underlying hardware(RTL8019AS). However, certain level of knowledge about the Ethernet andEtherne

Page 94

MikroElektronika: Development tools - Books - Compilers175pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 95

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...176MikroElektronika: Development tools - Books - CompilerspageProt

Page 96 - // Add member declarators

MikroElektronika: Development tools - Books - Compilers177pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 97 - Storage Classes

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...178MikroElektronika: Development tools - Books - CompilerspageProt

Page 98

MikroElektronika: Development tools - Books - Compilers179pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 99 - Type Qualifiers

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...180MikroElektronika: Development tools - Books - CompilerspageProt

Page 100 - Typedef Specifier

MikroElektronika: Development tools - Books - Compilers181pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 101 - // just a test

MikroElektronika: Development tools - Books - Compilers11pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...In ca

Page 102 - Initialization

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...182MikroElektronika: Development tools - Books - CompilerspageProt

Page 103 - FUNCTIONS

MikroElektronika: Development tools - Books - Compilers183pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 104 - Function Prototypes

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...184MikroElektronika: Development tools - Books - CompilerspageProt

Page 105 - Function Definition

MikroElektronika: Development tools - Books - Compilers185pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 106 - Argument Conversions

This library provides routines for accessing microcontroller Flash memory. Notethat prototypes differ for PIC16 and PIC18 families.Flash_ReadFlash_Wri

Page 107 - // function call

The example demonstrates simple data exchange via USART. When PIC MCUreceives data, it immediately sends the same data back. If PIC is connected to th

Page 108 - OPERATORS

I²C full master MSSP module is available with a number of PIC MCU models.mikroC provides I2C library which supports the master I²C mode.Note: This lib

Page 109

MikroElektronika: Development tools - Books - Compilers189pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 110 - Arithmetic Operators

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...190MikroElektronika: Development tools - Books - CompilerspageProt

Page 111

This code demonstrates use of I²C Library functions. PIC MCU is connected(SCL, SDA pins ) to 24c02 EEPROM. Program sends data to EEPROM (data iswritte

Page 112 - Relational Operators

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...iiMikroElektronika: Development tools - Books - CompilerspageDISCL

Page 113 - Bitwise Operators

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...12MikroElektronika: Development tools - Books - CompilerspageAfter

Page 114

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...192MikroElektronika: Development tools - Books - Compilerspage4MHz

Page 115 - Logical Operators

mikroC provides library for working with 4x4 keypad; routines can also be usedwith 4x1, 4x2, or 4x3 keypad. Check the connection scheme at the end of

Page 116 - /* equals 0 */

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...194MikroElektronika: Development tools - Books - CompilerspageProt

Page 117 - Conditional Operator ? :

MikroElektronika: Development tools - Books - Compilers195pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...The

Page 118 - Assignment Operators

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...196MikroElektronika: Development tools - Books - Compilerspage4MHz

Page 119

mikroC provides a library for communicating with commonly used LCD (4-bitinterface). Figures showing HW connection of PIC and LCD are given at the end

Page 120 - Sizeof Operator

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...198MikroElektronika: Development tools - Books - CompilerspageProt

Page 121 - EXPRESSIONS

MikroElektronika: Development tools - Books - Compilers199pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 122

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...200MikroElektronika: Development tools - Books - CompilerspageLCD

Page 123 - STATEMENTS

MikroElektronika: Development tools - Books - Compilers201pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 124 - Selection Statements

MikroElektronika: Development tools - Books - Compilers13pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Proce

Page 125

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...202MikroElektronika: Development tools - Books - CompilerspageLibr

Page 126

MikroElektronika: Development tools - Books - Compilers203pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...mikr

Page 127 - Iteration Statements

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...204MikroElektronika: Development tools - Books - CompilerspageProt

Page 128

MikroElektronika: Development tools - Books - Compilers205pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 129 - ;) for a loop body

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...206MikroElektronika: Development tools - Books - CompilerspageLibr

Page 130 - Jump Statements

MikroElektronika: Development tools - Books - Compilers207pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 131 - /* error handling code */

mikroC provides a library for drawing and writing on Graphic LCD. These rou-tines work with commonly used GLCD 128x64, and work only with the PIC18fam

Page 132 - Compound Statements (Blocks)

MikroElektronika: Development tools - Books - Compilers209pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 133 - PREPROCESSOR

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...210MikroElektronika: Development tools - Books - CompilerspageProt

Page 134

MikroElektronika: Development tools - Books - Compilers211pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 135 - #define MACRO

RAM WindowSummarizes all GPR and SFR registers and their addresses. Also displays symbol-ic names of variables and their addresses.ROM WindowLists op-

Page 136 - Macros with Parameters

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...212MikroElektronika: Development tools - Books - CompilerspageProt

Page 137 - Undefining Macros

MikroElektronika: Development tools - Books - Compilers213pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 138 - File Inclusion

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...214MikroElektronika: Development tools - Books - CompilerspageProt

Page 139 - Preprocessor Operators

MikroElektronika: Development tools - Books - Compilers215pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 140 - Conditional Compilation

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...216MikroElektronika: Development tools - Books - CompilerspageProt

Page 141

MikroElektronika: Development tools - Books - Compilers217pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 142

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...218MikroElektronika: Development tools - Books - Compilerspage118K

Page 143

mikroC provides a library for handling Manchester coded signals. Manchestercode is a code in which data and clock signals are combined to form a singl

Page 144 - BUILT-IN ROUTINES

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...220MikroElektronika: Development tools - Books - CompilerspageProt

Page 145 - Vdelay_ms

MikroElektronika: Development tools - Books - Compilers221pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 146 - LIBRARY ROUTINES

MikroElektronika: Development tools - Books - Compilers15pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...USART

Page 147 - ADC Library

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...222MikroElektronika: Development tools - Books - CompilerspageLibr

Page 148 - Hardware Connection

MikroElektronika: Development tools - Books - Compilers223pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Hard

Page 149 - CAN Library

mikroC provides a library for accessing data on Multi Media Card via SPIcommunication.Notes:- Library works with PIC18 family only; - Library function

Page 150 - CANGetOperationMode

MikroElektronika: Development tools - Books - Compilers225pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 151 - CANInitialize

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...226MikroElektronika: Development tools - Books - CompilerspageProt

Page 152 - CANSetBaudRate

MikroElektronika: Development tools - Books - Compilers227pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 153 - CANSetFilter

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...228MikroElektronika: Development tools - Books - CompilerspageProt

Page 154 - CANWrite

MikroElektronika: Development tools - Books - Compilers229pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 155 - CAN Constants

MikroElektronika: Development tools - Books - Compilers230pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 156

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...231MikroElektronika: Development tools - Books - CompilerspageLibr

Page 157

7 Segment Display DecoderThe 7seg Display Decoder is a convenient visual panel which returns decimal/hexvalue for any viable combination you would lik

Page 158

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...232MikroElektronika: Development tools - Books - CompilerspageHard

Page 159

OneWire library provides routines for communication via OneWire bus, for exam-ple with DS1820 digital thermometer. This is a Master/Slave protocol, an

Page 160

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...234MikroElektronika: Development tools - Books - CompilerspageProt

Page 161 - CANSPI Library

MikroElektronika: Development tools - Books - Compilers235pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 162 - CANSPIGetOperationMode

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...236MikroElektronika: Development tools - Books - CompilerspageHard

Page 163 - CANSPIInitialize

mikroC provides a library for communicating with common PS/2 keyboard.Thelibrary does not utilize interrupts for data retrieval, and requires oscillat

Page 164 - CANSPISetBaudRate

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...238MikroElektronika: Development tools - Books - CompilerspageProt

Page 165 - CANSPISetFilter

MikroElektronika: Development tools - Books - Compilers239pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 166 - CANSPIWrite

CCP module is available with a number of PICmicros. mikroC provides librarywhich simplifies using PWM HW Module.Note: These routines support module on

Page 167

MikroElektronika: Development tools - Books - Compilers241pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 168

mikroBootloadermikroBootloader can be used only with PICmicros that support flash write.1. Load the PIC with the appropriate hex file using the conven

Page 169

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...242MikroElektronika: Development tools - Books - CompilerspageHard

Page 170 - Compact Flash Library

RS-485 is a multipoint communication which allows multiple devices to be con-nected to a single signal cable. mikroC provides a set of library routine

Page 171 - Cf_Detect

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...244MikroElektronika: Development tools - Books - CompilerspageProt

Page 172 - Cf_Disable

MikroElektronika: Development tools - Books - Compilers245pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 173 - Cf_Read_Word

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...246MikroElektronika: Development tools - Books - CompilerspageProt

Page 174 - Cf_Find_File

MikroElektronika: Development tools - Books - Compilers247pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 175 - Cf_File_Write_Init

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...248MikroElektronika: Development tools - Books - CompilerspageHard

Page 176 - Cf_Set_File_Date

Secure Digital (SD) is a flash memory memory card standard, based on the olderMulti Media Card (MMC) format. SD cards are currently available in sizes

Page 177

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...250MikroElektronika: Development tools - Books - CompilerspageProt

Page 178

MikroElektronika: Development tools - Books - Compilers251pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 179 - PIC16F877A

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...18MikroElektronika: Development tools - Books - CompilerspageBelow

Page 180 - EEPROM Library

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...252MikroElektronika: Development tools - Books - CompilerspageLibr

Page 181 - Eeprom_Read

MikroElektronika: Development tools - Books - Compilers253pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Hard

Page 182 - Ethernet Library

mikroC provides routines which implement software I²C. These routines are hard-ware independent and can be used with any MCU. Software I2C enables you

Page 183 - Eth_Set_Ip_Address

MikroElektronika: Development tools - Books - Compilers255pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 184 - Eth_Set_Inport

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...256MikroElektronika: Development tools - Books - CompilerspageProt

Page 185 - Eth_Get_Ip_Hdr_Len

MikroElektronika: Development tools - Books - Compilers257pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 186 - Eth_Get_Source_Ip_Address

mikroC provides library which implement software SPI. These routines are hard-ware independent and can be used with any MCU. You can easily communicat

Page 187 - Eth_Arp_Response

MikroElektronika: Development tools - Books - Compilers259pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 188 - Eth_Get_Udp_Source_Port

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...260MikroElektronika: Development tools - Books - CompilerspageLibr

Page 189 - Eth_Get_Udp_Port

mikroC provides library which implements software UART. These routines arehardware independent and can be used with any MCU. You can easily communi-ca

Page 190 - Eth_Send_Udp

Debugger ShortcutsF4 Run to CursorF5 Toggle breakpointF6 Run/Pause DebuggerF7 Step intoF8 Step overF9 DebugCTRL+F2 ResetMikroElek

Page 191 - Eth_Get_Tcp_Hdr_Offset

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...262MikroElektronika: Development tools - Books - CompilerspageProt

Page 192 - Eth_Set_Tcp_Data

The example demonstrates simple data exchange via software UART. When PICMCU receives data, it immediately sends the same data back. If PIC is connect

Page 193 - RTL8019AS

mikroC provides a Sound Library which allows you to use sound signalization inyour applications. You need a simple piezo speaker (or other hardware) o

Page 194 - Flash Memory Library

The example is a simple demonstration of how to use sound library for playingtones on a piezo speaker. The code can be used with any MCU that has PORT

Page 195

SPI module is available with a number of PIC MCU models. mikroC provides alibrary for initializing Slave mode and comfortable work with Master mode. P

Page 196 - I2C Library

MikroElektronika: Development tools - Books - Compilers267pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 197 - I2C_Is_Idle

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...268MikroElektronika: Development tools - Books - CompilerspageProt

Page 198 - I2C_Stop

The code demonstrates how to use SPI library functions. Assumed HW configura-tion is: max7219 (chip select pin) connected to RC1, and SDO, SDI, SCK pi

Page 199

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...270MikroElektronika: Development tools - Books - CompilerspageHW C

Page 200 - HW Connection

USART hardware module is available with a number of PICmicros. mikroCUSART Library provides comfortable work with the Asynchronous (full duplex)mode.Y

Page 201 - Keypad Library

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...20MikroElektronika: Development tools - Books - Compilerspage

Page 202 - Keypad_Released

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...272MikroElektronika: Development tools - Books - CompilerspageProt

Page 203

The example demonstrates simple data exchange via USART. When PIC MCUreceives data, it immediately sends the same data back. If PIC is connected to th

Page 204

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...274MikroElektronika: Development tools - Books - CompilerspageSUB-

Page 205 - LCD Library (4-bit interface)

Universal Serial Bus (USB) provides a serial bus standard for connecting a widevariety of devices, including computers, cell phones, game consoles, PD

Page 206 - Lcd_Out_Cp

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...276MikroElektronika: Development tools - Books - CompilerspageProt

Page 207 - Lcd_Chr_Cp

MikroElektronika: Development tools - Books - Compilers277pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Libr

Page 208 - LCD Commands

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...278MikroElektronika: Development tools - Books - Compilerspage// T

Page 209

MikroElektronika: Development tools - Books - Compilers279pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...HW C

Page 210

Util library contains miscellaneous routines useful for project development.mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simpl

Page 211 - Lcd8_Config

mikroC provides a set of standard ANSI C library functions for testing and map-ping characters.Note: Not all of the standard functions have been inclu

Page 212 - Lcd8_Out_Cp

CHAPTERMikroElektronika: Development tools - Books - Compilers2BuildingApplicationsCreating applications in mikroC is easy and intuitive. Projec

Page 213 - Lcd8_Cmd

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...282MikroElektronika: Development tools - Books - CompilerspageProt

Page 214

MikroElektronika: Development tools - Books - Compilers283pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 215

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...284MikroElektronika: Development tools - Books - CompilerspageProt

Page 216 - GLCD Library

mikroC provides a set of standard ANSI C library functions for floating pointmath handling.Note: Functions have been implemented according to the ANSI

Page 217 - Glcd_Set_Side

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...286MikroElektronika: Development tools - Books - CompilerspageProt

Page 218 - Glcd_Read_Data

MikroElektronika: Development tools - Books - Compilers287pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 219 - Glcd_Dot

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...288MikroElektronika: Development tools - Books - CompilerspageProt

Page 220 - Glcd_H_Line

MikroElektronika: Development tools - Books - Compilers289pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 221 - Glcd_Box

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...290MikroElektronika: Development tools - Books - CompilerspageProt

Page 222 - Glcd_Set_Font

mikroC provides a set of standard ANSI C library functions of general utility.Note: Not all of the standard functions have been included. Functions ha

Page 223 - Glcd_Write_Char

MikroElektronika: Development tools - Books - CompilersTable of ContentsCHAPTER 1 mikroC IDECHAPTER 2 Building ApplicationsCHAPTER 3 mikroC Refe

Page 224 - Glcd_Image

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...22MikroElektronika: Development tools - Books - Compilerspagemikro

Page 225

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...292MikroElektronika: Development tools - Books - CompilerspageProt

Page 226

MikroElektronika: Development tools - Books - Compilers293pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 227 - 11 1 1 1

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...294MikroElektronika: Development tools - Books - CompilerspageProt

Page 228 - Man_Receive

mikroC provides a set of standard ANSI C library functions useful for manipulat-ing strings and arrays of char.Note: Not all of the standard functions

Page 229 - Man_Send

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...296MikroElektronika: Development tools - Books - CompilerspageProt

Page 230

MikroElektronika: Development tools - Books - Compilers297pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 231

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...298MikroElektronika: Development tools - Books - CompilerspageProt

Page 232 - Multi Media Card Library

mikroC Conversions Library provides routines for converting numerals to strings,and routines for BCD/decimal conversions.You can get text representati

Page 233 - Mmc_Write_Sector

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...300MikroElektronika: Development tools - Books - CompilerspageProt

Page 234 - Mmc_Read_Csd

MikroElektronika: Development tools - Books - Compilers301pagemikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...Prot

Page 235 - Mmc_Fat_Assign

Source files containing C code should have the extension .c. List of source filesrelevant for the application is stored in project file with extension

Page 236 - Mmc_Fat_Append

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...302MikroElektronika: Development tools - Books - CompilerspageProt

Page 237 - Mmc_Set_File_Date

mikroC implements fundamental trigonometry functions. These functions areimplemented as lookup tables, and return the result as integer, multiplied by

Page 238

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...304MikroElektronika: Development tools - Books - CompilerspageIf y

Page 239

Paths for Header Files (.h)Header files are included by means of preprocessor directive #include. If youplace an explicit path to the header file in p

Page 240 - MC33269-3.3

Opening an Existing FileSelect File > Open from drop-down menu, or press CTRL+O, or click the OpenFile icon. The Select Input File dialog opens. In

Page 241 - OneWire Library

When you have created the project and written the source code, you will want tocompile it. Select Project > Build from drop-down menu, or click Bui

Page 242 - Ow_Write

Error Messages- Specifier needed- Invalid declarator- Expected '(' or identifier- Integer const expected- Array dimension must be greater th

Page 243

- Inconsistent storage class- Inconsistent type- %s tag redefined- Illegal typecast- %s is not a valid identifier- Invalid statement- Constant express

Page 244

CHAPTERMikroElektronika: Development tools - Books - Compilers3mikroC LanguageReferenceC offers unmatched power and flexibility in programming m

Page 245 - PS/2 Library

In order to get the most from your mikroC compiler, you should be familiar withcertain aspects of PIC MCU. This knowledge is not essential, but it can

Page 246 - Ps2_Key_Read

PIC16 SpecificsBreaking Through PagesIn applications targeted at PIC16, no single routine should exceed one page (2,000instructions). If routine does

Page 247

CHAPTER 1: mikroC IDE 1Quick Overview 1Code Editor 3Code Explorer 6Debugger 7Error Window 11Statistics 12Integrated Tools 15Keyboard Shortcuts 19C

Page 248 - PWM Library

ANSI Standard IssuesDivergence from the ANSI C StandardmikroC diverges from the ANSI C standard in few areas. Some of these modifica-tions are improve

Page 249 - Pwm_Stop

Predefined Globals and ConstantsTo facilitate PIC programming, mikroC implements a number of predefined glob-als and constants.All PIC SFR registers a

Page 250

InterruptsInterrupts can be easily handled by means of reserved word interrupt. mikroCimplictly declares function interrupt which cannot be redeclared

Page 251 - RS-485 Library

Linker DirectivesmikroC uses internal algorithm to distribute objects within memory. If you need tohave variable or routine at specific predefined add

Page 252 - RS485Master_Receive

These topics provide a formal definition of the mikroC lexical elements. Theydescribe the different categories of word-like units (tokens) recognized

Page 253 - RS485Slave_Init

CommentsComments are pieces of text used to annotate a program, and are technicallyanother form of whitespace. Comments are for the programmer’s use o

Page 254 - RS485Slave_Send

Token is the smallest element of a C program that is meaningful to the compiler.The parser separates tokens from the input stream by creating the long

Page 255

Constants or literals are tokens representing fixed numeric or character values.mikroC supports:- integer constants,- floating point constants,- chara

Page 256 - RS485 communication line

Otherwise:If the constant has a U or u suffix, its data type will be the first of the followingthat can accommodate its value: unsigned short, unsigne

Page 257 - Secure Digital Library

Binary ConstantsAll constants starting with 0b (or 0B) are taken to be binary. In the absence of anyoverriding suffixes, the data type of an binary co

Page 258 - Sd_Write_Sector

Keywords 46Identifiers 47Punctuators 48Objects and Lvalues 52Scope and Visibility 54Name Spaces 56Duration 57Types 59Fundamental Types 60Arithmetic Ty

Page 259 - Sd_Read_Csd

Character ConstantsA character constant is one or more characters enclosed in single quotes, such as'A', '+', or '\n'. I

Page 260

The following table shows the available escape sequences in mikroC:MikroElektronika: Development tools - Books - Compilers43pagemikroC- C Compil

Page 261

String ConstantsString constants, also known as string literals, are a special type of constantswhich store fixed sequences of characters. A string li

Page 262 - Software I2C Library

Enumeration ConstantsEnumeration constants are identifiers defined in enum type declarations. The iden-tifiers are usually chosen as mnemonics to assi

Page 263 - Soft_I2C_Read

Keywords are words reserved for special purposes and must not be used as normalidentifier names.Beside standard C keywords, all relevant SFR are defin

Page 264 - Soft_I2C_Stop

Identifiers are arbitrary names of any length given to functions, variables, symbol-ic constants, user-defined data types, and labels. All these progr

Page 265

The mikroC punctuators (also known as separators) include brackets, parentheses,braces, comma, semicolon, colon, asterisk, equal sign, and pound sign.

Page 266 - Software SPI Library

BracesBraces { } indicate the start and end of a compound statement:if (d == z) {++x;func();}The closing brace serves as a terminator for the compound

Page 267 - Soft_Spi_Write

SemicolonThe semicolon (;) is a statement terminator. Any legal C expression (including theempty expression) followed by a semicolon is interpreted as

Page 268

Equal SignThe equal sign (=) separates variable declarations from initialization lists:int test[5] = {1, 2, 3, 4, 5};int x = 5;The equal sign is also

Page 269 - Software UART Library

Expressions 113Statements 115Labeled Statements 115Expression Statements 116Selection Statements 116Iteration Statements 119Jump Statements 122Compoun

Page 270 - Soft_Uart_Write

ObjectsAn object is a specific region of memory that can hold a fixed or variable value(or set of values). To prevent confusion, this use of the word

Page 271

LvaluesAn lvalue is an object locator: an expression that designates an object. An exampleof an lvalue expression is *P, where P is any expression eva

Page 272 - Sound Library

ScopeThe scope of identifier is the part of the program in which the identifier can beused to access its object. There are different categories of sco

Page 273

VisibilityThe visibility of an identifier is that region of the program source code from whichlegal access can be made to the identifier’s associated

Page 274 - SPI Library

Name space is the scope within which an identifier must be unique. C uses fourdistinct categories of identifiers:Goto label namesThese must be unique

Page 275 - Spi_Init_Advanced

Duration, closely related to storage class, defines the period during which thedeclared identifiers have real, physical objects allocated in memory. W

Page 276 - Spi_Write

Here is an example of two objects with local scope, but with different duration:void f() {/* local duration var; init a upon every call to f */int a =

Page 277

C is strictly typed language, which means that every object, function, and expres-sion need to have a strictly defined type, known in the time of comp

Page 278 - 8. 8. 8. 8. 8. 8. 8. 8

Arithmetic TypesThe arithmetic type specifiers are built from the following keywords: void, char,int, float, and double, together with prefixes short,

Page 279 - USART Library

Below is the overview of arithmetic types:MikroElektronika: Development tools - Books - Compilers61pagemikroC- C Compiler for Microchip PIC micr

Page 280 - Usart_Read

SPI Library 266USART Library 271USB HID Library 275Util Library 280ANSI C Ctype Library 281ANSI C Math Library 285ANSI C Stdlib Library 291ANSI C Stri

Page 281 - Usart_Write

EnumerationsAn enumeration data type is used for representing an abstract, discreet set of val-ues with appropriate symbolic names.Enumeration Declara

Page 282

The order of constants can be explicitly re-arranged. For example:enum colors { black,// value 0red,// value 1green,// value 2blue=6,// value 6violet,

Page 283 - USB HID Library

Void Typevoid is a special type indicating the absence of any value. There are no objects ofvoid; instead, void is used for deriving more complex type

Page 284 - Hid_Disable

The derived types are also known as structured types. These types are used as ele-ments in creating more complex user-defined types.ArraysArray is the

Page 285

Array InitializationArray can be initialized in declaration by assigning it a comma-delimited sequenceof values within braces. When initializing an ar

Page 286

Multi-dimensional ArraysAn array is one-dimensional if it is of scalar type. One-dimensional arrays aresometimes referred to as vectors.Multidimension

Page 287 - PIC18F4550

PointersPointers are special objects for holding (or “pointing to”) memory addresses. In C,address of an object in memory can be obtained by means of

Page 288 - Util Library

Note: You must initialize pointers before using them! Our previously declaredpointer *p is not initialized (i.e. assigned a value), so it cannot be us

Page 289 - ANSI C Ctype Library

Pointer ArithmeticPointer arithmetic in C is limited to:- assigning one pointer to another,- comparing two pointers,- comparing pointer to zero (NULL)

Page 290

According to these guidelines, we can write:pa = &a[4];// pa points to a[4]x = *(pa + 3);// x = a[7]y = *pa + 3;// y = a[4] + 3Also, you need to b

Page 291

mikroC- C Compiler for Microchip PIC microcontrollersmikroCmaking it simple...viiiMikroElektronika: Development tools - Books - Compilerspage

Page 292

You can also compare pointers to zero value – this tests if pointer actually pointsto anything. All pointers can be successfully tested for equality o

Page 293 - ANSI C Math Library

This allows you to write loops which access the array elements in a sequence bymeans of incrementing pointer — in the last iteration you will have a p

Page 294

StructuresA structure is a derived type usually representing a user-defined collection ofnamed members (or components). The members can be of any type

Page 295

Note that you can omit structure tag, but then you cannot declare additionalobjects of this type elsewhere. For more information, see the “UntaggedStr

Page 296

Structure AssignmentVariables of same structured type may be assigned one to another by means ofsimple assignment operator (=). This will copy the ent

Page 297

Structure Member AccessStructure and union members are accessed using the following two selection oper-ators:. (period)-> (right arrow)The operator

Page 298

Accessing Nested StructuresIf structure B contains a field whose type is structure A, the members of A can beaccessed by two applications of the membe

Page 299 - ANSI C Stdlib Library

UnionsUnion types are derived types sharing many of the syntactic and functional fea-tures of structure types. The key difference is that a union allo

Page 300

Referring to declarations from the previous example:mu.d = 4.016;Lcd_Out_Cp(FloatToStr(mu.d));// OK: displays mu.d = 4.016Lcd_Out_Cp(IntToStr(mu.i));/

Page 301

Here, tagis an optional name of the structure; bitfield-declarator-listisa list of bit fields. Each component identifer requires a colon and its width

Page 302

CHAPTERMikroElektronika: Development tools - Books - Compilers1mikroC IDEmikroC is a powerful, feature rich development tool for PICmicros. It i

Page 303 - ANSI C String Library

C is strictly typed language, with each operator, statement and function demandingappropriately typed operands/arguments. However, we often have to us

Page 304

Arithmetic ConversionsWhen you use an arithmetic expression, such as a+b, where a and b are of differ-ent arithmetic types, mikroC performs implicit t

Page 305

The result of the expression is the same type as that of the two operands.Here are several examples of implicit conversion:2+3.1// = 2. + 3.1 = 5.15/4

Page 306

Introduction to DeclarationsDeclaration introduces one or several names to a program – it informs the compil-er what the name represents, what is its

Page 307 - Conversions Library

Let’s have an example:/* Here is a nondefining declaration of function max; *//* it merely informs compiler that max is a function */int max();/* Here

Page 308 - IntToStr

LinkageAn executable program is usually created by compiling several independent trans-lation units, then linking the resulting object files with pree

Page 309 - FloatToStr

External Linkage Rule:1. names having file scope, that do not comply to any of previously stated internal linkage rules, have external linkage.The sto

Page 310 - Bcd2Dec16

Storage ClassesAssociating identifiers with objects requires each identifier to have at least twoattributes: storage class and type (sometimes referre

Page 311 - Trigonometry Library

StaticGlobal name declared with static specifier has internal linkage, meaning that itis local for a given file. See Linkage for more information.Loca

Page 312

Type QualifiersType qualifiers const and volatile are optional in declarations and do not actu-ally affect the type of declared object.Qualifier const

Commentaires sur ces manuels

Pas de commentaire