Energia - program a TI MSP430 using Arduino sketches
TI MSP430 LaunchpadI started tinkering with microcontroller a couple of years ago with an Arduino Uno. I had a little experience with C, so programming in the Arduino environment has been relatively easy and straightforward for me. My code is not necessarily elegant or efficient, but I can usually figure out how to make an Arduino do what I want it to do eventually. A lot of credit to the Arduino userbase, as it is very easy to figure most things out with a quick Google...
Introduction to Microcontrollers - Buttons and Bouncing
What Is A Button?To your hardware, that is. As discussed in Introduction to Microcontrollers - More On GPIO, a button (or key, or switch, or any form of mechanical contact) is generally hooked up to a microcontroller so as to generate a certain logic level when pushed or closed or "active," and the opposite logic level when unpushed or open or "inactive." The active logic level can be either '0' or '1', but for reasons both historical and electrical, an...
Arduino robotics #4 - HC-SR04 ultrasonic sensor
Arduino RoboticsArduino robotics is a series of article chronicling my first autonomous robot build, Clusterbot. This build is meant to be affordable, relatively easy and instructive. The total cost of the build is around $50.
1. Arduino robotics - motor control2. Arduino robotics - chassis, locomotion and power3. Arduino robotics - wiring, coding and a test run4.Arduino robotics #3 - wiring, coding and a test run
Arduino RoboticsArduino robotics is a series of article chronicling my first autonomous robot build, Clusterbot. This build is meant to be affordable, relatively easy and instructive. The total cost of the build is around $50.
1. Arduino robotics - motor control2. Arduino robotics - chassis, locomotion and power3. Arduino robotics - wiring, coding and a test run4.Arduino robotics #2 - chassis, locomotion and power
Arduino RoboticsBeginner robotics is a series of article chronicling my first autonomous robot build, Clusterbot. This build is meant to be affordable, relatively easy and instructive. The total cost of the build is around $50.
1. Arduino robotics - motor control2. Arduino robotics - chassis, locomotion and power3. Arduino robotics - wiring, coding and a test run4.Introduction to Microcontrollers - More Timers and Displays
Building Your World Around TimersBy now you have seen four different ways to use timers in your programs. Next we will look at some ways to produce the effect of multiple parallel streams of work in your program with the help of timers. This effect is only an appearance, not a reality, since a single microcontroller (one core) can only run a single thread of code. However, since microcontrollers are so fast in relation to a great many of the tasks to...
Arduino robotics #1 - motor control
Arduino RoboticsBeginner robotics is a series of article chronicling my first autonomous robot build, Clusterbot. This build is meant to be affordable, relatively easy and instructive. The total cost of the build is around $50.
1. Arduino robotics - motor control2. Arduino robotics - chassis, locomotion and power3. Arduino robotics - wiring, coding and a test run4.Introduction to Microcontrollers - Adding Some Real-World Hardware
When 2 LEDs Just Don't Cut It AnymoreSo far, we've done everything in this series using two LEDs and one button. I'm guessing that the thrill of blinking an LED has worn off by now, hard as that is to imagine. What's more, we've just about reached the limits of what we can learn with such limited I/O. We have come to the point where we need to add some hardware to our setup to continue with additional concepts and microcontroller...
Introduction to Microcontrollers - Timers
Timers - Because "When" MattersComputer programs are odd things, for one reason because they have no concept of time. They may have the concept of sequential execution, but the time between instructions can be essentially any number and the program won't notice or care (unless assumptions about time have been built into the program by the programmer). But the real world is not like this. In the real world, especially the real embedded world,...
Introduction to Microcontrollers - More On Interrupts
A Little More Detail About The Interrupt MechanismIt's time to look a little closer at what happens in an interrupt request and response. Again this is in general terms, and different microcontroller designs may do things somewhat differently, but the basics remain the same. Most but not all interrupt requests are latched, which means the interrupt event sets a flag that stays set even if the interrupt event then goes away. It is this latched flag...
Five Embedded Linux Topics for Newbies !
Are you an embedded systems enthusiast looking to broaden your horizons with embedded Linux? explore those 5 topics.
How to Build a Fixed-Point PI Controller That Just Works: Part II
In Part I we talked about some of the issues around discrete-time proportional-integral (PI) controllers:
- various forms and whether to use the canonical form for z-transforms (don't do it!)
- order of operation in the integral term: whether to scale and then integrate (my recommendation), or integrate and then scale.
- saturation and anti-windup
In this part we'll talk about the issues surrounding fixed-point implementations of PI controllers. First let's recap the conceptual structure...
C++ on microcontrollers 1 - introduction, and an output pin class
This blog series is about the use of C++ for modern microcontrollers. My plan is to show the gradual development of a basic I/O library. I will introduce the object-oriented C++ features that are used step by step, to provide a gentle yet practical introduction into C++ for C programmers. Reader input is very much appreciated, you might even steer me in the direction you find most interesting.
I am lazy. I am also a programmer. Luckily, being a lazy...
Introduction to Microcontrollers - More On Interrupts
A Little More Detail About The Interrupt MechanismIt's time to look a little closer at what happens in an interrupt request and response. Again this is in general terms, and different microcontroller designs may do things somewhat differently, but the basics remain the same. Most but not all interrupt requests are latched, which means the interrupt event sets a flag that stays set even if the interrupt event then goes away. It is this latched flag...
Introduction to Microcontrollers - Buttons and Bouncing
What Is A Button?To your hardware, that is. As discussed in Introduction to Microcontrollers - More On GPIO, a button (or key, or switch, or any form of mechanical contact) is generally hooked up to a microcontroller so as to generate a certain logic level when pushed or closed or "active," and the opposite logic level when unpushed or open or "inactive." The active logic level can be either '0' or '1', but for reasons both historical and electrical, an...
Debugging with Heartbeat LEDs
In this article I’ll discuss one of the most basic debugging tools in an embedded system: the heartbeat LED. Picture this: you’re developing your first program for a new microcontroller. You’ve written the code, configured the programmer, downloaded the HEX file and now... what Your program is running - isn’t it?
Truth is that it’s hard to tell with most embedded software. Compared to desktop or even server applications embedded software tend not to have very many...
Getting Started with (Apache) NuttX RTOS Part 2 - Looking Inside and Creating Your Customized Image
In the previous article (https://www.embeddedrelated.com/showarticle/1524.p...) we saw how to run NuttX RTOS using the SIMulator. Today we will see how NuttX's directory tree is organized and how to use the menuconfig to enable some applications, including some tricks to search and solve dependencies.
NuttX Directories organization:
If you have previously compiled the Linux kernel or the U-Boot bootloader you will see that the NuttX source tree organization is...
Arduino robotics #1 - motor control
Arduino RoboticsBeginner robotics is a series of article chronicling my first autonomous robot build, Clusterbot. This build is meant to be affordable, relatively easy and instructive. The total cost of the build is around $50.
1. Arduino robotics - motor control2. Arduino robotics - chassis, locomotion and power3. Arduino robotics - wiring, coding and a test run4.Introduction to Microcontrollers - Button Matrix & Auto Repeating
Too Many Buttons, Not Enough InputsAssigning one GPIO input to each button can use up a lot of GPIO pins. Numeric input requires at least 10 buttons, plus however many additional control or function buttons. This can quickly get expensive, GPIO pin-wise, and also connector-wise if the keypad is off the uC PCB as it often would be. A very common response to this expense is to wire buttons (keys, etc) in a matrix. By connecting our buttons in an...
Unit Tests for Embedded Code
I originate from an electrical engineering background and my first industry experience was in a large, staid defense contractor. Both of these experiences contributed to a significant lack of knowledge with regards to software development best practices. Electrical engineers often have a backwards view of software in general; large defense contractors have similar views of software and couple it with a general disdain for any sort of automation or ‘immature’ practices. While there...
Cortex-M Exception Handling (Part 2)
The first part of this article described the conditions for an exception request to be accepted by a Cortex-M processor, mainly concerning the relationship of its priority with respect to the current execution priority. This part will describe instead what happens after an exception request is accepted and becomes active.
PROCESSOR OPERATION AND PRIVILEGE MODEBefore discussing in detail the sequence of actions that occurs within the processor after an exception request...
Coding - Step 0: Setting Up a Development Environment
Articles in this series:
- Coding Step 0 - Development Environments
- Coding Step 1 - Hello World and Makefiles
- Coding Step 2 - Source Control
- Coding Step 3 - High-Level Requirements
- Coding Step 4 - Design
You can easily find a million articles out there discussing compiler nuances, weighing the pros and cons of various data structures or discussing the optimization of databases. Those sorts of articles are fascinating reads for advanced programmers but...
Introduction to Microcontrollers - Adding Some Real-World Hardware
When 2 LEDs Just Don't Cut It AnymoreSo far, we've done everything in this series using two LEDs and one button. I'm guessing that the thrill of blinking an LED has worn off by now, hard as that is to imagine. What's more, we've just about reached the limits of what we can learn with such limited I/O. We have come to the point where we need to add some hardware to our setup to continue with additional concepts and microcontroller...
Using XML to describe embedded devices (and speak to them)
This article discusses one of the typical development cycles in embedded device and communication design and presents a possible, light weight solution using the free DClib/netpp framework.
The challengeAssume we're faced with the design of an embedded device, be it a simple SoC unit or a more complex, uC controlled engine with various attached peripherals. From first prototype to the market, the following development cycle is typically walked through:
Energia - program a TI MSP430 using Arduino sketches
TI MSP430 LaunchpadI started tinkering with microcontroller a couple of years ago with an Arduino Uno. I had a little experience with C, so programming in the Arduino environment has been relatively easy and straightforward for me. My code is not necessarily elegant or efficient, but I can usually figure out how to make an Arduino do what I want it to do eventually. A lot of credit to the Arduino userbase, as it is very easy to figure most things out with a quick Google...
Real-time clocks: Does anybody really know what time it is?
We recently started writing software to make use of a real-time clock IC, and found to our chagrin that the chip was missing a rather useful function, namely elapsed time in seconds since the standard epoch (January 1, 1970, midnight UTC).Let me back up a second.A real-time clock/calendar (RTC) is a micropower chip that has an oscillator on it that keeps counting time, independent of main system power. Usually this is done with a lithium battery that can power the RTC for years, so that even...
C++ on microcontrollers 2 - LPCXpresso, LPC-link, Code Sourcery, lpc21isp, linkerscript, LPC1114 startup
previous parts: 1
This blog series is about the use of C++ for modern microcontrollers. My plan is to show the gradual development of a basic I/O library. I will introduce the object-oriented C++ features that are used step by step, to provide a gentle yet practical introduction into C++ for C programmers. Reader input is very much appreciated, you might even steer me in the direction you find most interesting.
I teach my students that...
How to Arduino - a video toolbox
I've begun producing a new series of video tutorials for the hobbyist new to the Arduino or microcontrollers in general. My videos are very pragmatic - I prefer to answer the question "what is the quickest, simplest and most affordable way to accomplish this?". The videos are meant to be a quick source of "how to" knowledge for the hobbyist that is using an LCD display, ultrasonic sensor or accelerometer for the first time, for example. I hope you enjoy this series of...
Introduction to Microcontrollers - More Timers and Displays
Building Your World Around TimersBy now you have seen four different ways to use timers in your programs. Next we will look at some ways to produce the effect of multiple parallel streams of work in your program with the help of timers. This effect is only an appearance, not a reality, since a single microcontroller (one core) can only run a single thread of code. However, since microcontrollers are so fast in relation to a great many of the tasks to...
Practical CRCs for Embedded Systems
CRCs are a very practical tool for embedded systems: you're likely to need to use one as part of a communications protocol or to verify the integrity of a program image before writing it to flash. But CRCs can be difficult to understand and tricky to implement. The first time I attempted to write CRC code from scratch I failed once. Then twice. Then three times. Eventually I gave up and used an existing library. I consider myself intelligent: I got A's...