試すGOLD- Free

Learn Lisp Programming Using MCUs - Part 2: Extending µLisp with Custom Functions
Circuit Cellar|February 2025
In the second installment of this series, Raul delves into the world of µLisp and shows how to extend capabilities by adding custom functions such as "pulsein" and "servo-create", enabling developers to interface with ultrasonic sensors and control servomotors. In Part 1, Raul presented µLisp concepts and syntax, and extensions specific to MCUs.
- Raul Alvarez-Torrico
Learn Lisp Programming Using MCUs - Part 2: Extending µLisp with Custom Functions

μLisp is a dialect of the Lisp programming language. It is tailored to microcontrollers having limited amounts of RAM, and can be run on various platforms—from the Arduino Uno based on the ATmega328, up to the Teensy 4.0/4.1 [1]. To follow the topics discussed here, you need to be acquainted with the Arduino platform and any programming language from the Lisp family. Please see Part 1 of this article series (“Crash Course Offers Insight into Pioneering Language,” Circuit Cellar 411, October, 2024) for a brief introduction to Lisp programming and the µLisp dialect [2].

With µLisp, it is possible to add your own extension functions, such that they appear as built into the language after re-compiling and flashing the µLisp interpreter to your Arduino board. There’s an excellent tutorial on how to do this on the µLisp website [3]. I will build on that tutorial to discuss how to add custom functions. For the examples presented here, I will continue to use Seeed Studio’s Wio Terminal MCU development board; but the information discussed also can be applied to other µLisp-supported Arduino boards.

EXTENDING µLISP

In general, any function not supported by default in µLisp can possibly be added as an extension to the language—for instance, hardware access functions for servomotor control. Let’s explore a simple example to help us understand how the language extension system works.

Listing 1 shows the Arduino C code for adding the pulsein extension to µLisp, which is not available by default. This extension will make it possible to measure digital pulse widths. Five sections of the listing show the µLisp extensions structure. Like the core µLisp interpreter, extensions are also written in Arduino C language. So, any extensions to the interpreter imply basically writing C code. That makes adding them straightforward, using the Arduino C language built-in functions and external libraries.

この記事は Circuit Cellar の February 2025 版に掲載されています。

7 日間の Magzter GOLD 無料トライアルを開始して、何千もの厳選されたプレミアム ストーリー、9,000 以上の雑誌や新聞にアクセスしてください。

この記事は Circuit Cellar の February 2025 版に掲載されています。

7 日間の Magzter GOLD 無料トライアルを開始して、何千もの厳選されたプレミアム ストーリー、9,000 以上の雑誌や新聞にアクセスしてください。

CIRCUIT CELLARのその他の記事すべて表示
Morse Micro Launches Highly Anticipated Second-Generation MM8108 SoC
Circuit Cellar

Morse Micro Launches Highly Anticipated Second-Generation MM8108 SoC

Enabling improved spectrum efficiency to minimize interference in high-density environments, the MM8108 delivers class-leading data rates of up to 43.33Mbps using world-first sub-GHz 256-QAM modulation at an 8MHz bandwidth, making it ideal for a range of applications in agricultural, mining, industrial, home, and city environments.

time-read
1 min  |
February 2025
NXP MCX MCUs and IDEs Cut Development Time
Circuit Cellar

NXP MCX MCUs and IDEs Cut Development Time

Development boards, such as NXP's FRDM platform for MCX A series MCUs, are revolutionizing embedded systems by integrating components for prototyping and innovation in the IoT landscape. These technologies streamline development, enhance flexibility, and reduce costs, enabling greater focus on software development while addressing complex challenges.

time-read
6 分  |
February 2025
Asynchronous Programming in Flutter - Shallow Dive into Google's Mobile App Framework
Circuit Cellar

Asynchronous Programming in Flutter - Shallow Dive into Google's Mobile App Framework

This month, Bob continues his look at mobile app programming from the perspective of an embedded system designer. He begins a shallow dive into Flutter, the mobile app framework from Google, by describing his transition from React Native to asynchronous programming in Flutter.

time-read
7 分  |
February 2025
Basic Pulse Circuits - Part 3: Metastability, Setting, or Resetting
Circuit Cellar

Basic Pulse Circuits - Part 3: Metastability, Setting, or Resetting

In digital design, signal processing is crucial when dealing with asynchronous signals from sensors and level translators. In Part 1 of a three-part series, Wolfgang described how pulse circuits help digital circuits deal with pulse trains. In Part 2, he wrote about flip-flops, timing parameters and synchronization. In Part 3, he looks at how to mitigate metastability and ensure internal clock synchronization.

time-read
10+ 分  |
February 2025
Infineon and Flex Showcase Zone Controller Design Platform for Software-Defined Vehicles
Circuit Cellar

Infineon and Flex Showcase Zone Controller Design Platform for Software-Defined Vehicles

Infineon Technologies AG and Flex, a diversified global manufacturer and new preferred automotive design partner for Infineon, are showcasing the new Flex Modular Zone Controller design platform for software-defined vehicles at CES 2025.

time-read
1 min  |
February 2025
Switching Regulator Efficiency - Minimize Power Consumption in Battery-Operated Systems
Circuit Cellar

Switching Regulator Efficiency - Minimize Power Consumption in Battery-Operated Systems

A switching voltage regulator converts input DC voltage into a desired output DC voltage. This month, Stuart delves into the factors that influence the efficiency of switching regulators, and why they are crucial for embedded applications. From understanding the role of inductors and transistors to exploring practical examples, this article offers valuable knowledge for anyone interested in optimizing power supply designs.

time-read
10+ 分  |
February 2025
Introducing Bluetooth LE Audio - Part 1: Sound of a Revolution
Circuit Cellar

Introducing Bluetooth LE Audio - Part 1: Sound of a Revolution

Following the Bluetooth Core 5.2 release, Bluetooth Low Energy Audio introduces capabilities that will revolutionize audio applications through isochronous channels and new audio middleware. Nick writes about a framework supporting bidirectional audio and shared listening in Part 1 of a two-part article.

time-read
10 分  |
February 2025
CMake the Most of Software Development - Modern Build Systems Support Scalability
Circuit Cellar

CMake the Most of Software Development - Modern Build Systems Support Scalability

Discover how modernizing your build system with CMake can revolutionize embedded software development, offering unparalleled flexibility and efficiency. Dive into this article to explore the transformative benefits of CMake's cross-platform capabilities and how it integrates seamlessly with contemporary development practices.

time-read
9 分  |
February 2025
Engineering Healthcare - Cutting-Edge Technologies to Enhance Patient Care
Circuit Cellar

Engineering Healthcare - Cutting-Edge Technologies to Enhance Patient Care

Explore the groundbreaking advancements in Pulsed Field Ablation technology, where engineering meets cardiac care to revolutionize atrial fibrillation treatment. This article delves into the intricate design and functionality of cutting-edge devices that enhance precision and safety in medical procedures, showcasing the vital role electronics play in shaping the future of healthcare.

time-read
10 分  |
February 2025

当サイトではサービスの提供および改善のためにクッキーを使用しています。当サイトを使用することにより、クッキーに同意したことになります。 Learn more