With the availability of free and open source C/C++ compilers today, you might wonder why someone would be interested in assembler language. What is so compelling about the RISC-V Instruction Set Architecture (ISA)? How does RISC-V differ from existing architectures? And most importantly, how do we gain experience with the RISC-V without a major investment? Is there affordable hardware available?
The availability of the Espressif ESP32-C3 chip provides a way to get hands-on experience with RISC-V. The open sourced QEMU emulator adds a 64-bit experience in RISC-V under Linux. These are just two ways for the student and enthusiast alike to explore RISC-V in this book.
The projects in this book are boiled down to the barest essentials to keep the assembly language concepts clear and simple. In this manner you will have “aha!” moments rather than puzzling about something difficult. The focus in this book is about learning how to write RISC-V assembly language code without getting bogged down. As you work your way through this tutorial, you’ll build up small demonstration programs to be run and tested. Often the result is some simple printed messages to prove a concept. Once you’ve mastered these basic concepts, you will be well equipped to apply assembly language in larger projects.
Projects with Thonny-IDE, uPyCraft-IDE, and ESP32The 'Python' programming language has enjoyed an enormous upswing in recent years. Not least, various single-board systems such as the Raspberry Pi have contributed to its popularity. But Python has also found widespread use in other fields, such as artificial intelligence (AI) or machine learning (ML). It is obvious, therefore, to use Python or the 'MicroPython' variant for use in SoCs (Systems on Chip) as well.Powerful controllers such as the ESP32 from Espressif Systems offer excellent performance as well as Wi-Fi and Bluetooth functionality at an affordable price. With these features, the Maker scene has been taken by storm. Compared to other controllers, the ESP32 has a significantly larger flash and SRAM memory, as well as a much higher CPU speed. Due to these characteristics, the chip is not only suitable for classic C applications, but also for programming with MicroPython.This book introduces the application of modern one-chip systems. In addition to the technical background, the focus is on MicroPython itself. After the introduction to the language, the programming skills learned are immediately put into practice. The individual projects are suitable for use in the laboratory as well as for everyday applications. So, in addition to the actual learning effect, the focus is also on the joy of building complete and useful devices. By using laboratory breadboards, circuits of all kinds can be realized with little effort, turning the testing and debugging of the 100% homebrew projects into an instructive pleasure.The various applications, such as weather stations, digital voltmeters, ultrasound range finders, RFID card readers or function generators, make the projects presented ideally suited for practical courses or subject and study work in the natural sciences, or in science and technology classes.
AVR Architecture and Programming An in-depth look at the 8-bit AVR architecture found in ATtiny and ATmega microcontrollers, mainly from a software and programming point of view. Explore the AVR architecture using C and assembly language in Microchip Studio (formerly Atmel Studio) with ATtiny microcontrollers. Learn the details of how AVR microcontrollers work internally, including the internal registers and memory map of ATtiny devices. Program ATtiny microcontrollers using an Atmel-ICE programmer/debugger, or use a cheap hobby programmer, or even an Arduino Uno as a programmer. Most code examples can be run using the Microchip Studio AVR simulator. Learn to write programs for ATtiny microcontrollers in assembly language. See how assembly language is converted to machine code instructions by the assembler program. Find out how programs written in the C programming language end up as assembly language and finally as machine code instructions. Use the Microchip Studio debugger in combination with a hardware USB programmer/debugger to test assembly and C language programs, or use the Microchip Studio AVR simulator. DIP packaged ATtiny microcontrollers are used in this volume for easy use on electronic breadboards, targeting mainly the ATtiny13(A) and ATtiny25/45/85. Learn about instruction timing and clocks in AVR microcontrollers using ATtiny devices. Be on your way to becoming an AVR expert with advanced debugging and programming skills.
TINA Design Suite is a professional, powerful and affordable circuit simulator. It is a circuit designer and PCB design software package for analysing, designing, and real-time testing of analogue, digital, IBIS, VHDL, Verilog, Verilog AMS, SystemC, MCU, and mixed electronic circuits and their PCB layouts.
In this book, top-selling Elektor author, Prof. Dr. Dogan Ibrahim aims to teach the design and analysis of electrical and electronic circuits and develop PCB boards using both TINA and TINACloud. The book is aimed at electrical/electronic engineers, undergraduate electronic/electrical engineering students at technical colleges and universities, postgraduate and research students, teachers, and hobbyists. Many tested and working simulation examples are provided covering most fields of analogue and digital electrical/electronic engineering. These include AC and DC circuits, diodes, zener diodes, transistor circuits, operational amplifiers, ladder diagrams, 3-phase circuits, mutual inductance, rectifier circuits, oscillators, active and passive filter circuits, digital logic, VHDL, MCUs, switch-mode power supplies, PCB design, Fourier series, and spectrum. Readers do not need to have any programming experience unless they wish to simulate complex MCU circuits.
Including one-year license of TINACloud Basic Edition (valued at €29)
This book comes with a free licence of TINACloud Basic Edition (valued at €29) for 1 years including all example files in this book. Your personal license code will be automatically sent to you in a separate email immediately after successful payment.
TINACloud is a powerful, cloud-based multi-language online circuit simulator tool that runs in your browser without any installation. TINACloud allows you to analyze & design analog, digital, VHDL, Verilog, Verilog A & AMS, MCU, and mixed electronic circuits including also SMPS, RF, communication, and optoelectronic circuits and test microcontroller applications in a mixed circuit environment.
In this book the author presents all essential aspects of microcontroller programming, without overloading the reader with unnecessary or quasi-relevant bits of information. Having read the book, you should be able to understand as well as program, 8-bit microcontrollers.The introduction to microcontroller programming is worked out using microcontrollers from the PIC series. Not exactly state-of-the-art with just 8 bits, the PIC micro has the advantage of being easy to comprehend. It is offered in a DIP enclosure, widely available and not overly complex. The entire datasheet of the PIC micro is shorter by decades than the description of the architecture outlining the processor section of an advanced microcontroller. Simplicity has its advantages here. Having mastered the fundamental operation of a microcontroller, you can easily enter into the realms of advanced softcores later.Having placed assembly code as the executive programming language in the foreground in the first part of the book, the author reaches a deeper level with ‘C’ in the second part. Cheerfully alongside the official subject matter, the book presents tips & tricks, interesting measurement technology, practical aspects of microcontroller programming, as well as hands-on options for easier working, debugging and faultfinding.
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
Third, extended and revised edition with AVR Playground and Elektor Uno R4
Arduino boards have become hugely successful. They are simple to use and inexpensive. This book will not only familiarize you with the world of Arduino but it will also teach you how to program microcontrollers in general. In this book theory is put into practice on an Arduino board using the Arduino programming environment.
Some hardware is developed too: a multi-purpose shield to build some of the experiments from the first 10 chapters on; the AVR Playground, a real Arduino-based microcontroller development board for comfortable application development, and the Elektor Uno R4, an Arduino Uno R3 on steroids.
The author, an Elektor Expert, provides the reader with the basic theoretical knowledge necessary to program any microcontroller: inputs and outputs (analog and digital), interrupts, communication busses (RS-232, SPI, I²C, 1-wire, SMBus, etc.), timers, and much more. The programs and sketches presented in the book show how to use various common electronic components: matrix keyboards, displays (LED, alphanumeric and graphic color LCD), motors, sensors (temperature, pressure, humidity, sound, light, and infrared), rotary encoders, piezo buzzers, pushbuttons, relays, etc. This book will be your first book about microcontrollers with a happy ending!
This book is for you if you are a beginner in microcontrollers, an Arduino user (hobbyist, tinkerer, artist, etc.) wishing to deepen your knowledge,an Electronics Graduate under Undergraduate student or a teacher looking for ideas.
Thanks to Arduino the implementation of the presented concepts is simple and fun. Some of the proposed projects are very original:
Money Game
Misophone (a musical fork)
Car GPS Scrambler
Weather Station
DCF77 Decoder
Illegal Time Transmitter
Infrared Remote Manipulator
Annoying Sound Generator
Italian Horn Alarm
Overheating Detector
PID Controller
Data Logger
SVG File Oscilloscope
6-Channel Voltmeter
All projects and code examples in this book have been tried and tested on an Arduino Uno board. They should also work with the Arduino Mega and every other compatible board that exposes the Arduino shield extension connectors.
Please note
For this book, the author has designed a versatile printed circuit board that can be stacked on an Arduino board. The assembly can be used not only to try out many of the projects presented in this book but also allows for new exercises that in turn provide the opportunity to discover new techniques. Also available is a kit of parts including the PCB and all components. With this kit you can build most of the circuits described in the book and more.
Datasheets Active Components Used (.PDF file):
ATmega328 (Arduino Uno)
ATmega2560 (Arduino Mega 2560)
BC547 (bipolar transistor, chapters 7, 8, 9)
BD139 (bipolar power transistor, chapter 10)
BS170 (N-MOS transistor, chapter 8)
DCF77 (receiver module, chapter 9)
DS18B20 (temperature sensor, chapter 10)
DS18S20 (temperature sensor, chapter 10)
HP03S (pressure sensor, chapter 8)
IRF630 (N-MOS power transistor, chapter 7)
IRF9630 (P-MOS power transistor, chapter 7)
LMC6464 (quad op-amp, chapter 7)
MLX90614 (infrared sensor, chapter 10)
SHT11 (humidity sensor, chapter 8)
TS922 (dual op-amp, chapter 9)
TSOP34836 (infrared receiver, chapter 9)
TSOP1736 (infrared receiver, chapter 9)
MPX4115 (analogue pressure sensor, chapter 11)
MCCOG21605B6W-SPTLYI (I²C LCD, chapter 12)
SST25VF016B (SPI EEPROM, chapter 13)
About the author
Clemens Valens, born in the Netherlands, lives in France since 1997. Manager at Elektor Labs and Webmaster of ElektorLabs, in love with electronics, he develops microcontroller systems for fun, and sometimes for his employer too. Polyglot—he is fluent in C, C++, PASCAL, BASIC and several assembler dialects—Clemens spends most of his time on his computer while his wife, their two children and two cats try to attract his attention (only the cats succeed). Visit the author’s website: www.polyvalens.com.Authentic testimony of Hervé M., one of the first readers of the book:'I almost cried with joy when this book made me understand things in only three sentences that seemed previously completely impenetrable.'
This book details the use of the ARM Cortex-M family of processors and the Arduino Uno in practical CAN bus based projects. Inside, it gives a detailed introduction to the architecture of the Cortex-M family whilst providing examples of popular hardware and software development kits. Using these kits helps to simplify the embedded design cycle considerably and makes it easier to develop, debug, and test a CAN bus based project. The architecture of the highly popular ARM Cortex-M processor STM32F407VGT6 is described at a high level by considering its various modules. In addition, the use of the mikroC Pro for ARM and Arduino Uno CAN bus library of functions are described in detail.
This book is written for students, for practising engineers, for hobbyists, and for everyone else who may need to learn more about the CAN bus and its applications. The book assumes that the reader has some knowledge of basic electronics. Knowledge of the C programming language will be useful in later chapters of the book, and familiarity with at least one microcontroller will be an advantage, especially if the reader intends to develop microcontroller based projects using CAN bus.
The book should be useful source of reference to anyone interested in finding an answer to one or more of the following questions:
What bus systems are available for the automotive industry?
What are the principles of the CAN bus?
What types of frames (or data packets) are available in a CAN bus system?
How can errors be detected in a CAN bus system and how reliable is a CAN bus system?
What types of CAN bus controllers are there?
What are the advantages of the ARM Cortex-M microcontrollers?
How can one create a CAN bus project using an ARM microcontroller?
How can one create a CAN bus project using an Arduino microcontroller?
How can one monitor data on the CAN bus?
Architecture, Programming and Applications
The MSP430 is a popular family of microcontrollers from Texas Instruments. In this book we will work with the smallest type, which is the powerful MSP430G2553. We will look at the capabilities of this microcontroller in detail, as it is well-suited for self-made projects because it is available in a P-DIP20 package.
We will take a closer look at the microcontroller and then build, step by step, some interesting applications, including a 'Hello World' blinking LED and a nice clock application, which can calculate the day of the week based on the date.
You also will learn how to create code for the MSP microcontroller in assembler. In addition to that, we will work with the MSP-Arduino IDE, which makes it quite easy to create fast applications without special in-depth knowledge of the microcontrollers.
All the code used in the book is available for download from the Elektor website.
35 Touch Develop & MicroPython Projects
The BBC micro:bit is a credit sized computer based on a highly popular and high performance ARM processor. The device is designed by a group of 29 partners for use in computer education in the UK and will be given free of charge to every secondary school student in the UK.
The device is based on the Cortex-M0 processor and it measures 4 x 5 cm. It includes several important sensors and modules such as an accelerometer, magnetometer, 25 LEDs, 2 programmable push-button switches, Bluetooth connectivity, micro USB socket, 5 ring type connectors, and a 23-pin edge connector. The device can be powered from its micro USB port by connecting it to a PC, or two external AAA type batteries can be used.
This book is about the use of the BBC micro:bit computer in practical projects. The BBC micro:bit computer can be programmed using several different programming languages, such as Microsoft Block Editor, Microsoft Touch Develop, MicroPython, and JavaScript.
The book makes a brief introduction to the Touch Develop programming language and the MicroPython programming language. It then gives 35 example working and tested projects using these language. Readers who learn to program in Touch Develop and MicroPython should find it very easy to program using the Block Editor or any other languages.
The following are given for each project:
Title of the project
Description of the project
Aim of the project
Touch Develop and MicroPython program listings
Complete program listings are given for each project. In addition, working principles of the projects are described briefly in each section. Readers are encouraged to go through the projects in the order given in the book.
32 new Projects, Practical Examples and Exercises with the Elektor Arduino Nano MCCAB Training Board
Electronics and microcontroller technology offer the opportunity to be creative. This practical microcontroller course provides you with the chance to bring your own Arduino projects and experience such moments of success. Ideally, everything works as you imagined when you switch it on for the first time. In practice, however, things rarely work as expected. At that point, you need knowledge to efficiently search for and find the reason for the malfunction.
In this book for advanced users, we delve deep into the world of microcontrollers and the Arduino IDE to learn new procedures and details, enabling you to successfully tackle and solve even more challenging situations.
With this book, the author gives the reader the necessary tools to create projects independently and also to be able to find errors quickly. Instead of just offering ready-made solutions, he explains the background, the hardware used, and any tools required. He sets tasks in which the reader contributes their own creativity and writes the Arduino sketch themselves.
If you don’t have a good idea and get stuck, there is, of course, a suggested solution for every project and every task, along with the corresponding software, which is commented on and explained in detail in the book.
This practical course will teach you more about the inner workings of the Arduino Nano and its microcontroller. You will get to know hardware modules that you can use to realize new and interesting projects. You will familiarize yourself with software methods such as ‘state machines,’ which can often be used to solve problems more easily and clearly.
The numerous practical projects and exercise sketches are once again realized on the Arduino Nano MCCAB Training Board, which you may already be familiar with from the course book ‘Microcontrollers Hands-on Course for Arduino Starters’, and which contains all the hardware peripherals and operating elements we need for the input/output operations of our sketches.
Readers who do not yet own the Arduino Nano MCCAB Training Board can purchase the required hardware separately, or alternatively, build it on a breadboard.
STmicroelectronics’ wireless IoT & wearable sensor development kit
‘SensorTile.box’ is a portable multi-sensor circuit board housed in a plastic box and developed by STMicroelectronics. It is equipped with a high-performance 32-bit ARM Cortex-M4 processor with DSP and FPU, and various sensor modules, such as accelerometer, gyroscope, temperature sensor, humidity sensor, atmospheric pressure sensor, microphone, and so on. SensorTile.box is ready to use with wireless IoT and Bluetooth connectivity that can easily be used with an iOS or Android compatible smartphone, regardless of the level of expertise of the users. SensorTile.box is shipped with a long-life battery and all the user has to do is connect the battery to the circuit to start using the box.
The SensorTile.box can be operated in three modes: Basic mode, Expert mode, and Pro mode. Basic mode is the easiest way of using the box since it is pre-loaded with demo apps and all the user has to do is choose the required apps and display or plot the measured data on a smartphone using an app called STE BLE Sensor. In Expert mode users can develop simple apps using a graphical wizard provided with the STE BLE Sensor. Pro mode is the most complex mode allowing users to develop programs and upload them to the SensorTile.box.
This book is an introduction to the SensorTile.box and includes the following:
Brief specifications of the SensorTile.box; description of how to install the STE BLE Sensor app on an iOS or Android compatible smartphone required to communicate with the box.
Operation of the SensorTile.box in Basic mode is described in detail by going through all of the pre-loaded demo apps, explaining how to run these apps through a smartphone.
An introduction to the Expert mode with many example apps developed and explained in detail enabling users to develop their own apps in this mode. Again, the STE BLE Sensor app is used on the smartphone to communicate with the SensorTile.box and to run the developed apps.
The book then describes in detail how to upload the sensor data to the cloud. This is an important topic since it allows the sensor measurements to be accessed from anywhere with an Internet connection, at any time.
Finally, Pro mode is described in detail where more experienced people can use the SensorTile.box to develop, debug, and test their own apps using the STM32 open development environment (STM32 ODE). The Chapter explains how to upload the developed firmware to the SensorTile.box using several methods. Additionally, the installation and use of the Unicleo-GUI package is described with reference to the SensorTile.box. This PC software package enables all of the SensorTile.box sensor measurements to be displayed or plotted in real time on the PC.