NET Microframework

conversebazaarSoftware and s/w Development

Nov 2, 2013 (4 years and 8 days ago)

140 views

2010
-
03
-
27

Laurent Ellerbach

Audience Marketing
Director


Microsoft Central and
Eastern

Europe


.NET
Microframework

.NET
Microframework


Demo

Hello
Led


Demo

My

first HTTP Server


Demo

managing

my

sprinklers


Demo

Lighting

my

Lego city

Agena

.NET Micro Framework

.NET for inexpensive
processors


Directly
on the
metal, No MMU


Small
, configurable
footprint


ARM7
@ 20
-
40
Mhz


ARM9 @ 200
Mhz


~ 300
Ko

de RAM


1 Mo de
mémoire

Flash/ROM

.NET compatibility


Different Versioning


Selections from all desktop
releases


Specific Embedded support
added

.NET
Microframework

for

Collaborative Open Source

Release History


V. 4.0 (Nov 2009) all Microsoft


V. 4.1 (June 2010) minor community
contributions


V 4.2
(Summer 2011) > 30% community
contributions


Non
-
M
icrosoft domain site


netmf.com


Partner communities


t
inyclr.com, netduino.com

Ports from Atmel, NXP,
Renasas
, TI, ST Micro, …

NETMF Open Source Model

Namespaces

System.Windows

System.Windows.Controls

Window

Border

Image

Panel

CheckBox

Button

ListBox

ListView

RadioButton

ScrollViewer

UIElement

TextBox

StackPanel

System.Windows.Input

Stylus

Mouse

Keyboard/GPIO

System.Forms

System.Data

System.XML

Writer

Reader

System.Drawing

System

Collections

IO

Resources

Threading

Security

Globalization

Reflection

NET/HTTP

Diagnostics

Compiler Svcs

Runtime

Remoting

Serialization

System.Service.Model

DPWS Addressing

DPWS
Eventing

DPWS Discovery

Proxy Discovery

DPWS Transfer

Managed Drivers

I2C/SPI

USB

SerialPort

GPIO

Watchdog

Power Mgmt

A/D

PWM

Partial
implementation

Same

as .NET Fx

1 board like the
Netduino

one


Get the
Netduino

Plus
version with network
support and SD for 50



The SDK


Free download

Visual Studio Express (C#)


Free download


…and a good idea to build
something


What do you need to start?

Processor
and memory

Atmel 32
-
bit microcontroller

Speed: 48MHz, ARM7

Code Storage: 64 KB


without networking: 128 KB

RAM: 28 KB


without networking: 60 KB

My

first
project

: Hello
Led



All what you have to know : U =
RxI

Want to use a led on an output pin (3,3V on
Netduino
)

1 led = 2 V average, current 0,02A

R = (3,3


2)/0,02 = 65 Ohms

Some Hard


Reuse an old sensor
from a 15 years old
hard drive used to
count turns


Will blink a Led when
the light sensor is
obstructed

More Hard

Ground

(black)

2V (
red
)

Digital IO (
yellow
)

Light sensor acting like a resistor
1M Ω (dark) to 100 Ω (very
bright)

R = √(1M x 100) = 10K Ω

Analogic input = 3.3/(1+R/RL)

Vary from 0.0323V (very bright)
to 3.23V (dark)


Analogic input example

Ground

+3.3V

Analogic input

10K


R

RL

My

first Web Server

Start from the Web Server sample


How it works

1 thread per protocol = 1 for http

1 handler to process all requests (GET and POST)

1 function to process GET

1 function to process POST

1 function to return a file from storage (by chunk as limited buffer
size)

1 function to upload a file
from
storage (by
chunk as limited buffer
size)


Lots of other functions used to make it work

Excellent example implementing lots of good practices like file access


Implementing a web server

Remove all code related to https

Remove all code related to POST if you only use GET

Remove all code related to file transfer

Remove all code related to directory listing


Add a function to read parameters in the URL

Add some code in the GET management function

Add your own code for your own pages

Simplifying the web server

Managing my sprinklers

How it works

Netduino

http

1 Page to manage the
programming

1 Page to switch on/of led

Client using a
simple browser

2 Pages to manage the
calendar programming

Timer to launch the sprinklers

Lighting my Lego city

How it works

Netduino

http

Page returning the setup

Page to switch on/of led

http

Web Server with
ASP.NET pages

Client using a
simple browser

Try catch all the time…

Buffer is limited (1024 in most small ARM)

System.Threading.Thread.Sleep
(100);

Compromise between nice code and efficient footprint

Security is important, think of it since the design

U=RI


if (
Microsoft.SPOT.Hardware.SystemInfo.IsEmulator
)


strDefaultDir

= "WINFS";


else


strDefaultDir

= "SD
";

localhost:81 used in the emulator for web
serveur

Tips and tricks

SDK
download:
http://
netmf.codeplex.com/releases/view/52341


.NET
Microframework

sources:
http://netmf.codeplex.com
/


Visual Studio
Express:
http://
www.microsoft.com/visualstudio/en
-
us/products/2010
-
editions/express


Netduino
:
http://www.netduino.com
/



Blogs and useful links


http://
www.netmf.com



http://
blogs.msdn.com/netmf



http://
blogs.msdn.com/netmfteam


http://www.tinyclr.com
/



http://nerduino.wordpress.com
/



http://
www.ghielectronics.com/downloads/FEZ/Beginners%20g
uide%20to%20NETMF.pdf



http://www.ghielectronics.com/catalog/category/265
/



http://
blogs.msdn.com/laurelle


Resources

Laurent Ellerbach

laurelle@microsoft.com

http://blogs.msdn.com/laurelle

QUESTIONS