Using Digital Input on FEZ Cerbuino Net

Hi everyone, I would like to connect a button to the board to adjust the RTC time. The examples of use of digital inputs that I find online all refer to the “InputPort” type which, however, is not known in my project. What assembly should I reference? I can’t find it among those made available by the SDK (NETMF v4.3 SDK) that I installed. Or maybe there are other ways to do it? Thank you.

Here is the tutorial Digital Inputs

But it is time to upgrade my friend. You will find much higher value and productivity out of SITCore.

Thanks for the reply, yes I have seen the tutorial, I added the reference “Microsoft.SPOT.Hardware” as explained but the type “InputPort” is still not known. What could be the problem?

You need to add the right assemblies from the netmf SDK

http://files.ghielectronics.com/downloads/Documents/Guides/NETMF%20for%20Beginners.pdf

Excuse me my fault, I added “Microsoft.SPOT.Hardware.Usb” assembly for mistake, thi s was the problem. Now, how can I find a specified pin? I would like to use the pin named “D0” on the board. On software side, for CerbuinoNet, I get three sockets and for each one pins from 3 to 9, wichone should I use? Thanks

image

There is already an assembly that lists all pins on all boards. I think it was called pins.

Or you can look at the schematic to see the pin number

On schematic is PIN PB11 but how can I find wich pin is on code side? The assembly I use is GHI.Pins, I think you mean this right? In this assembly, for Cerbuino Net , are listed 3 sockets, every one with some pins, but I don’t understand at what they refer and how to relate them to the pins on schematic.

Its very simple to create a pin from the schematic.

Each port has 16 pins so you can cast an int to a pin like this:

(Cpu.Pin)((Port # x 16) + pin number) Where Port # is PA = 0 , PB = 1, PC = 2 etc

So for PB11

OutputPort pb11 = new OutputPort((Cpu.Pin) (1 * 16) + 11, false);

2 Likes

Thanks, it works! Now I’m trying to set the RTC time, when I call the function “RealTimeClock.SetDateTime” the board get stuck. I read that I have to connect a 32.768 KHz quartz crystal with a load capacitance of 6 pF between PC14 and PC15 and a 3V battery to bat pin. Is it correct? If I adopt this solution the board will not stuck any more or the reason could be another? Thanks

It is very possible that the code will hang is the internal hardware is not powered and running and in your case, no crystal is likely the issue as the peripheral will be powered by Vcc but without the crystal, it might not work. The battery is switched over to when power is off.