• Contents
  • Index
  • Search
  • Overview
    • Legal stuff
    • What's new in V2?
    • PMP internals
    • Code optimization considerations
    • PMP Pascal specificities, keywords
    • Known limitations
    • EBNF notation
    • To do list
    • Not to do list
    • About the author
    • Hall of fame
  • Operation
    • Operating system
    • External tool-chain
    • Let's start
    • Projects sub-folder
    • Examples and libraries sub-folder
    • The PMP project
    • My first program
    • Help!
  • Project and general options
    • Project page
    • Compiler page
      • Optimizations Page
      • Hints Page
      • Warnings page
      • Assembler page
      • Linker page
    • Processor options page
    • IDE general page
  • Tools
    • User tools configuration
    • Show device characteristics
  • Language reference
    • Literal values
    • Identifiers
    • Comments
    • Integrated documentation
    • Directives
      • Overview
      • Conditional compilation
        • System-defined symbols
      • $ASSERTIONS | $C - Generate assertion code
      • $AUTODEFAULTS | $AD - Automatic Defaults
      • $BITMODE | $BM - PLC bit mode
      • $BOOLEVAL | $B - Boolean expression evaluation mode
      • $CODEGEN | $CG - PLC bit mode
      • $CONFIG - Configuration bits
      • $DEPRECATED - Define a unit, procedure or function as obsolete
      • $DUAL - Declare reserved dual port RAM
      • $EEPROM- Define useable EEPROM area
      • $EOL - Define end of line behavior
      • $EXTENDED - Enable / disable extended Pascal syntax
      • $FREQUENCY - Processor frequency
      • $HINT | $HINTS | $H - Define compiler hints behavior
      • $IDLOCS - Define user ID bytes
      • $INCLUDE | $I - Include source file
      • $INIT | $INITIALIZE - Define start-up initializations
      • $INTERRUPTS - Enable / disable / define interrupts
      • $JUMPS - Define jumps range
      • $NO_STD_SYMBOL_REDEFINE - No standard symbol redefine
      • $OPTIMIZE | $O - Define optimization modes
      • $OPTIMIZE_PARAMS - Define parameter passing optimization mode (obsolete)
      • $OPTIMIZE_RAM - Define RAM optimization mode (obsolete)
      • $OSCCAL – Activates or deactivates OSCCAL processor feature
      • $POINTERS | $P - Define pointers size
      • $POP – Restore compiler options
      • $PROCESSOR - Define processor
      • $PUSH – Save compiler options
      • $R - Range checking
      • $RESERVED RAM | EEPROM - Specify a memory region as unusable
      • $REGION / $ENDREGION - Define a folding region
      • $SCRIPT – Define the linker script to use
      • $SPACE | $S - Switch memory allocation to RAM or EEPROM
      • $STRICT – Enable / disable strict type control
      • $STRINGS - Set default string size
      • $TODO - "To do" list entry
      • $UERROR | $UE - Generate a compiler error
      • $UHINT | $UH - Generate a compiler hint
      • $UWARNING | $UW - Generate a compiler warning
      • $VARIABLES | $V - Define the memory region for RAM variables
      • $VECTORS - Define reset and interrupt vectors
      • $WARNING | $WARNINGS | $W - Define compiler warnings behavior
    • Constants
      • Configuration bits declaration as CONST
      • Special constants behaviors
      • Assembler equivalence of constants
      • Pseudo SET, IN keyword
      • Standard PIC registers and bit values
      • System constants and pseudo variables
      • Division / modulo special optimizations
      • EEPROM constants
    • Supported types
    • Types
      • Pointer types
      • Records
        • Record multi-bit fields
        • Dynamic records
    • Variables
      • Variables special behaviors
      • EEPROM memory allocation
      • Banking
      • Variables initial values
      • Variables internal names (as seen by the assembler)
      • Declaration at an ABSOLUTE address
      • Declaration as VOLATILE
      • Using special SFR casts
      • Special usage of bit number or reference
      • Declaration of SFR (Special Function Register) declaration
    • PROGRAM definition
    • UNIT definition
    • Procedures and functions
      • Parameter passing convention
      • Function RETURN statement
      • Side effect with string buffer and function calls
      • Open array parameters
      • Forward procedures and functions
      • External procedures and functions
        • Example of external .asm file
        • Memory allocation in assembler modules
      • Interrupt special procedures
    • Statements
      • Assignments and expressions
        • Operand size promotion, signed or unsigned
        • SHR & SHL "normal" behaviors
        • Divide operator /
        • Bitwise logical operators
        • Bit results and related special behaviors
        • PLC bit expressions and statements
      • ASM statement
      • BREAK statement
      • CASE statement
      • CONTINUE statement
      • FOR statement
      • FOR iterator
      • GOTO statement
      • ELSIF/ELSEIF statement
      • IF statement
      • LOOP statement
      • REPEAT statement
      • WHILE statement
      • WITH statement
    • Built-in functions
      • Math
        • ABS - Absolute value
        • MUL16 or MUL18 - Optimized multiply
        • MAX - Maximum of two values
        • MIN - Minimum of two values
      • Conversions
        • CHR - Value to CHAR
        • HEX - 4-bit value to hexadecimal CHAR
        • BCDBIN - 8-bit BCD to binary
        • BINBCD - 8-bit binary to BCD
        • ORD - Ordinal value
      • Conditional compilation
        • DEFINED - An identifier is defined
        • DEFINED_VALUE - Retrieve the value asserted to a defined identifier
        • DECLARED - An identifier is declared
        • IS_SFR - An identifier is a valid SFR
        • GET_xxxx - Get the associated PORTx/LATx/TRISx/WPUx
      • EE memory read
        • EEREAD - Read EEPROM
      • Buffer shifts
        • SHLB - Buffer left shift
        • SHRB - Buffer right shift
      • Miscellaneous
        • CARD - Get cardinality of an integer
        • HI - Get upper BYTE of a 16-bit value
        • HIGH - Get upper bound
        • HIWORD - Get upper WORD of a 32-bit value
        • LENGTH - Get length of a multi-elements identifier
        • LO - Get lower BYTE of a value
        • LOCASE - Get lowercase CHAR
        • LOW - Get lower bound
        • LOWORD - Get the lower WORD of a 32-bit value
        • PRED - Get previous
        • RANDOM - Get a pseudo random integer number
        • SIZEOF - Get the nb of bytes of a variable
        • SUCC - Next value
        • UPCASE - Get uppercase CHAR
      • Cast functions
    • Built-in procedures
      • Miscellaneous variable treatments
        • CLR - Clear a variable
        • FILL - Fill STRING or ARRAY elements
        • INC - Increment variable
        • DEC - Decrement variable
        • ROL - Rotate left variable
        • ROR - Rotate right variable
        • SHLB - Shift left buffer
        • SHRB - Shift right buffer
        • SWAP - Swap high and low parts of a variable
      • "console" procedures
        • ASSIGN procedure
        • ASSERT procedure
        • BAUD procedure
        • READ and READLN procedures
        • STR procedure
        • WRITE and WRITELN procedures
      • Delay routines
        • DELAY - microseconds
        • DELAY_NS - nanoseconds
        • DELAY_MS - milliseconds
        • DELAY_CY - cycles
      • Dynamic memory management
        • NEW - Allocate typed variable
        • DISPOSE - De-allocate typed variable
        • GETMEM - Allocate untyped variable
        • FREEMEM - De-allocate untyped variable
      • EE memory write
        • EEWRITE - Write to EEPROM
      • Bit management
        • EXCLUDE - Reset a bit in a variable
        • INCLUDE - Set a bit in a variable
        • TOGGLE - Flip a boolean or a bit within a variable
      • Floating Point management
        • FP_CLR - Clear FP flags
      • Miscellaneous
        • MOVE - Move a block of memory to another
        • PWM - Generate an analog-like output
        • RANDOMIZE - Initialize the random number generator
        • SFR_READ - Read and discard an SFR
      • Implied PIC statements
        • CLRWDT - Clear Watch Dog Timer
        • NOP - Generate NOP(s)
        • OPTION - Setup processor's OPTION register
        • RESET - Processor reset
        • SLEEP - Processor sleep
        • TRIS - Setup processor's TRIS register
    • Floating point
      • Overview
      • FP built-in functions
      • FP flags
    • Dynamic Memory Allocation
      • Overview
      • How it works
      • Error treatment
  • Libraries
    • Overview
    • Global usage rules
    • The LCD unit
      • Conditional compilation
      • Constants
      • Types
      • Interface
        • procedure LCD_Init
        • procedure LCD_GotoXY(XPos, YPos: byte)
        • procedure LCD_Write_Char(Ch: char)
        • procedure LCD_Clear
        • procedure LCD_Clear_EOL
        • procedure LCD_Clear_Line(YPos: byte)
        • function LCD_X: byte
        • function LCD_Y: byte
        • procedure LCD_Home
        • procedure LCD_WriteString(const romable St: LCD_String)
        • procedure LCD_MoveMode(Mode: byte)
        • procedure LCD_Cursor_On
        • procedure LCD_Cursor_Off
        • procedure LCD_DisplayMode(Mode: byte)
        • procedure LCD_ShiftMode(Mode: byte)
        • procedure LCD_User_Char_5x8(CharCode, ...)
        • procedure LCD_User_Char_5x8_array(CharCode, ...)
        • procedure LCD_User_Char_5x10(CharCode, ...)
        • procedure LCD_User_Char_5x10_array(CharCode, ...)
    • The KS107_108 (former GLCD) unit
      • Conditional compilation
      • Constants
      • Types
      • Interface
        • Low level functions
          • procedure GLCD_Init(Mode: tGLCD_InitMode)
          • procedure GLCD_Cmd(Cmd: byte)
          • procedure GLCD_WriteByte( ... )
          • function GLCD_ReadByte( ... )
        • High level functions
          • procedure FillScreen(State: tGLCD_FillMode)
          • procedure PlotPixel(X, Y: byte; State: tGLCD_PlotMode)
          • function GetPixel(X, Y: byte): boolean
          • procedure PlotData(X, Y, Data: byte; State: tGLCD_PlotMode)
          • procedure Line(X1, Y1, X2, Y2: byte; State: tGLCD_PlotMode)
          • procedure Rectangle(X1, Y1, X2, Y2: byte; FILL: tGLCD_FillMode; State: tGLCD_PlotMode)
          • procedure Circle(X, Y, Radius: byte; FILL: tGLCD_FillMode; State: tGLCD_PlotMode)
          • procedure Text(X, Y: byte; const St: tGLCD_String; State: tGLCD_PlotMode)
    • The SERIAL unit
      • Types
      • Variables
      • Interface
        • function SerialPort_InputReady: boolean
        • function SerialPort_Input: byte
        • procedure SerialPort_Output(Ch: byte)
        • procedure SerialPort_OutputString(const romable S: SerialString)
    • The SSERIAL unit
      • Conditional compilation
      • Types
      • Interface
        • procedure SerialPort_Init
        • function SerialPort_InputReady: boolean;
        • function SerialPort_Input: byte
        • procedure SerialPort_Output(Ch: byte)
        • procedure SerialPort_OutputString(const romable S: SerialString)
    • The A2D unit
      • Types
      • Interface
        • A2D_Init( ... )
        • function A2D_Get(Channel: byte): tA2D_Result
    • The CHARLIE unit
      • Conditional compilation
      • Constants
      • Types
      • Interface
        • procedure CharliePlexing( ... )
    • The DELAYS_TMR0 unit
      • Conditional compilation
      • Constants
      • Types
      • Variables
      • Interface
        • procedure TMR0_Delays_Init
        • procedure TMR0_Delay_Set( ... )
        • function TMR0_Delay_Get( ... ): word
        • function TMR0_Delay_Terminated( ... ): boolean
        • function TMR0_Delay_Elapsed( ... ): boolean
        • procedure TMR0_Delay_Start( ... )
        • procedure TMR0_Delay_Restart( ... )
        • procedure TMR0_Delay_Stop( ... )
    • The PWM_CCP unit
      • Conditional compilation
      • Constants
      • Interface
        • procedure PWM_Init
        • procedure PWM_Start
        • procedure PWM_Duty(...)
        • procedure PWM_Stop(...)
  • Compiler error messages
  • "to do"
  • $(mydocs)
  • $(myprojects)
  • $(pmp)
  • $(project)
  • $AD
  • $ASSERTIONS
  • $AUTODEFAULTS
  • $B
  • $BITMODE
  • $BM
  • $BOOLEVAL
  • $C
  • $CG
  • $CODEGEN
  • $CONFIG
  • $D
  • $DEF
  • $DEFINE
  • $DEPRECATED
  • $DUAL
  • $EEPROM
  • $ELSE
  • $ELSEIF
  • $ELSIF
  • $ENDIF
  • $ENDREGION
  • $EOL
  • $EXTENDED
  • $FREQUENCY
  • $H
  • $HINT
  • $HINTS
  • $I
  • $IDLOC
  • $IDLOCS
  • $IF
  • $IFDEF
  • $IFEND
  • $IFNDEF
  • $IFOPT
  • $INCLUDE
  • $INIT
  • $INITIALIZE
  • $INTERRUPTS
  • $JUMPS
  • $NO_STD_SYMBOL_REDEFINE
  • $O
  • $OPTIMIZE
  • $OPTIMIZE SPEED
  • $OPTIMIZE_PARAMS
  • $OPTIMIZE_RAM
  • $OSCCAL
  • $P
  • $POINTERS
  • $POP
  • $PROCESSOR
  • $PUSH
  • $REGION
  • $RESERVED
  • $S
  • $SCRIPT
  • $SPACE
  • $STRICT
  • $STRINGS
  • $TODO
  • $UE
  • $UERROR
  • $UH
  • $UHINT
  • $UNDEF
  • $UNDEFINE
  • $UW
  • $UWARNING
  • $V
  • $VARIABLES
  • $VECTORS
  • $W
  • $WARNING
  • $WARNINGS
  • __CONFIG
  • A2D_Acqt
  • A2D_Channels
  • A2D_Clock
  • A2D_Init
  • A2D_Mode
  • A2D_Vref_Mode
  • ABS
  • ABSOLUTE
  • Additional files to link
  • address
  • addresses
  • ALL
  • allocation
  • ANALOGS
  • AND
  • ARCCOS
  • ARCSIN
  • ARCTAN
  • argument
  • arguments
  • ARRAY
  • Arrays
  • ASM
  • Assembler
  • Assembler options
  • Assembler Page
  • ASSERT
  • assertion
  • ASSIGN
  • associations
  • AUTO
  • automatic default options
  • banking
  • BASELINE
  • BAUD
  • BCD
  • BCDBIN
  • Beacon
  • BIGINT
  • BIGWORD
  • BINBCD
  • BITS
  • blink a LED
  • Bold
  • BOOLEAN
  • bound
  • boundary
  • Braces
  • BREAK
  • BY
  • by address
  • by value
  • by-address
  • BYTE
  • BYTES
  • CALL
  • CALLS
  • CARD
  • CASE
  • cast
  • category
  • CCP
  • CHAR
  • characteristics
  • Charlie
  • Charlie Plexing
  • Charlie_LAST_LED
  • Charlie_MAX_LEDS
  • CharliePlexing
  • Check for updates
  • Circle
  • Clear
  • CLR
  • CLRWDT
  • code folding
  • code tree
  • command line
  • Comments
  • COMPARATORS
  • compatibility
  • compiler
  • Compiler Page
  • compiler progression
  • compressed
  • Conditional defines
  • CONFIG
  • CONST
  • CONTINUE
  • corrupted
  • COS
  • CTRL
  • cursor
  • CURSOR_MOVE_LEFT
  • CURSOR_MOVE_RIGHT
  • CURSOR_MOVE_TEXT
  • cycles
  • DAC
  • DATA
  • datasheet
  • datasheets
  • DEBUG
  • debug mode
  • DEC
  • DECLARED
  • Decrement
  • DEFAULT
  • Default string size
  • DEFINED
  • DEFINED_VALUE
  • DELAY
  • DELAY_CY
  • DELAY_MS
  • DELAY_NS
  • Delphi
  • device
  • device class
  • DINT
  • directive
  • directive-toggle
  • DISPLAY_CURSOR_BLINK
  • DISPLAY_CURSOR_FIXED
  • DISPLAY_CURSOR_OFF
  • DISPLAY_CURSOR_ON
  • DISPLAY_TEXT_OFF
  • DISPLAY_TEXT_ON
  • DISPOSE
  • DIV
  • divide
  • dmElapsed
  • dmOneShot
  • documentation
  • documents
  • domain
  • Download
  • downloaded
  • downloading
  • DOWNTO
  • Drag'n drop
  • duty
  • DWORD
  • dynamic
  • E003
  • EACH
  • EBNF
  • EEPROM
  • EEREAD
  • EEWRITE
  • Elapsed
  • elements
  • ELSE
  • ELSEIF
  • e-mail
  • ENHANCED
  • enumerated
  • Enumeration
  • ENUMS
  • ERROR
  • example code
  • EXCLUDE
  • EXP
  • EXTENDED
  • extended file / folder dialog
  • extensions
  • FAST
  • feature
  • fill
  • FillScreen
  • Filter
  • first run
  • folder
  • font
  • FOR
  • forever
  • FP
  • FP_CLR
  • FP_FLAGS
  • FREE
  • FREEMEM
  • FREQUENCY
  • function
  • generic scripts
  • GET_LAT
  • GET_PORT
  • GET_TRIS
  • GET_WPU
  • GETMEM
  • GetPixel
  • GIE
  • GLCD_Cmd
  • GLCD_CS1
  • GLCD_CS2
  • GLCD_Init
  • GLCD_ReadByte
  • GLCD_WriteByte
  • GOTO
  • GPASM
  • GPIO
  • GPLINK
  • GPUTILS
  • HD44780
  • Heap
  • hello world
  • help
  • HI
  • HIGH
  • HIGHPERF
  • hint
  • hints
  • HZ
  • IDE
  • IDLOC
  • IDLOCS
  • IN
  • INC
  • INCLUDE
  • Increment
  • InErrorCode
  • infinity
  • INIT
  • initial
  • INITIALIZATION
  • INITIALIZE
  • INPUT
  • INT
  • INT_HIGH
  • INT_LOW
  • INT16
  • INT32
  • INT64
  • INT8
  • INTEGER
  • INTERRUPT
  • INTERRUPTS
  • IS_SFR
  • iterator
  • JUMPS
  • keywords
  • KHZ
  • KS107
  • KS108
  • Label
  • LARGE
  • LCD
  • LCD_4BIT_UPPER
  • LCD_BIT_E
  • LCD_BIT_RS
  • LCD_BITS
  • LCD_Clear
  • LCD_Clear_EOL
  • LCD_Clear_Line
  • LCD_CNTRL
  • LCD_Cursor_Off
  • LCD_Cursor_On
  • LCD_DATA
  • LCD_DATA_DELAY
  • LCD_DELAY_DATA
  • LCD_DELAY_ENABLE
  • LCD_DELAY_HOME
  • LCD_DELAY_WAIT
  • LCD_DisplayMode
  • LCD_ENABLE_DELAY
  • LCD_GEN
  • LCD_GotoXY
  • LCD_Home
  • LCD_Init
  • LCD_LINES
  • LCD_MoveMode
  • LCD_READ
  • LCD_ShiftMode
  • LCD_String
  • LCD_User_Char_5x10
  • LCD_User_Char_5x10_array
  • LCD_User_Char_5x8
  • LCD_User_Char_5x8_array
  • LCD_WAIT_DELAY_HOME
  • LCD_WAIT_DELAY_NORMAL
  • LCD_Width
  • LCD_WR
  • LCD_Write_Char
  • LCD_WriteString
  • LCD_X
  • LCD_Y
  • LED
  • LENGTH
  • LFSR
  • libraries
  • library
  • Line
  • link
  • linker
  • Linker options
  • Linker Page
  • linker scripts
  • links
  • LN
  • LO
  • LOCASE
  • LONG
  • LONGINT
  • LONGWORD
  • LOOP
  • LOW
  • LOWORD
  • LSB
  • macros
  • main
  • Main File
  • main program file
  • MAX
  • MAXBIGINT
  • MAXBIGWORD
  • MAXINT
  • MAXLONGINT
  • MAXLONGWORD
  • MAXWORD
  • MEMORY
  • message
  • MHZ
  • Microchip
  • MIDRANGE
  • milliseconds
  • MIN
  • MINBIGINT
  • MINBIGWORD
  • MININT
  • MINLONGINT
  • MINLONGWORD
  • MINWORD
  • MOD16
  • MOD16S
  • MOD32
  • MOD32S
  • MOD8
  • MODULA
  • MOVE
  • MPASM
  • MPLAB
  • MPLAB-X
  • MPLINK
  • MUL16
  • MUL18
  • multi-bit
  • MULTIPLE
  • multiply
  • NaN
  • NEW
  • non blocking delays
  • NONE
  • NOP
  • NORMAL
  • OBERON
  • OFF
  • ON
  • OOP
  • open
  • optimization
  • Optimize
  • OPTION
  • options
  • OR
  • OUT
  • OUTPUT
  • overflow
  • owner
  • P/N
  • package
  • parameter
  • parameters
  • PARAMS
  • Parentheses
  • Part Number
  • Pascal
  • PI
  • PIC16
  • PIC16+
  • PIC16E
  • PIC18
  • pin-out
  • PLC
  • PlotData
  • PlotPixel
  • Pointer
  • POINTERS
  • PORTS
  • POW
  • precise time
  • PRED
  • previous
  • priority
  • procedure
  • PROCESSOR
  • Processor options page
  • PROGRAM
  • programming specifications
  • project options
  • Project Page
  • Project version
  • PROJECT_VERSION_BUILD
  • PROJECT_VERSION_MAJOR
  • PROJECT_VERSION_MINOR
  • PROJECT_VERSION_REVISION
  • PROJECT_VERSION_STRING
  • projects
  • Projects path
  • promotion
  • pseudo-XML
  • PWM
  • PWM_Duty
  • PWM_Init
  • PWM_Start
  • PWM_Stop
  • QINT
  • QWORD
  • RAM
  • random
  • RANDOMIZE
  • READ
  • READLN
  • REAL
  • RECORD
  • Rectangle
  • remainder
  • REPEAT
  • RESERVED
  • RESET
  • Reset bit
  • RESULT
  • RETURN
  • ROL
  • ROM
  • ROMABLE
  • root
  • ROR
  • Rotate
  • ROUND
  • SCRIPT
  • SELF
  • SERIAL
  • SerialPort_Input
  • SerialPort_InputReady
  • SerialPort_Output
  • SerialPort_OutputString
  • SerialString
  • SET
  • Set bit
  • SFR
  • SFR_READ
  • shared
  • shared documents
  • Shift
  • SHIFT_LEFT
  • SHIFT_RIGHT
  • SHIFT_TEXT
  • SHL
  • SHLB
  • shortcuts
  • SHORTINT
  • SHR
  • SHRB
  • signed
  • SIN
  • SINGLE
  • size
  • SIZEOF
  • SLEEP
  • slice
  • slices
  • SMALL
  • SPACE
  • SPEED
  • SQR
  • SQRT
  • Square brackets
  • STR
  • STRING
  • string buffer
  • STRINGS
  • sub-folder
  • SUCC
  • successful compile
  • suffix
  • SWAP
  • tA2D_Channels
  • tA2D_Vref_Mode
  • TAN
  • tDelays_Mode
  • tDelays_Slot
  • template files
  • Text
  • tGLCD_FillMode
  • tGLCD_InitMode
  • tGLCD_PlotMode
  • tGLCD_RegisterMode
  • tGLCD_String
  • tLCD_User_Char_array_10
  • tLCD_User_Char_array_8
  • tLEDs_Mask
  • TMR0
  • TMR0_Delay_Elapsed
  • TMR0_Delay_Set
  • TMR0_Delay_Start
  • TMR0_Delay_Stop
  • TMR0_Delay_Terminated
  • TMR0_Delays_Init
  • TO
  • tools
  • TP
  • TRIS
  • TRISIO
  • TRUNC
  • TYPE
  • UERROR
  • UHINT
  • UINT16
  • UINT32
  • UINT64
  • UINT8
  • underflow
  • UNIQUE
  • UNIT
  • unsigned
  • UNTIL
  • UPCASE
  • uppercase
  • user tools
  • UWARNING
  • VAR
  • VARIABLES
  • variables addresses
  • VECTORS
  • VERSION
  • VERSION_BUILD
  • VERSION_MAJOR
  • VERSION_MINOR
  • VERSION_REVISION
  • VERSION_STRING
  • VOLATILE
  • WARNING
  • WARNINGS
  • WDT
  • WHILE
  • WITH
  • WORD
  • WRITE
  • WRITELN
  • XML
  • XML documentation
  • XOR