Wellys Dev

  • Home
  • Search/Topics
  • Writings
  • About
  • 2024-03-12
    FlashForth: Datasheets

    Why the microcontroller datasheet is so important to programming in Forth.

    The Datasheet

    The ATmega328P datasheet is critical to understanding how to program the 328P. Exploring it with Forth is the joy of Forth as Forth allows you to interactively test commands, ports, timers, ADC’s etc of the 328P. And once you are convinced you have the correct set of commands to make what you want to happen, you can codify it into a word that becomes part of the vocabulary of Forth.

  • 2024-03-11
    FlashForth: Understanding the ATmega328P PWM

    Where I use Forth to develop a better understanding of the ATmega328P PWM capabilities. Revised from original post on April 17, 2021

    Sources

    • Flashforth Example on Github

    Introduction

    Pulse Width Modulation (PWM) is a technique used to control analog circuits using digital signals. It is the capability to change either the frequency or duty cycle of a digital signal. The former is the number of times the signal switches from low to high in a given period of time and the latter, is how long it is either high or low.

  • 2024-03-11
    Flashforth: Working with the Uno

    Where I describe how to use Forth with an Arduino Uno and make it easier to program the Uno in Forth.

    Introduction

    The Arduino Uno benefits from an incredible software framework. Between the programs already developed by the Arduino organization, and the hundreds of libraries which were created by others, you can find a program which does what you need. This makes it extremely easy to hit the ground running with a project. FlashForth isn’t like this.

  • 2024-03-10
    FlashForth: blink

    Where I demonstrate your first embedded application, much like the C Language “Hello, World” program, blink.

    A simple program, Blink

    To begin to understand how to program in Forth, I’ll iterate over several versions of blink.

    Light the LED

    First, let’s interactively light the built-in LED. On an Uno, we know it is pin 13, which corresponds to Port B, bit 5 on our microcontroller, the ATmega328P.

    This is lesson one, all references in Forth, are references to the ATmega328P, which is the microcontroller on the Uno, and not the pins on the Uno. This is why the data sheet for the ATmega328P is so important. I’ll call out the specific references as we go, however, the more you use FlashForth, the more you will come to read and understand the ATmega328P datasheet. As you begin to write more Forth programs, you will be able to create the words necessary to reference the Uno, just as you did with the Arduino framework.

  • 2024-03-09
    FlashForth: Simple Setup

    UPDATED: Where I describe how to use FlashForth, a phenomenal version of Forth for the ATmega328P to learn how to use Forth in an embedded system.

    Notes for Video

    This video demonstrates the ease of loading FlashForth on to an Arduino Uno, and replacing it with Optiboot, when you wish to use the Arduino software framework, again.

  • 2024-03-06
    Developing in C for the ATmega328P: Buffer Overflow

    Where I use examples from “The C Programming Language”, Kernighan & Ritchie, to demonstrate string copies, using pointers and how to check for buffer overflows.

    Introduction

    I find it very helpful to periodically review/read “The C Programming Language”, Kernighan and Ritchie (K&R). In this past review, I ran across some examples provided on pages 105-6 (Second Edition) as to using pointers to copy strings. There were 4 examples provided, with the last commented as “the idiom should be mastered”, which is an implication of “this is a programming best practice”. Perhaps, for the code in question is quite simple and extremely powerful, that said, it leads to the issue of buffer overflows, for which I provide a mechanism to resolve.

  • 2024-03-01
    Arduino: Reloading Bootloaders on the Uno and the 32U4

    Where I demonstrate how to reload Optiboot on an ATmega328P (Arduino Uno) and reload the Catarina bootloader on to an ItsyBitsy 32U4 board as well.

    Introduction

    Sometimes a board’s bootloader can become corrupted or you have consciously overwritten the bootloader (See Forth on this site), and you want to reload it. This page demonstrates how to do this with the ATmega328P (Uno) and board with the AVR 32U4 (Adafruit ItsyBitsy 32U4). It also discusses the different bootloaders available for the 32U4.

  • 2023

  • 2023-10-02
    Serial Applications for Embedded Development

    Where I discuss various serial monitor applications and why I believe CoolTerm is the best one.

    Introduction

    The serial port is an invaluable, if not mandatory tool, for developing programs in embedded computing. Given the popularity of software development for embedded computers, one would think there would be a clear answer or solution. For several years, I wasn’t able to determine the best solution. However, after more work on my part to understand a specific solution, I can conclusively say use this multiplatform, free solution: CoolTerm

  • 2023-08-24
    Developing in C for the ATmega328P: Using a Serial Monitor

    Updated: Where I describe the different options for using a serial monitor and the serial software in AVR_C and change my recommended programs.

    Introduction

    CoolTerm appears to be malware on some systems and PuTTY, its important to install from the proper site, has better security. PLEASE ENSURE YOU DOWNLOAD IT FROM THIS SITE ONLY: https://freeware.the-meiers.org/

    For macOS, I do likeSerial, however, this is a $40 serial program. For free, the solutions is tio, which can be easily installed using Homebrew or CoolTerm.

  • 2023-08-04
    Developing in C for the ATmega328P: Using the GNU Linker to Enhance printf()

    Where I describe how to use the GNU Linker wrapper capability and variable arguments to enhance printf() for better debugging.

    Introduction

    This recent post fascinated me. It describes a feature of the GNU linker called wrapping which allows you to replace an existing symbol (command) with a new version. The example describes adding a timestamp to printf(). While, for me, this might be a solution looking for a problem, I really liked the idea. And at the very least wanted to add the concept to AVR_C.

Page 2 of 8
Copyright © 2025 Lief Koepsel
  • Home
  • Search/Topics
  • Writings
  • About