Recently, I discovered a new way to
program small devices while using
the same programming language,
environment (IDE), and debugger I
use for PC applications. The key is
the .NET Micro Framework — a
special edition of .NET for devices
that don’t have the resources to run
Windows. You write code in Visual
C#, and develop and debug using
the Visual Studio IDE.
Small devices need I/O, and the .NET Micro Framework supports plenty of it, including basic input and output
ports, serial interfaces, networking, USB device functions,
and displays — even touch screens. Vendor classes add
support for USB host functions and more.
The .NET Micro Framework has expanded my ideas
about the kinds of small devices I can create without a big
investment in tools and time. This article will show how
you can use the .NET Micro Framework in your projects.
A .NET Edition for Devices
Microsoft’s .NET Framework has long been a popular
platform for writing applications for PCs. You can program
.NET applications in Visual Basic, Visual C#, and other
visual languages. (Microsoft only supports Visual C# on
the .NET Micro Framework. For more about the language,
see the sidebar About Visual C#.)
46 April 2010
By Jan Axelson
The Framework includes class libraries to support
common tasks. For example, the SerialPort class provides
properties, methods, and events for communicating with
RS-232 and similar serial ports.
The Framework also provides a common language
runtime (CLR) which manages program execution. The
CLR frees applications from the low-level details of
managing memory, threading, exceptions, garbage
collection, and security. Visual Studio provides an IDE and
debugger for programming in .NET languages.
Small devices that run Windows Embedded can use
the .NET Compact Framework. However, the .NET Micro
Framework goes a step further and provides a way to run
.NET programs on devices that don’t use Windows at all. If
you have experience with .NET programming on PCs,
much about the .NET Micro Framework will be familiar.
Multiple vendors offer modules with support for the
.NET Micro Framework built in. A porting kit from
Microsoft supports several processors. Most of the
modules available from vendors use 32-bit ARM7 or
ARM9 CPUs which have the resources to support running
.NET Micro Framework programs.
GHI Electronics has a wide selection of modules. The
FEZ Mini (Figure 1) has basic interfaces for simpler
projects (and its own website at tinyclr.com). On the
other end of the spectrum, the ChipworkX board supports
just about any type of I/O you might want, including a
touch panel and USB host and device functions.
Figure 2 shows a touch-screen data logger I designed
on the ChipworkX board. The screen shows images of
target bird species. When you touch an image, the logger
reads time and location information from a GPS unit and
stores the bird type and GPS data on a Flash drive.