Getting Started with the Meridian/P Micro Development Kit

Thank you for purchasing the Meridian/P!

This page takes you through:

  1. Unpacking the Meridian/P

  2. Setting up your system, and

  3. Writing your first application 

 

Unpacking

Your package includes:

  • Meridian/P Micro Development Board

  • USB Cable

  • 0.1" pin headers (4)

You will use the USB connector to power and communicate with the Meridian/P from your PC.

Meridian/P ships with the .NET Micro Framework run-time pre-installed.

For detailed information on the connectors on Meridian/P, refer to the Meridian/P Technical Reference Manual.

 

Setup

This section will take you through:

Verify PC Hardware Capability

In order to develop software for Meridian/P, you need a PC capable of running Microsoft Visual Studio 2008. The Microsoft MSDN web site
has details of these requirements.

You also need an available USB port on your PC.Meridian/P needs to be connected directly to your PC and not through a hub.

Software Setup

Before you can start developing applications, you need to install Visual Studio and two Software Development Kits (SDKs).
Please install these in the following order:

1. Visual Studio 2008 with SP1
If you do not have this already, you can install the FREE Visual C# 2008 Express Edition.

Please note that older versions of Visual Studio are not supported, and Service Pack 1 for VS2008 is required.

2. Microsoft .NET Micro Framework SDK (version 4.0)
Download this from the Microsoft web siteand follow the instructions to install. The Microsoft SDK includes a help file that integrates with the Visual Studio help. Go to the help contents to view details of the SDK.

3.Device Solutions SDK
Download the latest version here, and follow the instructions to install. The Device Solutions SDK also installs a help file into Visual Studio.
Refer to this for detailed information on the features of the SDK.

Connecting and Configuring the USB Connection

Connect Meridian/P to your PC with the USB cable.

When connecting for the first time, a dialog box will indicate a new USB device has been detected and a USB driver is required in order for this to work.
Select the option to install manually and indicate that you have a disk. When prompted for a location, enter the location of the USB driver as installed
aspart of the SDK (usually c:\ProgramFiles\ Device Solutions\MeridianUSBDriver) and follow the instructions.

If you have a Tahoe or Tahoe-II board, then you do not need to install a new driver.

 

Writing Applications

Now that you have the tools installed, you can being your first application.
We are going to write a simple application that flashes the LED every time the button is pressed.

First we are going to create a new project:

1. Open Visual Studio

2. From the main menu, select File | New | Project...

3. From the New Project Dialog, select Visual C# | Micro Framework | Console Application

4. Choose a name for the application and press OK

Now we can write some code:

5.To talk to the GPIO pins on the Meridian/P we need to add some references. In the Solution Explorer, right-click on References
and select Add Reference...

6. From the list, select DeviceSolutions.SPOT.Hardware.MeridianP, and while holding down the Ctrl key, select Microsoft.SPOT.Hardware, then press OK.
These two items will be added to the References list.

7. We need to included these in the code. From the Solution Explorer window, double-click Program.cs to open the main program file

8. At the top of the file, add:

using DeviceSolutions.SPOT.Hardware;
using Microsoft.SPOT.Hardware;
using System.Threading;

We need System.Threading for the Sleep() function we will use later.

9. Delete the Debug.Print( Resources... statement as this is not required in our application.

10. Now we can define the objects we need to access the LED and Button. Add the following lines at the start of the Main() function:

OutputPort led = new OutputPort( MeridianP.Pins.LED, true);
InputPort button = new InputPort(MeridianP.Pins.SW1, true, Port.ResistorMode.PullUp);

These statement create an OutputPort attached to the LED pin and an InputPort attached to SW1 which is the user button on Meridian/P.
The default state of the led is true, which corresponds to a high signal level with the LED off.

The internal pullup is required for the button to operate. This means a low level on the input will indicate the button is pressed.

 

11. We will now add the main code loop, and a statement to check the button:

 
 

while (true)
{
if(button.Read() == false)
{

}
}


As we mentioned earlier, the GPIO will be low when pressed, so we check to see when it is false.

 

12. Now to add the code to flash the LED:

led.Write(false);
Thread.Sleep(200);
led.Write(true);

Thread.Sleep(200);

This code turns the LED on for 200ms, then off again.

13. To try it out, connet your Meridian/P to you PC with the USB cable.

14. Right-click on the project in Solution Explorer and select Properties.

15. Select the .NET Micro Framework tab, and then select USB as the Deployment Transport.

You should see "Meridian_a7e70ea2" appear as the device.

16. Press F5 to deploy the application. Press SW1 on the Meridian/P to see the LED flash!

Congratulations, you have written your first application for the Meridian/P!

What next?

 

The Microsoft SDK includes many useful sample applications that demonstrate how to use the various features of the .NET Micro Framework.

A full range of support is available, including our public forum and premium support options.