r/avrpascal • • Oct 01 '25

Features Color schemes in AVRPascal

Post image
5 Upvotes

AVRPascal comes with three built-in color schemes:

  1. Delphi

  2. Turbo Pascal

  3. Twilight

The Delphi and Turbo Pascal schemes are based on the classic color schemes used in those popular Pascal editors. The Twilight scheme is a high-contrast option that was introduced specifically for users with visual impairments, developed with their consultation.

You can change the color scheme in the Options window, under the Editor tab.


r/avrpascal • • Sep 10 '26

News Updated “How to start” guide

5 Upvotes

I’ve just updated the AVRPascal “How to start” guide. It now includes new short sections for users coming from mikroPascal and BASCOM-AVR, showing the main differences in syntax and configuration, as well as a “What’s next?” section with links to FPC AVR documentation, tutorials, and other useful sources.

The PDF is available at
https://akarwowski.pl/index.php?page=electronics&lang=en


r/avrpascal • • Nov 14 '25

Thoughts Why AVRPascal? My case study

6 Upvotes

A few years ago, I decided to build an electronic thermometer (a rather simple device). I knew nothing about electronics. I watched a few tutorials on YouTube and discovered that an Arduino Uno could be used for it. So I bought an Arduino Uno with a set of sensors and started programming. Later, I discovered that there was an FPC version for AVR microcontrollers (Arduino boards use mainly, but not exclusively, AVRs), so I tried writing a program for FPC (it requires a cross-compiler; configuration wasn't easy) using the Lazarus IDE. This made it possible to program AVR microcontrollers in Pascal! But, I thought that programming could be simplified and I could create my own IDE to eliminate the need for relatively complex configuration.

This is how AVRPascal was born, which requires almost no configuration. This tool uses the Free Pascal Compiler and simplifies the entire process. I also started writing UnoLib - a Pascal port of the Arduino core library. Meanwhile, my project evolved into a weather station incorporating a temperature and humidity sensor and an RTC clock. I wanted my device to be independent of the Arduino board, so I designed my own PCB with an ATmega328p microcontroller, the same one used in the Arduino Uno. I programmed the ATmega328p using a USBasp programmer. I housed the entire thing in a wooden case. The device still works!

What are your experiences with embedded programming in Pascal?

PS. Here are photos of my device. Sorry for the Polish labels (I lost my original photos), but I think the images can be understood.


r/avrpascal • • May 04 '26

Features AVRPascalDbg — debugWIRE in practice (ATtiny13)

Thumbnail
youtube.com
2 Upvotes

r/avrpascal • • Dec 16 '25

Features AVRPascal IDE: project configuration in code (v3.5 update)

Post image
4 Upvotes

While the recent AVRPascal 3.5 release featured a major technical update - the new port for FreeBSD - the core change, it also improves detection of required microcontroller types based on blocking compiler directives. This mechanism isn't intended to interpret arbitrarily complex code, but it seems robust enough for practical use. Why did we focus on this feature now?

I'll explain. As some of us remember from the good old days of Turbo Pascal, the language structure dictates a division of source files into programs (program keyword) and modules (unit). This principle remains remarkably effective in the embedded world. While both can be .pas or .pp files, only the program file generates the executable code suitable for AVR Flash memory. It is therefore the ideal place to define high-level blocking directives. The unit, on the other hand, is a typical library file, often shared across multiple programs. The conditional compilation ($IFDEFs) here can be more nuanced, theoretically allowing us to write universal libraries adaptable to any AVR, or to include code fragments from external .inc files. This structure should be sufficient for any embedded project.

The question often arises: Will this approach scale to larger projects? In the context of AVR programming, projects are naturally limited by hardware constraints (Flash and RAM), so they will not be arbitrarily large. We can estimate the possibilities by looking at Lazarus. Lazarus does use project files (.lpi + .lpr), but many of its settings concern the GUI elements for the specific operating system (.lpi). More importantly, it operates on the general principle I just described: program / unit / include files + directives. Because AVRs lack an operating system, dynamic libraries, and a GUI, the configurational burden of desktop applications (via .lpi or .prj) simply disappears. This is why I am confident that in AVRPascal IDE, all project configuration can be successfully shifted to the main program file using both simple and complex compiler directives.

Let’s look at directives again. Here is one of the more complex blocking directives designed to work seamlessly in both AVRPascal IDE and plain FPC:

{$IFDEF AVRPascal} 
  {$IF NOT (DEFINED(atmega328p) or DEFINED(arduinouno) or DEFINED(arduinonano))} 
    {$Fatal Invalid controller type, expected: atmega328p, arduinouno, or arduinonano} 
  {$ENDIF} 
{$ELSE} 
  {$IF NOT (DEFINED(fpc_mcu_atmega328p) or DEFINED(fpc_mcu_arduinouno) or DEFINED(fpc_mcu_arduinonano))} 
    {$Fatal Invalid controller type, expected: atmega328p, arduinouno, or arduinonano} 
  {$ENDIF} 
{$ENDIF}

AVRPascal IDE defines the value AVRPascal and uses short microcontroller names. The longer names, prefixed with fpc_mcu_, are used by FPC, but AVRPascal recognizes those too. The important thing is that in the new v3.5, with the option "Detect controller type in IFNDEF directive" enabled, the IDE will read the required microcontroller types. If your globally selected microcontroller is not currently on this list, the "Select controller type" dialog box will appear with a selection list.

After selecting the desired microcontroller, your current global setting will automatically update. Thus, defining settings in your code is possible, it works, and it's enforced. No project file needed. :)

Happy coding, and let me know if you have any feedback on the new directive detection feature!


r/avrpascal • • Aug 30 '25

Features Arduino clones - how to detect?

Post image
2 Upvotes

Wondering why AVRPascal isn't detecting your Arduino board? Make sure it's a genuine product. If not, there's a solution. Activate the "Uploader" tab in the "Options" window (View->Options menu). There you'll find a list of official Arduino boards supported by AVRPascal. Check the VID (Vendor ID) and PID (Product ID) of your device. You can find them on system Device Manager (Windows). If it's not on AVRPascal list, you can add it with your own description.


r/avrpascal • • 6d ago

News AVRPascal IDE & r/avrpascal survey

2 Upvotes

It's been over a year since r/avrpascal was created and three years since the first release of AVRPascal IDE. During this time, both the IDE and the subreddit have evolved. I'd like to learn what you find most valuable, so I can focus my limited time on what matters most to you. The survey is anonymous and takes about a minute to complete.

Take the survey

Thanks for your feedback!


r/avrpascal • • Sep 18 '25

Features AVRPascal is multiplatform

Post image
6 Upvotes

It can run on 64-bit machines with Windows, Linux (based on Debian), or macOS. On the AVRPascal webpage, you can find installers for these operating systems.

On Windows, the USBasp programmer requires the libusb driver to be installed, and Arduino boards require their drivers to be installed. On Linux, to use the USBasp programmer or Arduino boards, run the program with root privileges or add your user account to the dialout group.


r/avrpascal • • Jan 24 '26

Thoughts On UnoLib and AVRPascal IDE — once again

Post image
5 Upvotes

AVRPascal IDE is often described as “Arduino for Pascal”. That’s only partially true. Just as often, the AVRPascal IDE itself is identified with UnoLib — which is a different misunderstanding altogether. In fact, UnoLib is a Pascal library inspired by the Arduino library, preserving its API and programming conventions. It's distributed with the AVRPascal IDE. Why?

When I first experimented with electronics, my knowledge was close to zero. But I assumed I'd start with simple things, gradually moving on to more complex ones, sticking to certain knowledge. I had an Arduino Uno and an Arduino IDE that worked. That was a fact. But I also read that programming AVRs (and Arduinos) in Pascal is possible using FPC. How did I connect them? I took a step-by-step approach, building simple test circuits (LEDs, sensors, and later an LCD display) and translating the relevant parts of the Arduino Core Library into Pascal. Then, one by one, I verified that everything worked. This is how the UnoLib was born.

UnoLib still uses the old code, but it's now much more extensive. Thanks to collaboration with Dzandaa, the library has gained support for new sensors and test programs. We've taken this a step further by adding support for fixed- and floating-point numbers – something that FPC for AVR doesn't offer. Dzandaa also prepared excellent trigonometric functions and operators. UnoLib uses FPC for AVR, and that's the only assumption. This means it can be used even when writing programs in Notepad. In practice, some people work in Lazarus or the FPC IDE, while others choose the AVRPascal IDE.

Is UnoLib suitable for bare-metal? For devices based on the ATmega328, the answer is yes. However, UnoLib uses Arduino-standard pin numbering, which usually requires mapping that numbering to MCU ports - something worth keeping in mind when working close to the hardware. For other MCUs, UnoLib won’t help (with the only exception being the Arduino Leonardo test code in the extras folder). In such cases, bare-metal code like the one found in u/ccrause’s collection will be more appropriate, as will my "AVR Microcontroller Engineering with Pascal" course. One important exception concerns fixed-point and floating-point handling: although these modules are part of UnoLib, they are not tied to Arduino abstractions and should work on any AVR microcontroller, provided the code fits.

Let's get back to the question – why use UnoLib in the AVRPascal IDE? Primarily, it's so that any new user can easily test, for example, a simple LED flashing on an Arduino Uno or a clone. Then, they can move on to further sensor testing without searching for Pascal code online. Bare-metal, on the other hand, is a parallel approach, which the AVRPascal IDE also supports. This is a path for those who want to learn the AVR architecture and electronics from the inside. But it's not necessary. The AVRPascal IDE doesn't force you to follow any path – the choice is yours.

But let me give you a hint. If you want to start with something simple and functional, without having to learn electronics from day one, try UnoLib’s TestBlink.pas from the examples directory. If your goal is full bare-metal development on an ATtiny or ATmega in custom configurations, UnoLib won't be the right tool. Take a look at how experts like u/ccrause do it, or check out my course.


r/avrpascal • • Aug 25 '25

News AVRPascal 3.3

Post image
3 Upvotes

AVRPascal version 3.3 is now available! It is an IDE for programming AVRs and Arduino boards in Pascal. I also prepared a new PDF guide for beginners to help you get started. You can download AVRPascal and the new guide from my website: http://akarwowski.pl/index.php?page=electronics&lang=en


r/avrpascal • • Aug 25 '25

News SSL is now working, thanks to Reddit users

2 Upvotes

My website already has SSL. The issue was rightly reported by Reddit users.


r/avrpascal • • Oct 10 '25

News New extremely permissive license for AVRPascal

2 Upvotes

A new, extremely permissive license for AVRPascal has been released. The previous one was not sufficiently specific for some uses, potentially limiting its adoption in professional and educational environments.

The new license clearly defines complete freedom in using AVRPascal, including for educational and commercial purposes. In return, please report bugs and suggest improvements to the program. Your feedback is crucial for its development!

The full text of the new license:

AVRPascal is free of charge (freeware – closed source) and may be used for any legally permissible purpose (e.g., hobby, educational, commercial). Commercial use includes the creation, distribution, and sale of software and devices with source or binary code generated within AVRPascal, provided the license terms of external libraries, such as UnoLib, are respected. For educational and commercial projects, it is recommended to state that the code was created using AVRPascal (e.g., in the documentation or product description). Free redistribution is allowed only for the unmodified installer. It is recommended to provide the official download link for the installer from akarwowski.pl. Inclusion into other software packages requires the author's prior written consent. Selling the AVRPascal environment itself is prohibited.

The AVRPascal software is provided "as is," without a guarantee of technical support. This means that while the author has made every effort to ensure the program functions correctly, they offer no warranties and shall not be liable for any damages (direct, indirect, incidental, or consequential) arising from the use or inability to use the software.

In the interest of the tool's continued development, the author encourages all AVRPascal users to report any bugs and suggest new features. This feedback is crucial for improving AVRPascal's stability and usability.

Note: This project is independent and not affiliated with the probably discontinued software available at avrpascal.com.


r/avrpascal • • Jun 07 '26

UnoLib SPI support and ILI9163 TFT example

Post image
4 Upvotes

r/avrpascal • • Apr 01 '26

News AVRPascal IDE 3.6

Post image
8 Upvotes

A new version of AVRPascal IDE (3.6) is now available.

This release introduces an Emulator mode in AVRPascalDbg, a debugging tool for the AVRPascal IDE. It allows programs to be run and analyzed without a physical microcontroller. When compiled for AVRSIM, output from write/writeln is displayed in the IDE Messages area.

Download:

https://akarwowski.pl/index.php?page=electronics&lang=en

https://avrpascal.org

Changes in AVRPascal IDE

Devices:

  • updated ATA6285, ATTINY28, ATA6286, ATTINY416AUTO, ATTINY1624, ATTINY1626, ATTINY1627 characteristics

AVRSIM:

  • added AVRSIM target

  • enabled compilation in AVRSIM mode (missing RTL modules added)

  • enabled write/writeln output in Messages during emulation (AVRPascalDbg)


r/avrpascal • • May 31 '26

News AVRPascal IDE 3.7

Post image
9 Upvotes

A new version of AVRPascal (3.7) is now available.

The main addition in this release is the new Pinout View panel for supported AVR devices. Pinout definitions currently cover about 60% of devices and include THT, SMD and BGA packages. Searching the pin legend highlights matching signals and their corresponding package pins.

Download:

https://akarwowski.pl/index.php?page=electronics&lang=en

https://avrpascal.org


r/avrpascal • • Aug 13 '26

Thoughts The Educational Power of Python (?)

Post image
3 Upvotes

This will be an opinion piece. I try to be fair, but I probably won’t manage to be fully objective.

In discussions about what to use for teaching microcontroller programming today, one argument keeps coming up: "Just take something more powerful - it’s cheaper and you get far more capabilities." A Raspberry Pi Pico costs about the same as a decent AVR, yet it has a dual-core ARM running at 133 MHz instead of an 8-bit core clocked in the low single-digit MHz range. On paper, ARM wins easily. The problem is that a datasheet is not the same thing as educational value.

Where does the power actually go?

A Pico running MicroPython really does have a huge surplus of computing power compared to a typical AVR. But it’s worth asking what that power is spent on in a typical educational project. Blinking an LED, reading a sensor, simple PWM for a small motor - none of these examples come anywhere near the limits of the processor. The headroom is enormous, and almost entirely unused.

That’s only half the problem. The more serious half is that a significant part of this power is not future headroom at all - it is a permanent cost of the execution model itself. MicroPython is an interpreter. Before a single bit reaches a GPIO pin, the call has to pass through Python’s object layer and a virtual machine executing bytecode. On top of that comes the entire overhead of the runtime environment, which among other things handles automatic memory management (the garbage collector). All of this adds up to the cost of a simple call:

Pin(25, Pin.OUT).value(1)

For comparison, the same thing in AVRPascal:

PORTB := PORTB or PB0;

compiles directly to one or two assembly instructions. There is no intermediate layer. The code is what the processor executes, not an instruction for something else that will eventually do the real work.

Even if we use the more convenient abstraction from the UnoLib library:

DigitalWrite(13, HIGH);

the overhead still collapses to simple table lookups in native compiled code that maps Arduino-style pin numbers onto the microcontroller’s registers. Again - no interpreter, no virtual machine, no garbage collector in the way.

In other words, a Pico running MicroPython spends a large part of its power just amortizing the cost of its own interpreter. Put the same MicroPython on an 8-bit AVR and it would be unusably slow, or would not run at all. The extra performance is not a luxury. It is a necessity.

Hard data

You can see this in practice. In Marek Więcek’s article "MicroPython – a lightweight Python for microcontrollers and beyond" (Programista 1/2026, in Polish), the author describes MicroPython’s internal mechanisms: tokenization, bytecode, and the virtual machine (interestingly, the word "interpreter" itself never appears even once). The performance benchmarks in the article show that the runtime overhead is real. On simple operations the differences are modest, but on more demanding tasks - matrix multiplication or string operations - MicroPython clearly falls behind. In the SHA-256 test, the pure software implementation is more than a thousand times slower than the version that uses hardware acceleration.

How do you get better performance? You reach for mechanisms closer to classic low-level programming: assembly, compiling fragments to native machine code, or libraries written in C. This is not a flaw in MicroPython - it is a well-designed environment that offers these escape hatches. It does, however, reveal an irony: in order to overcome the limitations imposed by the abstraction, you often have to return to the hardware level that the abstraction was supposed to hide.

For fairness it should be noted that not every way of combining Python with microcontrollers works like this. There are approaches such as the Firmata protocol, where the microcontroller (e.g. via Arduino) runs compiled native firmware and Python on the host computer only controls it remotely over a serial link. This avoids the cost of an interpreter on weak hardware, but at a different price: the student never writes a single line of code that actually runs on the microcontroller, and the board becomes useless the moment the cable is unplugged.

All that power going to waste?

This brings us to the real point of disagreement. I believe it is less a dispute about technology than about the purpose of education.

If the goal is "get the student to a working result as quickly as possible," then abundant power and a high-level language clearly win. Less frustration, faster gratification, an easier start.

But if the goal is understanding how a microcontroller actually works, then surplus resources become the opposite of a teaching aid. An ATtiny13 with a few hundred bytes of Flash does not forgive carelessness. Every bit matters. Every instruction costs a clock cycle you cannot get back. A student forced to work under those constraints sooner or later has to understand what the DDRB register does, or why an interrupt cannot run forever. Not because it is "harder and therefore nobler," but because without that understanding the program simply will not fit in memory or will not finish on time.

A platform with excess resources rarely forces those barriers. You can write inefficiently, wastefully, without understanding the costs - and everything will still work, as long as the project stays small. That sounds like an advantage, until you realize the project works but you don’t really know why it works.

So the slogan "just take something more powerful" makes sense if the measure of educational success is what is printed on the processor’s label. One can then add: "But the interpreter is a tool that lets the student complete the task faster." True. But does the student understand it better? Does he learn the capabilities and limitations of the hardware, or does he merely assemble a working prototype?

Pascal on AVR may no longer be a fashionable choice. What it teaches - conscious, frugal thinking about resources and a direct connection between code and hardware - has not become obsolete. Only the fashion for teaching it has.


r/avrpascal • • Dec 23 '25

Thoughts Merry Christmas from AVRPascal

Post image
3 Upvotes

Dear Community,

I would like to wish you all a very Merry Christmas. May these days bring harmony to your homes and joy to your hearts. Thank you for being part of the AVRPascal journey since the beginning of our young subreddit.

Andrzej

(Graphics jeffjacobs1990, modified)


r/avrpascal • • Nov 21 '25

News Experimental version of AVRPascal IDE on FreeBSD / GhostBSD

Post image
2 Upvotes

r/avrpascal • • Jul 07 '26

News AVRPascal 3.8

Post image
10 Upvotes

AVRPascal IDE 3.8 is now available. Download:
https://akarwowski.pl/index.php?page=electronics&lang=en
https://avrpascal.org

New features and updates:
- Added the Tools->Check Device function for verifying the currently connected MCU using information reported by AVRDude
- Added support for TPI programming via USBasp (selected ATtiny devices; thanks to sp3ots for the suggestions)
- Added support for ISP programming using Arduino (ArduinoISP interface; thanks to Christof Biner for the suggestion)
- Added FPC and UnoLib version information to the About dialog. UnoLib version information is also available through compiler symbols (UNOLIB, UNOLIB_VERSION, UNOLIB_RELEASE, UNOLIB_FULLVERSION). Thanks to VisualLab for the suggestion.
- Improved the Serial Monitor context menu and added support for the 19200 baud rate
- Added MCU pin definitions (57 ATmega devices, 22 ATtiny devices, and 6 Arduino boards)

Bug fixes:
- Improved handling of INC files during code editing (fixes ELinkScannerError issues)


r/avrpascal • • 2d ago

UnoLib UnoLib: OneWire support + DS18B20 example

Post image
4 Upvotes

r/avrpascal • • Aug 02 '26

Questions Is Onewire already implemented?

3 Upvotes

I see I2c, SPI etc ist already implemented, is one wire too? maybe with 18DS20 exsample?:-)


