Pascal? On My Arduino? It’s More Likely Than You Think

Screenshot of AVRpascal

The Arduino ecosystem is an amazing learning tool, but even those of us who love it admit that even the simplified C Arduino uses isn’t the ideal teaching language. Those of us who remember learning Pascal as our first “real” programming language in schools (first aside from BASIC, at least) might look fondly on the AVRPascal project by [Andrzej Karwowski].

[Andrzej] is using FreePascal’s compiler tools, and AVRdude to pipe compiled code onto the micro-controller. Those tools are built into his AVRPascal code editor to create a Pascal-based alternative to the Arduino IDE for programming AVR-based microcontrollers. The latest version, 3.3, even includes a serial port monitor compatible with the Arduino boards.

This guy, but with Pascal. What’s not to love?

The Arduino comparisons don’t stop there: [Andrzej] also maintains UnoLib, a Pascal library for the Arduino Uno and compatible boards with some of the functionality you’d expect from Arduino libraries: easy access to I/O (digital and analog ports) timers, serial communication, and even extras like i2c, LCD and sensor libraries.

He’s distributing the AVRPascal editor as freeware, but it is not open source. It’s too bad, because Pascal is a great choice for microcontrollers: compiled, it isn’t much slower than C, but it can be as easy to write as Python. Micropython shows there’s a big market for “easy” embedded programming; Pascal could help fill it in a more performant way. Is the one-man license holding this project back, or is it just that people don’t use Pascal much these days?

While AVR programming is mostly done in C, this is hardly the first time we’ve seen alternatives. While some have delved into the frightening mysteries of assembly, others have risen to higher abstraction to run LISP or even good old fashioned BASIC. Pascal seems like a good middle road, if you want to go off the beaten path away from C.

Via reddit.

