USBIZI100 What references are needed?

Hi,
What references do I need to load for pin definitions for using the USBizi100 on a custom board? For example, I use the ‘FEZMini_GHIElectronics.NETMF.FEZ’ reference for my FEZMini designs. In order to use the definitions in the program like the ‘FEZ_Pin.Digital’ enumeration, I need the code 'using GHIElectronics.NETMF.FEZ; and can only do that with the appropriate reference.
Thanks,
Tom

There is GHIElectronics.NETMF.Hardware.USBizi that has what you are looking for.

Thanks. Since there is no ‘using GHIElectronics.NETMF.FEZ;’ resource, how do I finish the following:

 InputPort myPort = new InputPort((Cpu.Pin)...);

Whereas with the mini I would write this:

InputPort button = new InputPort((Cpu.Pin)FEZ_Pin.Digital.An0, false, Port.ResistorMode.PullUp);

Tom

You’ll need to roll your own “FEZ_Pin” enum that matches up with your custom board.

I was wondering if FEZ developed a FEZ_Pin just for the USBizi100 with all pin functions available since they were not nailed down by hardware yet.

Any ideas on where to start regarding this? I am a mechanical engineer and am not very sophisticated with more of the behind the scenes computing, but am willing to learn. Can I just modify/add to one of the GHI resources?
Thanks,
Tom

The FEZ_Pin enum is simply a way to map the actual USBizi100 pin numbers to the exposed pins on the FEZ board. So, if “PWM5” on a Panda-II goes to pin #99 then that would be your enum value. You’ll need to see the USBizi manual to get actual pin numbers.

http://www.ghielectronics.com/downloads/USBizi/USBizi_User_Manual.pdf

If you’re not familiar with creating enums, then see:
http://msdn.microsoft.com/en-us/library/sbbt4032(v=vs.80).aspx

Hi,
I know how to create an enum, but not how to use it as a reference. For example I can create an enumeration that has all of the analog pins in it that are in my board design, but how can I use that as a reference to the actual hardware pins? When I write the following:

InputPort button = new InputPort((Cpu.Pin)FEZ_Pin.Digital.An0, false, Port.ResistorMode.PullUp);

I can see the enumeration of the digital pins, but how does the CPU know what An0 stands for?

Also, why does this code fail:

InputPort myPort = new InputPort((Cpu.Pin)GHIElectronics.NETMF.Hardware.USBizi.Pin.IO0,0,Port.ResistorMode.Disabled);

Is there any way to declare an input port (or analog port) without creating your own devices enumeration?
Thank you in advance,
Tom

Sure. The enum is just there to make it easier for the programmer. This would make an InputPort out of pin #99

InputPort button = new InputPort((Cpu.Pin)99, false, Port.ResistorMode.PullUp);

But, if you wanted to created a custom enum then doing it like this would work also…

enum TommyPins
{
    ...
   ,An0 = 99
   ....
}

InputPort button = new InputPort((Cpu.Pin)TommyPins.An0, false, Port.ResistorMode.PullUp);

However, depending on your board this may be totally unnecessary if you aren’t exposing the pins. If you just have them going directly to other hardware then the first approach probably makes more sense.

The “most pins” USBizi100 is the PandaII so if you only wanted to use the pins it offers you could do it…

Thanks Ian and Brett. I think you both answered my question.
Tom