Pic Micro Pascal
Encyclopedia
Pic Micro Pascal aka PMP is a free Pascal
Pascal (programming language)
Pascal is an influential imperative and procedural programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structuring.A derivative known as Object Pascal...

 cross compiler
Cross compiler
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is run. Cross compiler tools are used to generate executables for embedded system or multiple platforms. It is used to compile for a platform upon which it is not feasible to...

 for PIC microcontroller
PIC microcontroller
PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division...

s. It is intended to work with the Microchip Technology
Microchip Technology
Microchip Technology is an American manufacturer of microcontroller, memory and analog semiconductors. Its products include microcontrollers , Serial EEPROM devices, Serial SRAM devices, KEELOQ devices, radio frequency devices, thermal, power and battery management analog devices, as well as...

 MPLAB
MPLAB
MPLAB Integrated Development Environment is a free, integrated toolset for the development of embedded applications on Microchip's PIC and dsPIC microcontrollers.- MPLAB IDE v8 :...

 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
Microchip
Microchip can also refer to:* Integrated circuit, a set of electronic components on a single unit.* Microchip Technology, a company that makes popular 8, 16 and 32-bit microcontroller lines.* Microchip implant , a microchip implanted into animals....

 MPLAB
MPLAB
MPLAB Integrated Development Environment is a free, integrated toolset for the development of embedded applications on Microchip's PIC and dsPIC microcontrollers.- MPLAB IDE v8 :...

 suite installed, and directly uses MPASM and MPLINK .inc, .dev and .lkr files for standard register definitions, processor features, and memory mapping initializations.

PMP also supports the GPUTILS
GPUTILS
GPUTILS is a GPL-licensed set of tools for the PIC microcontroller, comprising an assembler, disassembler, linker, and object file viewer. It is available for various flavors of Unix, Mac OS X, and Microsoft Windows.-History:...

 suite partly. A better integration is in progress.

Language features

PMP does not support object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, but a RECORD can have methods.

As of 2011, the implementation supports multiple file compiling, by include directives and by a per unit concept.

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 40-bit internal (REAL) and a subset of the IEEE 32 bits format (SINGLE); both formats do not handle infinite and NaN
    NaN
    In computing, NaN is a value of the numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations...


Language dialect

PMP syntax is very close to the non-OOP
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 syntax of Turbo Pascal
Turbo Pascal
Turbo Pascal is a software development system that includes a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS, developed by Borland under Philippe Kahn's leadership...

 or Delphi, 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)
{ Beacon Addr dip switches }
I_ADDR_0 : boolean @PORTA.2;
I_ADDR_1 : boolean @PORTA.5;

CONST
LOW_BATT_SENSOR_CHANNEL = ANS0; // Channel for battery measurement (RA0)

{ Led on/off values }
cLED_ON = TRUE;
cLED_OFF = FALSE;

// pins that are inputs
TRISA_MASK = [I_NOT_OPTION_SERIAL, I_ADDR_0, I_ADDR_1];
TRISB_MASK = [I_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.

History

PMP was created in 2006 by Philippe Paternotte and released as freeware
Freeware
Freeware is computer software that is available for use at no cost or for an optional fee, but usually with one or more restricted usage rights. Freeware is in contrast to commercial software, which is typically sold for profit, but might be distributed for a business or commercial purpose in the...

 for now, as free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

in the future. The latest version is 1.6.1, July 2011.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK