Programming the Finite State Machine with 8-Bit PICs in Assembly and C
Andrew Pratt provides a detailed introduction to programming PIC microcontrollers, as well as a thorough overview of the Finite State Machine (FSM) approach to programming. Most of the book uses assembly programming, but do not be deterred. The FSM gives a structure to a program, making it easy to plan, write, and modify. The last two chapters introduce programming in C, so you can make a direct comparison between the two techniques. The book references the relevant parts of the Microchip datasheet as familiarity with it is the best way to discover detailed information.
This book is aimed at Microsoft Windows and Linux users. To keep your costs to a minimum and to simplify the toolchain, specific applications are provided as a free download to enable you to use an FTDI serial lead as the programmer. The assembler used is the open-source "gpasm". All programming can be done in a text editor. There are detailed instructions on how to perform the necessary installations on Windows, Linux Debian, and derivatives such as Ubuntu and Fedora. For programming in C, Microchip's XC8 compiler is used from the command line. In addition to the programming applications, two serial read and serial write applications can be used for communicating with the PICs from a computer.
A voltmeter project including practical instructions on building a circuit board from scratch is included. All theory is covered beforehand, including how to do integer arithmetic in assembly.
Two PICs are covered: the PIC12F1822 and the PIC16F1823. Both can run at 32 MHz with an internal oscillator. You do not need to buy a factory-made development board and programmer. With relatively inexpensive parts including a serial lead, microcontroller, a few resistors, and LEDs, you can get started exploring embedded programming.
Links
Updated Programmer
Master digital electronics – the hands-on way!
This bundle includes the book Learning Digital Electronics, featuring 20+ practical projects in Logic and Circuit design, as well as a 100-piece kit – so you can start building logic circuits, counters, displays, and more right away.
Learning Digital Electronics (Book)
This book is a practical guide to digital electronics, covering the essential components of modern digital systems: number systems, logic gates, Boolean algebra, combinational and sequential logic, and more.
Through more than 20 structured projects, you’ll design and build digital systems using real-world components such as logic gates, multiplexers, decoders, flip-flops, counters, and shift registers. The projects range from basic LED logic circuits to digital locks, display systems, traffic light controllers, and timing-based designs.
Selected projects introduce the use of tools such as CircuitVerse for circuit simulation, while several designs make use of 74HC-series logic devices, commonly used in digital hardware prototyping.
Inside, you’ll find:
Clear coverage of number systems and binary arithmetic
Logic gate fundamentals and universal gate implementations
Step-by-step projects using flip-flops, counters, and registers
Real-world design with 74HC-series logic chips
Techniques for designing combinational and sequential systems
This book takes a design-first, application-driven approach to digital electronics—built around working circuits, tested logic, and hands-on experimentation.
Learning Digital Electronics (Kit)
This kit has been specially developed to complement the book "Learning Digital Electronics". Since all necessary components are included, you can complete every practical project in the book directly.
Kit contents
2x 74HC08 AND gate chip
2x 74HC00 NAND gate chip
1x 74HC86 XOR gate chip
1x 555 timer chip
1x 74HC161 counter chip
1x 74HC164 shift register
1x CD4511 7-segment decoder
1x CD4027 JK flip-flop
1x BC337 NPN transistor
1x KPS-5161 7-segment common-cathode display
1x Light dependent resistor (LDR)
4x 10 KΩ resistors
8x 1 KΩ resistor
2x 47 KΩ resistors
1x 100 KΩ resistor
4x 2.7 KΩ resistors
1x 5.6 KΩ resistor
1x 150 KΩ resistor
1x 10 μF capacitor
2x 0.01 μF capacitor
2x 100 nF capacitor
8x Small red LED
1x Small green LED
1x Small orange LED
4x Pushbutton switches
1x Active buzzer
1x Battery holder for 3x AA batteries (batteries not included)
1x Breadboard
40x Male-to-male jumper wires (length: 200 mm)
in 10 captivating lessons
Using the lessons in this book you learn how to program a microcontroller. You’ll be using JAL, a free but extremely powerful programming language for PIC microcontrollers, which enjoys great popularity in the hobby world. Starting out from scratch virtually, you slowly build up the knowledge. No previous knowledge is needed: anyone can get started with this book. Assuming you have absorbed all lessons – meaning you have actually completed all the exercises – you should be confident to write PIC microcontroller programs, as well as read and understand programs written by other people.
JAL commands
You learn the function of JAL commands such as include, pin, delay, forever loop, while loop, case, exit loop, repeat until, if then, as well as the use of functions, procedures and timer- and port interrupts.
JAL programs
You make an LED blink, build a time switch, measure a potentiometer’s wiper position, produce sounds, suppress contact bounce, and control the brightness of an LED. And of course you learn to debug, meaning: how to spot and fix errors in your programs.
Hardware
You learn to recognize various components including the PIC microcontroller, potentiometer and quartz crystal, and how to wire up a PIC microcontroller and effectively link it to your PC. A breadboard is used for the purpose, allowing you to easily modify the component arrangement for further experimenting.
The companion software with this book can be downloaded free of charge, including the JAL programming language. In addition, you may order a kit of parts so you don’t have to go shopping for the required components. Especially for a beginner, this is the easiest way to start with this unique pastime.
Having finished this book does not mean you are through with your pastime. You can get your hands dirty again, and if desired use other books packed with fun projects using the JAL programming language. More information may be found at the end of the lessons in the chapter "Done! What’s next?""
Projects Using Arduino IDE and the LVGL Graphics Library
The ESP32 is probably one of the most popular microcontrollers used by many people, including students, hobbyists, and professional engineers. Its low cost, coupled with rich features makes it a popular device to use in many projects. Recently, a board called the ESP32 Cheap Yellow Display (CYD for short) is available from its manufacturers. The board includes a standard ESP32 microcontroller together with a 320x240 pixel TFT display. Additionally, the board provides several connectors for interfaces such as GPIO, serial port (TX/RX), power and Ground. The inclusion of a TFT display is a real advantage as it enables users to design complex graphics-based projects without resorting to an external LCD or graphics displays.
The book describes the basic hardware of the ESP32 CYD board and provides details of its on-board connectors. Many basic, simple, and intermediate-level projects are given in the book based on the ESP32 CYD, using the highly popular Arduino IDE 2.0 integrated development environment. The use of both the basic graphics functions and the use of the popular LVGL graphics library are discussed in the book and projects are given that use both types of approaches.
All the projects given in the book have been tested and are working. The block diagram, circuit diagram, and the complete program listings and program descriptions of all the projects are given with explanations. Readers can use the LVGL graphics library to design highly popular eye-catching full-color graphics projects using widgets such as buttons, labels, calendars, keypads, keyboards, message boxes, spinboxes, sliders, charts, tables, menus, bars, switches, drop-down lists, animations, and many more widgets.
This book contains 50 fun and exciting projects for PIC microcontrollers such as a laser alarm, USB teasing mouse, eggtimer, youth repellent, soundswitch, capacitive liquid level gauge, 'finger in the water' sensor, guarding a room using a camera, mains light dimmer (110-240 volts), talking microcontroller and much more. Several different techniques are discussed such as relay, alternating current control including mains, I²C, SPI, RS232, USB, pulse width modulation, rotary encoder, interrupts, infrared, analog-digital conversion (and the other way around), 7-segment display and even CAN bus.
You can use this book to build the projects for your own use. The clear explanations, schematics and even pictures of each project make this a fun activity. For each project the theory is discussed and why the project has been executed in that particular way. That means you can also use this book as a studybook, or as basis for larger and more complicated projects. All projects use a breadboard so modification and expansion is easy.
Three PIC microcontrollers are used, the 16f877A, 18f4455 and 18f4685. It is also discussed how you can migrate your project from one microcontroller to another – 15 types are supported - including two example projects.
All software that is used in this book can be downloaded for free. That also applies to the open source programming language JAL. This powerful and yet easy to learn language is used by hobbyists as well as professionals.
This book can also be used as a reference guide. It explains all JAL commands, as well as the expansion libraries. Using the index you can easily find example projects that illustrate the use of these commands. Even when you have built all projects in this book you will still want to keep it within arm's reach.
Der Autor zeigt in diesem Buch alle wichtigen Aspekte der Mikrocontroller-Programmierung, ohne den Leser mit unnötigen oder nebensächlichen Informationen zu überladen. Am Ende der Lektüre ist der Leser in der Lage, 8-Bit-Mikrocontroller zu verstehen und zu programmieren.
Die Einführung in die Mikrocontroller-Programmierung dekliniert der Autor an Mikrocontrollern aus der PIC-Familie durch. Der PIC mit seinem 8-Bit-Design ist nicht auf dem modernsten technischen Stand, aber dafür einfach zu verstehen. Er wird in einem DIP-Gehäuse angeboten, ist überall erhältlich und nicht besonders komplex. Das gesamte Datenblatt des PICs ist um Dekaden kürzer als die Architekturbeschreibung, die den Prozessor eines fortgeschrittenen Mikrocontrollers beschreibt. Die Einfachheit hat ihre Vorteile. Wer versteht, wie ein Mikrocontroller grundlegend funktioniert, kann sich später in fortgeschrittene Softcores einarbeiten.
Steht im ersten Teil des Buches Assembler als ausführende Programmiersprache im Vordergrund, so geht der Autor im zweiten Teil seines Buches vertiefend auf C ein. Quasi nebenbei entführt das Buch den Leser in die Tiefen der praktischen Arbeit mit Mikrocontrollern, erklärt interessante Messtechnik und zeigt Möglichkeiten zur Arbeitserleichterung und Fehlersuche.
Dit boek bevat 50 leuke en spannende projecten met PIC microcontrollers zoals een laser alarm, USB plaagmuis, eierwekker, jongerenverjager, geluidsschakelaar, capacitieve vloeistofniveau meting, 'vinger in het water' sensor, bewaking van een ruimte met een camera, 220 volt lichtdimmer, pratende microcontroller en nog veel meer. Er komen talloze technieken aan de orde zoals relais, wisselstroomregeling (ook 220 volt), I2C, SPI, RS232, USB, puls breedte modulatie, rotary encoder, interrupts, infrarood, analoog-digitaal conversie (en andersom), 7-segment display en zelfs CAN bus.
U kunt dit boek gebruiken om de verschillende projecten na te bouwen en daarna in de praktijk te brengen. Door de duidelijke uitleg, schema's en zelfs foto's van de opstelling is het nabouwen een leuke bezigheid. Bij ieder project wordt uitgelegd waarom het juist op die manier is uitgevoerd, en wordt kort de theorie behandeld. U kunt dit boek dus gebruiken als studieboek, of als basis voor grotere en ingewikkeldere projecten. Alle schakelingen zijn op een steekbord uitgevoerd zodat uitbreiden en aanpassen gemakkelijk is.
De drie PIC microcontrollers die in dit boek gebruikt worden, zijn de 16f877A, 18f4455 en 18f4685. Daarnaast komt aan de orde hoe u de programma's van de ene naar de andere microcontroller kunt overzetten (er worden 15 types ondersteund) inclusief twee praktijkvoorbeelden.
Alle benodigde software kunt u gratis downloaden. Dat geldt ook voor de open source programmeertaal JAL. Deze krachtige maar toch eenvoudig te leren taal wordt zowel door hobbyisten als professionals gebruikt.
Dit boek is ook goed te gebruiken als naslagwerk. U kunt er de uitleg van alle opdrachten van de programmeertaal JAL in terugvinden, en tevens van de gebruikte uitbreidingsbibliotheken. Via de index vindt u gemakkelijk projecten die als voorbeeld kunnen dienen voor de belangrijkste JAL opdrachten. Zelfs wanneer u alle projecten een keer gemaakt hebt, zal dit boek nog lang een plekje naast uw PC behouden.
The FNIRSI DLA Series combines high-performance USB 3.0 logic analysis with flexible multi-channel signal capture for debugging and analyzing digital circuits and embedded systems. The series is available in two versions: the DLA-16 Plus with 16 digital channels and the DLA-32 Plus with 32 digital channels.
Both models offer sampling rates of up to 1 GSa/s, 4 Gbit of onboard memory, and support for 120+ protocol decoders. With Buffer, Stream, and Roll acquisition modes, they are suitable for both high-speed signal analysis and long-term monitoring.
Choose the DLA-16 Plus for higher sampling rates when using all channels, or the DLA-32 Plus when you need more channels and advanced serial and parallel triggering.
Features
Available with 16 or 32 digital input channels
Up to 1 GSa/s sampling rate
DLA-16 Plus: up to 500 MSa/s with all 16 channels
DLA-32 Plus: up to 250 MSa/s with all 32 channels
4 Gbit onboard memory
High-speed USB 3.0 interface
Acquisition modes: Buffer, Stream, and Roll
Support for 120+ protocol decoders
Advanced triggering options
4 PWM outputs with 1 Hz–20 MHz frequency range
CSV and BIN data export
Specifications
DLA-16 Plus
DLA-32 Plus
Digital Channels
16
32
Max. Sampling Rate
1 GSa/s
Sampling Rate (1 Channel)
1 GSa/s
Sampling Rate (8 Channels)
1 GSa/s
Max. Buffer Sampling
16 CH @ 500 MSa/s
32 CH @ 250 MSa/s
Max. Stream Sampling
16 CH @ 125 MSa/s
32 CH @ 50 MSa/s
Hardware Memory
4 Gbit
Interface
USB 3.0 / USB-C
Max. USB Transfer Rate
5 Gbit/s
Acquisition Modes
Buffer / Stream / Roll
Protocol Decoders
120+
Custom Protocol Support
Yes
Trigger Modes
Rising Edge, Falling Edge, High, Low, Any Edge
Advanced Trigger
Standard Triggering
Serial and Parallel
Parallel Trigger Stages
–
Up to 16
PWM Outputs
4
PWM Output Voltage
3.3 V
PWM Frequency
1 Hz–20 MHz
Data Export
CSV, BIN
Dimensions
90 x 81 x 11.5 mm
Included
1x FNIRSI DLA-16/32 Plus Logic Analyzer
4 Sets x 5 Shielded Cables
18x Mini IC Test Hooks (High Configuration Version)
1x USB 3.0 Data Cable
10x IC Test Hooks
1x Transparent Storage Case for Test Hooks
1x Storage Bag
1x Manual
Downloads
Manual
Software for Windows
Software for macOS (Apple Silicon)
Software for macOS (Intel)
Kick off with the MAX1000 and VHDPlus
Ready to Master FPGA Programming? In this guide, we’re diving into the world of Field Programmable Gate Arrays (FPGAs) – a configurable integrated circuit that can be programmed after manufacturing. Imagine bringing your ideas to life, from simple projects to complete microcontroller systems!
Meet the MAX1000: a compact and budget-friendly FPGA development board packed with features like memory, user LEDs, push-buttons, and flexible I/O ports. It’s the ideal starting point for anyone wanting to learn about FPGAs and Hardware Description Languages (HDLs).
In this book, you’ll get hands-on with the VHDPlus programming language – a simpler version of VHDL. We’ll work on practical projects using the MAX1000, helping you gain the skills and confidence to unleash your creativity.
Get ready for an exciting journey! You’ll explore a variety of projects that highlight the true power of FPGAs. Let’s turn your ideas into reality and embark on your FPGA adventure – your journey starts now!
Exciting Projects You’ll Find in This Book
Arduino-Driven BCD to 7-Segment Display Decoder
Use an Arduino Uno R4 to supply BCD data to the decoder, counting from 0 to 9 with a one-second delay
Multiplexed 4-Digit Event Counter
Create an event counter that displays the total count on a 4-digit display, incrementing with each button press
PWM Waveform with Fixed Duty Cycle
Generate a PWM waveform at 1 kHz with a fixed duty cycle of 50%
Ultrasonic Distance Measurement
Measure distances using an ultrasonic sensor, displaying the results on a 4-digit 7-segment LED
Electronic Lock
Build a simple electronic lock using combinational logic gates with push buttons and an LED output
Temperature Sensor
Monitor ambient temperature with a TMP36 sensor and display the readings on a 7-segment LED
Downloads
Software
Met behulp van de lessen in dit boek leert u hoe u zelf een microcontroller kunt programmeren. We maken daarbij gebruik van JAL, een gratis maar uiterst krachtige programmeertaal voor PIC microcontrollers, die in de hobbywereld erg populair is.
We starten aan het absolute begin, en bouwen vandaar de kennis op. U heeft dus geen voorkennis nodig: iedereen kan met dit boek aan de slag. Wanneer u alle lessen volgt (dat wil zeggen: de oefeningen ook daadwerkelijk maakt) dan kunt u wanneer u het boek uit heeft zelf PIC microcontroller programma’s schrijven, en programma’s van anderen lezen.
JAL opdrachten
U leert de functie van JAL opdrachten zoals include, pin, delay, forever loop, while loop, case, exit loop, repeat until, if then, en het gebruik van functies, procedures en timer- en poortinterrupts.
JAL programma’s
U laat een LED knipperen, maakt een tijdschakelaar, meet de stand van een potmeter, maakt geluiden, voorkomt contactdender en regelt de helderheid van een LED. En uiteraard leert u debuggen: hoe u in uw programma’s fouten kunt vinden en oplossen.
Hardware
U leert verschillende onderdelen zoals PIC microcontroller, potmeter en kristal herkennen, en hoe u een PIC microcontroller aan moet sluiten en met uw PC moet verbinden. U maakt hierbij gebruik van een steekbord zodat u de opstelling gemakkelijk kunt aanpassen om verder te experimenteren.
,
by Clemens Valens
Trying Out the Joy-it JT-PS1440-C 1.5 kW Power Supply (Review)
In today's high-powered world of e-bikes, electric scooters, and various other electronic vehicles, robust and adaptable power supplies are indispensable for motor testing and battery...