Output to an entire port

I’m using a Cerb40 attached to an LCD screen by a parallel interface. How does one put a byte on 8 bits of a port? I can’t seem to create an output port bigger than 1 bit.

There is no support for any parallel ports directly in NETMF, you need to use some hw provider function or direct access to hw registers, dangerous…


GHI offers ParallelPort class in the premium library


That’s the sort of thing I would think would show up fairly quickly in the OSS library, as it’s fairly simple to implement…

IT WILL, YES. :slight_smile:

Looking at the API for the parallel class in the pro library I see that the method accepts an array of bits which can be any IO pins.

This leads me to the troubling conclusion that the parallel code is implemented as a shift and write of 8 bits. How the heck can that offer prformance?

I’m trying to interface a screen with a parallel driver circuit and I can see that 8 shift-set operations over 780K of screen memory would take a lot more time than an 8 bit write to the port directly.

Can any of you gurus comment?

I think the GHI lib requires the port pins to be in sequence.
but even the OSS lib would accept SET of pins to be defined as “parallel” out then if the handler code is done in native code the perfomance would be way superiour compared to the one pin at a time from managed lib or application


No it doesn’t although a sequence will make it much faster. See documentation please.

The GHI library will do it on any random set of pins, but will do it MUCH FASTER on a specific set of pins. For the Cerberus, this could be implemented as a byte/short write to any arbitrary GPIO port, I think.

Hi, well, at the risk of showing my newbie-ness I wonder if you can point me in the right direction. I’ve been studying the ARM 7 docs all afternoon and then thinking about whether I can use something like Marshal or coerce an intPtr into poking the right value for me.

I can’t seem to find any way to do inline assembler

I can’t find headers in the SDK so I can write some C modules

The GHI libraries don’t seem to be 4.2 compatible (unless I misssed something obvious)

I’m a bit stuck really.

Can you advise?

Where do you see incompatibility?


I have discovered the GHIElectronics.OSH.NETMF.Hardware.LowLevel assembly and it seems to work, at least, it compiles.I have referenced what seems to be the GHIElectronics.OSH.NETMF.Hardware DLL but no ParallelPort class exists therin but there seems to be a Register thingymabob.

Is there an address in a register space for PORTA ? or, am I completely barking up the wrong tree?

Is the Premium library somewhere else? is it for sale (hence the epiphet “premium”) Where can I buy it? There seems to be little information on the GHI site.

Can you point me to a sequence of actions that might solve my particular problem? IE Write a byte directly to PORTA??

I’ve spent literally all day trying to solve this. My working day started at 3:00 AM your time. I’m still going. You can see, i’m an old bloke and in need of my sleep.


You need to look in the processor datasheet to learn of the registers needed and their addresses. From there you can use register class to write to the registers.

Ianlee asked very similar question last week and I explained how register class is just like having pointers in c++

I have (potentially) found the info I need but:

Assembly: mscorlib ( Microsoft.SPOT.Native ( Microsoft.SPOT.Hardware (
Assembly: Microsoft.SPOT.Graphics ( Microsoft.SPOT.Hardware.SerialPort (
Assembly: Microsoft.SPOT.Net ( System ( Microsoft.SPOT.Hardware.Usb (
Assembly: Microsoft.SPOT.Hardware.PWM ( Deployment Assemblies.

Attaching deployed file.

Assembly: MFConsoleApplication1 ( deployed file.

Assembly: Microsoft.SPOT.IO ( deployed file.

Assembly: GHIElectronics.OSH.NETMF.Native ( deployed file.

Assembly: GHIElectronics.OSH.NETMF.Hardware (

Link failure: some assembly references cannot be resolved!!

Assembly: MFConsoleApplication1 ( needs assembly ‘GHIElectronics.OSH.NETMF.Hardware’ (

Assembly: GHIElectronics.OSH.NETMF.Native ( needs assembly ‘mscorlib’ (4.1.2821.0)

Assembly: GHIElectronics.OSH.NETMF.Hardware ( needs assembly ‘mscorlib’ (4.1.2821.0)

Assembly: GHIElectronics.OSH.NETMF.Hardware ( needs assembly ‘Microsoft.SPOT.Hardware’ (4.1.2821.0)

Error: a3000000

Is there a set of OSH DLL’s built with 4.2?

Using Cerberus, then take a look at red note please and then read the wiki page http://www.ghielectronics.com/catalog/product/349


We made that page to be complete so anyone using cerberus at this early stage is required to take a look at that wiki page, even before they order :slight_smile:

Back to your needs of writing a whole port at once on cerberus. This can be easily done in very near future with extended OSH libraries but if you want to do it now then you have to move it from 4.1 base to 4.2

I just went back and took a look at the post, I should have pointed this out earlier so I wasn’t clear myself. But, you also should have taken a look at the wiki page…we both got lazy reading this weekend :slight_smile:

I have no problems recompiling. Is the source available? I looked about but I can’t find it.

One of my clients decided on the Cerb40 so they bought the thing,

I just got told “this is what we’re developing on”

Ho hum :slight_smile:

If you do not know porting NETMF then this is much more that 1 hour task, just so you know.

The library code is on gadgeteer codeplex and cerberus code is linked from the wiki. We have a porting book that you can use as well. Finally, the GCC build is in the works by the community so you need to use a commercial compiler fro now, that is $10K :slight_smile:

It maybe easier to wait till we/community add it in couple months or pay GHI consulting and let us do it for you.

Ok, It looks like I’ve hit a brick wall on this one.

How’s about this:

Is there a way I can get the 4.1 framework on the Cerb40 to allow me to do my prototyping and to deliver at least a working example, however unpolished, to the client?

We chose the Cerb40 because the other GHI modules are too big physically to go in the proposed form-factor of the object.

I don’t see a huge need for the latest 4.2 features. I just need a few ports and a serial line for a WIFI.

What do you say Gus?

Everything is possible but in the few months you will work trying to get 4.1 on it, we will have 4.2 complete so basically you will be wasting your time :slight_smile:


  1. Wait couple months and get it for free
  2. Convince someone in community to do it for you
  3. Pay GHI to do whatever you want done.
  4. Do it yourself but that can take a while as I am assuming you never worked with PK before