
.Net Micro Framework - First Steps
The teaser was perceived conservatively, but positively, so continue.

So, the box was unpacked, the buttons poked, pushed to the debug output at startup. Cool! The piece of iron works.
Although, on the other hand, she is not doing anything useful.
I will not describe the installation of the IDE, SDK, and the primary firmware of the hardware, because with the first two, and so everything is clear, but firmware is a specific matter, and is well described by the manufacturer.
Disclaimer: Embedded platform for the first time in my hands. There is no development experience (I don’t think that viewing hackaday.com and reading wasm.ru is enough). There are only vague ideas. But there is experience writing in C #. If you are a severe Asm / C installer and this story is a harsh working day for you , then my article is probably not for you.
And for now, I'll write a short little Hello World!
I open a studio, choose a new project for ChipworkX Module.
I cheerfully write in the main method
and then I get
Uh, let's go. The console here does not smell. We will go the other way.
- Is there a screen?
- There is!
- So it will draw pictures.
After a short search, the following construction appears:
The Habr resource is a bitmap lying in the usual * .resx
. I run and see. It works, the picture draws, hello Habr.
But we would be more interactive.
- Do you have buttons?
- There is!
- We will intercept interruptions.
After a run through the documentation, the InterruptPort class was discovered, which allows you to hang an interrupt handler on GPIO pins.
A little mana smoking, and a code was written that, when you press the central button, it performs the operation of raising the pen and lowering the pen, winking at the same time with the LED (class OutputPort), and the cursor buttons respectively move the pen across the screen.
Code: pastebin.com/AMF2Th2g
And the result :)

It took 3 with a little hours. So far, the result is satisfactory ... The other day I’ll write something else.
PS
There is an accelerometer on the harness, so the continuation of the experiment will be to communicate with the I 2 C sensor and draw a rolling ball on the screen :)
PPS
Literature:
Beginner's Guide to NETMF
MicroFrameworkProject.com

So, the box was unpacked, the buttons poked, pushed to the debug output at startup. Cool! The piece of iron works.
Although, on the other hand, she is not doing anything useful.
What do we need to get started?
- Visual Studio 2010 Express (C # Edition)
- Microsoft .Net Micro Framework 4.1 SDK
- GHI Electronics SDK (this, of course, only for this family of glands)
I will not describe the installation of the IDE, SDK, and the primary firmware of the hardware, because with the first two, and so everything is clear, but firmware is a specific matter, and is well described by the manufacturer.
Wednesday prepared? Go!
Disclaimer: Embedded platform for the first time in my hands. There is no development experience (I don’t think that viewing hackaday.com and reading wasm.ru is enough). There are only vague ideas. But there is experience writing in C #. If you are a severe Asm / C installer and this story is a harsh working day for you , then my article is probably not for you.
And for now, I'll write a short little Hello World!
I open a studio, choose a new project for ChipworkX Module.
I cheerfully write in the main method
Console.WriteLine ("Hello, World!");
and then I get
Error 1 The name 'Console' does not exist in the current context
Uh, let's go. The console here does not smell. We will go the other way.
- Is there a screen?
- There is!
- So it will draw pictures.
After a short search, the following construction appears:
public class Program { private static readonly int LCDHeight = SystemMetrics.ScreenHeight; private static readonly int LCDWidth = SystemMetrics.ScreenWidth; private static Bitmap LCD = new Bitmap (LCDWidth, LCDHeight); public static void Main () { Bitmap habr = Resources.GetBitmap (Resources.BitmapResources.Habr); LCD.Clear (); LCD.DrawRectangle (Colors.White, 0, 0, 0, LCDWidth, LCDHeight, 0, 0, Colors.White, 0, 0, Colors.White, 0, 0, ushort.MaxValue); LCD.DrawImage ((LCDWidth - habr.Width) / 2, (LCDHeight - habr.Height) / 2, habr, 0, 0, habr.Width, habr.Height); LCD.Flush (); Thread.Sleep (Timeout.Infinite); } }
The Habr resource is a bitmap lying in the usual * .resx
. I run and see. It works, the picture draws, hello Habr.
But we would be more interactive.
- Do you have buttons?
- There is!
- We will intercept interruptions.
After a run through the documentation, the InterruptPort class was discovered, which allows you to hang an interrupt handler on GPIO pins.
A little mana smoking, and a code was written that, when you press the central button, it performs the operation of raising the pen and lowering the pen, winking at the same time with the LED (class OutputPort), and the cursor buttons respectively move the pen across the screen.
Code: pastebin.com/AMF2Th2g
And the result :)

It took 3 with a little hours. So far, the result is satisfactory ... The other day I’ll write something else.
PS
There is an accelerometer on the harness, so the continuation of the experiment will be to communicate with the I 2 C sensor and draw a rolling ball on the screen :)
PPS
Literature:
Beginner's Guide to NETMF
MicroFrameworkProject.com