Pic Micro Pascal PMP is a free Pascal cross compiler for PIC microcontrollers. It is intended to work with the Microchip TechnologyMPLAB suite installed; it has its own IDE and it is a highly optimized compiler. It is intended to target 8-bit processors only: PIC10, PIC12, PIC16, PIC16 enhanced, PIC18. The main axis of development was to avoid special built-in functions and procedures to interface hardware registers. These registers are accessed directly as variables, there are no wrapper functions, and emitted code is quite compact. PMP does not include an assembler or linker. It is designed to work with the Microchip MPLAB suite installed, and directly uses MPASM and MPLINK.lkr files for memory mapping initializations; as of V2 it comes with its own database for processor features and standard register definitions. PMP also supports the GPUTILS suite.
PMP does not support object-oriented programming, but a RECORD can have methods. As of 2014, the implementation supports multiple file compiling, by include directives and by a per unit concept. PMP supports a unique feature: variables may be declared in EEPROM and then used transparently as any other variable. PMP's data types:
unsigned and signed 8-bit integer types: CHAR, BYTE, SHORTINT
unsigned and signed 16-bit integer types: WORD, INTEGER
unsigned and signed 32-bit integer types: LONGWORD, LONGINT
enumerations
arrays : ARRAY
strings : STRING
pointers
floating point variables and operations : two FP formats, one 48-bit internal and a subset of the IEEE 32 bits format ; both formats do not handle infinite and NaN
Language dialect
PMP syntax is very close to the non-OOP syntax of Turbo Pascal or Delphi, with some extensions to support some target processor features. program Beacon; uses A2D; var I_IR_Receiver : boolean @PORTB.4; // TSOP1736 IR receiver O_LED_RECEIVING : boolean @PORTC.0; // Receive in progress O_LED_ERROR : boolean @PORTC.1; // Receive error O_PWM_A : boolean @PORTC.4; // PWM to US transducer phase A O_PWM_B : boolean @PORTC.5; // PWM to US transducer phase B
cLED_ON = TRUE; cLED_OFF = FALSE; // pins that are inputs TRISA_MASK = ; TRISB_MASK = ; TRISC_MASK = ; begin ... PORTA := 0; // Prepare all outputs TRISA := TRISA_MASK; // Set pins direction ... A2D_Init; Baud; // setup serial port assign; writeln; ... end.
Since version 1.6, some language "extensions" may be used, most of them coming from other Pascal-Like languages such as Oberon or Modula: ... FOR I in SomeVar DO FOR I := X TO Y BY n DO LOOP END IF Condition1 THEN ELSIF Condition2 THEN RETURN SomeResult