LightBlog

Tuesday, 15 January 2019

What is .NET Framework? Definition and Architecture of .NET Framework

What-is-.NET-Framework

What is the .NET Framework?


.NET Framework was developed to standardize programming. Once you program in .NET, you are not concerned with the underlying Operating System. It provides a set of libraries that developers can use from several programming languages.

The .NET Framework runs on PCs and not on smaller devices because this is a very large framework. Apart from this, there are many things in the full framework (methods) that will not be very useful on small appliances.

In this way, the .NET Compact Framework was born. Compact framework removed unnecessary libraries so that the size of the framework could be reduced. This short version runs on Windows CE and smartphones. The compact framework is smaller than the full framework, but it is still too big for mini devices due to its size and because it requires an operating system to run.

The .NET Micro Framework is the smallest version of those frameworks. It removed more libraries and the OS became independent. Due to similarities in these three settings, almost identical codes can now run on PC or small devices, with little or no modification.

For Example, the use of serial ports on PCs, WinCE devices, or FEZ works the same way when NET is used.

Advantages of  .NET Framework 


If you are using the .NET Micro Framework then there are several advantages:
  1. It runs on Microsoft's Visual C # Express, Free and High-end IDE.
  2. The .NET Micro Framework is open-source and free.
  3. Your single code will not run any Netmaff device with almost any change.
  4. Full debugging capabilities. (Stepping in the breakpoint, code, variable ... etc)
  5. Ensure quality has been tested in many commercial products.
  6. Many bus drivers are included. (SPI, UART, I2C ... etc)
  7. Completes the need to use complex and long processor datasheets.
  8. If you are already a PC C # programmer, then you know NETMF.

Gadget of .NET Framework


Definitions of the .NET Gadget Platform take the flexibility of NETMF to the next level. It is a set of rules that how the hardware module can interact with a mainboard. Full specifications and software are open-source. GHI is proud of the first person to offer the .NET gadget to Electronics.
Forum.

More details are found at https://www.ghielectronics.com

What is .NET Framework? Definition of .NET Framework


Getting Started with .NET Framework

Important note: If you have just received your hardware or you are not sure where the firmware is loaded, then you have to update the firmware. This page summarizes the firmware update https://ghielectronics.com

System Setup

Before we try to do anything, we want to ensure that the PC is set up with the necessary software. Download and install the first Visual C # Express 2017
https://visualstudio.microsoft.com/vs/express/

Now, download and install .NET Micro Framework 4.1 SDK (not porting kit) and GHI package installer. Both are found on this page
https://www.microsoft.com/en-us/download/details.aspx?id=8515
By the way, you may want to bookmark this page because it is about everything that you need to use NETMF.

The Emulator

NETMF includes an emulator that allows you to run NETMF applications on your PC. For our first project, we will use the emulator to run a very simple application.

Create a Project.

Open Visual C # Express and, from the menu, choose File -> New Project. The wizard should now have the option of "Micro Framework" in the left menu. Click on it, and from the templates, select "Console Application".

What-is-.NET-Framework


Click on the "OK" button and you will have a new project that is ready to run. There is only one C # file in the project, which is called Program.cs, which contain very few lines of code. The file is shown in the "Solution Explorer" window. If this window is not visible, you can open it by clicking on "View-> Solution Explorer" from the menu.

What-is-.NET-Framework?
Change the code to look like simplicity below for listings

What-is-.NET-Framework?


Selection of Transport

Do not worry if you do not understand the code. I will explain it later. For now, we want to run it on the emulator. Let's make sure you have everything properly set up. Click on "Project-"


From the "Properties" menu In the new show window, we want to make sure that we select the emulator. On the left side tab, select ".NET Micro Framework" and make sure that the window looks like the image below.

Transport: Emulator

What-is-.NET-Framework?


Device: Microsoft Emulator


Make sure that the output window is visible, click on

View> Output

If you are not seeing this option, then you need to first enable expert settings, which are found in

Tools-> Settings-> Expert Settings


Executing

Finally, we are ready to run our first application. Press F5 Key on the computer. This is a very useful shortcut and you will use it a lot to run your applications. After you press F5, the app will be compiled and loaded on the emulator and everything will be closed in a few seconds! That's because our program had ended execution so fast that we did not see much.

Now we want to "debug" the code. Debugging means that you are capable of stepping into code and see what it is doing. This is one of the biggest values of NETMF.

This time, use F11 instead of F5, it will simply "step" in the app instead of running it. It will deploy the app on the emulator and will close in the first line of code. This is indicated by a yellow arrow.


What-is-.NET-Framework?


The C # application always starts with a method called Main and this is where the arrow is closed. Again press F11 and run the next line of debugger code, which is the line that you previously changed. 

You've probably guessed it right, this line is "Amazing!" Will print Debug window The debug window is the output window on Visual C # Express. Ensure that the output window looks like before and press F11 once. Once you step on that line, you see "Amazing!" In the output window, Words will appear.


What-is-.NET-Framework?


If you press F11 again now, the program will end and the emulator will exit.

Breakpoints

The breakpoint is another useful feature when debugging codes. When the application is running, the debugger checks whether execution has reached a breakpoint. If so, the execution will stop. "wonderful!" Click on the bar on the left side of the printing line, it will show a red dot
A breakpoint indicates.


What-is-.NET-Framework?

Now press F5 to play software and when the app reaches the breakpoint, the debugger will stop, as shown in the image below


What-is-.NET-Framework?


Now, you can step into the code using F11 or continue execution using F5.

Running on Hardware

It is very easy to run NETMF applications on the hardware. Instructions may vary slightly on different hardware. This book uses FEZ for display purposes but no other hardware will work this way.

MfDeploy can Ping!

Before we use the hardware, make sure that it is properly connected. The NETMF SDK comes with Microsoft software that is called MFDeploy. There are many good uses for MFDeploy but now we just need to "ping" the device. In fact, "ping" means that MFDeploy will say "Hi" to the device and then check whether the device will respond with "Hi" back. It is good to make sure the device is properly connected and there is no problem with transport with it.

Open MFDeploy and connect FEZ using the included USB cable in your PC. If this is plugged into FEZ for the first time, Windows will look for drivers and find them automatically. If not, then supply the driver to the SDK folder and wait until the windows finish.

In the drop-down menu, select USB. You should see your device showing up in the device list. In my example, I see USBizi. Select your device and click the "Ping" button. Now you should see TinyCLR.

What-is-.NET-Framework?


Hardware Deployment

Now that we have checked that the hardware is connected using MFDeploy, we need to go back to Visual Studio. From the properties of the project, select USB to transport and then your device (My USBizi). Make sure your setup is similar to the image below.

What-is-.NET-Framework?


After pressing F5, our simple application will now be sent to FEZ and it will run exactly inside the actual hardware. Switching from emulator to real hardware is easy!

Try the steps we made with the emulator, such as setting a breakpoint and using F11 to move in code. Note that "debug.print" will still forward debug messages from the hardware to the output window on the Visual Studio.

Related:

No comments:

Post a Comment