Pic Micro Pascal PMP is a free
Pascal cross compiler for
PIC microcontroller
PIC (usually pronounced as /pɪk/) is a family of microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to ''Peripher ...
s. It is intended to work with the
Microchip Technology
Microchip Technology Incorporated is a publicly listed American semiconductor corporation that manufactures microcontroller, mixed-signal, analog, and Flash-IP integrated circuits.
Its corporate headquarters is located in Chandler, Arizona. ...
MPLAB MPLAB is a proprietary freeware integrated development environment for the development of embedded applications on PIC and dsPIC microcontrollers, and is developed by Microchip Technology. suite installed; it has its own IDE (
Scintilla-based) 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
An integrated circuit (IC), also known as a microchip or simply chip, is a set of electronic circuits, consisting of various electronic components (such as transistors, resistors, and capacitors) and their interconnections. These components a ...
MPLAB MPLAB is a proprietary freeware integrated development environment for the development of embedded applications on PIC and dsPIC microcontrollers, and is developed by Microchip Technology. 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.
Language features
PMP does not support
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impl ...
, 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 (with some limitations).
PMP's data types:
* simple records (subset): RECORD
* bit booleans: BOOLEAN
* 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 (one dimension): ARRAY
* strings (variable length): STRING
* pointers (subset)
* floating point variables and operations (PIC16 and PIC18 only): two FP formats, one 48-bit internal (REAL) and a subset of the
IEEE 32 bits format (SINGLE); both formats do not handle infinite and
NaN
Language dialect
PMP syntax is very close to the non-
OOP syntax of
Turbo Pascal
Turbo Pascal is a software development system that includes a compiler and an integrated development environment (IDE) for the programming language Pascal (programming language), Pascal running on the operating systems CP/M, CP/M-86, and MS-DOS. ...
or
Delphi
Delphi (; ), in legend previously called Pytho (Πυθώ), was an ancient sacred precinct and the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient Classical antiquity, classical world. The A ...
, with some extensions to support some target processor features (bit manipulations ...).
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 (addr cannot be changed)
O_PWM_B : boolean @PORTC.5; // PWM to US transducer phase B (addr cannot be changed)
I_ADDR_0 : boolean @PORTA.2;
I_ADDR_1 : boolean @PORTA.5;
CONST
LOW_BATT_SENSOR_CHANNEL = ANS0; // Channel for battery measurement (RA0)
cLED_ON = TRUE;
cLED_OFF = FALSE;
// pins that are inputs
TRISA_MASK = _NOT_OPTION_SERIAL, I_ADDR_0, I_ADDR_1
TRISB_MASK = _IR_Receiver
TRISC_MASK = [];
begin
...
PORTA := 0; // Prepare all outputs
TRISA := TRISA_MASK; // Set pins direction
...
A2D_Init([LOW_BATT_SENSOR_CHANNEL], 5, adcFosc16, adm8Bits, advVdd);
Baud(19200); // setup serial port
assign(output, SerialPort_Output);
writeln('Hello world!');
...
end.
Since version 1.6, some language "extensions" may be used (with explicit activation), most of them coming from other Pascal-Like languages such as
Oberon
Oberon () is a king of the fairy, fairies in Middle Ages, medieval and Renaissance literature. He is best known as a character in William Shakespeare's play ''A Midsummer Night's Dream'', in which he is King of the Fairies and spouse of Titania ...
or
Modula
The Modula programming language is a descendant of the Pascal language. It was developed in Switzerland, at ETH Zurich, in the mid-1970s by Niklaus Wirth, the same person who designed Pascal. The main innovation of Modula over Pascal is a mo ...
:
...
FOR I in SomeVar DO (* SomeVar may be any variable or an enumeration type *)
FOR I := X TO Y BY n DO (* Specification of the variable step value *)
LOOP END (* Forever loop *)
IF Condition1 THEN ELSIF Condition2 THEN (* Shortcut for ELSE IF *)
RETURN SomeResult (* Function's result value assignment and exit *)
History
PMP was created in 2006 by Philippe Paternotte and released as
freeware
Freeware is software, often proprietary, that is distributed at no monetary cost to the end user. There is no agreed-upon set of rights, license, or EULA that defines ''freeware'' unambiguously; every publisher defines its own rules for the free ...
for now, as
free software
Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
in the future. The latest version is 2.0.6, September 2014.
PMP has been the subject of an article in
SERVO Magazine
''SERVO Magazine'' is a monthly robotics publication produced by T&L Publications. The first issue appeared in November 2003. ''SERVO Magazine'' was a primary sponsor behind the Tetsujin competition, a contest where teams were challenged to desi ...
in March 2015.
[March 2015 ]SERVO Magazine
''SERVO Magazine'' is a monthly robotics publication produced by T&L Publications. The first issue appeared in November 2003. ''SERVO Magazine'' was a primary sponsor behind the Tetsujin competition, a contest where teams were challenged to desi ...
article, Thomas Henry, 2015
/ref>
References
External links
*
Official forum
French Developpez' site page about PMP
{{Pascal programming language family
Procedural programming languages
Pascal (programming language) compilers
Pascal programming language family
Cross-compilers
2006 software