Main Site Documentation

PinCapture Class


#1

I am trying to convert a basicX program where Pin 12 is a InputCapture,It is reading the input from an opto encoder on a motor to calculate RPM. I found the PinCapture Class in the GHI documentation but I am confused as to how to use it. The “Example” is not vary insightfull.
Thanks for any help.


#2

The GHI Pincapture gives you the ability of recording many “capture” samples in an array so you can even capture a digital waveform…to decode TV remote signal for example.


#3

You can also use InterruptPort class (http://msdn.microsoft.com/en-us/library/ee434402.aspx. You need to configure it to monitor edge low or high and subscribe to OnInterrupt event. Each event comes with timestamp argument so you can calculate the waveform.

My question about above solution: this events are stored in a FIFO queue of a event dispatcher ? If so than how are we able to predict if a waveform can cause out of memory exception?


#4

So the code to use this would be something like?
byte[] data
PinCapture pc = new PinCapture(Cpu.Pin.GPIO_Pin12, Port.ResistorMode.PullUp);

data = pc;


#5

David, no, please see here http://www.ghielectronics.com/downloads/NETMF/Library%20Documentation/html/a84bbaf1-7ab4-7398-787c-d1a85df650a7.htm


#6

“Cpu.Pin.GPIO_Pin12” you should use the FEZ_Pin.Digi…etc for your device.
Make sure to checkout the tutorial and ebook under downloads.


#7

Ok, I am a bit thick here. I have looked at the links you sent and tried it. I got nothing. I then tried to change the pin defenition to use FEZ_Pin.Digital.An7 and Visual Studio throws and error about the Port.ResistorMode.PullUp.
Could someone please show me a sample of the how to use this?


#8

after poking at it a while I finnally figured it out. Thanks.