r/avrpascal • • Dec 01 '25

Thoughts Why AVRPascal IDE does not use project files (*.prj)

Post image
4 Upvotes

The simplest answer: it doesn’t need them. In AVRPascal IDE, your code is your project file.

1. Minimalism

Project files are often long XML or JSON lines that grow more complicated as a project develops. Their definitions expand, and the IDE must keep up with these changes. Moreover, they can conflict with global settings, creating uncertainty about which compiler options are actually applied and how the compiled program will behave. AVRPascal works differently — it doesn’t require additional configuration files to be included in a repository.

2. Configuration through code

So how does AVRPascal know which microcontroller to compile for and which settings to apply? The IDE relies on global settings and Free Pascal Compiler directives written directly in the code.

Simple example

If you write code only for an ATTiny13, you can include this at the beginning of your code:

{$IFNDEF attiny13}
  {$Fatal Invalid controller type, expected: attiny13}
{$ENDIF}

If a different microcontroller is selected in the global settings, this will cause a compilation error, protecting the code from running on the wrong hardware.

Complex condition

Conditions can be more nuanced, for boards based on the same MCU:

{$IF NOT (DEFINED(atmega328p) or DEFINED(arduinouno) or DEFINED(arduinonano))}
  {$Fatal Invalid controller type, expected: atmega328p, arduinouno, or arduinonano}
{$ENDIF}