32 thoughts on “Pascal? On My Arduino? It’s More Likely Than You Think

  1. Pascal was/is still just nice language!

    I grew up writing that A LOT. Also Delphi was mind blowing. RAD on Windows! And funny thing is that those Delphi binaries I have compiled 20 years a go work on modern Windows machines. And of course, without installing anything.

    TP/Delphi was so way ahead back in the days. Such enjoyable way to do software. And still being used..

    1. I second that. Great times. I always miss those basic things that C was always lacking…like the compiler could actually help you with the exact place and type of the error, and not just reporting some weird issue several rows later, and still being incorrect about the real issue :)

    2. I have many happy memories of Delphi. The palette of GUI components was enormous fun. I write a lot of Python now and it has many advantages, but trying to build a GUI from the command line using TK is excruciating.

        1. Have used SG on two projects. It cannot be considered close to the stuff I did with TP+TV, and later Borland C Builder over 30 years ago.

          Software dev sucks worse with each year into the 21st century. Get off of my dirt.

        2. Sadly, this would not be allowed. I write code for other people in the company to execute and I’m not allowed to use non-standard libraries – they can’t be expected to pip install anything before running the .py file. That means TK only.

    3. TP/Delphi was so way ahead back in the days. Such enjoyable way to do software. And still being used..

      The Calmira shell for Windows 3.1 was being developed using Delphi 1.0..
      Delphi 2 was unofficially used to write Win32s compatible applications.
      Delphi 3 Professional was often included in Delphi books for free.
      Last but not leistet, Delphi 7 added Windows XP support (+manifest file for GDI+ style GUI elements).
      It was being widely used up until 2020, I believe.

      Then there are the lesser known sisters of Delphi.
      Turbo Pascal for Windows 1.x (aka TPW), Borland Pascal 7 for Windows (aka BPW or BP7)..
      Both used OWL, which Delphi still had being supported next to VCL.
      On Linux, there used to be Kylix, which wasn’t too shabby, either.
      Or let’s take Lazarus – an Object Pascal IDE (not by Borland).

    4. I grew up writing that A LOT. Also Delphi was mind blowing. RAD on Windows!

      Delphi was often used in conjunction with VB5/6, I think.
      The great thing about Delphi was that it could be used to write DLLs.
      Both had great RAD IDEs, I think. VB Classic had used the old, humble Visual Studio.

      And funny thing is that those Delphi binaries I have compiled 20 years a go work on modern Windows machines. And of course, without installing anything.

      +1

    5. You all must be using some different language called Pascal. Pure Pascal was such a straitjacket that I can’t imagine anyone willingly choosing it for anything larger than a first- or second-year class assignment. I’m still traumatized from doing compiler assignments in it.

      1. Hi! Turbo Pascal really made a difference, I think.
        By mid-80s, many lesser known Pascal compilers took inspiration from TP.

        Turbo Pascal wasn’t just a Borland product name, but became a language of its own.
        Like a dialect, so to say. Like Microsoft Basic being a dialect compared to original BASIC.

        There’s even QuickPascal by Microsoft, for example.
        Borland Turbo Basic (later: PowerBASIC) was an reverse attempt to compete with QuickBASIC.
        https://en.wikipedia.org/wiki/Microsoft_Pascal

        Then Turbo Pascal evolved into Object Pascal/Delphi.
        Just like QuickBASIC/PDS evolved into Visual Basic (aka VB Classic).

      2. Definitely an imagination problem you have, there.

        We ran on the IBM PC/XT/AT, the DecStations, HP, IBM and SUN workstations, using Pascal as the common language for the application. First release was hundreds of thousands of lines, using Microsoft Pascal for the x86 stuff. Bitmapped graphics, chorded keyboard commands, mouse inputs.

  2. i don’t get it. this project is just an awful and closed IDE (nothing personal, but you know it has all the regular IDE downsides, plus bugs from novelty, plus bugs from closedness) for freepascal? isn’t freepascal the headline, and an old one at that?

    i also don’t understand “it isn’t much slower than C, but it can be as easy to write as Python.” isn’t pascal exactly as fast as C, supporting essentially the same idioms, with only a slight difference in the maturity of the compilers to differentiate them? and isn’t pascal exactly as easy to write as C is?

    i don’t even find python easy to write…it has a lot of purely awful conventions, mostly focused on its object model. but its ease according to its fans is based around its obscuration of pointers, garbage collection, and set of idioms that encourage the absolute worst list processing. but pascal is almost indistinguishable from C, and extremely distinguished from python. arduino users in 2025 are supposed to find BEGIN/END easier than { } ?

  3. I would tend to think Ada would potentially be a better choice than pascal, but I have no problem with Pascal.

    Gcc supports ada. I wonder how much effort it would be to get microcontroller support.

    1. i think now that ‘microcontroller’ to most people means some sort of arm32 like rp2040 or stm32 or esp32, i think it’s simply a matter of porting a minimal runtime library and then building gnat (gcc ada) with –target=arm-none-eabi.

      trying to gauge the size of the effort of making a suitable runtime library, i found this resource, which makes it look rather involved, but also says you can use AdaCore’s ‘community edition’ on embedded ARM :)

      https://wiki.osdev.org/Ada_Runtime_Library

  4. On 2004 (or 2005) I discovered JAL ( https://www.voti.nl/jal/index_1.html ) it was a Pascal like compiler for PIC microcontrollers, at that time, I had one 16F84A, a couple of 16F628 and one 877 (which I have never finally used).

    JAL was very useful, cause, one of the issues I faced getting libs from sites like PicList was the compatibility of those libs between them (most of the time, none) every lib used to use it’s own set of macros for the same assembler, in witch case, to use a lib most of the time you just end writing the whole thing again. So JAL was pretty great at reusable code. I remember that there was even a simulator, that let me find a small bug on timings over a I2C lib that I used in a project.

    Later, I think around mid 2007 I discovered Arduino, having even a that time a much larger community. In Jan/2009, the only (3) Arduinos that I had were the ones that I made myself, and I wanted a nice looking one, so I contacted the Arduino Team and became the first official Arduino distributor for Argentina.

  5. BASCOM-AVR keeps churning out Basic coding on AVR. C is painful for me for the mere fact I don’t work in it every day. I could be more proficient if I did. Until the mfg’s reply to an alternative, BASCOM is working well for me

  6. Does anyone know of any competent books on learning C? All of the books I’ve read just list the commands and don’t really explain C in a good sense. The author(s) just thought they would put a book out.

  7. “AVRPascal editor as freeware, but it is not open source.”
    “I have made my best to ensure that the program works correctly, I cannot give any guarantees for the program operation and I am not liable”

    DEAD IN THE WATER.
    Makes me wonder how much open-source code was incorporated into this IDE and how many licenses were disregarded?

    Open it up, what do you fear?

    1. As I have written on my webpage and ReadMe.txt, AVRPascal uses binaries of FPC compiler, Avr8 GNU toolchain (used internally by FPC), and AVRdude, and none of their code is incorporated into the IDE. AVRPascal simply distributes these third-party binaries.

      I don’t rule out opening the project in the future, as a response to valuable user feedback. For example, we recently added a significant improvements to UnoLib (an open-source library used by AVRPascal), but the community rarely submits fixes, or comments on our work. So I invite you to first evaluate our changes and help in testing them :)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.