Hi,
I am a french engineering student currently using gadgeteer with cerberus v4.2.6.1. For a project purpose I have to use dl40 in order to count pulses from an encoder. However I can’t manage to make the taylorza firmware to work properly.
I am using his test samples (TestCounter.cs). I have connected the 3.3v and the P0.2 to a touch-sensitive device and when I expect the program to count the number of time I short circuit the two pins it always displays on the debug output the same line :
Last Count : 18446744073709551615
which I believe is 2^64 - 1.
I have tried to update the firmware and to wire differently but I can’t figure out the solution.
Here is the code sample I am using :
class TestCounter
{
static DLIOModule Module;
static IPulseCounterPin Counter;
public static void Run(DLIOModule module)
{
Module = module;
Counter = module.CreateCounterPin(0, 2,
Microsoft.SPOT.Hardware.Port.ResistorMode.PullDown,
Microsoft.SPOT.Hardware.Port.InterruptMode.InterruptEdgeHigh, true);
Gadgeteer.Timer timer = new Gadgeteer.Timer(1000);
timer.Tick += new Gadgeteer.Timer.TickEventHandler(timer_Tick);
timer.Start();
}
static void timer_Tick(Gadgeteer.Timer timer)
{
// Read the counter value
ulong reading = Counter.ReadCounter();
Debug.Print("Last Count : " + reading);
}
}
Thanks,
Joshua