1 / 20

.NET Microframework

.NET Microframework. 2010-03-27 Laurent Ellerbach Audience Marketing Director Microsoft Central and Eastern Europe. Agena. .NET Microframework Demo Hello Led Demo My first HTTP Server Demo managing my sprinklers Demo Lighting my Lego city. .NET Micro Framework.

berny
Télécharger la présentation

.NET Microframework

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. .NET Microframework 2010-03-27Laurent EllerbachAudience Marketing Director Microsoft Central and Eastern Europe

  2. Agena • .NET Microframework • Demo Hello Led • DemoMy first HTTP Server • Demomanagingmy sprinklers • DemoLightingmy Lego city

  3. .NET Micro Framework .NET Microframework for • .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émoireFlash/ROM • .NET compatibility • Different Versioning • Selections from all desktop releases • Specific Embedded support added

  4. NETMF Open Source Model • 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-Microsoft domain site – netmf.com • Partner communities • tinyclr.com, netduino.com • Ports from Atmel, NXP, Renasas, TI, ST Micro, …

  5. Partial implementation Namespaces Same as .NET Fx System.Windows System.Windows.Controls Window Border ListView Button RadioButton System.Data CheckBox ScrollViewer System.Windows.Input System.XML Panel StackPanel Keyboard/GPIO Image TextBox Reader Mouse ListBox UIElement Writer Stylus System.Forms System.Drawing System Collections Globalization Diagnostics System.Service.Model Runtime Remoting Serialization Security Reflection DPWS Discovery Threading IO DPWS Eventing Resources NET/HTTP Compiler Svcs DPWS Addressing Managed Drivers DPWS Transfer I2C/SPI Power Mgmt SerialPort A/D Proxy Discovery USB GPIO Watchdog PWM

  6. What do you need to start? • 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  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

  7. My first project : Hello Led

  8. Some Hard  • 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

  9. More 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 2V (red) Digital IO (yellow) Ground (black)

  10. Analogic input example • 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) +3.3V 10KΩ R Analogic input RL Ground

  11. My first Web Server

  12. Implementing a 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

  13. Simplifying the 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

  14. Managing my sprinklers

  15. How it works Netduino http Client using a simple browser 2 Pages to manage the calendar programming 1 Page to switch on/of led 1 Page to manage the programming Timer to launch the sprinklers

  16. Lighting my Lego city

  17. How it works Web Server with ASP.NET pages Netduino http http Page to switch on/of led Client using a simple browser Page returning the setup

  18. Tips and tricks • 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

  19. Resources • SDK download: http://netmf.codeplex.com/releases/view/52341 • .NET Microframeworksources: 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%20guide%20to%20NETMF.pdf • http://www.ghielectronics.com/catalog/category/265/ • http://blogs.msdn.com/laurelle

  20. QUESTIONS Laurent Ellerbachlaurelle@microsoft.comhttp://blogs.msdn.com/laurelle

More Related