Thought for the Dazed

I've had to give up that Distance Learning course as I was having trouble seeing the teacher.

RobMiles' items Go to RobMiles' photostream
C# Yellow Book

Search entire site

This FAQ touches on and expands material as provided here. However, it focuses more on the development aspects.

The .NET Micro Framework in General

What is the .NET Micro Framework?

It provides a platform for running programs written in C# on a small device. The C# source code is compiled into MSIL (Microsoft(tm) Intermediate Language) and this is interpreted by a program running on the target hardware. There is no operating system as such, for resource management the running program simply makes calls into the language libraries.

What does "Small Device" mean?

At the moment this means an ARM 7 or ARM 9 microprocessor. Other devices may follow. These are the kind of processors you find embedded in consumer devices such as remote controls, microwave ovens etc. The programs inside such devices are simply there to provide behaviour for that device.  The .NET Micro Framework will allow such devices to be controlled by managed code written in C#.

How do I get hold of a .NET Micro Framework based device?

At the moment you can't. Whilst the hardware and software is well developed the precise way in which devices are going to be sold and supported has yet to be released.

Is the .NET Micro Framework really going to change the world?

In a way, yes. At the moment if you want to write code to run in a tiny device you have to learn how to do lots of low level interfacing and write code which runs directly on the hardware. The programs are hard to debug and you have to learn how to use lots of new tools to do this. With the .NET Micro Framework the code is written and debugged using Visual Studio 2005. Programs running in the device can be single stepped and debugged just like any other. The language used is C# and the actual hardware features of the devices are exposed in an object oriented manner which makes them very easy to use. This will make embedded codemuch easier to create and open it up to a wider range of developers.

So just what can you do with this thing?

At the most simple level you can read inputs (perhaps switches) and turn things on and off (perhaps lights).  In fact your code can interact directly with any kind of digital device that you like. Your program  can also read voltages and, using a technique called "pulse width modulation" it can provide analogue outputs. There are also libraries of routines available to perform logging and simple data transfer as well as interface with standard hardware components. Take a look at some of the example programs to find out more.

Is there anything that the .NET Micro Framework can't do?

Yes. Programs running on the Micro Framework are not "real time". In other words it is not possible to guarantee that a response to a given stimulus will be produced within a strict and guaranteed time. For real time work you really need an operating system (for example Windows CE) which contains scheduling features. However, in the context of the target devices for this framework the lack of real time behaviour  is not a problem. A user of a remote control only cares that when the button is pressed something happens, not that it happens within a millisecond. Given the high clock speeds of the underlying hardware the lack of real time support is not a major problem.


Writing programs for the .NET Micro Framework

How do I write and deploy programs?

You write your programs in C#, as you would for the PC, Pocket PC or Smartphone. You use Visual Studio 2005 and set your project properties to tell Visual Studio which serial port the physical device is attached to. When you press deploy the program is sent down this serial port into the target device, which then stores the code in non-volatile (i.e. holds its conents when the power is off) memory. Once the program has been deployed it will run automatically each time the device is switched on, whether Visual Studio is connected or not. When you are developing Visual Studio will send commands down the serial port to pause an existing program and overwrite it each time you send a new version.

Is it really that easy?

Yes and no. When it works, it really is that easy. Even better, you can set breakpoints (even in running programs) and view variables just as you would any C# program. The bad news is that the present version of the hardware and the Visual Studio add-in that you use to deploy the code are a bit fussy about the connection between them. Only certain kinds of serial port work correctly, and you may need to manually configure the COM port (perhaps using HyperTerm) to get it to work.  Bear in mind that the current release of both hardware and software are at a technology preview level of release though, and that later versions can be expected to be much better in this respect.

What does a .NET Micro Framework Program Look Like?

The programs look just like any other C# programs. The hardware is exposed by means of an object model. Take a look here for a sample.