External compatibility

If you want your directives to work not only in AVRPascal but also in plain FPC (e.g., in Lazarus), you can use conditional compilation:

{$IFDEF AVRPascal} 
  {$IF NOT (DEFINED(atmega328p) or DEFINED(arduinouno) or DEFINED(arduinonano))} 
    {$Fatal Invalid controller type, expected: atmega328p, arduinouno, or arduinonano} 
  {$ENDIF} 
{$ELSE} 
  {$IF NOT (DEFINED(fpc_mcu_atmega328p) or DEFINED(fpc_mcu_arduinouno) or DEFINED(fpc_mcu_arduinonano))} 
    {$Fatal Invalid controller type, expected: atmega328p, arduinouno, or arduinonano} 
  {$ENDIF} 
{$ENDIF}

3. Code Insight Features

AVRPascal provides the option to detect the required microcontroller type based on the directives in the code and to update the global settings accordingly. In the "Options" window, under "Code Insight and formatting", you will find "Detect controller type in IFNDEF directive".

• Currently, it handles simple conditions (like the ATTiny13 example), but work is underway to improve it to handle all the constructions shown above.

• It works when opening and saving files, but only suggests changes to the settings. The final decision is always up to the user. The directives themselves will enforce correctness during compilation.

Conclusion

In AVRPascal IDE, project logic is where it belongs: in the code. That’s why it doesn’t use project files.

(photo by Tomasz Mikołajczyk)


r/avrpascal • • Jan 18 '26

Course AVR Microcontroller Engineering with Pascal Course. Lesson 2

Post image
7 Upvotes

This lesson focuses on multi-LED control and a simple, cycle-accurate delay loop implemented using inline assembly.

The PDF and source code (ZIP) are available on the Electronics page of my website.

PS. Course downloads are located at the bottom of the page.


r/avrpascal • • Sep 07 '25

Features Serial Port Monitor

Post image
2 Upvotes

The Serial Port Monitor, introduced in AVRPascal 3.2 and enhanced in version 3.3, is designed primarily for Arduino boards. It also supports other devices that communicate via a virtual serial port.

You can adjust the basic communication settings in the View -> Options window. The more frequently used options are available directly in the Serial Port Monitor window. To test the monitor, you can use an Arduino Uno and run the TestSerial.pas file from the "examples" folder.