Pic Micro Pascal

Last updated
Pic Micro Pascal
Developer(s) Philippe Paternotte
Stable release
2.0.6 / September 9, 2014;6 years ago (2014-09-09)
Operating system Win32
Type Compiler
License Freeware
Website www.pmpcomp.fr

Pic Micro Pascala.k.a. PMP is a free Pascal cross compiler for PIC microcontrollers. It is intended to work with the Microchip Technology MPLAB suite installed; it has its own IDE (Scintilla-based) and it is a highly optimized compiler.

Contents

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.

Language features

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 (with some limitations).

PMP's data types:

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 (bit manipulations ...).

programBeacon;usesA2D;varI_IR_Receiver:boolean@PORTB.4;// TSOP1736 IR receiverO_LED_RECEIVING:boolean@PORTC.0;// Receive in progressO_LED_ERROR:boolean@PORTC.1;// Receive errorO_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;CONSTLOW_BATT_SENSOR_CHANNEL=ANS0;// Channel for battery measurement (RA0){ Led on/off values }cLED_ON=TRUE;cLED_OFF=FALSE;// pins that are inputsTRISA_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 portassign(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 or Modula:

...FORIinSomeVarDO<Statements>(* SomeVar may be any variable or an enumeration type *)FORI:=XTOYBYnDO<Statements>(* Specification of the variable step value *)LOOP<Statements>END(* Forever loop *)IFCondition1THEN<Statements>ELSIFCondition2THEN<Statements>(* Shortcut for ELSE IF *)RETURNSomeResult(* Function's result value assignment and exit *)

History

PMP was created in 2006 by Philippe Paternotte and released as freeware for now, as free software in the future. The latest version is 2.0.6, September 2014. [1]

PMP has been the subject of an article in SERVO Magazine in March 2015. [2]

Related Research Articles

In computer science, an integer is a datum of integral data type, a data type that represents some range of mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values. Integers are commonly represented in a computer as a group of binary digits (bits). The size of the grouping varies so the set of integer sizes available varies between different types of computers. Computer hardware, including virtual machines, nearly always provide a way to represent a processor register or memory address as an integer.

Pascal (programming language) Programming language

Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named in honour of the French mathematician, philosopher and physicist Blaise Pascal.

Data type classification of data in computer science

In computer science and computer programming, a data type or simply type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers, floating-point numbers, characters and Booleans. A data type constrains the values that an expression, such as a variable or a function, might take. This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored. A data type provides a set of values from which an expression may take its values.

In computer programming, a bitwise operation operates on one or more bit patterns or binary numerals at the level of their individual bits. It is a fast and simple action, directly supported by the processor, and is used to manipulate values for comparisons and calculations.

In computer science, primitive data type is either of the following:

ActionScript object-oriented programming language

ActionScript is an object-oriented programming language originally developed by Macromedia Inc.. It is influenced by HyperTalk, the scripting language for HyperCard. It is now an implementation of ECMAScript, though it originally arose as a sibling, both being influenced by HyperTalk.

In computer science, the Boolean data type is a data type that has one of two possible values which is intended to represent the two truth values of logic and Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century. The Boolean data type is primarily associated with conditional statements, which allow different actions by changing control flow depending on whether a programmer-specified Boolean condition evaluates to true or false. It is a special case of a more general logical data type —logic doesn't always need to be Boolean.

In computer science, a literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values such as integers, floating-point numbers, and strings, and usually for booleans and characters; some also have notations for elements of enumerated types and compound values such as arrays, records, and objects. An anonymous function is a literal for the function type.

The computer programming languages C and Pascal have similar times of origin, influences, and purposes. Both were used to design their own compilers early in their lifetimes. The original Pascal definition appeared in 1969 and a first compiler in 1970. The first version of C appeared in 1972.

IP Pascal is an implementation of the Pascal programming language using the IP portability platform, a multiple machine, operating system and language implementation system.

In the C programming language, data types constitute the semantics and characteristics of storage of data elements. They are expressed in the language syntax in form of declarations for memory locations or variables. Data types also determine the types of operations or methods of processing of data elements.

SystemVerilog hardware description and hardware verification language

SystemVerilog, standardized as IEEE 1800, is a hardware description and hardware verification language used to model, design, simulate, test and implement electronic systems. SystemVerilog is based on Verilog and some extensions, and since 2008 Verilog is now part of the same IEEE standard. It is commonly used in the semiconductor and electronic design industry as an evolution of Verilog.

In computer programming, an enumerated type is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language. An enumerated type can be seen as a degenerate tagged union of unit type. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. In other words, an enumerated type has values that are different from each other, and that can be compared and assigned, but are not specified by the programmer as having any particular concrete representation in the computer's memory; compilers and interpreters can represent them arbitrarily.

PLANC is a high level computer programming language. The acronym stands for Programming LAnguage for Nd Computers.

In computer science, type punning is a common term for any programming technique that subverts or circumvents the type system of a programming language in order to achieve an effect that would be difficult or impossible to achieve within the bounds of the formal language.

Concurrent Pascal is a programming language designed by Per Brinch Hansen for writing concurrent computing programs such as operating systems and real-time computing monitoring systems on shared memory computers.

SuperPascal is an imperative, concurrent computing programming language developed by Per Brinch Hansen. It was designed as a publication language: a thinking tool to enable the clear and concise expression of concepts in parallel programming. This is in contrast with implementation languages which are often complicated with machine details and historical conventions. It was created to address the need at the time for a parallel publication language. Arguably, few languages today are expressive and concise enough to be used as thinking tools.

Joyce is a secure programming language for concurrent computing designed by Per Brinch Hansen in the 1980s. It is based on the sequential language Pascal and the principles of communicating sequential processes (CSP). It was created to address the shortcomings of CSP to be applied as a programming language, and to provide a tool, mainly for teaching, for distributed computing system implementation.

The computer programming languages C and Object Pascal have similar times of origin, influences, and purposes. Both were used to design their own compilers early in their lifetimes.

In the C programming language, register is a reserved word, type modifier, storage class, and hint. The register keyword was deprecated in C++, until it became reserved and unused in C++17. It suggests that the compiler store a declared variable in a CPU register instead of in RAM. If possible, depending of type of CPU and complexity of the program code, it will optimize access to that variable, and will hence improve the execution time of a program. In C the location of a variable declared with register cannot be accessed, but the sizeof operator can be applied. Aside from this limitation, register is essentially meaningless in modern compilers due to optimization which will place variables in a register if appropriate regardless of whether the hint is given. For programming of embedded systems register may still be significant; for example the Microchip MPLAB XC32 compiler allows the programmer to specify a particular register with the keyword; however, this is discouraged in favor of the compiler's optimizations. When used, register is typically for loop counters, or possibly for other very frequently used variables in the code.

References

  1. Reference manual, PPA, 2014, Documentation for Pic Micro Pascal V2
  2. March 2015 SERVO Magazine article, Thomas Henry, 2015,